-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Using Etag + Last-Modified headers to detect new releases #442
Comments
Here are the current headers being given by
|
You can use the rotating url checker https://github.com/flathub-infra/flatpak-external-data-checker?tab=readme-ov-file#url-checker Don't set a pattern, just set the url to the unversioned download link and checksums will be automatically updated. |
@bbhtt Ah, thank you for the help. At first, The description of that checker says "If the upstream vendor has an URL that redirects to the latest version of the application". But I am not sure about this... It says that it extracts the version number from AppImages or URLs. But what does it do in my case when neither of those exist? It also has the issue that it downloads the entire file every time to check the hash, which causes problems for other people. Would it be possible to implement a |
No it can be a fully static URL that points to the latest version always also. It may redirect or may not. About versioning, version is extracted from the Url pattern. But since you have none it will not work. But why do you need to set an arbitrary time based version to an unversioned thing? That will confuse people because inside the source there might be a totally different version set which will not match with manifest. If the distributor sets up unversioned sources the problem is on their end.
There is a PR for it, so wait for it to be fixed. |
Ah right, that's a nice feature then. Unfortunately it always downloads the file to checksum it every time. For Minecraft it's only 1 megabyte, but for other projects it could be half a gigabyte or more, which slows down your Flathub infrastructure. An implementation of
Think of it like the "this is the Flatpak release date/version" rather than the "app version". It's a good solution for unversioned upstream files. It's not really that confusing, and it's much better than no version info at all. :D It could be set via a flag, like |
Having false version info is worse than having none, at least with none people will know to look for it elsewhere. |
If they get added to app data, people will start reporting bugs or asking about non existent versions. |
That's a matter of personal opinion. But date-based auto-versioning should definitely be an opt-in flag that is off by default. And static extraction such as
Nah, I think that worry is way overblown. If I download "v2024.10.23" from Flathub and the app itself is "v1.0.3", I won't think "oh Flatpak is bugged". I'll think "Okay the app was released on "2024-10-23 and it is v1.0.3". Let's not underestimate the intelligence of Linux users. :D |
vYYYY are actual version strings often used by projects, it's a problem to generate random versions. |
Yeah some projects use Now let's turn the argument around completely for a moment to show it from the other perspective:
|
By the way, is there another date format that could be used for automatic versioning which doesn't look like real app version numbers? Perhaps the version can be set to |
And considering that a large portion of Flatpaks are in low-maintenance mode, where the owner basically just auto-merges auto-checker PRs and doesn't maintain the metadata manually, we cannot expect everyone to be manually fixing the latter problem (the "forever v1.0.0, oh my god Flathub is absolutely ancient" issue). Not to mention the hassle of having to fix that post-merge/or via manually editing every single bot merge request, triggering lots of extra Flatpak builds and releases with version numbers that jump around before being fixed, if the Flatpak maintainer is even around to fix it at all. People leave, die, suffer natural disasters, go on vacation, etc. But it seems to me like the format |
I'm not going to go on about the versioning. That seems like a bad idea to me and too much complexity for very little gain and imo makes things worse. Also re checking Etag/Last modified, how would x-chexker know what the last value was? It runs stateless, it cannot know the previous header values to know if a page changed or do a comparison with current values. |
Yeah. I think not having dates is a bad idea since it leads to great confusion and makes Flathub's static version number look ancient/outdated, leading people to not install the Flatpak at all. But let's not talk about it for now, and focus on the implementation details you brought up. :)
x-checker stores lots of state in the manifest already, "sha256", "size", "url", "tag", "commit". It stores the last result/"state" there, and even adds the fields if they are missing. Of course, it seems to only be using fields that are reserved by Flatpak itself already, but if any extra fields are needed beyond what can already be stored, I would suggest extending Only used when a checker needs to know about extra state, of course. This might be the only checker that would need that at the moment, but it still seems like something that could be a useful feature for x-checker, just to have the option of remembering important state such as what would be needed for this "fast header comparison" update check method. |
One strong motivation for adding an "extra state" dictionary to x-checker is that solves the Flathub server infrastructure strain that the current |
Flathub server does not download them, it runs on Github actions and they have a large bandwidth. 90% of the time the tool is going to be run in CI where this is not a problem. Anyway optionally extending extending |
Ahh okay! Glad to hear that. Microsoft is paying for it then. :')
How does something like this look? {
"sources": [
{
"type": "extra-data",
"filename": "Minecraft.tar.gz",
"url": "https://launcher.mojang.com/download/Minecraft.tar.gz",
"sha256": "cd9f0b44fc9cec42829cb2e71145ee599f3d34c7715b55963514d0a8d36214ab",
"size": 1102510,
"x-checker-data": {
"type": "http-headers",
"url": "https://launcher.mojang.com/download/Minecraft.tar.gz",
"checker-metadata": {
"header-type": "ETag",
"header-value": "0x8DCE8A71945C432"
}
}
}
]
} Possible alternative names:
Algorithm for the
As for the disputed feature of generating a Thinking about it again, I actually think that basing it on the Flathub build date (instead of Actually, I even see that Freedesktop sets their version to As for multiple releases on the same day: Not really an issue. The And of course: Always prioritize This is the only checker that would need that feature, since there's no extractable version information anywhere else. |
No need to introduce a new type. This currently only makes sense for rotating URLs which are static. The checkers already skip any downloads if the URLs remain unchanged. |
Yeah, I was considering proposing it as an improvement for rotating-url instead, but wasn't sure if it makes sense to mix the algorithms. But I am sure there's some neat way to merge the two different update-check behaviors, such as:
So yeah, it seems like it would be very neat to merge these two algorithms. 👍 |
The first one is also how it works currently. The version is extracted from the pattern if it exists. |
I can't find this on the project page or in search engines.
Sometimes, the upstream publishes a link to a single file which changes on the server, but doesn't publish the version number on a website anywhere. So there's no version number to scrape.
What can be done in that case?
The ideal scenario for me would be:
Last-Modified
date in UTC/GMT timezone as the version? Like2024-10-23
(formatted withoutv
or.
periods, to not be confused with real verson numbers)? That would be super helpful for identifying what version someone is running!This is the metadata that the new
"type": "http-header-check",
would need to keep track of:etag > last-modified > content-length
(only one of them, but prioritized in that order).Last-Modified
as UTC if that was available in the headers, formatted as2024-10-23
. Could be disabled/enabled via"auto-date-version": true,
if someone doesn't want that feature. But there's really no other way to get versions from unversioned URLs, unless we do analysis of the package contents (such as what yourrotating-url
does for AppImages).Here's an example URL that would need this kind of detector:
https://launcher.mojang.com/download/Minecraft.tar.gz
They do not publish its version number anywhere:
The text was updated successfully, but these errors were encountered: