feat: Add support for targetPlatform ShadowRocket

This commit is contained in:
Peng-YM 2022-07-11 18:23:56 +08:00
parent 49c8f2e521
commit 848491c0f8
4 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.8.6", "version": "2.8.7",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@ -282,6 +282,9 @@ async function syncToGist(files) {
async function produceArtifact({ type, name, platform }) { async function produceArtifact({ type, name, platform }) {
platform = platform || 'JSON'; platform = platform || 'JSON';
// produce Clash node format for ShadowRocket
if (platform === 'ShadowRocket') platform = 'Clash';
if (type === 'subscription') { if (type === 'subscription') {
const allSubs = $.read(SUBS_KEY); const allSubs = $.read(SUBS_KEY);
const sub = findByName(allSubs, name); const sub = findByName(allSubs, name);

View File

@ -51,7 +51,7 @@ async function updateGitHubAvatar() {
} }
async function updateArtifactStore() { async function updateArtifactStore() {
console.log('Updating artifact store'); $.log('Updating artifact store');
const settings = $.read(SETTINGS_KEY); const settings = $.read(SETTINGS_KEY);
const { githubUser, gistToken } = settings; const { githubUser, gistToken } = settings;
if (githubUser && gistToken) { if (githubUser && gistToken) {

View File

@ -14,7 +14,7 @@ export function getPlatformFromHeaders(headers) {
} else if (UA.indexOf('Decar') !== -1 || UA.indexOf('Loon') !== -1) { } else if (UA.indexOf('Decar') !== -1 || UA.indexOf('Loon') !== -1) {
return 'Loon'; return 'Loon';
} else if (UA.indexOf('Shadowrocket') !== -1) { } else if (UA.indexOf('Shadowrocket') !== -1) {
return 'Clash'; return 'ShadowRocket';
} else if (UA.indexOf('Stash') !== -1) { } else if (UA.indexOf('Stash') !== -1) {
return 'Stash'; return 'Stash';
} else { } else {