Skip to content
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

Options to modify download links, e.g. redirect to local mirror. #5273

Open
1 task done
mk-pmb opened this issue Oct 9, 2023 · 2 comments
Open
1 task done

Options to modify download links, e.g. redirect to local mirror. #5273

mk-pmb opened this issue Oct 9, 2023 · 2 comments
Labels
suggestion Feature suggestions that have not been accepted yet.

Comments

@mk-pmb
Copy link

mk-pmb commented Oct 9, 2023

Role

I'm trying to set up a new modded instance on unreliable network.

Suggestion

I'd like an easy way to redirect download attempts for static files to a local mirror. We should define some categories like 1. modpack's files, 2. mojang files, and then for each category have a text field with replacement rules.

Benefit

I can provide the files on a simple dumb webspace like Python's integrated webserver.

This suggestion is unique

  • I have searched the issue tracker and did not find an issue describing my suggestion, especially not one that has been rejected.

You may use the editor below to elaborate further.

My ideas for replacement rules:

  • If there is a # anywhere in the line, ignore it an everything behind it.
  • Word-split the line, "word" meaning a sequence of non-whitespace characters.
  • The 1st word is the pattern. No 1st word = ignore the rule.
  • The 2nd word is the replacement text. No 2nd word = empty replacement = remove only.
  • If there is a 3rd word, that's a syntax error.
  • In a pattern, < denotes the start and > the end of whatever text is currently in the buffer (initially, the original URL). Inspired by RFC 1738, page 3, "delimiters around URLs in free text".
    • <> as the pattern denotes the empty buffer. Someone may want to map that to a fallback URL.
    • > at the start of the pattern with text behind it would never match, so we can use that for future upgrades like using sed if the rules list starts with >>sed<<.

That way it would be easy to remap servers to which my connection is unreliable to a local mirror:

# Example ruleset. Example URLs are picked random from search results.
<http:      :
<https:     :
<://www.mediafire.com/file/                           mediafire/
/file>      # for MediaFire
<://downloads.gtnewhorizons.com/Multi_mc_downloads/   gtnewhorizons/
<://        web/
///         /
//          /
?           __QM__/
=           =/
<           http://mirror.test/

… would transform:

- https://www.mediafire.com/file/buk9khs455r8lkp/Player_API.jar/file
+   http://mirror.test/mediafire/buk9khs455r8lkp/Player_API.jar

- http://downloads.gtnewhorizons.com/Multi_mc_downloads/GT_New_Horizons_2.4.0_Java_17-20.zip
+                      http://mirror.test/gtnewhorizons/GT_New_Horizons_2.4.0_Java_17-20.zip

-                https://example.net/texture.php?player=Steve
+ http://mirror.test/web/example.net/texture.php__QM__/player=/Steve
@phit
Copy link
Contributor

phit commented Oct 9, 2023

nothing stopping you from doing really edge case stuff like this locally, just hijack dns setup and proxy with self signed certs, multimc will use your OS' cert store

@phit phit added the suggestion Feature suggestions that have not been accepted yet. label Oct 9, 2023
@mk-pmb
Copy link
Author

mk-pmb commented Oct 9, 2023

Been there, done that for evil corporate software, but setting up the live on-demand SSL certificate generation and injection is rather cumbersome just to convince a program that is meant to help its users get stuff done.
Would also be a good stopgap for all the chinese users requesting mirror server support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Feature suggestions that have not been accepted yet.
Projects
None yet
Development

No branches or pull requests

2 participants