setting.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { ObjectUtil } from '@/utils';
  2. export class AllSetting {
  3. webListen = '';
  4. webDomain = '';
  5. webPort = 2053;
  6. webCertFile = '';
  7. webKeyFile = '';
  8. webBasePath = '/';
  9. sessionMaxAge = 360;
  10. trustedProxyCIDRs = '127.0.0.1/32,::1/128';
  11. panelOutbound = '';
  12. pageSize = 25;
  13. expireDiff = 0;
  14. trafficDiff = 0;
  15. remarkTemplate = '{{INBOUND}}|📊{{TRAFFIC_LEFT}}|⏳{{DAYS_LEFT}}D';
  16. datepicker: 'gregorian' | 'jalalian' = 'gregorian';
  17. tgBotEnable = false;
  18. tgBotToken = '';
  19. tgBotAPIServer = '';
  20. tgBotChatId = '';
  21. tgRunTime = '@daily';
  22. tgBotBackup = false;
  23. tgCpu = 80;
  24. tgLang = 'en-US';
  25. twoFactorEnable = false;
  26. twoFactorToken = '';
  27. xrayTemplateConfig = '';
  28. subEnable = true;
  29. subJsonEnable = false;
  30. subTitle = '';
  31. subSupportUrl = '';
  32. subProfileUrl = '';
  33. subAnnounce = '';
  34. subEnableRouting = false;
  35. subRoutingRules = '';
  36. subListen = '';
  37. subPort = 2096;
  38. subPath = '/sub/';
  39. subJsonPath = '/json/';
  40. subClashEnable = false;
  41. subClashPath = '/clash/';
  42. subDomain = '';
  43. externalTrafficInformEnable = false;
  44. externalTrafficInformURI = '';
  45. restartXrayOnClientDisable = true;
  46. subCertFile = '';
  47. subKeyFile = '';
  48. subUpdates = 12;
  49. subEncrypt = true;
  50. subURI = '';
  51. subJsonURI = '';
  52. subClashURI = '';
  53. subClashEnableRouting = false;
  54. subClashRules = '';
  55. subJsonMux = '';
  56. subJsonRules = '';
  57. subJsonFinalMask = '';
  58. subThemeDir = '';
  59. subHideSettings = false;
  60. timeLocation = 'Local';
  61. ldapEnable = false;
  62. ldapHost = '';
  63. ldapPort = 389;
  64. ldapUseTLS = false;
  65. ldapBindDN = '';
  66. ldapPassword = '';
  67. ldapBaseDN = '';
  68. ldapUserFilter = '(objectClass=person)';
  69. ldapUserAttr = 'mail';
  70. ldapVlessField = 'vless_enabled';
  71. ldapSyncCron = '@every 1m';
  72. ldapFlagField = '';
  73. ldapTruthyValues = 'true,1,yes,on';
  74. ldapInvertFlag = false;
  75. ldapInboundTags = '';
  76. ldapAutoCreate = false;
  77. ldapAutoDelete = false;
  78. ldapDefaultTotalGB = 0;
  79. ldapDefaultExpiryDays = 0;
  80. ldapDefaultLimitIP = 0;
  81. tgEnabledEvents = '';
  82. smtpEnable = false;
  83. smtpHost = '';
  84. smtpPort = 587;
  85. smtpUsername = '';
  86. smtpPassword = '';
  87. smtpTo = '';
  88. smtpEncryptionType = 'starttls';
  89. smtpEnabledEvents = '';
  90. smtpCpu = 80;
  91. hasTgBotToken = false;
  92. hasTwoFactorToken = false;
  93. hasLdapPassword = false;
  94. hasApiToken = false;
  95. hasWarpSecret = false;
  96. hasNordSecret = false;
  97. hasSmtpPassword = false;
  98. constructor(data?: unknown) {
  99. if (data != null) {
  100. ObjectUtil.cloneProps(this, data);
  101. }
  102. const cpu = Math.round(Number(this.tgCpu));
  103. this.tgCpu = Number.isFinite(cpu) ? Math.min(100, Math.max(0, cpu)) : 80;
  104. }
  105. equals(other: AllSetting): boolean {
  106. return ObjectUtil.equals(this, other);
  107. }
  108. }