mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 12:44:22 +00:00
feat(settings): drop email leg from default remark model
Change the default remarkModel from "-ieo" to "-io" so a freshly installed panel composes share-link remarks from the inbound name + optional extra only, leaving out the client email. Existing panels keep whatever value they have saved — only fresh installs and fallback paths (parse failure, missing setting) pick up the new default. Touched everywhere the literal "-ieo" lived: the canonical default map, the two sub-package fallback constants, the four frontend defaults (model class, link generator, two inbound modals, useInbounds hook). Two snapshot tests regenerated and one obsolete "contains email" assertion in inbound-from-db.test.ts removed. To migrate an existing panel that wants the new behaviour, edit Settings → Remark Model and remove the email leg.
This commit is contained in:
parent
a038ad6135
commit
d9ec23c442
10 changed files with 22 additions and 23 deletions
|
|
@ -790,13 +790,13 @@ export interface GenAllLinksInput {
|
||||||
// link when there are no external proxies. remarkModel is a 4-char
|
// link when there are no external proxies. remarkModel is a 4-char
|
||||||
// string: first char is the separator, remaining chars pick which
|
// string: first char is the separator, remaining chars pick which
|
||||||
// pieces to compose into the per-link remark — 'i' = inbound remark,
|
// pieces to compose into the per-link remark — 'i' = inbound remark,
|
||||||
// 'e' = client email, 'o' = externalProxy remark. Defaults to '-ieo'
|
// 'e' = client email, 'o' = externalProxy remark. Defaults to '-io'
|
||||||
// (dash-separated, inbound + email + proxy).
|
// (dash-separated, inbound + email + proxy).
|
||||||
export function genAllLinks(input: GenAllLinksInput): GenAllLinksEntry[] {
|
export function genAllLinks(input: GenAllLinksInput): GenAllLinksEntry[] {
|
||||||
const {
|
const {
|
||||||
inbound,
|
inbound,
|
||||||
remark = '',
|
remark = '',
|
||||||
remarkModel = '-ieo',
|
remarkModel = '-io',
|
||||||
client,
|
client,
|
||||||
hostOverride = '',
|
hostOverride = '',
|
||||||
fallbackHostname,
|
fallbackHostname,
|
||||||
|
|
@ -855,7 +855,7 @@ export function genInboundLinks(input: GenInboundLinksInput): string {
|
||||||
const {
|
const {
|
||||||
inbound,
|
inbound,
|
||||||
remark = '',
|
remark = '',
|
||||||
remarkModel = '-ieo',
|
remarkModel = '-io',
|
||||||
hostOverride = '',
|
hostOverride = '',
|
||||||
fallbackHostname,
|
fallbackHostname,
|
||||||
} = input;
|
} = input;
|
||||||
|
|
@ -890,7 +890,7 @@ export interface GenWireguardFanoutInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function genWireguardLinks(input: GenWireguardFanoutInput): string {
|
export function genWireguardLinks(input: GenWireguardFanoutInput): string {
|
||||||
const { inbound, remark = '', remarkModel = '-ieo', hostOverride = '', fallbackHostname } = input;
|
const { inbound, remark = '', remarkModel = '-io', hostOverride = '', fallbackHostname } = input;
|
||||||
if (inbound.protocol !== 'wireguard') return '';
|
if (inbound.protocol !== 'wireguard') return '';
|
||||||
const addr = resolveAddr(inbound, hostOverride, fallbackHostname);
|
const addr = resolveAddr(inbound, hostOverride, fallbackHostname);
|
||||||
const sep = remarkModel.charAt(0);
|
const sep = remarkModel.charAt(0);
|
||||||
|
|
@ -906,7 +906,7 @@ export function genWireguardLinks(input: GenWireguardFanoutInput): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function genWireguardConfigs(input: GenWireguardFanoutInput): string {
|
export function genWireguardConfigs(input: GenWireguardFanoutInput): string {
|
||||||
const { inbound, remark = '', remarkModel = '-ieo', hostOverride = '', fallbackHostname } = input;
|
const { inbound, remark = '', remarkModel = '-io', hostOverride = '', fallbackHostname } = input;
|
||||||
if (inbound.protocol !== 'wireguard') return '';
|
if (inbound.protocol !== 'wireguard') return '';
|
||||||
const addr = resolveAddr(inbound, hostOverride, fallbackHostname);
|
const addr = resolveAddr(inbound, hostOverride, fallbackHostname);
|
||||||
const sep = remarkModel.charAt(0);
|
const sep = remarkModel.charAt(0);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export class AllSetting {
|
||||||
pageSize = 25;
|
pageSize = 25;
|
||||||
expireDiff = 0;
|
expireDiff = 0;
|
||||||
trafficDiff = 0;
|
trafficDiff = 0;
|
||||||
remarkModel = '-ieo';
|
remarkModel = '-io';
|
||||||
datepicker: 'gregorian' | 'jalalian' = 'gregorian';
|
datepicker: 'gregorian' | 'jalalian' = 'gregorian';
|
||||||
tgBotEnable = false;
|
tgBotEnable = false;
|
||||||
tgBotToken = '';
|
tgBotToken = '';
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ export default function InboundInfoModal({
|
||||||
onClose,
|
onClose,
|
||||||
dbInbound,
|
dbInbound,
|
||||||
clientIndex = 0,
|
clientIndex = 0,
|
||||||
remarkModel = '-ieo',
|
remarkModel = '-io',
|
||||||
expireDiff = 0,
|
expireDiff = 0,
|
||||||
trafficDiff = 0,
|
trafficDiff = 0,
|
||||||
ipLimitEnable = false,
|
ipLimitEnable = false,
|
||||||
|
|
@ -369,7 +369,7 @@ export default function InboundInfoModal({
|
||||||
genWireguardConfigs({
|
genWireguardConfigs({
|
||||||
inbound: inboundForLinks,
|
inbound: inboundForLinks,
|
||||||
remark: dbInbound.remark,
|
remark: dbInbound.remark,
|
||||||
remarkModel: '-ieo',
|
remarkModel: '-io',
|
||||||
hostOverride: nodeAddress,
|
hostOverride: nodeAddress,
|
||||||
fallbackHostname,
|
fallbackHostname,
|
||||||
}).split('\r\n'),
|
}).split('\r\n'),
|
||||||
|
|
@ -378,7 +378,7 @@ export default function InboundInfoModal({
|
||||||
genWireguardLinks({
|
genWireguardLinks({
|
||||||
inbound: inboundForLinks,
|
inbound: inboundForLinks,
|
||||||
remark: dbInbound.remark,
|
remark: dbInbound.remark,
|
||||||
remarkModel: '-ieo',
|
remarkModel: '-io',
|
||||||
hostOverride: nodeAddress,
|
hostOverride: nodeAddress,
|
||||||
fallbackHostname,
|
fallbackHostname,
|
||||||
}).split('\r\n'),
|
}).split('\r\n'),
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export default function QrCodeModal({
|
||||||
onClose,
|
onClose,
|
||||||
dbInbound,
|
dbInbound,
|
||||||
client = null,
|
client = null,
|
||||||
remarkModel = '-ieo',
|
remarkModel = '-io',
|
||||||
nodeAddress = '',
|
nodeAddress = '',
|
||||||
subSettings,
|
subSettings,
|
||||||
}: QrCodeModalProps) {
|
}: QrCodeModalProps) {
|
||||||
|
|
@ -65,7 +65,7 @@ export default function QrCodeModal({
|
||||||
genWireguardConfigs({
|
genWireguardConfigs({
|
||||||
inbound,
|
inbound,
|
||||||
remark: peerRemark,
|
remark: peerRemark,
|
||||||
remarkModel: '-ieo',
|
remarkModel: '-io',
|
||||||
hostOverride: nodeAddress,
|
hostOverride: nodeAddress,
|
||||||
fallbackHostname,
|
fallbackHostname,
|
||||||
}).split('\r\n'),
|
}).split('\r\n'),
|
||||||
|
|
@ -74,7 +74,7 @@ export default function QrCodeModal({
|
||||||
genWireguardLinks({
|
genWireguardLinks({
|
||||||
inbound,
|
inbound,
|
||||||
remark: peerRemark,
|
remark: peerRemark,
|
||||||
remarkModel: '-ieo',
|
remarkModel: '-io',
|
||||||
hostOverride: nodeAddress,
|
hostOverride: nodeAddress,
|
||||||
fallbackHostname,
|
fallbackHostname,
|
||||||
}).split('\r\n'),
|
}).split('\r\n'),
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ export function useInbounds() {
|
||||||
const tgBotEnable = !!defaults.tgBotEnable;
|
const tgBotEnable = !!defaults.tgBotEnable;
|
||||||
const ipLimitEnable = !!defaults.ipLimitEnable;
|
const ipLimitEnable = !!defaults.ipLimitEnable;
|
||||||
const pageSize = defaults.pageSize ?? 0;
|
const pageSize = defaults.pageSize ?? 0;
|
||||||
const remarkModel = defaults.remarkModel || '-ieo';
|
const remarkModel = defaults.remarkModel || '-io';
|
||||||
const datepicker = (defaults.datepicker as 'gregorian' | 'jalalian') || 'gregorian';
|
const datepicker = (defaults.datepicker as 'gregorian' | 'jalalian') || 'gregorian';
|
||||||
|
|
||||||
const subSettings: SubSettings = useMemo(() => ({
|
const subSettings: SubSettings = useMemo(() => ({
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
exports[`genHysteriaLink > hysteria-v1-tls: byte-stable 1`] = `"hysteria://hyst-v1-auth-XYZ@example.test:36715?security=tls&fp=chrome&alpn=h3&sni=hysteria.example.test#parity-test"`;
|
exports[`genHysteriaLink > hysteria-v1-tls: byte-stable 1`] = `"hysteria://hyst-v1-auth-XYZ@example.test:36715?security=tls&fp=chrome&alpn=h3&sni=hysteria.example.test#parity-test"`;
|
||||||
|
|
||||||
exports[`genInboundLinks orchestrator > hysteria-v1-tls: byte-stable 1`] = `"hysteria://hyst-v1-auth-XYZ@override.test:36715?security=tls&fp=chrome&alpn=h3&sni=hysteria.example.test#parity-test-gina%40example.test"`;
|
exports[`genInboundLinks orchestrator > hysteria-v1-tls: byte-stable 1`] = `"hysteria://hyst-v1-auth-XYZ@override.test:36715?security=tls&fp=chrome&alpn=h3&sni=hysteria.example.test#parity-test"`;
|
||||||
|
|
||||||
exports[`genInboundLinks orchestrator > shadowsocks-tcp-2022: byte-stable 1`] = `"ss://MjAyMi1ibGFrZTMtYWVzLTI1Ni1nY206Wm1GclpTMXpaWEoyWlhJdGNHRnpjM2R2Y21RdE1EQXdNUT09OmRHVnpkQzFqYkdsbGJuUXRjR0Z6YzNkdmNtUXRNUT09@override.test:8388?type=tcp#parity-test-frank%40example.test"`;
|
exports[`genInboundLinks orchestrator > shadowsocks-tcp-2022: byte-stable 1`] = `"ss://MjAyMi1ibGFrZTMtYWVzLTI1Ni1nY206Wm1GclpTMXpaWEoyWlhJdGNHRnpjM2R2Y21RdE1EQXdNUT09OmRHVnpkQzFqYkdsbGJuUXRjR0Z6YzNkdmNtUXRNUT09@override.test:8388?type=tcp#parity-test"`;
|
||||||
|
|
||||||
exports[`genInboundLinks orchestrator > trojan-ws-tls: byte-stable 1`] = `"trojan://trojan-test-pw-XYZ@override.test:443?type=ws&path=%2Ftrojan&host=trojan.example.test&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=trojan.example.test#parity-test-eve%40example.test"`;
|
exports[`genInboundLinks orchestrator > trojan-ws-tls: byte-stable 1`] = `"trojan://trojan-test-pw-XYZ@override.test:443?type=ws&path=%2Ftrojan&host=trojan.example.test&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=trojan.example.test#parity-test"`;
|
||||||
|
|
||||||
exports[`genInboundLinks orchestrator > vless-tcp-reality: byte-stable 1`] = `"vless://22222222-3333-4444-9555-666666666666@override.test:443?type=tcp&encryption=none&security=reality&pbk=Tx5yj1bRcOPHkdvT2pIAQ2zh0gQ8m4OPdnzqXJxxV3o&fp=chrome&sid=a3f1&spx=%2F&flow=xtls-rprx-vision#parity-test-dave%40example.test"`;
|
exports[`genInboundLinks orchestrator > vless-tcp-reality: byte-stable 1`] = `"vless://22222222-3333-4444-9555-666666666666@override.test:443?type=tcp&encryption=none&security=reality&pbk=Tx5yj1bRcOPHkdvT2pIAQ2zh0gQ8m4OPdnzqXJxxV3o&fp=chrome&sid=a3f1&spx=%2F&flow=xtls-rprx-vision#parity-test"`;
|
||||||
|
|
||||||
exports[`genInboundLinks orchestrator > vless-ws-tls: byte-stable 1`] = `"vless://8c14d6f7-2e3b-4a91-9d24-3f7a6b8c1e02@override.test:443?type=ws&encryption=none&path=%2Fws&host=cdn.example.test&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=cdn.example.test#parity-test-alice%40example.test"`;
|
exports[`genInboundLinks orchestrator > vless-ws-tls: byte-stable 1`] = `"vless://8c14d6f7-2e3b-4a91-9d24-3f7a6b8c1e02@override.test:443?type=ws&encryption=none&path=%2Fws&host=cdn.example.test&security=tls&fp=chrome&alpn=h2%2Chttp%2F1.1&sni=cdn.example.test#parity-test"`;
|
||||||
|
|
||||||
exports[`genInboundLinks orchestrator > vmess-tcp-tls: byte-stable 1`] = `"vmess://ewogICJ2IjogIjIiLAogICJwcyI6ICJwYXJpdHktdGVzdC1jYXJvbEBleGFtcGxlLnRlc3QiLAogICJhZGQiOiAib3ZlcnJpZGUudGVzdCIsCiAgInBvcnQiOiA4NDQzLAogICJpZCI6ICIxMTExMTExMS0yMjIyLTQzMzMtODQ0NC01NTU1NTU1NTU1NTUiLAogICJzY3kiOiAiYXV0byIsCiAgIm5ldCI6ICJ0Y3AiLAogICJ0bHMiOiAidGxzIiwKICAidHlwZSI6ICJub25lIiwKICAic25pIjogInZtZXNzLmV4YW1wbGUudGVzdCIsCiAgImZwIjogImNocm9tZSIsCiAgImFscG4iOiAiaDIsaHR0cC8xLjEiCn0="`;
|
exports[`genInboundLinks orchestrator > vmess-tcp-tls: byte-stable 1`] = `"vmess://ewogICJ2IjogIjIiLAogICJwcyI6ICJwYXJpdHktdGVzdCIsCiAgImFkZCI6ICJvdmVycmlkZS50ZXN0IiwKICAicG9ydCI6IDg0NDMsCiAgImlkIjogIjExMTExMTExLTIyMjItNDMzMy04NDQ0LTU1NTU1NTU1NTU1NSIsCiAgInNjeSI6ICJhdXRvIiwKICAibmV0IjogInRjcCIsCiAgInRscyI6ICJ0bHMiLAogICJ0eXBlIjogIm5vbmUiLAogICJzbmkiOiAidm1lc3MuZXhhbXBsZS50ZXN0IiwKICAiZnAiOiAiY2hyb21lIiwKICAiYWxwbiI6ICJoMixodHRwLzEuMSIKfQ=="`;
|
||||||
|
|
||||||
exports[`genInboundLinks orchestrator > wireguard-server: byte-stable 1`] = `
|
exports[`genInboundLinks orchestrator > wireguard-server: byte-stable 1`] = `
|
||||||
"[Interface]
|
"[Interface]
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@ describe('inboundFromDb', () => {
|
||||||
fallbackHostname: FALLBACK_HOST,
|
fallbackHostname: FALLBACK_HOST,
|
||||||
});
|
});
|
||||||
expect(links).toContain('vless://');
|
expect(links).toContain('vless://');
|
||||||
expect(links).toContain('alice%40test');
|
|
||||||
expect(links).toContain('encryption=none');
|
expect(links).toContain('encryption=none');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func (p *LinkProvider) build(host string) *SubService {
|
||||||
showInfo, _ := p.settingService.GetSubShowInfo()
|
showInfo, _ := p.settingService.GetSubShowInfo()
|
||||||
rModel, err := p.settingService.GetRemarkModel()
|
rModel, err := p.settingService.GetRemarkModel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rModel = "-ieo"
|
rModel = "-io"
|
||||||
}
|
}
|
||||||
svc := NewSubService(showInfo, rModel)
|
svc := NewSubService(showInfo, rModel)
|
||||||
svc.PrepareForRequest(host)
|
svc.PrepareForRequest(host)
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ func (s *Server) initRouter() (*gin.Engine, error) {
|
||||||
|
|
||||||
RemarkModel, err := s.settingService.GetRemarkModel()
|
RemarkModel, err := s.settingService.GetRemarkModel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
RemarkModel = "-ieo"
|
RemarkModel = "-io"
|
||||||
}
|
}
|
||||||
|
|
||||||
SubUpdates, err := s.settingService.GetSubUpdates()
|
SubUpdates, err := s.settingService.GetSubUpdates()
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ var defaultValueMap = map[string]string{
|
||||||
"pageSize": "25",
|
"pageSize": "25",
|
||||||
"expireDiff": "0",
|
"expireDiff": "0",
|
||||||
"trafficDiff": "0",
|
"trafficDiff": "0",
|
||||||
"remarkModel": "-ieo",
|
"remarkModel": "-io",
|
||||||
"timeLocation": "Local",
|
"timeLocation": "Local",
|
||||||
"tgBotEnable": "false",
|
"tgBotEnable": "false",
|
||||||
"tgBotToken": "",
|
"tgBotToken": "",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue