mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-02 23:36:17 +00:00
Added toggle for client side app
This commit is contained in:
@@ -45,6 +45,9 @@ def createClientBlueprint(wireguardConfigurations: dict[WireguardConfiguration],
|
|||||||
|
|
||||||
@client.before_request
|
@client.before_request
|
||||||
def clientBeforeRequest():
|
def clientBeforeRequest():
|
||||||
|
if not dashboardConfig.GetConfig("Clients", "enable")[1]:
|
||||||
|
abort(404)
|
||||||
|
|
||||||
if request.method.lower() == 'options':
|
if request.method.lower() == 'options':
|
||||||
return ResponseObject(True)
|
return ResponseObject(True)
|
||||||
|
|
||||||
|
@@ -1342,6 +1342,14 @@ def API_OIDC_Status():
|
|||||||
'''
|
'''
|
||||||
Client Controller
|
Client Controller
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@app.get(f'{APP_PREFIX}/api/clients/toggleStatus')
|
||||||
|
def API_Clients_ToggleStatus():
|
||||||
|
DashboardConfig.SetConfig("Clients", "enable",
|
||||||
|
not DashboardConfig.GetConfig("Clients", "enable")[1])
|
||||||
|
return ResponseObject(data=DashboardConfig.GetConfig("Clients", "enable")[1])
|
||||||
|
|
||||||
|
|
||||||
@app.get(f'{APP_PREFIX}/api/clients/allClients')
|
@app.get(f'{APP_PREFIX}/api/clients/allClients')
|
||||||
def API_Clients_AllClients():
|
def API_Clients_AllClients():
|
||||||
return ResponseObject(data=DashboardClients.GetAllClients())
|
return ResponseObject(data=DashboardClients.GetAllClients())
|
||||||
|
@@ -81,7 +81,7 @@ class DashboardConfig:
|
|||||||
"client_enable": "false"
|
"client_enable": "false"
|
||||||
},
|
},
|
||||||
"Clients": {
|
"Clients": {
|
||||||
"allow_local_sign_up": "true"
|
"enable": "true",
|
||||||
},
|
},
|
||||||
"WireGuardConfiguration": {
|
"WireGuardConfiguration": {
|
||||||
"autostart": ""
|
"autostart": ""
|
||||||
|
@@ -8,13 +8,13 @@
|
|||||||
"short_name": "WGDashboard",
|
"short_name": "WGDashboard",
|
||||||
"screenshots": [
|
"screenshots": [
|
||||||
{
|
{
|
||||||
"src": "https://donaldzou.github.io/WGDashboard-Documentation/images/sign-in.png",
|
"src": "https://wgdashboard-resources.tor1.cdn.digitaloceanspaces.com/Documentation%20Images/sign-in.png",
|
||||||
"sizes": "2880x1826",
|
"sizes": "2880x1826",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"form_factor": "wide"
|
"form_factor": "wide"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "https://donaldzou.github.io/WGDashboard-Documentation/images/sign-in.png",
|
"src": "https://wgdashboard-resources.tor1.cdn.digitaloceanspaces.com/Documentation%20Images/index.png",
|
||||||
"sizes": "2880x1826",
|
"sizes": "2880x1826",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
|
@@ -2,13 +2,23 @@
|
|||||||
import { ref, reactive } from "vue"
|
import { ref, reactive } from "vue"
|
||||||
import LocaleText from "@/components/text/localeText.vue";
|
import LocaleText from "@/components/text/localeText.vue";
|
||||||
import OidcSettings from "@/components/clientComponents/clientSettingComponents/oidcSettings.vue";
|
import OidcSettings from "@/components/clientComponents/clientSettingComponents/oidcSettings.vue";
|
||||||
|
import { fetchGet } from "@/utilities/fetch.js"
|
||||||
const emits = defineEmits(['close'])
|
const emits = defineEmits(['close'])
|
||||||
import { DashboardConfigurationStore } from "@/stores/DashboardConfigurationStore"
|
import { DashboardConfigurationStore } from "@/stores/DashboardConfigurationStore"
|
||||||
const dashboardConfigurationStore = DashboardConfigurationStore()
|
const dashboardConfigurationStore = DashboardConfigurationStore()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const values = reactive({
|
const values = reactive({
|
||||||
allow_local_sign_up: dashboardConfigurationStore.Configuration.Clients.allow_local_sign_up
|
enableClients: dashboardConfigurationStore.Configuration.Clients.enable
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const toggling = ref(false)
|
||||||
|
const toggleClientSideApp = async () => {
|
||||||
|
toggling.value = true
|
||||||
|
await fetchGet("/api/clients/toggleStatus", {}, (res) => {
|
||||||
|
values.enableClients = res.data
|
||||||
|
})
|
||||||
|
toggling.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -20,27 +30,23 @@ const values = reactive({
|
|||||||
</h4>
|
</h4>
|
||||||
<button type="button" class="btn-close ms-auto" @click="emits('close')"></button>
|
<button type="button" class="btn-close ms-auto" @click="emits('close')"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body px-4">
|
<div class="card-body px-4 d-flex gap-3 flex-column">
|
||||||
<div class="py-2">
|
<div class="d-flex align-items-center">
|
||||||
<OidcSettings mode="Client"></OidcSettings>
|
<h6 class="mb-0">
|
||||||
<!-- <hr>-->
|
<LocaleText t="Client Side App"></LocaleText>
|
||||||
<!-- <div>-->
|
</h6>
|
||||||
<!-- <div class="d-flex">-->
|
<div class="form-check form-switch ms-auto">
|
||||||
<!-- <h6 class="mb-0">-->
|
<label class="form-check-label" for="oidc_switch">
|
||||||
<!-- <LocaleText t="Allow Local Accounts Sign Up"></LocaleText>-->
|
<LocaleText :t="values.enableClients ? 'Enabled':'Disabled'"></LocaleText>
|
||||||
<!-- </h6>-->
|
</label>
|
||||||
<!-- <div class="form-check form-switch ms-auto">-->
|
<input
|
||||||
<!-- <label class="form-check-label" for="allow_local_sign_up">-->
|
:disabled="oidcStatusLoading"
|
||||||
<!-- <LocaleText :t="values.allow_local_sign_up ? 'Enabled':'Disabled'"></LocaleText>-->
|
v-model="values.enableClients"
|
||||||
<!-- </label>-->
|
@change="toggleClientSideApp()"
|
||||||
<!-- <input-->
|
class="form-check-input" type="checkbox" role="switch" id="oidc_switch">
|
||||||
<!-- :disabled="loading"-->
|
</div>
|
||||||
<!-- v-model="values.allow_local_sign_up"-->
|
|
||||||
<!-- class="form-check-input" type="checkbox" role="switch" id="allow_local_sign_up">-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</div>
|
</div>
|
||||||
|
<OidcSettings mode="Client"></OidcSettings>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -115,8 +115,8 @@ const deleteSuccess = async () => {
|
|||||||
@refresh="getAssignedPeers()"
|
@refresh="getAssignedPeers()"
|
||||||
:clientAssignedPeers="clientAssignedPeers"
|
:clientAssignedPeers="clientAssignedPeers"
|
||||||
:client="client"></ClientAssignedPeers>
|
:client="client"></ClientAssignedPeers>
|
||||||
<ClientResetPassword
|
<!-- <ClientResetPassword-->
|
||||||
:client="client" v-if="client.ClientGroup === 'Local'"></ClientResetPassword>
|
<!-- :client="client" v-if="client.ClientGroup === 'Local'"></ClientResetPassword>-->
|
||||||
<ClientDelete
|
<ClientDelete
|
||||||
@deleteSuccess="deleteSuccess()"
|
@deleteSuccess="deleteSuccess()"
|
||||||
:client="client"></ClientDelete>
|
:client="client"></ClientDelete>
|
||||||
|
Reference in New Issue
Block a user