Gibberlings3 / modhub

Microservice to find the latest or latest (pre)release version of a mod hosted on GitHub
GNU General Public License v3.0
1 stars 1 forks source link

IAP and WMP compatibility request: fallbacks to pkg=zip #11

Closed skellytz closed 1 month ago

skellytz commented 1 month ago

Infinity Auto Packager typically needs pkg=zip to download the package with Windows + macOS WeiDU installers. Example:

https://lynxlynx.info/ie/modhub.php?Spellhold-Studios/Mod-Name&pkg=zip

WeiDU Mod Packager typically needs pkg=wzp, pkg=osx, or pkg=lin. Example:

https://lynxlynx.info/ie/modhub.php?Spellhold-Studios/Mod-Name&pkg=wzp

Would it be possible to set fallbacks like so: &pkg=wzp&pkg=zip, &pkg=osx&pkg=zip, and &pkg=lin&pkg=zip? Or a new parameter to achieve this? That way, if modhub can't find an OS-specific package (WMP), it'll fallback to the universal zip package (IAP).

Use case: For SHS Forums download pages, I'd like to make the green main download button use modhub with WMP and pkg=wzp by default (with alternative links to macOS and Linux packages in the mod's description); but, if a mod's maintainer on GitHub chooses to switch to IAP instead (which needs pkg=zip), the button won't work anymore.

Example; http://www.shsforums.net/files/file/67-baldurs-gate-trilogy-tweak-pack/

lynxlynxlynx commented 1 month ago

You can now use a comma separated list:

$ curl -I "https://lynxlynx.info/ie/modhub.php?Spellhold-Studios/BGT-Tweak-Pack&pkg=win,lin"
HTTP/2 302 
x-powered-by: PHP/7.3.33
location: https://github.com/Spellhold-Studios/BGT-Tweak-Pack/releases/download/v11/lin-bgttweak-v11.zip
vary: User-Agent
content-type: text/html; charset=UTF-8
date: Sun, 06 Oct 2024 06:57:48 GMT
server: Apache/2

$ curl -I "https://lynxlynx.info/ie/modhub.php?Spellhold-Studios/BGT-Tweak-Pack&pkg=win,wzp"
HTTP/2 302 
x-powered-by: PHP/7.3.33
location: https://github.com/Spellhold-Studios/BGT-Tweak-Pack/releases/download/v11/win-bgttweak-v11.zip
vary: User-Agent
content-type: text/html; charset=UTF-8
date: Sun, 06 Oct 2024 06:57:56 GMT
server: Apache/2
skellytz commented 1 month ago

That was fast! Thank you! 🙏