Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHo3ein <ho3ein.sanaei@gmail.com>2023-04-18 20:40:33 +0300
committerGitHub <noreply@github.com>2023-04-18 20:40:33 +0300
commitdc7dbae14a37492ac3a7e3822b3e0b250e248173 (patch)
tree85160488f60dd4995ea4fb3798af9e9c2fb5305a /web/service
parentee2089257a504d153cf180e7c8ffc41a46701552 (diff)
parentdd8c763b21f6f4823e7a3ee418b348775bf51b5d (diff)
Merge pull request #266 from hamid-gh98/main
[Support] change settings by different items in panel
Diffstat (limited to 'web/service')
-rw-r--r--web/service/config.json45
-rw-r--r--web/service/setting.go10
2 files changed, 28 insertions, 27 deletions
diff --git a/web/service/config.json b/web/service/config.json
index 34e2038f..9d8d2d9f 100644
--- a/web/service/config.json
+++ b/web/service/config.json
@@ -1,25 +1,22 @@
{
"log": {
"loglevel": "warning",
- "access": "./access.log"
+ "access": "./access.log",
+ "error": "./error.log"
},
"api": {
- "services": [
- "HandlerService",
- "LoggerService",
- "StatsService"
- ],
- "tag": "api"
+ "tag": "api",
+ "services": ["HandlerService", "LoggerService", "StatsService"]
},
"inbounds": [
{
+ "tag": "api",
"listen": "127.0.0.1",
"port": 62789,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
- },
- "tag": "api"
+ }
}
],
"outbounds": [
@@ -28,16 +25,16 @@
"settings": {}
},
{
+ "tag": "blocked",
"protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
+ "settings": {}
}
],
"policy": {
"levels": {
"0": {
- "statsUserUplink": true,
- "statsUserDownlink": true
+ "statsUserDownlink": true,
+ "statsUserUplink": true
}
},
"system": {
@@ -49,27 +46,21 @@
"domainStrategy": "IPIfNonMatch",
"rules": [
{
- "inboundTag": [
- "api"
- ],
- "outboundTag": "api",
- "type": "field"
+ "type": "field",
+ "inboundTag": ["api"],
+ "outboundTag": "api"
},
{
+ "type": "field",
"outboundTag": "blocked",
- "ip": [
- "geoip:private"
- ],
- "type": "field"
+ "ip": ["geoip:private"]
},
{
+ "type": "field",
"outboundTag": "blocked",
- "protocol": [
- "bittorrent"
- ],
- "type": "field"
+ "protocol": ["bittorrent"]
}
]
},
"stats": {}
-} \ No newline at end of file
+}
diff --git a/web/service/setting.go b/web/service/setting.go
index ff22f847..9d92685e 100644
--- a/web/service/setting.go
+++ b/web/service/setting.go
@@ -2,6 +2,7 @@ package service
import (
_ "embed"
+ "encoding/json"
"errors"
"fmt"
"reflect"
@@ -42,6 +43,15 @@ var defaultValueMap = map[string]string{
type SettingService struct {
}
+func (s *SettingService) GetDefaultJsonConfig() (interface{}, error) {
+ var jsonData interface{}
+ err := json.Unmarshal([]byte(xrayTemplateConfig), &jsonData)
+ if err != nil {
+ return nil, err
+ }
+ return jsonData, nil
+}
+
func (s *SettingService) GetAllSetting() (*entity.AllSetting, error) {
db := database.GetDB()
settings := make([]*model.Setting, 0)