diff --git a/frontend/src/locales/en.ts b/frontend/src/locales/en.ts index 06e1896..8395855 100644 --- a/frontend/src/locales/en.ts +++ b/frontend/src/locales/en.ts @@ -22,6 +22,9 @@ export default { online: "Online", version: "Version", commaSeparated: "(comma separated)", + error: { + dplData: "Duplicate Data", + }, pages: { login: "Login", home: "Home", diff --git a/frontend/src/locales/fa.ts b/frontend/src/locales/fa.ts index 16cc376..02c52ca 100644 --- a/frontend/src/locales/fa.ts +++ b/frontend/src/locales/fa.ts @@ -22,6 +22,9 @@ export default { online: "آنلاین", version: "نسخه", commaSeparated: "(جداشده با کاما)", + error: { + dplData: "داده تکراری", + }, pages: { login: "ورود", home: "خانه", diff --git a/frontend/src/locales/vi.ts b/frontend/src/locales/vi.ts index 553e1f7..487265d 100644 --- a/frontend/src/locales/vi.ts +++ b/frontend/src/locales/vi.ts @@ -22,6 +22,9 @@ export default { online: "Trực tuyến", version: "Phiên bản", commaSeparated: "(được phân tách bằng dấu phẩy)", + error: { + dplData: "Dữ liệu trùng lặp", + }, pages: { login: "Đăng nhập", home: "Trang chủ", diff --git a/frontend/src/locales/zhcn.ts b/frontend/src/locales/zhcn.ts index e64c1ac..8bbf303 100644 --- a/frontend/src/locales/zhcn.ts +++ b/frontend/src/locales/zhcn.ts @@ -22,6 +22,9 @@ export default { online: "在线", version: "版本", commaSeparated: "(逗号分隔)", + error: { + dplData: "重复数据", + }, pages: { login: "登录", home: "主页", diff --git a/frontend/src/locales/zhtw.ts b/frontend/src/locales/zhtw.ts index a6724bd..ff0728d 100644 --- a/frontend/src/locales/zhtw.ts +++ b/frontend/src/locales/zhtw.ts @@ -23,6 +23,9 @@ export default { online: "在線", version: "版本", commaSeparated: "(逗號分隔)", + error: { + dplData: "重複數據", + }, pages: { login: "登錄", home: "主頁", diff --git a/frontend/src/views/Clients.vue b/frontend/src/views/Clients.vue index 3909e77..90a7779 100644 --- a/frontend/src/views/Clients.vue +++ b/frontend/src/views/Clients.vue @@ -132,6 +132,8 @@ import { Config, V2rayApiStats } from '@/types/config' import { InTypes, Inbound,InboundWithUser, ShadowTLS, VLESS } from '@/types/inbounds' import { Link, LinkUtil } from '@/plugins/link' import { HumanReadable } from '@/plugins/utils' +import Message from '@/store/modules/message' +import { i18n } from '@/locales' const clients = computed((): any[] => { return Data().clients @@ -177,6 +179,11 @@ const closeModal = () => { modal.value.visible = false } const saveModal = (data:any, stats:boolean) => { + if (clients.value.findIndex(c => c.name == data.name) != modal.value.index) { + const sb = Message() + sb.showMessage(i18n.global.t('error.dplData') + ': ' + i18n.global.t('client.name') ,'error', 5000) + return + } const inboundTags: string[] = data.inbounds.split(',')?? [] let oldName:string = "" if(modal.value.index == -1) { diff --git a/frontend/src/views/Inbounds.vue b/frontend/src/views/Inbounds.vue index 3fe32d7..bee6546 100644 --- a/frontend/src/views/Inbounds.vue +++ b/frontend/src/views/Inbounds.vue @@ -108,6 +108,8 @@ import { computed, ref } from 'vue' import { InTypes, Inbound, InboundWithUser, ShadowTLS, VLESS } from '@/types/inbounds' import { Client } from '@/types/clients' import { Link, LinkUtil } from '@/plugins/link' +import Message from '@/store/modules/message' +import { i18n } from '@/locales' const appConfig = computed((): Config => { return Data().config @@ -156,6 +158,11 @@ const closeModal = () => { modal.value.visible = false } const saveModal = (data:Inbound, stats: boolean) => { + if (inbounds.value.findIndex(c => c.tag == data.tag) != modal.value.id) { + const sb = Message() + sb.showMessage(i18n.global.t('error.dplData') + ': ' + i18n.global.t('objects.tag') ,'error', 5000) + return + } // New or Edit if (modal.value.id == -1) { inbounds.value.push(data) diff --git a/frontend/src/views/Outbounds.vue b/frontend/src/views/Outbounds.vue index 5918def..d9210cd 100644 --- a/frontend/src/views/Outbounds.vue +++ b/frontend/src/views/Outbounds.vue @@ -96,6 +96,8 @@ import Stats from '@/layouts/modals/Stats.vue' import { Config, V2rayApiStats } from '@/types/config'; import { Outbound } from '@/types/outbounds'; import { computed, ref } from 'vue' +import Message from '@/store/modules/message'; +import { i18n } from '@/locales'; const appConfig = computed((): Config => { return Data().config @@ -137,6 +139,11 @@ const closeModal = () => { modal.value.visible = false } const saveModal = (data:Outbound, stats: boolean) => { + if (outbounds.value.findIndex(c => c.tag == data.tag) != modal.value.id) { + const sb = Message() + sb.showMessage(i18n.global.t('error.dplData') + ': ' + i18n.global.t('objects.tag') ,'error', 5000) + return + } // New or Edit if (modal.value.id == -1) { outbounds.value.push(data)