Cross platform way to get icon of firefox exe - firefox-addon

I'm trying to get the path to the default firefox executable cross platform.
I tried the way recommended here:
https://stackoverflow.com/a/24056586/1828637
However its not working on mac os or linux
on mac it shows this: http://i.imgur.com/xu5GrF8.png
on linux (tested on ubuntu 14) it shows this: http://i.imgur.com/QxWKxbH.png
I was hoping to get the .xpm on linux and the .icns on mac os and the .ico on windows which is the container file, meaning like not just .ico of the single 64x64 image but contain all files please.
Thanks

Your title and question ask two different things, which is a bit confusing. I am not clear on if you want just a way to find the Firefox executable, or a way to extract the currently used (or default?) icon from Firefox.
Icon files:
If you are just looking for a URL to use within Firefox, they should be located at:
chrome://branding/content/icon128.png
chrome://branding/content/icon64.png
chrome://branding/content/icon32.png
chrome://branding/content/icon16.png
They do not appear to exist in .ico files within the Firefox distribution. In fact there are only 4 .ico files in the entire distribution. They are all within the browser/omni.ja file at (windows assumed as primary based on your statements in prior questions):
chrome\browser\skin\classic\browser\customizableui\customizeFavicon.ico
chrome\browser\skin\classic\aero\browser\customizableui\customizeFavicon.ico
chrome\browser\skin\classic\browser\preferences\in-content\favicon.ico
chrome\browser\skin\classic\aero\browser\preferences\in-content\favicon.ico
omni.ja files are just zip format files with the extension changed to .ja instead of .zip. You can change the file extension back to .zip and read it with any appropriate archive handler.
The chrome:// URLs are:
chrome://skin/customizableui/customizeFavicon.ico
chrome://skin/preferences/favicon.ico
I think you can only get access to two of them at a time through chrome://skin/ depending on if you are using aero. If you really need access to both you could use nsiZipReader to open the actual omni.ja file.
Executable file:
You already had a batter way to get the executable file. From your comment it is:
FileUtils.getFile('XREExeF', []);

Related

detect and remove all executable files in uploaded ZIP file

I am working on a web application using Rails which user can upload a zip file which contains its data/file/docs and etc. But I'm concerned with security right now, I want to scan the uploaded zip file and remove all kind of executable such exe, bash and etc how can I do this?
Edit: I am aware of clamav API for rails but it would only scan the file for malicious files not removing the executable, just imagine opening a wrong uploaded executable file in the server and the cost of this action server/business-wide!
First, it would be better and more robust to whitelist allowed file types, and not blacklist disallowed ones (eg. executables). So you should have a list of types you allow if that is possible in your application.
Then the question is how you determine the type of a file.
The trivial way is checking the file extension, but that's not very strong. It may still be good for a first check to avoid spending precious cpu time on further checks.
After that, you can use the filemagic database to quite reliably find the type of uploaded files. You have two options:
If your application runs on linux, you can call the file tool directly, something like filetype = `file -Ib #{filename}` to get the filetype. Note that filename in this example needs to be sanitized to avoid OS command injection!
If you want to support Windows too (or just want to avoid calling shell commands and have nicer code), you can use the ruby-filemagic gem:
require 'filemagic'
filename = 'yourfile.ext'
magic = FileMagic.new
filetype = magic.file(filename)
The problem with ruby-filemagic is that it's not maintained anymore, but it would probably still work fine to find executables.

iOS file upload - original filename

I have a simple HTML file upload snippet that works under iOS as well. However my problem is that the filename of the uploaded file will always be 'image.jpeg'. Is there a way to get the original filename - i.e. 'IMG_0001.jpg' instead? The major issue is that if I have 2 files selected they both have the name of 'image.jpeg' as opposed to their unique names.
Safari on iOS will always make the name of the uploaded file image.jpeg, presumably for security/privacy purposes. You need to generate your own name for the files, which is a good idea in general for uploaded files: you never want to trust the client too much.
If you are targeting more than just Safari on iOS, you will still need to handle this case because it is reasonable that people might upload multiple files with the same name, but originally located in different directories.

Make Firefox read profiles.ini from other location pre-startup

I'm making a Bootstrap addon.
On Firefox pre-startup I need to make it read a profiles.ini file from a custom path. Normally, it always tries to read profiles.ini at this location: OS.Path.join(OS.Constants.Path.userApplicationDataDir, 'profiles.ini');
On Windows XP it is:"C:\Documents and Settings\Noitidart\Application Data\Mozilla\Firefox"
Is it possible to make it read from another location?
Where profiles.ini is read from isn't exactly something you can influence. Given that no profile is selected at this point, your add-on obviously isn't active yet. Also, any preferences your add-on could write aren't active either because these would be stored in the profile as well. And if you look at the actual implementation - there is indeed no configurability here, the profiles.ini file is always looked up in userApplicationDataDir. On Linux you could manipulate that value by setting the HOME environment variable differently, this approach won't work on Windows or OS X however - OS functions are used to locate the home directory there.
So what you could do is bypassing profiles.ini completely by passing in -profile c:\foo\bar command line option when you run Firefox, this will make Firefox use the specified profile directory. Other than that there isn't much you can do.

