mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-06 01:03:16 +08:00
添加 Surge Hybrid 参数支持,添加一键上传所有节点配置到 Gist
This commit is contained in:
@@ -105,6 +105,14 @@ export default {
|
||||
this.save();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (typeof this.args !== 'undefined') {
|
||||
this.action = this.args.action || this.action;
|
||||
this.position = this.args.position || this.position;
|
||||
this.template = this.args.template || this.template;
|
||||
this.link = typeof this.args.link !== 'undefined' ? this.args.link : this.link;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
const DEBUG = process.env.NODE_ENV === "development";
|
||||
export const BACKEND_BASE = DEBUG ? `http://localhost:3000` : `https://sub.store`;
|
||||
// export const BACKEND_BASE = DEBUG ? `http://localhost:3000` : `https://sub.store`;
|
||||
export const BACKEND_BASE = DEBUG ? `https://sub.store:9999` : `https://sub.store`;
|
||||
@@ -5,6 +5,9 @@
|
||||
<v-icon left>mdi-cloud</v-icon>
|
||||
同步配置
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn icon @click="syncAllArtifacts()">
|
||||
<v-icon>backup</v-icon>
|
||||
</v-btn>
|
||||
<v-btn icon @click="openGist()">
|
||||
<v-icon>visibility</v-icon>
|
||||
</v-btn>
|
||||
@@ -318,6 +321,20 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async syncAllArtifacts() {
|
||||
try {
|
||||
const {data} = await axios.get(`/cron/sync-artifacts`);
|
||||
const {failed} = data;
|
||||
if (failed.length > 0) {
|
||||
this.$store.commit("SET_ERROR_MESSAGE", `部分配置(${failed.map(artifact => artifact.name).join(", ")})同步失败,请查看日志!`);
|
||||
} else {
|
||||
this.$store.commit("SET_SUCCESS_MESSAGE", `Gist 同步生成节点成功!`);
|
||||
}
|
||||
} catch (err) {
|
||||
this.$store.commit("SET_ERROR_MESSAGE", `Gist 同步生成节点失败!${err}`);
|
||||
}
|
||||
},
|
||||
|
||||
setArtifactType(type) {
|
||||
this.currentArtifact.type = type;
|
||||
this.currentArtifact.source = "";
|
||||
|
||||
@@ -178,6 +178,30 @@
|
||||
</v-item-group>
|
||||
</v-form>
|
||||
</v-card>
|
||||
|
||||
<v-card class="mb-4">
|
||||
<v-subheader>Surge 选项</v-subheader>
|
||||
<v-form class="pl-4 pr-4">
|
||||
<v-radio-group
|
||||
v-model="options['surge-hybrid']"
|
||||
class="mt-0 mb-0"
|
||||
dense
|
||||
>
|
||||
Hybrid 策略
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-radio label="默认" value="DEFAULT"/>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-radio label="强制开启" value="FORCE_OPEN"/>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-radio label="强制关闭" value="FORCE_CLOSE"/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-radio-group>
|
||||
</v-form>
|
||||
</v-card>
|
||||
<v-card id="processors" class="mb-4">
|
||||
<v-subheader>
|
||||
节点操作
|
||||
@@ -270,7 +294,7 @@ const AVAILABLE_PROCESSORS = {
|
||||
},
|
||||
"Handle Duplicate Operator": {
|
||||
component: "HandleDuplicateOperator",
|
||||
name: "重复节点处理"
|
||||
name: "节点去重"
|
||||
},
|
||||
"Script Filter": {
|
||||
component: "ScriptFilter",
|
||||
@@ -334,6 +358,7 @@ export default {
|
||||
udp: "DEFAULT",
|
||||
"skip-cert-verify": "DEFAULT",
|
||||
tfo: "DEFAULT",
|
||||
"surge-hybrid": "DEFAULT"
|
||||
},
|
||||
process: [],
|
||||
selected: []
|
||||
@@ -345,12 +370,12 @@ export default {
|
||||
let source;
|
||||
if (this.isCollection) {
|
||||
source = (typeof name === 'undefined' || name === 'UNTITLED') ? {} : this.$store.state.collections[name];
|
||||
this.$store.commit("SET_NAV_TITLE", source.name ? `组合订阅编辑 -- ${source.name}` : "新建组合订阅");
|
||||
this.$store.commit("SET_NAV_TITLE", source.name ? `组合订阅编辑 ➤ ${source.name}` : "新建组合订阅");
|
||||
this.selected = source.subscriptions || [];
|
||||
|
||||
} else {
|
||||
source = (typeof name === 'undefined' || name === 'UNTITLED') ? {} : this.$store.state.subscriptions[name];
|
||||
this.$store.commit("SET_NAV_TITLE", source.name ? `订阅编辑 -- ${source.name}` : "新建订阅");
|
||||
this.$store.commit("SET_NAV_TITLE", source.name ? `订阅编辑 ➤ ${source.name}` : "新建订阅");
|
||||
}
|
||||
this.name = source.name;
|
||||
const {options, process} = loadProcess(this.options, source);
|
||||
@@ -395,7 +420,7 @@ export default {
|
||||
});
|
||||
}
|
||||
// udp, tfo, scert
|
||||
for (const opt of ['udp', 'tfo', 'skip-cert-verify']) {
|
||||
for (const opt of ['udp', 'tfo', 'skip-cert-verify', 'surge-hybrid']) {
|
||||
if (this.options[opt] !== 'DEFAULT') {
|
||||
output.process.push({
|
||||
type: "Set Property Operator",
|
||||
@@ -575,7 +600,7 @@ function loadProcess(options, source, isCollection = false) {
|
||||
|
||||
function uuidv4() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user