Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alireza0 committed Jan 19, 2025
1 parent a0dc165 commit 891a61a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 44 deletions.
2 changes: 1 addition & 1 deletion backend/database/model/outbounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions backend/service/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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()}
Expand Down
76 changes: 40 additions & 36 deletions frontend/src/components/protocols/Warp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,54 @@
<v-card subtitle="Warp">
<template v-if="data.id>0">
<table dir="ltr" width="100%">
<tr>
<td>Device ID</td>
<td>{{ data.ext.device_id }}</td>
</tr>
<tr>
<td>Access Token</td>
<td>{{ data.ext.access_token }}</td>
</tr>
<tr>
<td>{{ $t('types.wg.privKey') }}</td>
<td>{{ data.private_key }}</td>
</tr>
<tr>
<td>{{ $t('types.wg.localIp') }}</td>
<td>{{ data.address.join(',') }}</td>
</tr>
<tr>
<td colspan="2">
<v-text-field
v-model="data.ext.license_key"
label="License Key"
hide-details>
</v-text-field>
</td>
</tr>
</table>
<v-card :subtitle="$t('types.wg.peer')">
<table dir="ltr" width="100%">
<tbody>
<tr>
<td>Device ID</td>
<td>{{ data.ext.device_id }}</td>
</tr>
<tr>
<td>{{ $t('out.addr') }}</td>
<td>{{ data.peers[0].address + ":" + data.peers[0].port }}</td>
<td>Access Token</td>
<td>{{ data.ext.access_token }}</td>
</tr>
<tr>
<td>{{ $t('types.wg.pubKey') }}</td>
<td>{{ data.peers[0].public_key }}</td>
<td>{{ $t('types.wg.privKey') }}</td>
<td>{{ data.private_key }}</td>
</tr>
<tr>
<td>{{ $t('types.wg.allowedIp') }}</td>
<td>{{ data.peers[0].allowed_ips.join(',') }}</td>
<td>{{ $t('types.wg.localIp') }}</td>
<td>{{ data.address.join(',') }}</td>
</tr>
<tr>
<td>Reserved</td>
<td>[{{ data.peers[0].reserved.join(',') }}]</td>
<td colspan="2">
<v-text-field
v-model="data.ext.license_key"
label="License Key"
hide-details>
</v-text-field>
</td>
</tr>
</tbody>
</table>
<v-card :subtitle="$t('types.wg.peer')">
<table dir="ltr" width="100%">
<tbody>
<tr>
<td>{{ $t('out.addr') }}</td>
<td>{{ data.peers[0].address + ":" + data.peers[0].port }}</td>
</tr>
<tr>
<td>{{ $t('types.wg.pubKey') }}</td>
<td>{{ data.peers[0].public_key }}</td>
</tr>
<tr>
<td>{{ $t('types.wg.allowedIp') }}</td>
<td>{{ data.peers[0].allowed_ips.join(',') }}</td>
</tr>
<tr>
<td>Reserved</td>
<td>[{{ data.peers[0].reserved.join(',') }}]</td>
</tr>
</tbody>
</table>
</v-card>
</template>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/protocols/Wireguard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<v-col cols="12" sm="8">
<v-text-field
v-model="options.public_key"
disabled
readonly
:label="$t('tls.pubKey')"
append-icon="mdi-refresh"
@click:append="getWgPubKey()"
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/store/modules/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { defineStore } from 'pinia'
import { push } from 'notivue'
import { i18n } from '@/locales'
import { Inbound } from '@/types/inbounds'
import { Outbound } from '@/types/outbounds'
import { Endpoint } from '@/types/endpoints'
import { Client } from '@/types/clients'

const Data = defineStore('Data', {
Expand All @@ -15,8 +13,8 @@ const Data = defineStore('Data', {
onlines: {inbound: <string[]>[], outbound: <string[]>[], user: <string[]>[]},
config: <any>{},
inbounds: <any[]>[],
outbounds: <Outbound[]>[],
endpoints: <Endpoint[]>[],
outbounds: <any[]>[],
endpoints: <any[]>[],
clients: <any>[],
tlsConfigs: <any[]>[],
}),
Expand Down

0 comments on commit 891a61a

Please sign in to comment.