浏览代码

chore: deleting unnecessary functions

Shishkevich D. 2 天之前
父节点
当前提交
1a53af0434
共有 2 个文件被更改,包括 2 次插入51 次删除
  1. 1 9
      web/html/settings.html
  2. 1 42
      web/html/xray.html

+ 1 - 9
web/html/settings.html

@@ -319,19 +319,11 @@
         this.loading(false);
         await this.updateAllSetting();
       },
-      generateRandomString(length) {
-        var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
-        let randomString = "";
-        for (let i = 0; i < length; i++) {
-          randomString += chars[Math.floor(Math.random() * chars.length)];
-        }
-        return randomString;
-      },
       async getNewSecret() {
         if (!this.changeSecret) {
           this.changeSecret = true;
           this.user.loginSecret = '';
-          const newSecret = this.generateRandomString(64);
+          const newSecret = RandomUtil.randomSeq(64);
           await PromiseUtil.sleep(1000);
           this.user.loginSecret = newSecret;
           this.changeSecret = false;

+ 1 - 42
web/html/xray.html

@@ -131,7 +131,7 @@
 {{template "modals/fakednsModal"}}
 {{template "modals/warpModal"}}
 <script>
-        const rulesColumns = [
+    const rulesColumns = [
         { title: "#", align: 'center', width: 15, scopedSlots: { customRender: 'action' } },
         { title: '{{ i18n "pages.xray.rules.source"}}', children: [
             { title: 'IP', dataIndex: "source", align: 'center', width: 20, ellipsis: true },
@@ -383,47 +383,6 @@
                     if(msg.obj.length > 1) Vue.prototype.$message.error(msg.obj);
                 }
             },
-            async fetchUserSecret() {
-                this.loading(true);
-                const userMessage = await HttpUtil.post("/panel/setting/getUserSecret", this.user);
-                if (userMessage.success) {
-                    this.user = userMessage.obj;
-                }
-                this.loading(false);
-            },
-            async updateSecret() {
-                this.loading(true);
-                const msg = await HttpUtil.post("/panel/setting/updateUserSecret", this.user);
-                if (msg.success) {
-                    this.user = msg.obj;
-                    window.location.replace(basePath + "logout");
-                }
-                this.loading(false);
-                await this.updateXraySetting();
-            },
-            generateRandomString(length) {
-                var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
-                let randomString = "";
-                for (let i = 0; i < length; i++) {
-                    randomString += chars[Math.floor(Math.random() * chars.length)];
-                }
-                return randomString;
-            },
-            async getNewSecret() {
-                this.loading(true);
-                await PromiseUtil.sleep(600);
-                const newSecret = this.generateRandomString(64);
-                this.user.loginSecret = newSecret;
-                document.getElementById("token").textContent = newSecret;
-                this.loading(false);
-            },
-            async toggleToken(value) {
-                if (value) {
-                    await this.getNewSecret();
-                } else {
-                    this.user.loginSecret = "";
-                }
-            },
             async resetXrayConfigToDefault() {
                 this.loading(true);
                 const msg = await HttpUtil.get("/panel/setting/getDefaultJsonConfig");