Files
CDN-APP-INSIDER/views/setup.ejs
Dinawo 8a12843880
All checks were successful
continuous-integration/drone/push Build is passing
Update button text in setup.ejs
2024-03-29 09:22:53 +01:00

249 lines
8.9 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
<link rel="stylesheet" href="/public/css/login.css">
<title>Setup CDN</title>
<link rel="icon" href="/public/assets/homelab_logo.png" />
<style>
.custom-btn {
transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
color: #007BFF;
background-color: transparent;
padding: 5px 10px;
text-decoration: none;
display: inline-block;
font-size: 14px;
margin: 4px 2px;
border-radius: 50px;
cursor: pointer;
box-shadow: 0 2px 5px rgba(0,0,0,0.25);
border: 2px solid #007BFF;
}
.custom-btn:hover {
transform: scale(1.15);
background-color: #007BFF;
color: #fff;
}
input[type="text"] {
width: 100%;
padding: 5px 15px;
margin: 8px 0;
box-sizing: border-box;
border: none;
border-bottom: 2px solid #007BFF;
border-radius: 4px;
}
input[type="text"]:focus {
border-bottom: 2px solid #555;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
</style>
</head>
<body class="light-mode animate">
<div class="container mt-4 table-container animate">
<h2 class="text-center">Gestion de la configuration</h2><br>
<div class="table-responsive">
<form action="/setup/save" method="POST">
<table class="table w-100">
<thead>
<tr>
<th>Paramètre</th>
<th>Valeur</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2"><h2>LDAP Settings</h2></td>
</tr>
<tr>
<td>Activer LDAP:</td>
<td>
<label class="switch">
<input type="checkbox" name="ldap[enabled]" <%= setup.ldap ? 'checked' : '' %>
onchange="toggleForm('ldapForm', this)">
<span class="slider round"></span>
</label>
</td>
</tr>
<tbody id="ldapForm" style="display: block">
<tr>
<td>URL:</td>
<td><input type="text" name="ldap[url]" value="<%= setup.ldap ? setup.ldap.url : '' %>"></td>
</tr>
<tr>
<td>Base DN:</td>
<td><input type="text" name="ldap[baseDN]" value="<%= setup.ldap ? setup.ldap.baseDN : '' %>"></td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="ldap[username]" value="<%= setup.ldap ? setup.ldap.username : '' %>"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="text" name="ldap[password]" value="<%= setup.ldap ? setup.ldap.password : '' %>"></td>
</tr>
</tbody>
<tr>
<td colspan="2"><h2>Discord Settings</h2></td>
</tr>
<tr>
<td>Activer Discord:</td>
<td>
<label class="switch">
<input type="checkbox" name="discord[enabled]" <%= setup.discord ? 'checked' : '' %>
onchange="toggleForm('discordForm', this)">
<span class="slider round"></span>
</label>
</td>
</tr>
<tbody id="discordForm" style="display: block">
<tr>
<td>Client ID:</td>
<td><input type="text" name="discord[clientID]" value="<%= setup.discord ? setup.discord.clientID : '' %>"></td>
</tr>
<tr>
<td>Client Secret:</td>
<td><input type="text" name="discord[clientSecret]" value="<%= setup.discord ? setup.discord.clientSecret : '' %>"></td>
</tr>
<tr>
<td>Identify URL:</td>
<td><input type="text" name="discord[identifyURL]" value="<%= setup.discord ? setup.discord.identifyURL : '' %>"></td>
</tr>
<tr>
<td>Authorized IDs:</td>
<td><input type="text" name="discord[authorizedIDs]" value="<%= setup.discord ? setup.discord.authorizedIDs : '' %>">
</td>
</tr>
</tbody>
<tr>
<td colspan="2"><h2>Other Settings</h2></td>
</tr>
<tr>
<td>Domain:</td>
<td><input type="text" name="domain" value="<%= setup.domain %>"></td>
</tr>
<tr>
<td>Uptime:</td>
<td><input type="text" name="uptime" value="<%= setup.uptime %>"></td>
</tr>
</tbody>
</table>
<div class="text-center">
<button type="submit" class="btn btn-primary custom-btn">Enregistrer</button>
</div>
</form>
</div>
<div class="d-flex justify-content-center animate">
<button id="themeSwitcher" class="btn btn-warning mt-3 animate ">Changer de Thème</button>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script>
const body = document.body;
document.getElementById('themeSwitcher').addEventListener('click', function () {
if (body.classList.contains('dark-mode')) {
body.classList.remove('dark-mode');
body.classList.add('light-mode');
} else {
body.classList.remove('light-mode');
body.classList.add('dark-mode');
}
});
document.addEventListener('DOMContentLoaded', function () {
const darkModeSwitch = document.getElementById('darkModeSwitch');
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
body.classList.toggle('dark-mode', darkModeMediaQuery.matches);
darkModeMediaQuery.addListener(function (e) {
body.classList.toggle('dark-mode', e.matches);
});
});
function toggleForm(formId, checkbox) {
const form = document.getElementById(formId);
form.style.display = checkbox.checked ? 'block' : 'none';
}
</script>
</body>
</html>