mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-04 11:13:59 +08:00
添加 Surge Hybrid 参数支持,添加一键上传所有节点配置到 Gist
This commit is contained in:
parent
204e5b73a2
commit
87deb369fb
@ -2573,6 +2573,7 @@ var ProxyUtils = (function () {
|
|||||||
function Surge_Producer() {
|
function Surge_Producer() {
|
||||||
const targetPlatform = "Surge";
|
const targetPlatform = "Surge";
|
||||||
const produce = (proxy) => {
|
const produce = (proxy) => {
|
||||||
|
let result = "";
|
||||||
let obfs_opts, tls_opts;
|
let obfs_opts, tls_opts;
|
||||||
switch (proxy.type) {
|
switch (proxy.type) {
|
||||||
case "ss":
|
case "ss":
|
||||||
@ -2587,13 +2588,14 @@ var ProxyUtils = (function () {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return `${proxy.name}=ss,${proxy.server}, ${proxy.port
|
result = `${proxy.name}=ss,${proxy.server}, ${proxy.port
|
||||||
},encrypt-method=${proxy.cipher},password=${proxy.password
|
},encrypt-method=${proxy.cipher},password=${proxy.password
|
||||||
}${obfs_opts},tfo=${proxy.tfo || "false"},udp-relay=${proxy.udp || "false"
|
}${obfs_opts},tfo=${proxy.tfo || "false"},udp-relay=${proxy.udp || "false"
|
||||||
}`;
|
}`;
|
||||||
|
break;
|
||||||
case "vmess":
|
case "vmess":
|
||||||
tls_opts = "";
|
tls_opts = "";
|
||||||
let config = `${proxy.name}=vmess,${proxy.server},${proxy.port
|
result = `${proxy.name}=vmess,${proxy.server},${proxy.port
|
||||||
},username=${proxy.uuid},tls=${proxy.tls || "false"},tfo=${proxy.tfo || "false"
|
},username=${proxy.uuid},tls=${proxy.tls || "false"},tfo=${proxy.tfo || "false"
|
||||||
}`;
|
}`;
|
||||||
if (proxy.network === "ws") {
|
if (proxy.network === "ws") {
|
||||||
@ -2601,35 +2603,42 @@ var ProxyUtils = (function () {
|
|||||||
const wsHeaders = Object.entries(proxy["ws-headers"]).map(
|
const wsHeaders = Object.entries(proxy["ws-headers"]).map(
|
||||||
([key, value]) => (`${key}:"${value}"`))
|
([key, value]) => (`${key}:"${value}"`))
|
||||||
.join('|');
|
.join('|');
|
||||||
config += `,ws=true${path ? ",ws-path=" + path : ""}${wsHeaders ? ",ws-headers=" + wsHeaders : ""}`;
|
result += `,ws=true${path ? ",ws-path=" + path : ""}${wsHeaders ? ",ws-headers=" + wsHeaders : ""}`;
|
||||||
}
|
}
|
||||||
if (proxy.tls) {
|
if (proxy.tls) {
|
||||||
config += `${typeof proxy["skip-cert-verify"] !== "undefined"
|
result += `${typeof proxy["skip-cert-verify"] !== "undefined"
|
||||||
? ",skip-cert-verify=" + proxy["skip-cert-verify"]
|
? ",skip-cert-verify=" + proxy["skip-cert-verify"]
|
||||||
: ""
|
: ""
|
||||||
}`;
|
}`;
|
||||||
config += proxy.sni ? `,sni=${proxy.sni}` : "";
|
result += proxy.sni ? `,sni=${proxy.sni}` : "";
|
||||||
}
|
}
|
||||||
return config;
|
break;
|
||||||
case "trojan":
|
case "trojan":
|
||||||
return `${proxy.name}=trojan,${proxy.server},${proxy.port
|
result = `${proxy.name}=trojan,${proxy.server},${proxy.port
|
||||||
},password=${proxy.password}${typeof proxy["skip-cert-verify"] !== "undefined"
|
},password=${proxy.password}${typeof proxy["skip-cert-verify"] !== "undefined"
|
||||||
? ",skip-cert-verify=" + proxy["skip-cert-verify"]
|
? ",skip-cert-verify=" + proxy["skip-cert-verify"]
|
||||||
: ""
|
: ""
|
||||||
}${proxy.sni ? ",sni=" + proxy.sni : ""},tfo=${proxy.tfo || "false"
|
}${proxy.sni ? ",sni=" + proxy.sni : ""},tfo=${proxy.tfo || "false"
|
||||||
}`;
|
}`;
|
||||||
|
break;
|
||||||
case "http":
|
case "http":
|
||||||
tls_opts = ", tls=false";
|
tls_opts = ", tls=false";
|
||||||
if (proxy.tls) {
|
if (proxy.tls) {
|
||||||
tls_opts = `,tls=true,skip-cert-verify=${proxy["skip-cert-verify"]},sni=${proxy.sni}`;
|
tls_opts = `,tls=true,skip-cert-verify=${proxy["skip-cert-verify"]},sni=${proxy.sni}`;
|
||||||
}
|
}
|
||||||
return `${proxy.name}=http, ${proxy.server}, ${proxy.port}${proxy.username ? ",username=" + proxy.username : ""
|
result = `${proxy.name}=http, ${proxy.server}, ${proxy.port}${proxy.username ? ",username=" + proxy.username : ""
|
||||||
}${proxy.password ? ",password=" + proxy.password : ""
|
}${proxy.password ? ",password=" + proxy.password : ""
|
||||||
}${tls_opts},tfo=${proxy.tfo || "false"}`;
|
}${tls_opts},tfo=${proxy.tfo || "false"}`;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(
|
||||||
|
`Platform ${targetPlatform} does not support proxy type: ${proxy.type}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
throw new Error(
|
|
||||||
`Platform ${targetPlatform} does not support proxy type: ${proxy.type}`
|
// handle surge hybrid param
|
||||||
);
|
result += proxy["surge-hybrid"] !== undefined ? `,hybrid=${proxy["surge-hybrid"]}` : "";
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
return {produce};
|
return {produce};
|
||||||
}
|
}
|
||||||
|
4
backend/sub-store.min.js
vendored
4
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
@ -66,5 +66,7 @@ function operator(proxies) {
|
|||||||
// flag operator
|
// flag operator
|
||||||
procedure = $get("Flag Operator", true);
|
procedure = $get("Flag Operator", true);
|
||||||
proxies = $process(procedure, proxies);
|
proxies = $process(procedure, proxies);
|
||||||
|
|
||||||
|
procedure = $get("Flag Operator", true);
|
||||||
return proxies;
|
return proxies;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,14 @@ export default {
|
|||||||
this.save();
|
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>
|
</script>
|
||||||
|
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
const DEBUG = process.env.NODE_ENV === "development";
|
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-icon left>mdi-cloud</v-icon>
|
||||||
同步配置
|
同步配置
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn icon @click="syncAllArtifacts()">
|
||||||
|
<v-icon>backup</v-icon>
|
||||||
|
</v-btn>
|
||||||
<v-btn icon @click="openGist()">
|
<v-btn icon @click="openGist()">
|
||||||
<v-icon>visibility</v-icon>
|
<v-icon>visibility</v-icon>
|
||||||
</v-btn>
|
</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) {
|
setArtifactType(type) {
|
||||||
this.currentArtifact.type = type;
|
this.currentArtifact.type = type;
|
||||||
this.currentArtifact.source = "";
|
this.currentArtifact.source = "";
|
||||||
|
@ -178,6 +178,30 @@
|
|||||||
</v-item-group>
|
</v-item-group>
|
||||||
</v-form>
|
</v-form>
|
||||||
</v-card>
|
</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-card id="processors" class="mb-4">
|
||||||
<v-subheader>
|
<v-subheader>
|
||||||
节点操作
|
节点操作
|
||||||
@ -270,7 +294,7 @@ const AVAILABLE_PROCESSORS = {
|
|||||||
},
|
},
|
||||||
"Handle Duplicate Operator": {
|
"Handle Duplicate Operator": {
|
||||||
component: "HandleDuplicateOperator",
|
component: "HandleDuplicateOperator",
|
||||||
name: "重复节点处理"
|
name: "节点去重"
|
||||||
},
|
},
|
||||||
"Script Filter": {
|
"Script Filter": {
|
||||||
component: "ScriptFilter",
|
component: "ScriptFilter",
|
||||||
@ -334,6 +358,7 @@ export default {
|
|||||||
udp: "DEFAULT",
|
udp: "DEFAULT",
|
||||||
"skip-cert-verify": "DEFAULT",
|
"skip-cert-verify": "DEFAULT",
|
||||||
tfo: "DEFAULT",
|
tfo: "DEFAULT",
|
||||||
|
"surge-hybrid": "DEFAULT"
|
||||||
},
|
},
|
||||||
process: [],
|
process: [],
|
||||||
selected: []
|
selected: []
|
||||||
@ -345,12 +370,12 @@ export default {
|
|||||||
let source;
|
let source;
|
||||||
if (this.isCollection) {
|
if (this.isCollection) {
|
||||||
source = (typeof name === 'undefined' || name === 'UNTITLED') ? {} : this.$store.state.collections[name];
|
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 || [];
|
this.selected = source.subscriptions || [];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
source = (typeof name === 'undefined' || name === 'UNTITLED') ? {} : this.$store.state.subscriptions[name];
|
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;
|
this.name = source.name;
|
||||||
const {options, process} = loadProcess(this.options, source);
|
const {options, process} = loadProcess(this.options, source);
|
||||||
@ -395,7 +420,7 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// udp, tfo, scert
|
// 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') {
|
if (this.options[opt] !== 'DEFAULT') {
|
||||||
output.process.push({
|
output.process.push({
|
||||||
type: "Set Property Operator",
|
type: "Set Property Operator",
|
||||||
@ -575,7 +600,7 @@ function loadProcess(options, source, isCollection = false) {
|
|||||||
|
|
||||||
function uuidv4() {
|
function uuidv4() {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
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);
|
return v.toString(16);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user