mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-29 16:39:35 +00:00
Adds the settings entry as a new Vite multi-page input. Lays down the shared page chrome (sidebar, save bar, restart, security alert) and the AllSetting fetch/dirty-poll lifecycle so 5d-ii through 5d-vi can drop in tab partials without re-implementing it. - settings.html + src/settings.js: third Vite entry; mounts SettingsPage. - SettingsPage.vue: page chrome with the legacy two-button save/restart bar, conf-alerts banner, and 5 a-tabs (4 always-visible + the formats tab gated on subJsonEnable || subClashEnable). Each tab body is an a-empty placeholder until 5d-ii…vi fill them in. - useAllSetting.js composable: POST /panel/setting/all on mount, mirrors the legacy 1s busy-loop dirty check via setInterval, and exposes fetchAll/saveAll. saveDisabled flips off as soon as the user diverges from the server snapshot. - restartPanel rebuilds the URL (host/port/scheme/base path) from the saved settings so users land on the new endpoint after a port or cert change. - models/setting.js: adopts the @/utils alias and a leading file-level doc — semantics unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
100 lines
3.1 KiB
JavaScript
100 lines
3.1 KiB
JavaScript
// Mirrors web/assets/js/model/setting.js — every field on this class is
|
|
// round-tripped through `/panel/setting/all` and `/panel/setting/update`,
|
|
// so adding a field here without a matching Go-side change will silently
|
|
// drop it on save. Defaults match the legacy panel.
|
|
|
|
import { ObjectUtil } from '@/utils';
|
|
|
|
export class AllSetting {
|
|
|
|
constructor(data) {
|
|
this.webListen = "";
|
|
this.webDomain = "";
|
|
this.webPort = 2053;
|
|
this.webCertFile = "";
|
|
this.webKeyFile = "";
|
|
this.webBasePath = "/";
|
|
this.sessionMaxAge = 360;
|
|
this.pageSize = 25;
|
|
this.expireDiff = 0;
|
|
this.trafficDiff = 0;
|
|
this.remarkModel = "-ieo";
|
|
this.datepicker = "gregorian";
|
|
this.tgBotEnable = false;
|
|
this.tgBotToken = "";
|
|
this.tgBotProxy = "";
|
|
this.tgBotAPIServer = "";
|
|
this.tgBotChatId = "";
|
|
this.tgRunTime = "@daily";
|
|
this.tgBotBackup = false;
|
|
this.tgBotLoginNotify = true;
|
|
this.tgCpu = 80;
|
|
this.tgLang = "en-US";
|
|
this.twoFactorEnable = false;
|
|
this.twoFactorToken = "";
|
|
this.xrayTemplateConfig = "";
|
|
this.subEnable = true;
|
|
this.subJsonEnable = false;
|
|
this.subTitle = "";
|
|
this.subSupportUrl = "";
|
|
this.subProfileUrl = "";
|
|
this.subAnnounce = "";
|
|
this.subEnableRouting = true;
|
|
this.subRoutingRules = "";
|
|
this.subListen = "";
|
|
this.subPort = 2096;
|
|
this.subPath = "/sub/";
|
|
this.subJsonPath = "/json/";
|
|
this.subClashEnable = true;
|
|
this.subClashPath = "/clash/";
|
|
this.subDomain = "";
|
|
this.externalTrafficInformEnable = false;
|
|
this.externalTrafficInformURI = "";
|
|
this.restartXrayOnClientDisable = true;
|
|
this.subCertFile = "";
|
|
this.subKeyFile = "";
|
|
this.subUpdates = 12;
|
|
this.subEncrypt = true;
|
|
this.subShowInfo = true;
|
|
this.subURI = "";
|
|
this.subJsonURI = "";
|
|
this.subClashURI = "";
|
|
this.subJsonFragment = "";
|
|
this.subJsonNoises = "";
|
|
this.subJsonMux = "";
|
|
this.subJsonRules = "";
|
|
|
|
this.timeLocation = "Local";
|
|
|
|
// LDAP settings
|
|
this.ldapEnable = false;
|
|
this.ldapHost = "";
|
|
this.ldapPort = 389;
|
|
this.ldapUseTLS = false;
|
|
this.ldapBindDN = "";
|
|
this.ldapPassword = "";
|
|
this.ldapBaseDN = "";
|
|
this.ldapUserFilter = "(objectClass=person)";
|
|
this.ldapUserAttr = "mail";
|
|
this.ldapVlessField = "vless_enabled";
|
|
this.ldapSyncCron = "@every 1m";
|
|
this.ldapFlagField = "";
|
|
this.ldapTruthyValues = "true,1,yes,on";
|
|
this.ldapInvertFlag = false;
|
|
this.ldapInboundTags = "";
|
|
this.ldapAutoCreate = false;
|
|
this.ldapAutoDelete = false;
|
|
this.ldapDefaultTotalGB = 0;
|
|
this.ldapDefaultExpiryDays = 0;
|
|
this.ldapDefaultLimitIP = 0;
|
|
|
|
if (data == null) {
|
|
return
|
|
}
|
|
ObjectUtil.cloneProps(this, data);
|
|
}
|
|
|
|
equals(other) {
|
|
return ObjectUtil.equals(this, other);
|
|
}
|
|
} |