Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShishkevich D. <135337715+shishkevichd@users.noreply.github.com>2025-04-06 12:40:33 +0300
committerGitHub <noreply@github.com>2025-04-06 12:40:33 +0300
commitbea19a263db88fef44b4356082b199fbfcc39a25 (patch)
treea111e9328c6273ad9721118238c40cf3004f72a9 /web/html/modals/inbound_modal.html
parent878e0d02cd01a045f4f32464124c59e24f98aedd (diff)
Code refactoring (#2865)
* refactor: use vue inline styles in entire application * refactor: setting row in dashboard page * refactor: use blob for download file in text modal * refactor: move all html templates in `web/html` folder * refactor: `DeviceUtils` -> `MediaQueryMixin` The transition to mixins has been made, as they can update themselves. * chore: pretty right buttons in `outbounds` tab in xray settings * refactor: add translations for system status * refactor: adjust gutter spacing in setting list item * refactor: use native `a-input-password` for password field * chore: return old system status with new translations * chore: add missing translation
Diffstat (limited to 'web/html/modals/inbound_modal.html')
-rw-r--r--web/html/modals/inbound_modal.html144
1 files changed, 144 insertions, 0 deletions
diff --git a/web/html/modals/inbound_modal.html b/web/html/modals/inbound_modal.html
new file mode 100644
index 00000000..99d182b9
--- /dev/null
+++ b/web/html/modals/inbound_modal.html
@@ -0,0 +1,144 @@
+{{define "modals/inboundModal"}}
+<a-modal id="inbound-modal" v-model="inModal.visible" :title="inModal.title"
+ :dialog-style="{ top: '20px' }" @ok="inModal.ok"
+ :confirm-loading="inModal.confirmLoading" :closable="true" :mask-closable="false"
+ :class="themeSwitcher.currentTheme"
+ :ok-text="inModal.okText" cancel-text='{{ i18n "close" }}'>
+ {{template "form/inbound"}}
+</a-modal>
+<script>
+
+ const inModal = {
+ title: '',
+ visible: false,
+ confirmLoading: false,
+ okText: '{{ i18n "sure" }}',
+ isEdit: false,
+ confirm: null,
+ inbound: new Inbound(),
+ dbInbound: new DBInbound(),
+ ok() {
+ ObjectUtil.execute(inModal.confirm, inModal.inbound, inModal.dbInbound);
+ },
+ show({ title = '', okText = '{{ i18n "sure" }}', inbound = null, dbInbound = null, confirm = (inbound, dbInbound) => {}, isEdit = false }) {
+ 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;
+ this.isEdit = isEdit;
+ },
+ close() {
+ inModal.visible = false;
+ inModal.loading(false);
+ },
+ loading(loading=true) {
+ inModal.confirmLoading = loading;
+ },
+ };
+
+ new Vue({
+ delimiters: ['[[', ']]'],
+ el: '#inbound-modal',
+ data: {
+ inModal: inModal,
+ delayedStart: false,
+ get inbound() {
+ return inModal.inbound;
+ },
+ get dbInbound() {
+ return inModal.dbInbound;
+ },
+ get isEdit() {
+ return inModal.isEdit;
+ },
+ get client() {
+ return inModal.inbound.clients[0];
+ },
+ get datepicker() {
+ return app.datepicker;
+ },
+ get delayedExpireDays() {
+ return this.client && this.client.expiryTime < 0 ? this.client.expiryTime / -86400000 : 0;
+ },
+ set delayedExpireDays(days) {
+ this.client.expiryTime = -86400000 * days;
+ },
+ get externalProxy() {
+ return this.inbound.stream.externalProxy.length > 0;
+ },
+ set externalProxy(value) {
+ if (value) {
+ inModal.inbound.stream.externalProxy = [{
+ forceTls: "same",
+ dest: window.location.hostname,
+ port: inModal.inbound.port,
+ remark: ""
+ }];
+ } else {
+ inModal.inbound.stream.externalProxy = [];
+ }
+ }
+ },
+ methods: {
+ streamNetworkChange() {
+ if (!inModal.inbound.canEnableTls()) {
+ this.inModal.inbound.stream.security = 'none';
+ }
+ if (!inModal.inbound.canEnableReality()) {
+ this.inModal.inbound.reality = false;
+ }
+ if (this.inModal.inbound.protocol == Protocols.VLESS && !inModal.inbound.canEnableTlsFlow()) {
+ this.inModal.inbound.settings.vlesses.forEach(client => {
+ client.flow = "";
+ });
+ }
+ },
+ SSMethodChange() {
+ if (this.inModal.inbound.isSSMultiUser) {
+ if (this.inModal.inbound.settings.shadowsockses.length ==0){
+ this.inModal.inbound.settings.shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()];
+ }
+ if (!this.inModal.inbound.isSS2022) {
+ this.inModal.inbound.settings.shadowsockses.forEach(client => {
+ client.method = this.inModal.inbound.settings.method;
+ })
+ } else {
+ this.inModal.inbound.settings.shadowsockses.forEach(client => {
+ client.method = "";
+ })
+ }
+ } else {
+ if (this.inModal.inbound.settings.shadowsockses.length > 0){
+ this.inModal.inbound.settings.shadowsockses = [];
+ }
+ }
+ },
+ setDefaultCertData(index) {
+ inModal.inbound.stream.tls.certs[index].certFile = app.defaultCert;
+ inModal.inbound.stream.tls.certs[index].keyFile = app.defaultKey;
+ },
+ async getNewX25519Cert() {
+ inModal.loading(true);
+ const msg = await HttpUtil.post('/server/getNewX25519Cert');
+ inModal.loading(false);
+ if (!msg.success) {
+ return;
+ }
+ inModal.inbound.stream.reality.privateKey = msg.obj.privateKey;
+ inModal.inbound.stream.reality.settings.publicKey = msg.obj.publicKey;
+ }
+ },
+ });
+
+</script>
+{{end}}