Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

useragent in checkver should be used duing autoupdate

Open se35710 opened this issue 4 years ago • 7 comments

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

se35710 avatar Jul 15 '20 13:07 se35710

Fixed

rashil2000 avatar Jan 14 '22 17:01 rashil2000

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

vmvmpvm avatar Jul 07 '22 17:07 vmvmpvm

Can you provide an example?

rashil2000 avatar Jul 07 '22 17:07 rashil2000

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 avatar Jul 07 '22 22:07 vmvmpvm

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

are you able to review and approve it?

vmvmpvm avatar Jul 15 '22 11:07 vmvmpvm

It will get reviewed

rashil2000 avatar Jul 15 '22 14:07 rashil2000

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.

rashil2000 avatar Oct 03 '23 12:10 rashil2000