Sublime tmLanguage file and sublime-settings file

I have two questions about the Sublime Text Editor 2.
My 1st question is, I have several different .tmLanguage files ( ex: Console.tmLanguage) or .tmbundle (Ex: Handlebars.tmbundle) saved in the Packages/User folder. But it won't detect by the Sublime when the initial loads. If I move them under the Package folder, sublime will see them as a color syntax setting.
I thought everything should store inside the User Folder so that it won't be erased when updates or any other possible overwritten situations. What can I do to make sublime see those file when they are stored inside User folder.
I have moved those file several different locations. When I initialized sublime, I received this error " Error loading syntax file "Packages/User/Console.tmLanguage": Error parsing plist xml: Failed to open file In file "Packages/User/Console.tmLanguage" "
I did research about this error, one of the file maybe use that color setting has been cached. I could not remember that which one is using it. How can I clear all the cache to get rid of this initial loading error?
My 2nd question is, I am sharing the Preferences.sublime-settings file for Windows and Mac via Dropbox. But Mac has high resolution, window has not. Mac need font size of 21 to show the same size on windows( font-size: 14 ). Every time When I sync the setting, I have to switch this value from setting file. So I created two different files, Preferences (OSX).sublime-settings and Preferences (Windows).sublime-settings to hold the font-size setting only. It seems to work on windows, but Mac just ignore that file, no font size is being applied at all. It is so tiny that I could not see. Any ideas how could I fix that?
I solved the 2nd problem (i.e. eliminating display differences) as follows:
Create the Default folder that will "mirror" Default.sublime-package:
Window 7:
%USERPROFILE%\AppData\Roaming\Sublime Text 3\Packages\Default
Mac OS X:
~/Library/Application Support/Sublime Text 3/Packages/Default
Extract two files from Default.sublime-package into this folder:
Preferences (OSX).sublime-settings
Preferences (Windows).sublime-settings
I used the following settings to get the same look and feel on Windows 7/XP and MacBook with Retina:
Windows:
{
"font_face": "Consolas",
"font_size": 11,
"line_padding_top": -1
}
Mac OS X:
{
"font_face": "Consolas",
"font_size": 14,
"line_padding_bottom": -1,
}
According to this post in the Sublime Text forums, you need to remove an existing .tmlanguage file from the /Packages folder AND the .tmlanguage.cache file and relaunch Sublime Text to confirm that the program is no longer reading them. Then you can put your .tmlanguage or .tmbundle file in /Packages/User.
It's not clear to me that the error message you got was indicating a problem with the location and not a problem with the plist file itself. You might try using one of the free plist editors to make sure the structure of the file itself is OK.
Good luck on the Mac/Windows display difference. I have no idea how you might solve that.
For windows delete - Delete all the sublime files from
C:\Users\\AppData\Roaming

Open a file that is on a file server from a webpage?

I am working on an internal application. We have a website that displays all our SSRS reports for a group of work. I have been asked to see if I can link all the files (pdf, word, excel) for the group of work. These files are stored on a file server that users viewing the reports have access to. Each group has its own group of reports and shared files.
Is it possible to open the files (without downloading them) from a webpage? Meaning that they file is opened from the file server? I don't want people to download a copy of the file.
I am pretty sure this can work with IE because sharepoint does it. However, other browsers may have an issue.
EDIT: What I would like is to have a web page with links to the files. When they click on a link (say for a word doc), word will open the file that resides on the file server. Without out a local copy downloaded from the network share.
EDIT2: Please note, I know what I am asking is probably not possible in all browsers. I am more or less just making sure. It seems possible in IE using activeX, but out side of that browsers do a good job at keeping processes inside a sandbox.
3 options. Remember this is for an internal website.
link to the share using file://. This will have the side affect of downloading the file to be viewed. As long as user clicks open every time it should not be a big deal.
Use JavaScript and activeX to open word (excel, reader, ect) passing in the file path as a command line arguments. This works only in IE and in win7 (probably vista) user will get a pop up asking if it is ok for the activeX control to run.
Create a new protocol. openfile://. This would be set up to run an application that is installed on the client machine which would open the file. Since it is internal, the application could be installed on the machines without issues. This also requires a registry change.
I haven't picked one as this change is still being looked into but i figure I would update this in case someone runs into something similar.

Resources