perf: Improve /utils/env API

- Add version number
- Add support for Stash & ShadowRocket backend
This commit is contained in:
Peng-YM 2022-06-29 11:25:50 +08:00
parent 7e1139528e
commit ffc7c07469
6 changed files with 21 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

@ -3,6 +3,7 @@ import {
GIST_BACKUP_KEY,
GIST_BACKUP_FILE_NAME,
} from './constants';
import { version as substoreVersion } from '../../package.json';
import { ENV, HTTP } from '@/vendor/open-api';
import express from '@/vendor/express';
import Gist from '@/utils/gist';
@ -59,15 +60,21 @@ export default function serve() {
}
function getEnv(req, res) {
const { isNode, isQX, isLoon, isSurge } = ENV();
const { isNode, isQX, isLoon, isSurge, isStash, isShadowRocket } = ENV();
let backend = 'Node';
if (isNode) backend = 'Node';
if (isQX) backend = 'QX';
if (isLoon) backend = 'Loon';
if (isSurge) backend = 'Surge';
if (isStash) backend = 'Stash';
if (isShadowRocket) backend = 'ShadowRocket';
res.json({
status: 200,
backend,
data: {
backend,
version: substoreVersion,
},
});
}

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,8 @@ const store = new Vuex.Store({
// fetch env
async FETCH_ENV({state}) {
return axios.get("/utils/env").then(resp => {
state.env = resp.data;
const {data} = resp.data;
state.env = data;
})
},
async FETCH_SETTINGS({state}) {