How to install and enable Firefox extensions using bash script - firefox

I need to install & enable a series of Firefox add-ons, for a singe profile, without user input, using a bash script. It is a matter of editing a config file in the user's profile folder, as copying an entire, manually installed folder worked.
Any online resources I could find are extremely outdated.
Just downloading the .xpi files into ~/.mozilla/firefox/*123abc.profilename/extensions does install the add-ons, but requires user input to enable.
user_pref("extensions.webextensions.ExtensionStorageIDB.migrated.*extensionid*", true); is inserted into prefs.js by manual enabling, but doesn't enable the addon itseld
extenstions.json [1] & extension-settings.json also have no effect.
extension-preferences.json is only observed to be affected by allowing addons to run in private windows.
Thank you in advance.
Corrections:
[1] My Testing indicates that extenstion.json is what i'm looking for, but I am not yet sure what needs to be modified as it has no white space, making it hard to read. Will edit with any updates.

Related

Jekyll on Windows without installation

Is there a way to run Jekyll on windows without installing Ruby or anything else?
It doesn't need to be perfect - I am basically looking for a simple way to preview a Jekyll and GitHub pages based blog.
It's not possible without copying anything onto your machine, but it's possible without installing anything.
You can use Portable Jekyll - it's a portable download including Ruby and anything else needed to run Jekyll.
Just download it as a .zip file, unzip on your machine and run setpath.cmd, which opens a command prompt with all environment variables set that you need to execute Jekyll.
I'm using this to build multiple Jekyll sites locally on my Windows machine.
By slightly tweaking setpath.cmd, it's also possible to create a batch file which you can just double-click to build your site.
I submitted a pull request for that (but unfortunately it has not yet been merged yet), read the description for more information.

Can't save when running "jekyll serve" on Windows 8.1, Notepad++

I am trying to use jekyll locally to build my website. It is all set up, and I can build and serve and see results at localhost:4000. There are no errors.
The problem is that when I run "Jekyll serve" I can't save files. The save option is greyed out and "ctrl + s" wont work.
I can open and edit the files, can do "Save As" and do other things - basically anything except saving.
I can save files when I am not serving them.
From what I understand, Jekyll is intended to be used to allow saving while serving so we can see our changes as we go. The auto-regenerate function (now a default with serve) supports that use.
I suspect the problem relates to some sort of permissions-type rule stopping me from editing files that are in use.
But because I am self-taught newbie and am not a developer/programmer, I don't know if it is something to do with how I have set up jekyll, notepad++, permissions or something else entirely.
Here is my environment:
Windows 8.1 64-bit
Ruby v2.1.5p
Jekyll v2.5.1
wdm v0.1.0
RubyDevKit
Notepad++ (in admin mode)
Here is what I have tried:
Scaled back the listen gem from v2.10.0 to v2.7.11 (the earlier was listed as safe/tested on a jekyll on windows website)
Scaled back Jekyll from v2.5.3 to v2.5.1 (the earlier was listed as safe/tested on a jekyll on windows website)
Opened Notepad++ in admin mode instead of normal mode.
Tried executing jekyll serve --watch (in case watch enabled saving)
I have not tried re-installing ruby v2.1.3 (listed as safe/tested on a Jekyll on windows website) because Jekyll is otherwise working I don't want to try a re-install except as a last resort - as a newbie I found it a pain to install it on Windows in the first place.
Can anyone help me with this (probably simple) issue?
I thank you for any assistance in advance.
Okay. So I feel really stupid.
But instead of pretending this never happened, I had better post this answer in case anyone else has a blonde 'moment' (read: an entire day) like I did:
Firstly, you can't edit the _config.yml files while serving. You can edit the other files - html, markdown, etc - but not the config file.
Secondly, in Notepad++ you need to make an actual change to a document before the saving option will appear.
I was using the _config file as my 'test' document for regeneration. While I did open up other files to check when I first thought I had an issue, I THINK I may not have made any changes to them - so the option to save them was never activated. After that, I only looked at the config file after making changes.
So, I THINK I may have been able to save while serving all along.
However, if I am wrong and it wasn't my own stupidity (which I strongly doubt), the steps I took which fixed it were:
Those steps outlined in my question; and
A reinstall of Notepad++ (as kindly recommended by 'nerver nerver' who has since removed his/her comment after I said that did not work).
SORRY ... and excuse me while I go and crawl away and hide in shame ...
If the files you were editing at that time was only _config.yml then the expected behavior is that the saved changes are not reflected when the Jekyll server is running/watching.
This is because the server is started after reading the configuration settings in _config.yml, and then changes that happen to that special file after that are not monitored by Jekyll (this is current as of May 2015, in case this gets changed in the future). Currently this is by design. see this SO question as well
What that means is, you have been saving the file when Jekyll is running just fine, the changes just do not get updated. A way to check this is to make some changes, close the file, then open it again (if you want to be extra sure, open in another editor) and see if reflected changes show up.
Changes made to other files in Jekyll when the server is running will be reflected. For example, if I edit a typo in a blog post, edit CSS files or change some formatting, and save in any text editor, Jekyll will regenerate the file from scratch and you should be able to see the changes by refreshing the localhost:4000 page (or whereever your server is running at).
I'm not sure about running Jekyll on Windows, but on a Linux terminal, Jekyll actually notified the number of files that have changed (with a timestamp) and that it regenerated X number of files. Something like
<timestamp> 3 files have changed. Regenerated 3 files in 0.0536 sec..
Lastly, this is probably not your issue, but I thought I might add this here for future reference, do not edit the files inside the _site folder, as they are always deleted and regenerated whenever the server is started again. Editing those files by hand might save and display changes, but the changes will be lost (because they are, statically generated every time by Jekyll)
TL;DR You most probably have been saving your files! The changes in _config.yml are just not reflected once the server is running, and has to be restarted for the new configuration parameters to take effect.

Method to install multiple Firefox extensions or addons in with least user intervention?

The Question:
How do I install multiple Firefox extensions into a fresh Firefox v11+ profile, with the least amount of user wasted motion (reduced mouse clicks and keyboard presses) other than the bare minimum for verifying security constraints (e.g., a single "scare" prompt)?
The Constraints:
The methodology should be exactly the same on both Linux and Windows installations of Firefox, and not require administrators rights (exceptions made for Windows, maybe) or root privileges (Firefox installed locally in the users home directory, not under /bin).
Any extensions that are automatically updated via whatever mechanism is currently used should continue to update those extensions. (Exception maybe for keyconfig extension (see below) if it doesn't automatically update itself upon new revisions, but I don't know if that is the case or not).
The methodology should work for extensions that do not show up in the "Get Addons" search under Tools/Add-ons (e.g., keyconfig mentioned below in the "almost" solutions section).
The "Almost" Solutions:
Below are various things I've tried but that do not do exactly what is needed. The key constraint here is reducing the amount of wasted motion I spend when installing Firefox extensions.
The command-line way:
I can get almost what I want via invoking Firefox with the fully-qualified paths to .xpi files stored locally on my filesystem (tested only on Linux 64-bit machines; not on Windows yet but may work there too) via this type of command-line:
firefox some_extension1.xpi \
some_extension2.xpi \
some_extension3.xpi \
... \
some_extensionN.xpi
where some_extensionN.xpi are fully-qualified paths to specific extensions I desire to be installed. But that is not workable because Firefox prompts multiple times, once per each extension to be installed, when only one security prompt is necessary. Multiple promptings are a show-stopper.
The Massive Extender Way:
Massive Extender extension kept me mostly happy, but was rendered inoperable because of the dropping of support for the AddOn Collections extension. Waiting for someone to get around to supporting extensions in Firefox Sync is probably not an option: I believe that they will disallow syncing of extensions that are not registered through some official channel such as the one that shows up in searches from the Tools>Addons menu entry in Firefox. An example of a extremely useful extension that does not seem to be managed via the official channel is the keyconfig extension.
The FEBE Extension way:
The FEBE extension comes close, but is not workable either because, well, it crashes Firefox when trying to restore from Box.net (as of 2014-04-05).
You should create a multi-item package. You basically ZIP up an install.rdf file and several XPI files and rename the archive into something.xpi. The install.rdf file should look like this:
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>foobar#example.com</em:id>
<em:type>32</em:type>
<em:targetApplication>
<Description>
<!-- Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>10.0</em:minVersion>
<em:maxVersion>11.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
You probably want to choose some ID for your bundle that is different from foobar#example.com and adjust the compatible Firefox versions. Then you can simply trigger the installation of this bundle and it will install all the extensions inside.
Important note: install.rdf has to be located at the top level of the ZIP archive, not inside a subdirectory.

FireFox API install extension

How do I install, update, uninstall FireFox extensions on Windows?
The article (https://developer.mozilla.org/en/Adding_Extensions_using_the_Windows_Registry) seems like a legacy information...
I have installed FireFox 3.6.3.
However, I don't see "HKEY_LOCAL_MACHINE\Software\Mozilla\Firefox\Extensions" in my registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.6.3 (en-GB)]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.6.3 (en-GB)\Main]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.6.3 (en-GB)\Uninstall]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox 3.6.3]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox 3.6.3\bin]
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox 3.6.3\extensions]
For example, I want to install my_ext.xpi (ID: my_ext#my_site.com, Path: c:\myapp\ff_addons\my_ext.xpi).
Could you talk me how can I install my extension ?
Which firefox's versions support this method ?
The extension registry key (HKEY_LOCAL_MACHINE\Software\Mozilla\Firefox\Extensions) doesn't exist by default - simply create it and register your extension there as detailed in Mozilla's instructions (which you linked to).
This method has been working fine for me for over a year now.
You also have another option (which also works on non-Windows machines): Installing Extensions
The windows registry method is not a legacy method, and it's the supported way of installing an add-on for all users on a machine (and all Firefox profiles).
I'm curious as to why you felt it was a legacy method.
Are you talking about an extension or a plug-in?
Extensions are generally installed by having Firefox open an .xpi file. And .xpi files are just .zip files with a manifest (.rdf) and your various scripts and libraries. You can install it manually by creating the right directory structure. On my machine extensions live here: C:\Users\[username]\AppData\Roaming\Mozilla\Firefox\Profiles\[random-number].default\extensions. You create a subdirectory there called yourextension#yourcompany.com and then unzip the contents of your XPI inside the subdirectory. The next time the user re-starts firefox, your extension will be installed. There are a few gotcha's though:
Users have to manually restart Firefox.
You don't know which profile to use if there is more than one. The profile is identified by the [random-number] above. Many users have more than one profile.
On Mac and Linux this is a different directory, though the same basic idea applies.
Plugins are things like Flash that run inside a webpage. You can install those by setting a registry key, but I think in general there is a well-known folder where Firefox looks and loads anything that starts with NP (e.g. NPSWF32.dll). Seriously, it looks for NP. And each plugin must export certain NPAPI functions that Firefox uses to negotiate... stuff.

Editing remote files over SSH, using TextMate?

I LOVE using TextMate on my MacBook. It's great.
Unfortunately, I want to edit some files directly on my dev server, since it's difficult to recreate the environment locally. I'm using Git, so one alternative is to just edit locally, git commit, git push, and then git merge, but that's kind of complicated every time I want to make a simple change.
I'd rather just ... use another solution. One thing I tried is mounting a hard drive via MacFusion, and then loading that in an editor. But that's so freaking laggy/slow!
Has anyone cooked up a better solution?
OK - here is the one that works on Mountain Lion.
Go to http://osxfuse.github.com/
Install FUSE for OS X
Install SSHFS for OS X
Then the following commands on your terminal:
mkdir /Volumes/SSHFS
/usr/local/bin/sshfs username#host:/path/to/dir /Volumes/SSHFS
Done.
I would also recommend using the ReMate plugin as pointed out by another user to prevent TextMate from beach-balling every time you refocus it. Link:
ReMate http://ciaranwal.sh/remate
I use Fetch and TextMate for just such tasks. Fetch can be set to use TextMate as an external editor and can even automatically open files in TextMate by double clicking.
Saving the window in TextMate automatically pushes the file back to the server. Of course you would have to commit the changes on the server at a later time.
I'm sure most Mac FTP clients could do the same.
The best thing would be using TextMate's rmate script, follow the link and you'll find the instructions bellow, I recommend it since it will make your life easier and handle all the Nitty-Gritty.
I use the free version of TextWrangler for just this and it works great. I can load and save files over sftp.
The correct answer is to use sshfs and make sure "Perform atomic saves" is checked in the Textmate preferences window. The easiest way to setup sshfs is to use Macfusion. http://macfusionapp.org/.
Try one of these methods.
see: http://wiki.macromates.com/Main/FAQ#projects
also have a look at:
http://www.gnu.org/software/tramp/
You don't need to push every time you make simple changes; git is a distributed version control system, you commit to your local repository for the small changes. You should only push to the remote repository once you finished working on a feature/bug (or for really huge feature, a complete subfeature). Well, that's assuming you can recreate the environment; which apparently you can't.
A decent text editor can have integration with your favorite control version system; if you cannot configure your editor to commit and push from inside your editor, get a decent editor.
An even better editor can be set to save, commit, push, compile, and run your program all in one click or keypress.
If you are not able — for whatever reason — to replicate your environment locally and still want to use TextMate, the FTP client+TextMate combo is the best solution I can think of. MacFusion and all the other similar solutions are neat on the paper but awfully slow.
If you feel adventurous and confident enough to drop the TextMate requirement, SSH+Vim in the terminal works amazingly well.
Are you positive you can't replicate at all your remote environment?
I know this question already has several answers, and it's been a while, but I wanted to also point out DokanSSHFS - This will use SSH to make a local drive of the directory location on the server that you choose. Then you can use your editor of choice to edit the files as if they were on a local disk.
Most of the proposed solutions are centered around sshfs in one form or another. I have tried these solutions, but I found that reliability of filesystem is not always as good as desired.
There is tool called rmate, which allows editing of remote files in text mate.
Use command from ssh session to edit file on the server:
rmate file_name
The readme on github provides easy to follow instructions on how to set it up.
MacFusion is pretty sweet for free - basically ssh-mounting of directories.
http://macfusionapp.org/
Transmit 4 has a similar feature, tho it costs $$.
Try http://ciaranwal.sh/remate/ if it seems slow, as that will disable textmate from refreshing the file list so often.
Use Fuse for OS X http://osxfuse.github.com and the companion package, SSHFS (same URL) and install them. I installed the MacFUSE compatibility libraries from there too, just for good measure.
Then, install http://macfusionapp.org and follow the instructions located here ( https://github.com/osxfuse/osxfuse/wiki/SSHFS ) to configure macfusion to use the newer libraries.
I had trouble getting authenticated with password, so I set up ssh key authentication and used macfusion without password. Works like a charm.
If you do use an IDE, you could just set up an SSH tunnel to your dev server and edit your files from the comfort of your favourite IDE. Saving the files locally would automatically then push the files on the dev server as well
P.S: I am NOT endorsing the use of IDE
You need rmate it works fine to edit files on your server via ssh using TextMate on you local machine.
Github link here
rmate might be another choice. On server side, you type rmate /path/to/file. The file will be transferred to local machine, where you use some editor like Sublime Text or VS Code (TexMate may also work). To use it, one needs to install both server and client.
For server side, there are several ones in various languages. Choose one you like. Here is the Github repo.
On local machine, as far as I know, VS Code and Sublime Text have their extensions to receive files. For VS Code, refer to here. For Sublime Text, refer to here.
On the other hand, Microsoft just announced an official remote editing extension for VS Code (not released yet).
For those remote machines not having ruby or if bash not compiled with /dev/tcp, but has python, this works: https://github.com/scriptmaster/rmate-python
If you have pip:
pip install rmate
or simply:
wget https://raw.githubusercontent.com/scriptmaster/rmate-python/master/bin/rmate
chmod +x ./rmate
mv ./rmate /usr/local/bin/rmate
then rmate /path/to/file
especially if you are in a containerd-os with restrictions (with only python and docker) such as kubernetes-vm or gce-vm
you don't need vs-code-server, atom-editor,

Resources