Skip to content
This repository

Auto-update scripts #1053

Closed
avindra opened this Issue October 29, 2009 · 24 comments

9 participants

Avindra Goolcharan arantius Nikita Vasilyev Tim Mike Medley Erik Vold forteller Ryan Chatham Jay R.
Avindra Goolcharan

I searched, but didn't find this issue, other than the one here:

http://userscripts.uservoice.com/pages/795-general/suggestions/5436-auto-update-scripts

Which doesn't really make sense, because Jesse can't do anything for this.

Auto-update scripts; it's been a hotter topic than ever in userscripting, especially as greasemonkey is reaching more people. Jesse provides enough resources on userscripts.org to properly update any script from userscripts.org. It would be ultra-badass if script updating were given a similar look and feel to the Firefox add-on manager.

As for scripts not installed from userscripts.org, maybe you can flag it with a "manual update" flag, whereas scripts from US.o would be flagged for automatic updating.

What do you guys think?

Nikita Vasilyev
NV commented October 29, 2009

I agree.

As Greasemonkey user, now I use wescript.net for update scripts. It works, but it's another add-on. Not so many people know about it.

Look at Stylish add-on. It has "Find Updates" button Greasemonkey should learn from this.

Nikita Vasilyev
NV commented November 02, 2009

I see this issue has been labeled "0.9.x". Great!

GM needs UI for updating scripts.

Greasemonkey Script manager UI

What do you think about it?

Tim

This is also being discussed on Userscripts.org: http://userscripts.org/topics/48267

Mike Medley

Well here's a start to solving this issue. This commit involves mostly changes to the GM core to support update checking and doesn't do anything to notify users of an available update. Specifics are in the commit message.

Update: I'm currently working on this feature in this branch. Any help would be greatly appreciated.

Mike Medley

I finally got around to integrating recent upstream changes into my branch for this issue. So far the actual update checking works fairly well given the few tests that I've run. I've only been able to get some basic integration with the addons dialog working. On Firefox start up, if there are any updates that have been accumulated the addons dialog will open and display them for the user. You can install available updates via the context menu. I've made the "Find Updates" button filter the scripts list to show only scripts with available updates. Scripts that have an update have a little green exclamation mark next to them in the addons dialog.

Tim

Great work sizzle. I might flick though a few patches if I get some time off my other projects :)

Erik Vold

For those interested I just implemented this feature for Scriptish, it's only for FF4 though, but it should help whomever works on this for GM.

Mike Medley

I posted a progress update on this issue. Latest test build is here.

forteller

I'm sorry if it is redundant to mention this, but I just wanted to say that Stylish does a good job of using the same update system as Firefox uses to update extensions to also update their Userstyles. The same thing for Userscripts would be fantastic!

Mike Medley

I just spent the last two hours resolving conflicts when I attempted to merge my updater branch with Greasemonkey 0.9.10. I haven't had a chance to test it yet and I also need to port this important commit from Scriptish. Also merging brought back the utils.js file by accident.

arantius
Collaborator

Sorry I missed this for so long. I'm working on merging it. But as you pointed out, because of the time passed and the recent really large refactor, it's taking some work.

arantius@master...issue-1053

arantius
Collaborator

@sizzlemctwizzle

Is your branch supposed to pop up an installation dialog, when installing an update? It does currently, and I'm thinking that's where the breakage I'm seeing is coming from.

Mike Medley

No it's supposed to bypass the installation dialog since its an update and not a new install. It is also supposed to open the script manager on FF startup if there are available updates. That never worked perfectly so perhaps that is the cause of the breakage.

arantius
Collaborator

Ok. My previously linked branch is updated, and much more functional.

Mike Medley

Okay, I just tried your branch in FF 6.0.2 and it managed to find an update for one of my scripts and I installed it. Very nice work. A few suggestions from my test experience:

  1. Make the progress indicator work(right now it stays empty until the script has installed) when downloading an update, or just hide it.
  2. When you enable/disable a script that has an update, it no longer shows an update is available until you reload the script manager.
  3. Open the Add-ons Manager to the "Updates" section when there are available script updates on Firefox startup. I know there is code in place to do this but it doesn't appear to be working. I'm gonna go try this in FF3.6 to see if it is a >= FF4 only issue.

Edit: Yeah the Add-ons Manager doesn't open on startup when updates are available in FF3.6 either. Also in FF3.6 I noticed:

  1. When a script shows that an update is available in the "User Script" view and you right click on it there is no option to install the update.
  2. When there is a script in the "Updates" view and you right click on it, the "Install Update" option doesn't work. However, clicking the "Install Updates" button in the lower right corner does work.
arantius
Collaborator

Make the progress indicator work(right now it stays empty until the script has installed) when downloading an update, or just hide it.

I agree it would be very nice. But it's hard. Code plumbing aside, we don't actually know how much will be downloaded: you've got the main script, then any number of requires and resources it defines. The latter you don't know until the script is downloaded.

When you enable/disable a script that has an update, it no longer shows an update is available until you reload the script manager.

Hm. Will have to test!

Open the Add-ons Manager to the "Updates" section when there are available script updates on Firefox startup.

Why would there "be available updates"? I rather think that if it's been discovered automatically, it should be installed automatically. Firefox even does this with extensions now, with the caveat that you have to restart Firefox for them to really be installed (but if you do restart, they are installed, silently).

arantius
Collaborator

All that aside: I think it might well be time to merge this into master, and start tracking all these little issues in their own tickets so they don't get lost track of.

Ryan Chatham

if it's been discovered automatically, it should be installed automatically. Firefox even does this with extensions now

As with extensions, you should have the option to disable update checking on a per-script basis (if it hasn't already been implemented).

arantius
Collaborator
arantius
Collaborator

I've decided that for 0.9.12 this feature will be included, but disabled by default. Therefore it won't do anything unless you manually check for, and apply, updates. We'll work out the remaining warts in the future (and in following tickets), and when it's ready, turn it on for everyone.

arantius arantius closed this issue from a commit September 23, 2011
arantius Disable update checking by default.
The plan is to enable it by default after some of the rough edges have been polished.

Fixes #1053
4294e31
arantius arantius closed this in 4294e31 September 23, 2011
arantius
Collaborator

Created a pile of separate smaller issues, all in 0.9.13, to improve this feature:
https://github.com/greasemonkey/greasemonkey/issues?milestone=28&state=open

Jay R.

It'd be great if there was something explaining how a script can be configured for updating. There's zero documentation, and reading over this bug doesn't really shed any light. Is there a new "source" parameter in the header, or something?

arantius
Collaborator

Things are still under development and docs will be coming. But for now it's as simple as the @version header. If a script at the same URL which the installed script was installed from has a higher @version, then it will update. We use nsIVersionComparator and thus its definition of what version is "higher" than another.

Mike Medley

@signe

As arantius explains, you don't need to do anything special to your script to enable updating besides setting and incrementing the @version value. Greasemonkey keeps track of the url from which a script was downloaded (it has done this since 0.9.0 in anticipation of this feature) and by default uses this to check for an update (i.e. where we parse the @version value and compare it the version number of the installed script) and install the update. You can use the @updateURL metadata key to manually set where you want Greasemonkey to check for updates. This lets you upload just the metadata of a script to a separate url to save bandwidth. You can also use @installURL to manually set where you want updates to install from. I hope that clears a few things up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.