2

I try to make my userscripts as comprehensive as possible on the first attempt. However there are often cases where I need to push some new update to it.

In these cases, past users have to manually navigate to my Stack Apps page and see if the userscript was updated. I want to set it up so that it automatically checks for updates every day - and if there's an update - automatically installs it.

Is it possible?

1 Answer 1

4

It's debatable whether this question is on topic here, but here is an approach that works in most cases (User has a quality script manager, like Tampermonkey, and default settings):

  1. Host your script somewhere like GitHub, GreasyFork, etc.
  2. Make sure your script has a proper @version directive.
  3. Provide direct install links to the hosted script, rather then listing the full code here.
  4. Whenever you make a change to your script, increment the @version and upload the change to the host from step 1.
  5. Recommend that you also add a short @history line, to the script's metadata block, summarizing the change. EG:

    // @version     2.4
    // @history     2.4 HTTPS support; add Tampermonkey metadata.
    // @history     2.3 Exclude chat.
    etc.
    

When you do the above, Tampermonkey (and most script engines) record the install location and periodically scan the location for script changes. If a newer script is found, the user's script is updated (or the user is asked if she wants to update). Although users have full control over these settings and can alter the defaults, few users actually do.

See also: A more detailed description of the update process.




Violentmonkey probably works correctly, but I haven't verified. Greasemonkey also used to be okay, but GM4 broke so many things that this may be busted too.

4
  • GM4 did break auto-updating. However, it's something that's being actively worked on. It appears that it's currently scheduled for GM4.7.
    – Makyen
    Commented Aug 8, 2018 at 20:40
  • Oh, a note: Tampermonkey does not correctly/fully implement dot-format version number comparison. It works correctly for versions with the same number of dots (e.g. 1.1.2 is > 1.2.1). Unfortunately, it does not properly compare when the number of dots is different (e.g. 1.1.1.1 is not > 1.1.1).
    – Makyen
    Commented Aug 8, 2018 at 20:45
  • @Makyen, GTK. Unfortunately, I can't see the status of that Tampermonkey bug at the moment, but he's pretty good about fixing things that he's made aware of. Commented Aug 8, 2018 at 20:49
  • Grumble..... My first example should have been "(e.g. 1.1.2 is > 1.1.1)", i.e. that is correctly compared, as is 1.2.1 > 1.1.1. I managed to mess up the example when editing.
    – Makyen
    Commented Aug 8, 2018 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .