clone TLS

This commit is contained in:
Alireza Ahmadi
2024-06-30 22:29:44 +02:00
parent bb5cd91bc9
commit a41140190f
+14 -1
View File
@@ -14,7 +14,7 @@
</v-row> </v-row>
<v-row> <v-row>
<v-col cols="12" sm="4" md="3" lg="2" v-for="(item, index) in <any[]>tlsConfigs" :key="item.id"> <v-col cols="12" sm="4" md="3" lg="2" v-for="(item, index) in <any[]>tlsConfigs" :key="item.id">
<v-card rounded="xl" elevation="5" min-width="200" :title="item.id + '. ' + item.name"> <v-card rounded="xl" elevation="5" min-width="200" :title="(item.id? item.id + '. ' : '*') + item.name">
<v-card-subtitle style="margin-top: -20px;"> <v-card-subtitle style="margin-top: -20px;">
{{ item.server?.server_name?.length>0 ? item.server.server_name : "-" }} {{ item.server?.server_name?.length>0 ? item.server.server_name : "-" }}
</v-card-subtitle> </v-card-subtitle>
@@ -71,6 +71,10 @@
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-overlay> </v-overlay>
<v-btn icon="mdi-content-duplicate" @click="clone(index)">
<v-icon />
<v-tooltip activator="parent" location="top" :text="$t('actions.clone')"></v-tooltip>
</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-col> </v-col>
@@ -111,6 +115,15 @@ const showModal = (index: number) => {
modal.value.data = index == -1 ? '{}' : JSON.stringify(tlsConfigs.value[index]) modal.value.data = index == -1 ? '{}' : JSON.stringify(tlsConfigs.value[index])
modal.value.visible = true modal.value.visible = true
} }
const clone = (index: number) => {
let data = JSON.parse(JSON.stringify(tlsConfigs.value[index]))
data.id = 0
data.inbounds = []
while (tlsConfigs.value.findIndex(t => t.name == data.name) != -1){
data.name += "-copy"
}
saveModal(data)
}
const closeModal = () => { const closeModal = () => {
modal.value.visible = false modal.value.visible = false
} }