修复Trojan一处解析错误

This commit is contained in:
Peng-YM 2020-12-31 14:30:01 +08:00
parent 76cd097a23
commit b092d3fd6a
6 changed files with 28 additions and 6 deletions

View File

@ -1192,7 +1192,7 @@ var ProxyUtils = (function () {
const parse = (line) => {
const supported = {};
line = line.split("trojan://")[1];
const [server, port] = line.split("@")[1].split("?")[0].split(".");
const [server, port] = line.split("@")[1].split("?")[0].split(":");
const name = decodeURIComponent(line.split("#")[1].trim());
return {

File diff suppressed because one or more lines are too long

View File

@ -24,6 +24,14 @@
>
{{ errorMessage }}
</v-snackbar>
<v-overlay :value="isLoading">
<v-progress-circular
indeterminate
size="64"
color="primary"
></v-progress-circular>
</v-overlay>
</v-app>
</template>
@ -63,7 +71,8 @@ export default {
this.$store.watch(
(state => state.settings.theme.darkMode),
(value => {
this.$vuetify.theme.dark = value
this.$vuetify.theme.dark = value;
window.localStorage.setItem("darkMode", value);
})
)
},
@ -75,6 +84,9 @@ export default {
errorMessage() {
return this.$store.state.errorMessage;
},
isLoading() {
return this.$store.state.isLoading;
}
},
watch: {

View File

@ -8,6 +8,7 @@ const store = new Vuex.Store({
state: {
title: "Sub-Store",
clipboard: "",
isLoading: false,
successMessage: "",
errorMessage: "",
@ -19,7 +20,7 @@ const store = new Vuex.Store({
env: {},
settings: {
theme: {
darkMode: false
darkMode: window.localStorage.getItem("darkMode") || false
}
}
},
@ -33,6 +34,10 @@ const store = new Vuex.Store({
state.title = title;
},
SET_LOADING(state, loading) {
state.isLoading = loading;
},
SET_SNACK_BAR_TIMER(state, timer) {
state.snackbarTimer = timer;
},

View File

@ -269,12 +269,15 @@ export default {
},
async sync(name) {
this.$store.commit("SET_LOADING", true);
try {
await axios.get(`/artifact/${name}?action=sync`);
await this.$store.dispatch("FETCH_ARTIFACTS");
this.$store.commit("SET_SUCCESS_MESSAGE", `同步配置成功!`);
} catch (err) {
this.$store.commit("SET_ERROR_MESSAGE", `同步配置失败!${err}`);
} finally {
this.$store.commit("SET_LOADING", false);
}
},

View File

@ -412,7 +412,8 @@ export default {
if (this.options.name && this.selected) {
if (this.$route.params.name === 'UNTITLED') {
this.$store.dispatch("NEW_COLLECTION", this.config).then(() => {
showInfo(`成功创建组合订阅:${this.name}`)
showInfo(`成功创建组合订阅:${this.name}`);
this.$router.back();
}).catch(() => {
showError(`发生错误,无法创建组合订阅!`)
});
@ -442,6 +443,7 @@ export default {
} else {
this.$store.dispatch("NEW_SUBSCRIPTION", this.config).then(() => {
showInfo(`成功创建订阅:${this.options.name}`);
this.$router.back();
}).catch(() => {
showError(`发生错误,无法创建订阅!`);
});