Browse Source

add check for geosite function

Hamidreza Ghavami 1 year ago
parent
commit
65588a4492
1 changed files with 24 additions and 0 deletions
  1. 24 0
      web/html/xui/settings.html

+ 24 - 0
web/html/xui/settings.html

@@ -307,6 +307,9 @@
                 },
             }
         },
+        created() {
+            this.checkForGeosites();
+        },
         methods: {
             loading(spinning = true, obj) {
                 if (obj == null) this.spinning = spinning;
@@ -401,6 +404,27 @@
                     this.saveBtnDisable = true;
                 }
             },
+            checkForGeosites() {
+                const domainsToCheck = [
+                    {
+                        query: "category-ru-gov",
+                        key: "this.settingsData.domains.ru",
+                        data: [
+                            "geosite:category-ru-gov",
+                            "regexp:.*\\.ru$"
+                        ]
+                    },
+                ];
+                this.loading(true);
+                domainsToCheck.forEach(async (dd) => {
+                    const msg = await HttpUtil.get(`/xui/setting/searchDatafiles?query=${dd.query}`);
+                    if (msg.success && msg.obj) {
+                        [dd.key] = dd.data;
+                        console.log([dd.key])
+                    }
+                })
+                this.loading(false);
+            },
             checkRequiredOutbounds() {
                 const newTemplateSettings = this.templateSettings;
                 const haveIPv4Outbounds = newTemplateSettings.outbounds.some((o) => o?.tag === "IPv4");