tampermonkeyauto-updateuserscripts

How to make userscript auto update from private domain/github?


I am developing a userscript for Tampermonkey and storing it on private Github, that belongs to my company. I can't upload the code on a public server. The auto update feature of the script doesn't seem to work.

  1. Is Tampermonkey using its own servers to check for updates?

  2. Is it possible to make userscript auto update itself from private domain?

I am using these properties in userscript:

// @downloadURL  https://github02.private.domain/raw/github-username/repo-name/master/userscript.js
// @updateURL    https://github02.private.domain/raw/github-username/repo-name/master/userscript.js

Solution

  • It looks like the auto update actually works on a private domain, but there were 2 problems:

    1. I entered an incorrect URL. I copied the link AFTER opening the RAW file on GitHub, but you need to copy the link from the button that leads to the RAW version of the file. The link is only slightly different, so it was hard to notice at first.

    Incorrect URL: https://github.com/raw/username/your-repo/main/script.user.js
    Correct URL: https://github.com/username/your-repo/raw/main/script.user.js

    Copy the link from RAW button

    1. Second issue is that the script file name actually needs to end with ".user.js" (!), like in example above. I don't see that mentioned anywhere. Everyone is doing it like this in examples on Stackoverflow, but no one explains, that this is a requirement!