mjpieters / SO-userscripts

User scripts for use on Stack Exchange websites
MIT License
3 stars 1 forks source link

Tampermonkey does not see/install updates automatically #533

Closed Rubio9 closed 1 year ago

Rubio9 commented 1 year ago

Describe the bug Tampermonkey has the ability to check for updates, but it does not find them on (at least) Connected Users.

To Reproduce Steps to reproduce the behavior:

  1. Wait for an update, as the one which happened a few days ago to v1.4.0

Expected behavior Tampermonkey should see the update and offer to install it

Environment (please complete the following information):

Additional context I believe this may be because you have hardcoded the version in the @downloadURL, so it only looks at that one location when trying to download an update and of course does not find a newer one.

mjpieters commented 1 year ago

Right, thanks for poking on this because I thought I had this covered.

I thought that the downloadURL is the value where you download the current version, and the updateURL value (which points to the main/dist/... URL) is what is used to fetch the new version. The documentation on this is rather vague and Tampermonkey is closed source so you have no way of checking what really happens.

But I just found the ViolentMonkey updating code, and this shows where I went wrong: when you have both URLs, then the updateURL is only meant to serve the metadata.

So yes, you are right, the update fails because the downloadURL points to the currently downloaded version.

I'll see about fixing this; the userscript builder originally did put out just the headers into a separate file, so we can re-enable that for faster checks, and I'll redirect the download URL asap.

mjpieters commented 1 year ago

I've committed an update that addresses the updating issue. I'm keeping this open until I have a better header-only solution for the update URL in place.

Thanks again for the report!

Rubio9 commented 1 year ago

looks good, thanks! for what it's worth, apparently if you omit both fields, the various Monkeys will find the updates anyway based on the URL used for the most recent download. Also, if .meta.js is found it's supposed to automatically use that as @updateURL and .user.js for @downloadURL. (It seems the GreaseMonkey author was pretty anti-@download/@updateURL metadata, Because Reasons™ - not really sure what the right answer is, but perhaps the caution was due to the ease with which they end up accidentally misunderstood/misused resulting in no auto update?) anyway - thanks for the quick turnaround!

mjpieters commented 1 year ago

Thanks for the additional detail!

Indeed, the webpack-userscript outputs the headers-only update file with the extension meta.js, which I now enabled. This means updates will now be (slightly) faster as only the headers are downloaded.

With those now being served, I can close this issue.