mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-09-04 02:41:14 +00:00
All AWG support work is done ;)
This commit is contained in:
@@ -145,49 +145,61 @@ watch(data, () => {
|
||||
id="configuration_listen_port">
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<label for="configuration_preup" class="form-label">
|
||||
<div v-for="key in ['PreUp', 'PreDown', 'PostUp', 'PostDown']">
|
||||
<label :for="'configuration_' + key" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="PreUp"></LocaleText>
|
||||
<LocaleText :t="key"></LocaleText>
|
||||
</small>
|
||||
</label>
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="data.PreUp"
|
||||
id="configuration_preup">
|
||||
v-model="data[key]"
|
||||
:id="'configuration_' + key">
|
||||
</div>
|
||||
<div>
|
||||
<label for="configuration_predown" class="form-label">
|
||||
<!-- <div>-->
|
||||
<!-- <label for="configuration_predown" class="form-label">-->
|
||||
<!-- <small class="text-muted">-->
|
||||
<!-- <LocaleText t="PreDown"></LocaleText>-->
|
||||
<!-- </small>-->
|
||||
<!-- </label>-->
|
||||
<!-- <input type="text" class="form-control form-control-sm rounded-3"-->
|
||||
<!-- :disabled="saving"-->
|
||||
<!-- v-model="data.PreDown"-->
|
||||
<!-- id="configuration_predown">-->
|
||||
<!-- </div>-->
|
||||
<!-- <div>-->
|
||||
<!-- <label for="configuration_postup" class="form-label">-->
|
||||
<!-- <small class="text-muted">-->
|
||||
<!-- <LocaleText t="PostUp"></LocaleText>-->
|
||||
<!-- </small>-->
|
||||
<!-- </label>-->
|
||||
<!-- <input type="text" class="form-control form-control-sm rounded-3"-->
|
||||
<!-- :disabled="saving"-->
|
||||
<!-- v-model="data.PostUp"-->
|
||||
<!-- id="configuration_postup">-->
|
||||
<!-- </div>-->
|
||||
<!-- <div>-->
|
||||
<!-- <label for="configuration_postdown" class="form-label">-->
|
||||
<!-- <small class="text-muted">-->
|
||||
<!-- <LocaleText t="PostDown"></LocaleText>-->
|
||||
<!-- </small>-->
|
||||
<!-- </label>-->
|
||||
<!-- <input type="text" class="form-control form-control-sm rounded-3"-->
|
||||
<!-- :disabled="saving"-->
|
||||
<!-- v-model="data.PostDown"-->
|
||||
<!-- id="configuration_postdown">-->
|
||||
<!-- </div>-->
|
||||
<div v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'H1', 'H2', 'H3', 'H4']"
|
||||
v-if="configurationInfo.Protocol === 'awg'">
|
||||
<label :for="'configuration_' + key" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="PreDown"></LocaleText>
|
||||
<LocaleText :t="key"></LocaleText>
|
||||
</small>
|
||||
</label>
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
<input type="number" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="data.PreDown"
|
||||
id="configuration_predown">
|
||||
</div>
|
||||
<div>
|
||||
<label for="configuration_postup" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="PostUp"></LocaleText>
|
||||
</small>
|
||||
</label>
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="data.PostUp"
|
||||
id="configuration_postup">
|
||||
</div>
|
||||
<div>
|
||||
<label for="configuration_postdown" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="PostDown"></LocaleText>
|
||||
</small>
|
||||
</label>
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="data.PostDown"
|
||||
id="configuration_postdown">
|
||||
v-model="data[key]"
|
||||
:id="'configuration_' + key">
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2 mt-4">
|
||||
<button class="btn bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3 shadow ms-auto"
|
||||
|
@@ -32,7 +32,16 @@ export default {
|
||||
PreDown: "",
|
||||
PostUp: "",
|
||||
PostDown: "",
|
||||
Protocol: "wg"
|
||||
Protocol: "wg",
|
||||
Jc: 5,
|
||||
Jmin: 49,
|
||||
Jmax: 998,
|
||||
S1: 17,
|
||||
S2: 110,
|
||||
H1: 0,
|
||||
H2: 0,
|
||||
H3: 0,
|
||||
H4: 0
|
||||
},
|
||||
numberOfAvailableIPs: "0",
|
||||
error: false,
|
||||
@@ -42,9 +51,20 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.wireguardGenerateKeypair();
|
||||
this.wireguardGenerateKeypair();
|
||||
let hValue = []
|
||||
while ([...new Set(hValue)].length !== 4){
|
||||
hValue = [this.rand(1, (2**31) - 1), this.rand(1, (2**31) - 1), this.rand(1, (2**31) - 1), this.rand(1, (2**31) - 1)]
|
||||
}
|
||||
this.newConfiguration.H1 = hValue[0]
|
||||
this.newConfiguration.H2 = hValue[1]
|
||||
this.newConfiguration.H3 = hValue[2]
|
||||
this.newConfiguration.H4 = hValue[3]
|
||||
},
|
||||
methods: {
|
||||
rand(min, max){
|
||||
return Math.floor(Math.random() * (max - min) + min);
|
||||
},
|
||||
wireguardGenerateKeypair(){
|
||||
const wg = window.wireguard.generateKeypair();
|
||||
this.newConfiguration.PrivateKey = wg.privateKey;
|
||||
@@ -293,24 +313,16 @@ export default {
|
||||
class="form-control font-monospace" :id="key" v-model="this.newConfiguration[key]">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="card rounded-3">-->
|
||||
<!-- <div class="card-header">PreDown</div>-->
|
||||
<!-- <div class="card-body">-->
|
||||
<!-- <input type="text" class="form-control" id="preDown" v-model="this.newConfiguration.PreDown">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="card rounded-3">-->
|
||||
<!-- <div class="card-header">PostUp</div>-->
|
||||
<!-- <div class="card-body">-->
|
||||
<!-- <input type="text" class="form-control" id="postUp" v-model="this.newConfiguration.PostUp">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="card rounded-3">-->
|
||||
<!-- <div class="card-header">PostDown</div>-->
|
||||
<!-- <div class="card-body">-->
|
||||
<!-- <input type="text" class="form-control" id="postDown" v-model="this.newConfiguration.PostDown">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="card rounded-3"
|
||||
v-if="this.newConfiguration.Protocol === 'awg'"
|
||||
v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'H1', 'H2', 'H3', 'H4']">
|
||||
<div class="card-header">{{ key }}</div>
|
||||
<div class="card-body">
|
||||
<input type="text"
|
||||
class="form-control font-monospace" :id="key" v-model="this.newConfiguration[key]">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user