修复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 parse = (line) => {
const supported = {}; const supported = {};
line = line.split("trojan://")[1]; 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()); const name = decodeURIComponent(line.split("#")[1].trim());
return { return {

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@ -269,12 +269,15 @@ export default {
}, },
async sync(name) { async sync(name) {
this.$store.commit("SET_LOADING", true);
try { try {
await axios.get(`/artifact/${name}?action=sync`); await axios.get(`/artifact/${name}?action=sync`);
await this.$store.dispatch("FETCH_ARTIFACTS"); await this.$store.dispatch("FETCH_ARTIFACTS");
this.$store.commit("SET_SUCCESS_MESSAGE", `同步配置成功!`); this.$store.commit("SET_SUCCESS_MESSAGE", `同步配置成功!`);
} catch (err) { } catch (err) {
this.$store.commit("SET_ERROR_MESSAGE", `同步配置失败!${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.options.name && this.selected) {
if (this.$route.params.name === 'UNTITLED') { if (this.$route.params.name === 'UNTITLED') {
this.$store.dispatch("NEW_COLLECTION", this.config).then(() => { this.$store.dispatch("NEW_COLLECTION", this.config).then(() => {
showInfo(`成功创建组合订阅:${this.name}`) showInfo(`成功创建组合订阅:${this.name}`);
this.$router.back();
}).catch(() => { }).catch(() => {
showError(`发生错误,无法创建组合订阅!`) showError(`发生错误,无法创建组合订阅!`)
}); });
@ -442,6 +443,7 @@ export default {
} else { } else {
this.$store.dispatch("NEW_SUBSCRIPTION", this.config).then(() => { this.$store.dispatch("NEW_SUBSCRIPTION", this.config).then(() => {
showInfo(`成功创建订阅:${this.options.name}`); showInfo(`成功创建订阅:${this.options.name}`);
this.$router.back();
}).catch(() => { }).catch(() => {
showError(`发生错误,无法创建订阅!`); showError(`发生错误,无法创建订阅!`);
}); });