mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Fixed issue #352
Fixed issue when allowed_ips have more than 1 IP Address, allow access will crash
This commit is contained in:
parent
2cb06bb4bb
commit
71349f35e4
@ -697,7 +697,7 @@ class WireguardConfiguration:
|
|||||||
with open(f"{uid}", "w+") as f:
|
with open(f"{uid}", "w+") as f:
|
||||||
f.write(p['preshared_key'])
|
f.write(p['preshared_key'])
|
||||||
|
|
||||||
subprocess.check_output(f"wg set {self.Name} peer {p['id']} allowed-ips {p['allowed_ip']}{f' preshared-key {uid}' if presharedKeyExist else ''}",
|
subprocess.check_output(f"wg set {self.Name} peer {p['id']} allowed-ips {p['allowed_ip'].replace(' ', '')}{f' preshared-key {uid}' if presharedKeyExist else ''}",
|
||||||
shell=True, stderr=subprocess.STDOUT)
|
shell=True, stderr=subprocess.STDOUT)
|
||||||
if presharedKeyExist: os.remove(str(uid))
|
if presharedKeyExist: os.remove(str(uid))
|
||||||
else:
|
else:
|
||||||
|
4
src/static/app/dist/assets/index.css
vendored
4
src/static/app/dist/assets/index.css
vendored
File diff suppressed because one or more lines are too long
54
src/static/app/dist/assets/index.js
vendored
54
src/static/app/dist/assets/index.js
vendored
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build && git commit -a",
|
"build": "vite build && git commit -a && git push",
|
||||||
"build electron": "vite build && vite build --mode electron && cd ../../../../WGDashboard-Desktop && electron-builder --mac --win",
|
"build electron": "vite build && vite build --mode electron && cd ../../../../WGDashboard-Desktop && electron-builder --mac --win",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
|
@ -111,7 +111,7 @@ export default {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.slide-fade-leave-active, .slide-fade-enter-active{
|
.slide-fade-leave-active, .slide-fade-enter-active{
|
||||||
transition: all 0.2s cubic-bezier(0.82, 0.58, 0.17, 0.9);
|
transition: all 0.2s cubic-bezier(0.82, 0.58, 0.17, 1.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.slide-fade-enter-from,
|
.slide-fade-enter-from,
|
||||||
|
@ -18,6 +18,7 @@ export default {
|
|||||||
deleteBtnDisabled: false,
|
deleteBtnDisabled: false,
|
||||||
restrictBtnDisabled: false,
|
restrictBtnDisabled: false,
|
||||||
allowAccessBtnDisabled: false,
|
allowAccessBtnDisabled: false,
|
||||||
|
confirmDelete: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -88,80 +89,98 @@ export default {
|
|||||||
<ul class="dropdown-menu mt-2 shadow-lg d-block rounded-3" style="max-width: 200px">
|
<ul class="dropdown-menu mt-2 shadow-lg d-block rounded-3" style="max-width: 200px">
|
||||||
|
|
||||||
<template v-if="!this.Peer.restricted">
|
<template v-if="!this.Peer.restricted">
|
||||||
|
<template v-if="!this.confirmDelete">
|
||||||
<template v-if="this.Peer.status === 'running'">
|
<template v-if="this.Peer.status === 'running'">
|
||||||
<li style="font-size: 0.8rem; padding-left: var(--bs-dropdown-item-padding-x); padding-right: var(--bs-dropdown-item-padding-x);">
|
<li style="font-size: 0.8rem; padding-left: var(--bs-dropdown-item-padding-x); padding-right: var(--bs-dropdown-item-padding-x);">
|
||||||
<span class="text-body d-flex">
|
<span class="text-body d-flex">
|
||||||
<i class="bi bi-box-arrow-in-right"></i>
|
<i class="bi bi-box-arrow-in-right"></i>
|
||||||
<span class="ms-auto">
|
<span class="ms-auto">
|
||||||
{{this.Peer.endpoint}}
|
{{this.Peer.endpoint}}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
</li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
</template>
|
||||||
|
<template v-if="!this.Peer.private_key">
|
||||||
|
<li>
|
||||||
|
<small class="w-100 dropdown-item text-muted"
|
||||||
|
style="white-space: break-spaces; font-size: 0.7rem">
|
||||||
|
<LocaleText t="Download & QR Code is not available due to no private key set for this peer"></LocaleText>
|
||||||
|
</small>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<li class="d-flex" style="padding-left: var(--bs-dropdown-item-padding-x); padding-right: var(--bs-dropdown-item-padding-x);">
|
||||||
|
<a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.downloadPeer()">
|
||||||
|
<i class="me-auto bi bi-download"></i>
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item text-center px-0 rounded-3" role="button"
|
||||||
|
@click="this.downloadQRCode()">
|
||||||
|
<i class="me-auto bi bi-qr-code"></i>
|
||||||
|
</a>
|
||||||
|
<a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.$emit('share')">
|
||||||
|
<i class="me-auto bi bi-share"></i>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item d-flex" role="button"
|
||||||
|
@click="this.$emit('setting')"
|
||||||
|
>
|
||||||
|
<i class="me-auto bi bi-pen"></i> <LocaleText t="Peer Settings"></LocaleText>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item d-flex" role="button"
|
||||||
|
@click="this.$emit('jobs')"
|
||||||
|
>
|
||||||
|
<i class="me-auto bi bi-app-indicator"></i> <LocaleText t="Schedule Jobs"></LocaleText>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><hr class="dropdown-divider"></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
</template>
|
|
||||||
<template v-if="!this.Peer.private_key">
|
|
||||||
<li>
|
<li>
|
||||||
<small class="w-100 dropdown-item text-muted"
|
<a class="dropdown-item d-flex text-warning"
|
||||||
style="white-space: break-spaces; font-size: 0.7rem">
|
@click="this.restrictPeer()"
|
||||||
<LocaleText t="Download & QR Code is not available due to no private key set for this peer"></LocaleText>
|
:class="{disabled: this.restrictBtnDisabled}"
|
||||||
</small>
|
role="button">
|
||||||
</li>
|
<i class="me-auto bi bi-lock"></i>
|
||||||
|
<LocaleText t="Restrict Access" v-if="!this.restrictBtnDisabled"></LocaleText>
|
||||||
|
<LocaleText t="Restricting..." v-else></LocaleText>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item d-flex fw-bold text-danger"
|
||||||
|
@click="this.confirmDelete = true"
|
||||||
|
:class="{disabled: this.deleteBtnDisabled}"
|
||||||
|
role="button">
|
||||||
|
<i class="me-auto bi bi-trash"></i>
|
||||||
|
<LocaleText t="Delete" v-if="!this.deleteBtnDisabled"></LocaleText>
|
||||||
|
<LocaleText t="Deleting..." v-else></LocaleText>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<li class="d-flex" style="padding-left: var(--bs-dropdown-item-padding-x); padding-right: var(--bs-dropdown-item-padding-x);">
|
<li class="confirmDelete">
|
||||||
<a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.downloadPeer()">
|
<small style="white-space: break-spaces" class="mb-2 d-block fw-bold">Are you sure to delete this peer?</small>
|
||||||
<i class="me-auto bi bi-download"></i>
|
<div class="d-flex w-100 gap-2">
|
||||||
</a>
|
<button
|
||||||
<a class="dropdown-item text-center px-0 rounded-3" role="button"
|
:disabled="this.deleteBtnDisabled"
|
||||||
@click="this.downloadQRCode()">
|
@click="this.confirmDelete = false"
|
||||||
<i class="me-auto bi bi-qr-code"></i>
|
class="flex-grow-1 btn btn-sm bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle">
|
||||||
</a>
|
<LocaleText t="No"></LocaleText>
|
||||||
<a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.$emit('share')">
|
</button>
|
||||||
<i class="me-auto bi bi-share"></i>
|
<button
|
||||||
</a>
|
@click="this.deletePeer()"
|
||||||
|
:disabled="this.deleteBtnDisabled"
|
||||||
|
class="flex-grow-1 ms-auto btn btn-sm bg-danger">
|
||||||
|
<LocaleText t="Yes"></LocaleText>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
<li><hr class="dropdown-divider"></li>
|
|
||||||
<li>
|
|
||||||
<a class="dropdown-item d-flex" role="button"
|
|
||||||
@click="this.$emit('setting')"
|
|
||||||
>
|
|
||||||
<i class="me-auto bi bi-pen"></i> <LocaleText t="Peer Settings"></LocaleText>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="dropdown-item d-flex" role="button"
|
|
||||||
@click="this.$emit('jobs')"
|
|
||||||
>
|
|
||||||
<i class="me-auto bi bi-app-indicator"></i> <LocaleText t="Schedule Jobs"></LocaleText>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
|
|
||||||
<li><hr class="dropdown-divider"></li>
|
|
||||||
<li>
|
|
||||||
<a class="dropdown-item d-flex text-warning"
|
|
||||||
@click="this.restrictPeer()"
|
|
||||||
:class="{disabled: this.restrictBtnDisabled}"
|
|
||||||
role="button">
|
|
||||||
<i class="me-auto bi bi-lock"></i>
|
|
||||||
<LocaleText t="Restrict Access" v-if="!this.restrictBtnDisabled"></LocaleText>
|
|
||||||
<LocaleText t="Restricting..." v-else></LocaleText>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="dropdown-item d-flex fw-bold text-danger"
|
|
||||||
@click="this.deletePeer()"
|
|
||||||
:class="{disabled: this.deleteBtnDisabled}"
|
|
||||||
role="button">
|
|
||||||
<i class="me-auto bi bi-trash"></i>
|
|
||||||
<LocaleText t="Delete" v-if="!this.deleteBtnDisabled"></LocaleText>
|
|
||||||
<LocaleText t="Deleting..." v-else></LocaleText>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<li>
|
<li>
|
||||||
@ -172,7 +191,6 @@ export default {
|
|||||||
<i class="me-auto bi bi-unlock"></i>
|
<i class="me-auto bi bi-unlock"></i>
|
||||||
<LocaleText t="Allow Access" v-if="!this.allowAccessBtnDisabled"></LocaleText>
|
<LocaleText t="Allow Access" v-if="!this.allowAccessBtnDisabled"></LocaleText>
|
||||||
<LocaleText t="Allowing Access..." v-else></LocaleText>
|
<LocaleText t="Allowing Access..." v-else></LocaleText>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
@ -188,4 +206,8 @@ export default {
|
|||||||
.dropdown-item.disabled, .dropdown-item:disabled{
|
.dropdown-item.disabled, .dropdown-item:disabled{
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.confirmDelete{
|
||||||
|
padding: var(--bs-dropdown-item-padding-y) var(--bs-dropdown-item-padding-x);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -1051,17 +1051,17 @@ pre.index-alert {
|
|||||||
|
|
||||||
.fade2-enter-active,
|
.fade2-enter-active,
|
||||||
.fade2-leave-active {
|
.fade2-leave-active {
|
||||||
transition: all 0.2s cubic-bezier(0.82, 0.58, 0.17, 0.9);
|
transition: all 0.3s cubic-bezier(0.82, 0.58, 0.17, 1.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade2-enter-from{
|
.fade2-enter-from{
|
||||||
transform: translateY(30px);
|
transform: translateY(-30px);
|
||||||
filter: blur(3px);
|
/*filter: blur(3px);*/
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade2-leave-to {
|
.fade2-leave-to {
|
||||||
transform: translateY(-30px);
|
transform: translateY(30px);
|
||||||
filter: blur(3px);
|
filter: blur(3px);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user