Files
x-ui/web/html/xui/inbound_modal.html
2021-05-28 17:32:51 +08:00

79 lines
2.3 KiB
HTML

{{define "inboundModal"}}
<a-modal id="inbound-modal" v-model="inModal.visible" :title="inModal.title" @ok="inModal.ok"
:confirm-loading="inModal.confirmLoading" :closable="true" :mask-closable="false"
:ok-text="inModal.okText" cancel-text='{{ i18n "close" }}'>
{{template "form/inbound"}}
</a-modal>
<script>
const inModal = {
title: '',
visible: false,
confirmLoading: false,
okText: '确定',
confirm: null,
inbound: new Inbound(),
dbInbound: new DBInbound(),
ok() {
ObjectUtil.execute(inModal.confirm, inModal.inbound, inModal.dbInbound);
},
show({ title='', okText='确定', inbound=null, dbInbound=null, confirm=(inbound, dbInbound)=>{} }) {
this.title = title;
this.okText = okText;
if (inbound) {
this.inbound = Inbound.fromJson(inbound.toJson());
} else {
this.inbound = new Inbound();
}
if (dbInbound) {
this.dbInbound = new DBInbound(dbInbound);
} else {
this.dbInbound = new DBInbound();
}
this.confirm = confirm;
this.visible = true;
},
close() {
inModal.visible = false;
inModal.loading(false);
},
loading(loading) {
inModal.confirmLoading = loading;
},
};
const protocols = {
VMESS: Protocols.VMESS,
VLESS: Protocols.VLESS,
TROJAN: Protocols.TROJAN,
SHADOWSOCKS: Protocols.SHADOWSOCKS,
DOKODEMO: Protocols.DOKODEMO,
SOCKS: Protocols.SOCKS,
HTTP: Protocols.HTTP,
};
new Vue({
delimiters: ['[[', ']]'],
el: '#inbound-modal',
data: {
inModal: inModal,
Protocols: protocols,
SSMethods: SSMethods,
get inbound() {
return inModal.inbound;
},
get dbInbound() {
return inModal.dbInbound;
}
},
methods: {
streamNetworkChange(oldValue) {
if (oldValue === 'kcp') {
this.inModal.inbound.tls = false;
}
}
}
});
</script>
{{end}}