ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
20.37k stars 1.37k forks source link

useragent in checkver should be used duing autoupdate #4062

Open se35710 opened 3 years ago

se35710 commented 3 years ago

When providing useragent in checkver, that useragent is not used during autoupdate, nor for hash extraction, etc.

rashil2000 commented 2 years ago

Fixed

vmvmpvm commented 2 years ago

It is still not used with autoupdate, is that something you can fix as well?

rashil2000 commented 2 years ago

Can you provide an example?

vmvmpvm commented 2 years ago

I have below in my manifest, after adding useragent checkver works as expected, but fails to get hash after taking a long time (roughly 90 seconds, this was the behavior with checkver before adding useragent). It could be our corporate network or the oracle website itself that needs this useragent set.

    "checkver": {
        "url": "https://www.oracle.com/database/sqldeveloper/technologies/download/",
        "useragent": "Mozilla/5.0",
        "re": "Version ([\\d\\.]+)"
    },
    "autoupdate": {
        "url": "https://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-$version-x64.zip",
        "hash": {
            "url": "https://www.oracle.com/database/sqldeveloper/technologies/download/",
            "find": "SHA1: ([^<]+)"
        }
vmvmpvm commented 1 year ago

I was able to fix this issue for myself, and created this pull request.

are you able to review and approve it?

rashil2000 commented 1 year ago

It will get reviewed

rashil2000 commented 9 months ago

From @antonoks in #5586:

Feature Request

Add a global "useragent" key, which, if defined, overwrites what

https://github.com/ScoopInstaller/Scoop/blob/f93028001fbe5c78cc41f59e3814d2ac8e595724/lib/core.ps1#L26

returns

Is your feature request related to a problem? Please describe.

Some websites seem to ban"scoop". One of them is "filezilla-project.org". Sometimes manifests work around this ban and refer to other websites, see also the filezilla manifest. Seems like to address this kind of issue, "checkver" introduces the "useragent" key here . So now one can check if a new version is available based on "scoop banning sites", but still cannot "autoupdate" such manifests.

Describe the solution you'd like

I'd like to see an "useragent" root key in the manifests, which, if defined, overwrites all respective user agents everywhere in the scoop tools and manifests.

Describe alternatives you've considered

I thought about extending "autosupport" in the same way as commit 8feb386 extended "checkver", but then again I'm convinced a general "useragend" key would be the better solution.