small fixes

This commit is contained in:
Alireza Ahmadi
2025-01-19 01:52:44 +01:00
parent a0dc165995
commit 891a61ac16
5 changed files with 51 additions and 49 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ func (o *Outbound) UnmarshalJSON(data []byte) error {
delete(raw, "tag") delete(raw, "tag")
// Remaining fields // Remaining fields
o.Options, err = json.Marshal(raw) o.Options, err = json.MarshalIndent(raw, "", " ")
return err return err
} }
+2 -2
View File
@@ -163,7 +163,7 @@ func (s *ServerService) GenKeypair(keyType string, options string) []string {
case "reality": case "reality":
return s.generateRealityKeyPair() return s.generateRealityKeyPair()
case "wireguard": case "wireguard":
return generateWireGuardKey(options) return s.generateWireGuardKey(options)
} }
return []string{"Failed to generate keypair"} 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[:])} 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 { if len(pk) > 0 {
key, _ := wgtypes.ParseKey(pk) key, _ := wgtypes.ParseKey(pk)
return []string{key.PublicKey().String()} return []string{key.PublicKey().String()}
+45 -41
View File
@@ -2,50 +2,54 @@
<v-card subtitle="Warp"> <v-card subtitle="Warp">
<template v-if="data.id>0"> <template v-if="data.id>0">
<table dir="ltr" width="100%"> <table dir="ltr" width="100%">
<tr> <tbody>
<td>Device ID</td> <tr>
<td>{{ data.ext.device_id }}</td> <td>Device ID</td>
</tr> <td>{{ data.ext.device_id }}</td>
<tr> </tr>
<td>Access Token</td> <tr>
<td>{{ data.ext.access_token }}</td> <td>Access Token</td>
</tr> <td>{{ data.ext.access_token }}</td>
<tr> </tr>
<td>{{ $t('types.wg.privKey') }}</td> <tr>
<td>{{ data.private_key }}</td> <td>{{ $t('types.wg.privKey') }}</td>
</tr> <td>{{ data.private_key }}</td>
<tr> </tr>
<td>{{ $t('types.wg.localIp') }}</td> <tr>
<td>{{ data.address.join(',') }}</td> <td>{{ $t('types.wg.localIp') }}</td>
</tr> <td>{{ data.address.join(',') }}</td>
<tr> </tr>
<td colspan="2"> <tr>
<v-text-field <td colspan="2">
v-model="data.ext.license_key" <v-text-field
label="License Key" v-model="data.ext.license_key"
hide-details> label="License Key"
</v-text-field> hide-details>
</td> </v-text-field>
</tr> </td>
</tr>
</tbody>
</table> </table>
<v-card :subtitle="$t('types.wg.peer')"> <v-card :subtitle="$t('types.wg.peer')">
<table dir="ltr" width="100%"> <table dir="ltr" width="100%">
<tr> <tbody>
<td>{{ $t('out.addr') }}</td> <tr>
<td>{{ data.peers[0].address + ":" + data.peers[0].port }}</td> <td>{{ $t('out.addr') }}</td>
</tr> <td>{{ data.peers[0].address + ":" + data.peers[0].port }}</td>
<tr> </tr>
<td>{{ $t('types.wg.pubKey') }}</td> <tr>
<td>{{ data.peers[0].public_key }}</td> <td>{{ $t('types.wg.pubKey') }}</td>
</tr> <td>{{ data.peers[0].public_key }}</td>
<tr> </tr>
<td>{{ $t('types.wg.allowedIp') }}</td> <tr>
<td>{{ data.peers[0].allowed_ips.join(',') }}</td> <td>{{ $t('types.wg.allowedIp') }}</td>
</tr> <td>{{ data.peers[0].allowed_ips.join(',') }}</td>
<tr> </tr>
<td>Reserved</td> <tr>
<td>[{{ data.peers[0].reserved.join(',') }}]</td> <td>Reserved</td>
</tr> <td>[{{ data.peers[0].reserved.join(',') }}]</td>
</tr>
</tbody>
</table> </table>
</v-card> </v-card>
</template> </template>
@@ -13,7 +13,7 @@
<v-col cols="12" sm="8"> <v-col cols="12" sm="8">
<v-text-field <v-text-field
v-model="options.public_key" v-model="options.public_key"
disabled readonly
:label="$t('tls.pubKey')" :label="$t('tls.pubKey')"
append-icon="mdi-refresh" append-icon="mdi-refresh"
@click:append="getWgPubKey()" @click:append="getWgPubKey()"
+2 -4
View File
@@ -3,8 +3,6 @@ import { defineStore } from 'pinia'
import { push } from 'notivue' import { push } from 'notivue'
import { i18n } from '@/locales' import { i18n } from '@/locales'
import { Inbound } from '@/types/inbounds' import { Inbound } from '@/types/inbounds'
import { Outbound } from '@/types/outbounds'
import { Endpoint } from '@/types/endpoints'
import { Client } from '@/types/clients' import { Client } from '@/types/clients'
const Data = defineStore('Data', { const Data = defineStore('Data', {
@@ -15,8 +13,8 @@ const Data = defineStore('Data', {
onlines: {inbound: <string[]>[], outbound: <string[]>[], user: <string[]>[]}, onlines: {inbound: <string[]>[], outbound: <string[]>[], user: <string[]>[]},
config: <any>{}, config: <any>{},
inbounds: <any[]>[], inbounds: <any[]>[],
outbounds: <Outbound[]>[], outbounds: <any[]>[],
endpoints: <Endpoint[]>[], endpoints: <any[]>[],
clients: <any>[], clients: <any>[],
tlsConfigs: <any[]>[], tlsConfigs: <any[]>[],
}), }),