-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from Jan200101/PR/protocol
feat: support thunderstore ror2mm protocol for installing mods
- Loading branch information
Showing
10 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} | ||
} | ||
} | ||
} |