From bea19a263db88fef44b4356082b199fbfcc39a25 Mon Sep 17 00:00:00 2001
From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com>
Date: Sun, 6 Apr 2025 16:40:33 +0700
Subject: 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
---
web/html/form/allocate.html | 15 +
web/html/form/client.html | 172 +++++++++
web/html/form/inbound.html | 133 +++++++
web/html/form/outbound.html | 517 +++++++++++++++++++++++++++
web/html/form/protocol/dokodemo.html | 20 ++
web/html/form/protocol/http.html | 26 ++
web/html/form/protocol/shadowsocks.html | 50 +++
web/html/form/protocol/socks.html | 34 ++
web/html/form/protocol/trojan.html | 50 +++
web/html/form/protocol/vless.html | 50 +++
web/html/form/protocol/vmess.html | 23 ++
web/html/form/protocol/wireguard.html | 76 ++++
web/html/form/reality_settings.html | 56 +++
web/html/form/sniffing.html | 29 ++
web/html/form/stream/external_proxy.html | 29 ++
web/html/form/stream/stream_grpc.html | 13 +
web/html/form/stream/stream_httpupgrade.html | 26 ++
web/html/form/stream/stream_kcp.html | 48 +++
web/html/form/stream/stream_settings.html | 51 +++
web/html/form/stream/stream_sockopt.html | 66 ++++
web/html/form/stream/stream_tcp.html | 72 ++++
web/html/form/stream/stream_ws.html | 29 ++
web/html/form/stream/stream_xhttp.html | 46 +++
web/html/form/tls_settings.html | 116 ++++++
24 files changed, 1747 insertions(+)
create mode 100644 web/html/form/allocate.html
create mode 100644 web/html/form/client.html
create mode 100644 web/html/form/inbound.html
create mode 100644 web/html/form/outbound.html
create mode 100644 web/html/form/protocol/dokodemo.html
create mode 100644 web/html/form/protocol/http.html
create mode 100644 web/html/form/protocol/shadowsocks.html
create mode 100644 web/html/form/protocol/socks.html
create mode 100644 web/html/form/protocol/trojan.html
create mode 100644 web/html/form/protocol/vless.html
create mode 100644 web/html/form/protocol/vmess.html
create mode 100644 web/html/form/protocol/wireguard.html
create mode 100644 web/html/form/reality_settings.html
create mode 100644 web/html/form/sniffing.html
create mode 100644 web/html/form/stream/external_proxy.html
create mode 100644 web/html/form/stream/stream_grpc.html
create mode 100644 web/html/form/stream/stream_httpupgrade.html
create mode 100644 web/html/form/stream/stream_kcp.html
create mode 100644 web/html/form/stream/stream_settings.html
create mode 100644 web/html/form/stream/stream_sockopt.html
create mode 100644 web/html/form/stream/stream_tcp.html
create mode 100644 web/html/form/stream/stream_ws.html
create mode 100644 web/html/form/stream/stream_xhttp.html
create mode 100644 web/html/form/tls_settings.html
(limited to 'web/html/form')
diff --git a/web/html/form/allocate.html b/web/html/form/allocate.html
new file mode 100644
index 00000000..aba8d5c9
--- /dev/null
+++ b/web/html/form/allocate.html
@@ -0,0 +1,15 @@
+{{define "form/allocate"}}
+
+
+
+ [[ s ]]
+
+
+
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/client.html b/web/html/form/client.html
new file mode 100644
index 00000000..c67f1470
--- /dev/null
+++ b/web/html/form/client.html
@@ -0,0 +1,172 @@
+{{define "form/client"}}
+
+
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.emailDesc" }}
+
+ {{ i18n "pages.inbounds.email" }}
+
+
+
+
+
+
+
+
+
+ {{ i18n "reset" }}
+
+ {{ i18n "password" }}
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "reset" }}
+
+ ID
+
+
+
+
+
+
+ [[ key ]]
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.subscriptionDesc" }}
+
+ Subscription
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.telegramDesc" }}
+
+ Telegram ChatID
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.IPLimitDesc"}}
+
+ {{ i18n "pages.inbounds.IPLimit"}}
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.IPLimitlogDesc" }}
+
+ {{ i18n "pages.inbounds.IPLimitlog" }}
+
+
+
+
+
+ {{ i18n "pages.inbounds.IPLimitlogclear" }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "none" }}
+ [[ key ]]
+
+
+
+
+
+
+ 0 {{ i18n "pages.inbounds.meansNoLimit" }}
+
+ {{ i18n "pages.inbounds.totalFlow" }}
+
+
+
+
+
+
+
+ [[ SizeFormatter.sizeFormat(clientStats.up) ]] /
+ [[ SizeFormatter.sizeFormat(clientStats.down) ]]
+ ([[ SizeFormatter.sizeFormat(clientStats.up + clientStats.down) ]])
+
+
+ {{ i18n "pages.inbounds.resetTraffic" }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.leaveBlankToNeverExpire" }}
+ {{ i18n "pages.inbounds.expireDate" }}
+
+
+
+
+
+ Expired
+
+
+
+
+ {{ i18n "pages.client.renewDesc" }}
+ {{ i18n "pages.client.renew" }}
+
+
+
+
+
+
+{{end}}
\ No newline at end of file
diff --git a/web/html/form/inbound.html b/web/html/form/inbound.html
new file mode 100644
index 00000000..021a51c7
--- /dev/null
+++ b/web/html/form/inbound.html
@@ -0,0 +1,133 @@
+{{define "form/inbound"}}
+
+
+
+
+
+
+
+
+
+
+
+ [[ p ]]
+
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.monitorDesc" }}
+
+ {{ i18n "monitor" }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 {{ i18n "pages.inbounds.meansNoLimit" }}
+
+ {{ i18n "pages.inbounds.totalFlow" }}
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.inbounds.leaveBlankToNeverExpire" }}
+
+ {{ i18n "pages.inbounds.expireDate" }}
+
+
+
+
+
+
+
+
+
+
+
+ {{template "form/vmess"}}
+
+
+
+
+ {{template "form/vless"}}
+
+
+
+
+ {{template "form/trojan"}}
+
+
+
+
+ {{template "form/shadowsocks"}}
+
+
+
+
+ {{template "form/dokodemo"}}
+
+
+
+
+ {{template "form/socks"}}
+
+
+
+
+ {{template "form/http"}}
+
+
+
+
+ {{template "form/wireguard"}}
+
+
+
+
+ {{template "form/streamSettings"}}
+ {{template "form/externalProxy" }}
+
+
+
+
+ {{template "form/tlsSettings"}}
+
+
+
+
+
+ {{template "form/sniffing"}}
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/outbound.html b/web/html/form/outbound.html
new file mode 100644
index 00000000..5069c51b
--- /dev/null
+++ b/web/html/form/outbound.html
@@ -0,0 +1,517 @@
+{{define "form/outbound"}}
+
+ {outModal.toggleJson(activeKey == '2'); }">
+
+
+
+
+ [[ y ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ s ]]
+
+
+
+
+
+
+ outbound.settings.fragment = checked ? new Outbound.FreedomSettings.Fragment() : {}">
+
+
+
+
+
+ [[ s ]]
+
+
+
+
+
+
+
+
+
+
+
+
+ outbound.settings.noises = checked ? [new Outbound.FreedomSettings.Noise()] : []">
+
+
+
+
+
+
+
+
+
+
+
+ Noise [[ index + 1 ]]
+ outbound.settings.delNoise(index)"
+ :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }">
+
+
+
+ [[ s ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ s ]]
+
+
+
+
+
+
+
+
+ [[ s ]]
+
+
+
+
+ [[ s ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.xray.rules.useComma" }}
+
+ {{ i18n "pages.xray.outbound.address" }}
+
+
+
+
+
+
+
+
+
+ {{ i18n "reset" }}
+
+ {{ i18n "pages.xray.wireguard.secretKey" }}
+
+
+
+
+
+
+
+
+
+
+
+ [[ wds ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.xray.rules.useComma" }}
+ Reserved
+
+
+
+
+
+
+
+
+ Peer [[ index + 1 ]] outbound.settings.delPeer(index)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }">
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "pages.xray.wireguard.allowedIPs" }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ key ]]
+
+
+
+
+
+
+
+
+ {{ i18n "none" }}
+ [[ key ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ method_name ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TCP (RAW)
+ mKCP
+ WebSocket
+ gRPC
+ HTTPUpgrade
+ XHTTP
+
+
+
+
+ outbound.stream.tcp.type = checked ? 'http' : 'none'">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+ SRTP
+ uTP
+ WeChat
+ DTLS 1.2
+ WireGuard
+ DNS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ key ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "none" }}
+ TLS
+ Reality
+
+
+
+
+
+
+
+
+ None
+ [[ key ]]
+
+
+
+
+ [[ alpn ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ key ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ tag ]]
+
+
+
+
+ [[ key ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ c ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/dokodemo.html b/web/html/form/protocol/dokodemo.html
new file mode 100644
index 00000000..70ffe7e0
--- /dev/null
+++ b/web/html/form/protocol/dokodemo.html
@@ -0,0 +1,20 @@
+{{define "form/dokodemo"}}
+
+
+
+
+
+
+
+
+
+ TCP,UDP
+ TCP
+ UDP
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/http.html b/web/html/form/protocol/http.html
new file mode 100644
index 00000000..fb1d74b0
--- /dev/null
+++ b/web/html/form/protocol/http.html
@@ -0,0 +1,26 @@
+{{define "form/http"}}
+
+
+
+ | {{ i18n "username" }} |
+ {{ i18n "password" }} |
+
+
+ |
+
+
+
+
+ [[ index+1 ]]
+
+
+
+
+
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/shadowsocks.html b/web/html/form/protocol/shadowsocks.html
new file mode 100644
index 00000000..b9813afb
--- /dev/null
+++ b/web/html/form/protocol/shadowsocks.html
@@ -0,0 +1,50 @@
+{{define "form/shadowsocks"}}
+
+
+
+ {{template "form/client"}}
+
+
+
+
+
+
+
+ | [[ client.email ]] |
+ [[ client.password ]] |
+
+
+
+
+
+
+
+
+ [[ method_name ]]
+
+
+
+
+
+
+ {{ i18n "reset" }}
+ Password
+
+
+
+
+
+
+ TCP,UDP
+ TCP
+ UDP
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/socks.html b/web/html/form/protocol/socks.html
new file mode 100644
index 00000000..e126c51c
--- /dev/null
+++ b/web/html/form/protocol/socks.html
@@ -0,0 +1,34 @@
+{{define "form/socks"}}
+
+
+
+
+
+
+
+
+ inbound.settings.auth = checked ? 'password' : 'noauth'">
+
+
+
+
+ | {{ i18n "username" }} |
+ {{ i18n "password" }} |
+
+
+ |
+
+
+
+
+ [[ index+1 ]]
+
+
+
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/trojan.html b/web/html/form/protocol/trojan.html
new file mode 100644
index 00000000..fc327721
--- /dev/null
+++ b/web/html/form/protocol/trojan.html
@@ -0,0 +1,50 @@
+{{define "form/trojan"}}
+
+
+ {{template "form/client"}}
+
+
+
+
+
+
+
+ | [[ client.email ]] |
+ [[ client.password ]] |
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fallback [[ index + 1 ]] inbound.settings.delFallback(index)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/vless.html b/web/html/form/protocol/vless.html
new file mode 100644
index 00000000..3cebda6e
--- /dev/null
+++ b/web/html/form/protocol/vless.html
@@ -0,0 +1,50 @@
+{{define "form/vless"}}
+
+
+ {{template "form/client"}}
+
+
+
+
+
+
+
+ | [[ client.email ]] |
+ [[ client.id ]] |
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fallback [[ index + 1 ]] inbound.settings.delFallback(index)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/vmess.html b/web/html/form/protocol/vmess.html
new file mode 100644
index 00000000..3c5200ac
--- /dev/null
+++ b/web/html/form/protocol/vmess.html
@@ -0,0 +1,23 @@
+{{define "form/vmess"}}
+
+
+ {{template "form/client"}}
+
+
+
+
+
+
+
+ | [[ client.email ]] |
+ [[ client.id ]] |
+ [[ client.security ]] |
+
+
+
+
+{{end}}
diff --git a/web/html/form/protocol/wireguard.html b/web/html/form/protocol/wireguard.html
new file mode 100644
index 00000000..51fc4f02
--- /dev/null
+++ b/web/html/form/protocol/wireguard.html
@@ -0,0 +1,76 @@
+{{define "form/wireguard"}}
+
+
+
+
+
+ {{ i18n "reset" }}
+
+ {{ i18n "pages.xray.wireguard.secretKey" }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Peer [[ index + 1 ]] inbound.settings.delPeer(index)" :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }">
+
+
+
+
+
+ {{ i18n "reset" }}
+
+ {{ i18n "pages.xray.wireguard.secretKey" }}
+
+
+
+
+
+
+
+ {{ i18n "pages.xray.wireguard.publicKey" }}
+
+
+
+
+
+
+
+ {{ i18n "reset" }}
+
+ {{ i18n "pages.xray.wireguard.psk" }}
+
+
+
+
+
+
+
+ {{ i18n "pages.xray.wireguard.allowedIPs" }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+{{end}}
\ No newline at end of file
diff --git a/web/html/form/reality_settings.html b/web/html/form/reality_settings.html
new file mode 100644
index 00000000..7d5e6fb9
--- /dev/null
+++ b/web/html/form/reality_settings.html
@@ -0,0 +1,56 @@
+{{define "form/realitySettings"}}
+
+
+
+
+
+
+
+
+
+ [[ key ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ i18n "reset" }}
+ Short IDs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Get New Cert
+
+
+{{end}}
\ No newline at end of file
diff --git a/web/html/form/sniffing.html b/web/html/form/sniffing.html
new file mode 100644
index 00000000..d8a2e85a
--- /dev/null
+++ b/web/html/form/sniffing.html
@@ -0,0 +1,29 @@
+{{define "form/sniffing"}}
+
+
+
+ {{ i18n "enabled" }}
+
+
+ {{ i18n "pages.inbounds.noRecommendKeepDefault" }}
+
+
+
+
+
+
+
+