fix: unable to delete subscription with trailing spaces #build

This commit is contained in:
Peng-YM 2022-06-21 17:02:27 +08:00
parent 89164c3e7a
commit 50a3eb5592
3 changed files with 18 additions and 14 deletions

View File

@ -56,16 +56,28 @@ const types = [
value: "ssr"
},
{
name: "V2Ray",
name: "VMess",
value: "vmess"
},
{
name: "VLess",
value: "vless"
},
{
name: "Trojan",
value: "trojan"
},
{
name: "HTTP",
name: "HTTP(s)",
value: "http"
},
{
name: "Socks5",
value: "socks5"
},
{
name: "Snell",
value: "snell"
}
];
export default {

View File

@ -296,7 +296,7 @@ export default {
copy(artifact) {
if (artifact.url) {
this.$clipboard(artifact.url + (isPlainName(artifact.name) ? '' : `#${artifact.name}`));
this.$clipboard(artifact.url);
this.$store.commit("SET_SUCCESS_MESSAGE", "成功复制配置链接");
}
},
@ -357,10 +357,6 @@ export default {
}
}
}
function isPlainName(name) {
return /^[0-9a-zA-Z-_]*$/.test(name);
}
</script>
<style scoped>

View File

@ -224,14 +224,14 @@ export default {
console.log(`${action} --> ${sub.name}`);
switch (action) {
case 'COPY':
this.$clipboard(`${this.subscriptionBaseURL}/download/${encodeURIComponent(sub.name)}${isPlainName(sub.name) ? '' : '#' + sub.name}`);
this.$clipboard(`${this.subscriptionBaseURL}/download/${encodeURIComponent(sub.name)}`);
this.$store.commit("SET_SUCCESS_MESSAGE", "成功复制订阅链接");
break
case 'EDIT':
this.$router.push(`/sub-edit/${encodeURIComponent(sub.name)}`);
break
case 'DELETE':
this.$store.dispatch("DELETE_SUBSCRIPTION", sub.name);
this.$store.dispatch("DELETE_SUBSCRIPTION", encodeURIComponent(sub.name));
break
}
},
@ -239,7 +239,7 @@ export default {
console.log(`${action} --> ${collection.name}`);
switch (action) {
case 'COPY':
this.$clipboard(`${this.subscriptionBaseURL}/download/collection/${encodeURIComponent(collection.name)}${isPlainName(collection.name) ? '' : '#' + collection.name}`);
this.$clipboard(`${this.subscriptionBaseURL}/download/collection/${encodeURIComponent(collection.name)}`);
this.$store.commit("SET_SUCCESS_MESSAGE", "成功复制订阅链接");
break
case 'EDIT':
@ -278,10 +278,6 @@ export default {
}
}
}
function isPlainName(name) {
return /^[0-9a-zA-Z-_]*$/.test(name);
}
</script>
<style scoped>