diff options
author | 0neGal <mail@0negal.com> | 2024-12-20 13:09:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-20 13:09:12 +0100 |
commit | 28130f46eb9c167671994b47b77b926386002ac2 (patch) | |
tree | 26185cbcba747df98e6de6d7e225777093c6720c /src/modules | |
parent | 8fddf38701f50015ee8f61ce7bc8978f1dcebfd3 (diff) | |
parent | b9c0243d6433550784116fac7eec462cc5ae2a79 (diff) | |
download | Viper-28130f46eb9c167671994b47b77b926386002ac2.tar.gz Viper-28130f46eb9c167671994b47b77b926386002ac2.zip |
Merge pull request #248 from Jan200101/PR/protocol
feat: support thunderstore ror2mm protocol for installing mods
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/packages.js | 1 | ||||
-rw-r--r-- | src/modules/protocol.js | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/modules/packages.js b/src/modules/packages.js index 8df6665..125705a 100644 --- a/src/modules/packages.js +++ b/src/modules/packages.js @@ -194,6 +194,7 @@ packages.install = async (url, author, package_name, version) => { return false; } + let name = packages.format_name(author, package_name, version); // removes zip's and folders diff --git a/src/modules/protocol.js b/src/modules/protocol.js new file mode 100644 index 0000000..1aeb7f9 --- /dev/null +++ b/src/modules/protocol.js @@ -0,0 +1,39 @@ +const { app } = require("electron"); + +const win = require("../win"); +const version = require("./version"); + +module.exports = async (argv) => { + if (version.northstar() == "unknown") + return; + + const args = argv || process.argv; + + for (const key of args) { + if (key.startsWith("ror2mm://")) { + let fragments = key.slice(9).split("/"); + + if (fragments.length < 6) + return; + + const ver = fragments[0]; + const term = fragments[1]; + const domain = fragments[2]; + const author = fragments[3]; + const package_name = fragments[4]; + const version = fragments[5]; + + // There is only v1 + if (ver != "v1") + continue; + + // No support for custom thunderstore instances + if (domain != "thunderstore.io") + continue; + + if (term == "install") { + win().send("protocol-install-mod", [domain, author, package_name, version]); + } + } + } +} |