Sub-Store现在会为单个订阅转发流量信息

This commit is contained in:
Peng-YM 2021-01-25 14:20:25 +08:00
parent 99b3d44c63
commit 20ea35c9fb
4 changed files with 28 additions and 19 deletions

View File

@ -148,6 +148,20 @@ function service() {
const allSubs = $.read(SUBS_KEY); const allSubs = $.read(SUBS_KEY);
const sub = allSubs[name]; const sub = allSubs[name];
if (sub) { if (sub) {
// forward flow headers
if (["QX", "Surge", "Loon"].indexOf(getPlatformFromHeaders(req.headers)) !== -1) {
const {headers} = await $.http.get({
url: sub.url,
headers: {
"User-Agent":
"Quantumult/1.0.13 (iPhone10,3; iOS 14.0)"
}
});
const subkey = Object.keys(headers).filter(k => /SUBSCRIPTION-USERINFO/i.test(k))[0];
const userinfo = headers[subkey];
res.set("subscription-userinfo", userinfo);
}
try { try {
const output = await produceArtifact({ const output = await produceArtifact({
type: 'subscription', type: 'subscription',
@ -620,8 +634,8 @@ function service() {
async function deleteArtifact(req, res) { async function deleteArtifact(req, res) {
const name = req.params.name; const name = req.params.name;
$.info(`正在删除Artifact${name}`); $.info(`正在删除Artifact${name}`);
try {
const allArtifacts = $.read(ARTIFACTS_KEY); const allArtifacts = $.read(ARTIFACTS_KEY);
try {
const artifact = allArtifacts[name]; const artifact = allArtifacts[name];
if (!artifact) throw new Error(`远程配置:${name}不存在!`); if (!artifact) throw new Error(`远程配置:${name}不存在!`);
if (artifact.updated) { if (artifact.updated) {
@ -638,6 +652,9 @@ function service() {
status: "success" status: "success"
}); });
} catch (err) { } catch (err) {
// delete local cache
delete allArtifacts[name];
$.write(allArtifacts, ARTIFACTS_KEY);
res.status(500).json({ res.status(500).json({
status: "failed", status: "failed",
message: `无法删除远程配置:${name}, 原因:${err}` message: `无法删除远程配置:${name}, 原因:${err}`

File diff suppressed because one or more lines are too long

View File

@ -977,8 +977,6 @@ html, body {
padding: 0 15px; padding: 0 15px;
.v-tab { .v-tab {
color: #555;
&.primary, &.secondary { &.primary, &.secondary {
-webkit-box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(156, 39, 176, 0.4); -webkit-box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(156, 39, 176, 0.4);
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(156, 39, 176, 0.4); box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(156, 39, 176, 0.4);
@ -1004,10 +1002,6 @@ html, body {
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(244, 67, 54, 0.4); box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(244, 67, 54, 0.4);
} }
&.v-tab--active {
color: #fff;
}
.v-icon { .v-icon {
font-size: 24px; font-size: 24px;
} }

View File

@ -119,8 +119,10 @@
</v-card> </v-card>
<v-dialog fullscreen hide-overlay transition="dialog-bottom-transition" v-model="showProxyList" scrollable> <v-dialog fullscreen hide-overlay transition="dialog-bottom-transition" v-model="showProxyList" scrollable>
<v-card fluid> <v-card fluid>
<v-toolbar> <v-toolbar
<v-icon>mdi-cloud</v-icon> class="flex-grow-0"
>
<v-icon>mdi-dns</v-icon>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-toolbar-title> <v-toolbar-title>
<h4>节点列表</h4> <h4>节点列表</h4>
@ -141,12 +143,12 @@
<v-tab <v-tab
key="raw" key="raw"
> >
原始节点 <h4>原始节点</h4>
</v-tab> </v-tab>
<v-tab <v-tab
key="processed" key="processed"
> >
生成节点 <h4>生成节点</h4>
</v-tab> </v-tab>
</v-tabs> </v-tabs>
</template> </template>
@ -156,14 +158,10 @@
v-model="tab" v-model="tab"
> >
<v-tab-item key="raw"> <v-tab-item key="raw">
<v-card-text class="pl-0 pr-0">
<proxy-list :url="url" :sub="sub" :raw="true" ref="proxyList" :key="url + 'raw'"></proxy-list> <proxy-list :url="url" :sub="sub" :raw="true" ref="proxyList" :key="url + 'raw'"></proxy-list>
</v-card-text>
</v-tab-item> </v-tab-item>
<v-tab-item key="processed"> <v-tab-item key="processed">
<v-card-text class="pl-0 pr-0">
<proxy-list :url="url" :sub="sub" ref="proxyList" :key="url"></proxy-list> <proxy-list :url="url" :sub="sub" ref="proxyList" :key="url"></proxy-list>
</v-card-text>
</v-tab-item> </v-tab-item>
</v-tabs-items> </v-tabs-items>
</v-card-text> </v-card-text>