Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

[Feature Request]: Fallback/mirrors/redirecting URLs

Open Yaojian opened this issue 3 years ago • 6 comments

In China, the Great FireWall blocks raw.githubusercontent.com so the powershell installation command fails.

Is their another way to install ?

Yaojian avatar Feb 19 '21 16:02 Yaojian

This domain has DNS cache poisoning in some areas of China.

temporary solution for this problem, get actual IP: https://ip.sb/domain/raw.githubusercontent.com then add to hosts file: actual_IP raw.githubusercontent.com

without a proxy, will also be blocked or slowed when downloading most app using scoop.

if you have a proxy server, install this app when scoop installation done: scoop install https://github.com/HUMORCE/scoop-nuke/blob/master/bucket/proxychains.json for use proxychains, read the docs: https://github.com/shunf4/proxychains-windows/

for url from github, you can replace the original address with https://fastgit.org or other mirrors.

e.g. proxychains.json

replace:
"url": "https://github.com/shunf4/proxychains-windows/releases/download/0.6.8/proxychains_0.6.8_win32_x64.zip",
to:
"url": "https://hub.fastgit.org/shunf4/proxychains-windows/releases/download/0.6.8/proxychains_0.6.8_win32_x64.zip",

HUMORCE avatar Feb 19 '21 21:02 HUMORCE

@Yaojian CODE.CHINA Mirror provides Scoop itself and 10 "known buckets". To install Scoop via CODE.CHINA, you can act as follows:

  1. The installation process uses 2 important files: bin/install.ps1 and lib/core.ps1. Download them to your device before installation.
  2. Modify install.ps1 file. At line 31, change the URL from raw.githubusercontent.com to your local core.ps1.
  3. Also, modify the URL at line 44 and line 60 to CODE.CHINA mirror.
  4. That's it! Excecute your local install.ps1 and Scoop will be installed via that mirror.
  5. "Scoop known buckets" are only refered to those repositories on GitHub. When adding them with scoop bucket add, specify them to CODE.CHINA mirror. If they already added, enter the bucket directory (such as $SCOOP/buckets/main) and change the Git URL with git remote set-url origin. Scoop will update these buckets through the mirror instead of GitHub.

NOTICE: I haven't found out a way to specify a mirror for updating Scoop itself. When invoking scoop update, the Git URL of Scoop itself (directory $SCOOP/apps/scoop/current/) will switch back to this "GitHub Official Repository".


@lukesampson Could you do us a favour? There's something wrong with accessing GitHub these days. Is there a solution to update Scoop itself via some other mirror instead of this "GitHub Official Repository"?

Dragon1573 avatar Feb 28 '21 07:02 Dragon1573

@Dragon1573

scoop config SCOOP_REPO http://mirror.repo

SCOOP_REPO: http://github.com/lukesampson/scoop Git repository containining scoop source code. This configuration is useful for custom tweaked forks.

HUMORCE avatar Feb 28 '21 09:02 HUMORCE

Currently, We users unable to access raw.githubusercontent.com can use mirrors to install scoop and add buckets. But many links in buck are using raw.githubusercontent.com.Is it possible for scoop to add an option for fallbacks.

for example, add a config fallback like scoop config download_fallback raw.githubusercontent.com raw.fastgit.com

when download https://raw.githubusercontent.com/ScoopInstaller/Main/master/scripts/7-zip/install-context.reg failed, use https://raw.fastgit.com/ScoopInstaller/Main/master/scripts/7-zip/install-context.reg as a fallback

Just an idea 😄

xsro avatar Jan 01 '22 08:01 xsro

Somewhat related: https://github.com/ScoopInstaller/Scoop/issues/4539 https://github.com/ScoopInstaller/Scoop/pull/4406

rashil2000 avatar Jan 01 '22 08:01 rashil2000

From @silverkorn in #3858:

Hi,

We have a situation at my office in which the firewall is blocking dangerous domains. A concrete example is our case is PuTTY and the other security tools (from the extras bucket) where the official URL is hosted on "the.earth.li", known to be blacklisted on many security softwares and devices.

Unfortunately, they cannot allow a whitelisting for this domain for obvious security reasons and their devices cannot redirect to one of their official mirrors, at least, not from an URL prefix.

This said, is there a way, potentially with scoop config, to redirect a package URL to another one with scoop?

If not, could I suggest some kind of local configuration that could redirect an URL to another one? Maybe something like one of the following (Maybe as a RegExp compatible):

  • A single key with a JSON value containing a dictionary of all redirections:

    • scoop config redirections "{""https://the.earth.li/~sgtatham/putty/"":""https://www.puttyssh.org/"", ""https://www.test.com/"": ""https://www.test.org/""}"
  • A key per redirection with a JSON value for a single dictionary :

    • scoop config redirection.1 "{""https://the.earth.li/~sgtatham/putty/"":""https://www.puttyssh.org/""}" scoop config redirection.2 "{""https://www.test.com/"":""https://www.test.org/""}"
  • A key per redirection prefixed by something like "redirect:" then a single value (Seems to save properly with current version):

    • scoop config redirect:https://the.earth.li/~sgtatham/putty/ https://www.puttyssh.org/ scoop config redirect:https://www.test.com/ https://www.test.org/

Thanks!

rashil2000 avatar Jan 08 '22 16:01 rashil2000