From 891a61ac16fbeae942b89863317c3c5497ab18e1 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sun, 19 Jan 2025 01:52:44 +0100 Subject: [PATCH] small fixes --- backend/database/model/outbounds.go | 2 +- backend/service/server.go | 4 +- frontend/src/components/protocols/Warp.vue | 86 ++++++++++--------- .../src/components/protocols/Wireguard.vue | 2 +- frontend/src/store/modules/data.ts | 6 +- 5 files changed, 51 insertions(+), 49 deletions(-) diff --git a/backend/database/model/outbounds.go b/backend/database/model/outbounds.go index 75b6fc2..9aec2ae 100644 --- a/backend/database/model/outbounds.go +++ b/backend/database/model/outbounds.go @@ -27,7 +27,7 @@ func (o *Outbound) UnmarshalJSON(data []byte) error { delete(raw, "tag") // Remaining fields - o.Options, err = json.Marshal(raw) + o.Options, err = json.MarshalIndent(raw, "", " ") return err } diff --git a/backend/service/server.go b/backend/service/server.go index f12d427..a1887ad 100644 --- a/backend/service/server.go +++ b/backend/service/server.go @@ -163,7 +163,7 @@ func (s *ServerService) GenKeypair(keyType string, options string) []string { case "reality": return s.generateRealityKeyPair() case "wireguard": - return generateWireGuardKey(options) + return s.generateWireGuardKey(options) } return []string{"Failed to generate keypair"} @@ -195,7 +195,7 @@ func (s *ServerService) generateRealityKeyPair() []string { return []string{"PrivateKey: " + base64.RawURLEncoding.EncodeToString(privateKey[:]), "PublicKey: " + base64.RawURLEncoding.EncodeToString(publicKey[:])} } -func generateWireGuardKey(pk string) []string { +func (s *ServerService) generateWireGuardKey(pk string) []string { if len(pk) > 0 { key, _ := wgtypes.ParseKey(pk) return []string{key.PublicKey().String()} diff --git a/frontend/src/components/protocols/Warp.vue b/frontend/src/components/protocols/Warp.vue index 38df7ad..932a150 100644 --- a/frontend/src/components/protocols/Warp.vue +++ b/frontend/src/components/protocols/Warp.vue @@ -2,50 +2,54 @@ diff --git a/frontend/src/components/protocols/Wireguard.vue b/frontend/src/components/protocols/Wireguard.vue index 1cc0b8d..6a357fe 100644 --- a/frontend/src/components/protocols/Wireguard.vue +++ b/frontend/src/components/protocols/Wireguard.vue @@ -13,7 +13,7 @@ [], outbound: [], user: []}, config: {}, inbounds: [], - outbounds: [], - endpoints: [], + outbounds: [], + endpoints: [], clients: [], tlsConfigs: [], }),