Files
MIND/frontend/templates/admin.html
2024-03-03 23:19:04 +01:00

213 lines
9.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta id="url_prefix" data-value="{{url_prefix}}">
<link rel="manifest" href="{{ url_for('static', filename='json/manifest.json') }}">
<link rel="apple-touch-icon" href="{{ url_for('static', filename='img/favicon.svg') }}">
<meta name="apple-mobile-web-app-status-bar" content="#6b6b6b">
<meta name="theme-color" content="#6b6b6b">
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.svg') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ url_for('static', filename='css/general.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/admin.css') }}">
<script src="{{ url_for('static', filename='js/general.js') }}" defer></script>
<script src="{{ url_for('static', filename='js/admin.js') }}" defer></script>
<title>Admin - MIND</title>
</head>
<body>
<header>
<img src="{{ url_for('static', filename='img/favicon.svg') }}" alt="">
</header>
<main>
<section class="action-buttons">
<button id="save-button" title="Save Settings" type="submit" form="settings-form">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="512" height="512">
<path d="M12,10a4,4,0,1,0,4,4A4,4,0,0,0,12,10Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,12,16Z"/>
<path d="M22.536,4.122,19.878,1.464A4.966,4.966,0,0,0,16.343,0H5A5.006,5.006,0,0,0,0,5V19a5.006,5.006,0,0,0,5,5H19a5.006,5.006,0,0,0,5-5V7.657A4.966,4.966,0,0,0,22.536,4.122ZM17,2.08V3a3,3,0,0,1-3,3H10A3,3,0,0,1,7,3V2h9.343A2.953,2.953,0,0,1,17,2.08ZM22,19a3,3,0,0,1-3,3H5a3,3,0,0,1-3-3V5A3,3,0,0,1,5,2V3a5.006,5.006,0,0,0,5,5h4a4.991,4.991,0,0,0,4.962-4.624l2.16,2.16A3.02,3.02,0,0,1,22,7.657Z"/>
</svg>
</button>
<button id="logout-button" aria-label="Log out of MIND" title="Logout">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="256" height="256" x="0" y="0" viewBox="0 0 24 24" style="enable-background:new 0 0 512 512" xml:space="preserve">
<g>
<path d="M11.476,15a1,1,0,0,0-1,1v3a3,3,0,0,1-3,3H5a3,3,0,0,1-3-3V5A3,3,0,0,1,5,2H7.476a3,3,0,0,1,3,3V8a1,1,0,0,0,2,0V5a5.006,5.006,0,0,0-5-5H5A5.006,5.006,0,0,0,0,5V19a5.006,5.006,0,0,0,5,5H7.476a5.006,5.006,0,0,0,5-5V16A1,1,0,0,0,11.476,15Z"></path>
<path d="M22.867,9.879,18.281,5.293a1,1,0,1,0-1.414,1.414l4.262,4.263L6,11a1,1,0,0,0,0,2H6l15.188-.031-4.323,4.324a1,1,0,1,0,1.414,1.414l4.586-4.586A3,3,0,0,0,22.867,9.879Z"></path>
</g>
</svg>
</button>
</section>
<div class="form-container">
<form id="settings-form">
<h2>Authentication</h2>
<div class="settings-table-container">
<table class="settings-table">
<tbody>
<tr>
<td><label for="allow-new-accounts-input">Allow New Accounts</label></td>
<td>
<input type="checkbox" id="allow-new-accounts-input">
<p>Allow users to register a new account. The admin can always add a new account from this panel.</p>
</td>
</tr>
<tr>
<td><label for="login-time-input">Login Time</label></td>
<td>
<div class="number-input">
<input type="number" id="login-time-input" min="1" max="43200" required>
<p>Min</p>
</div>
<p>For how long users stay logged in before having to authenticate again. Between 1 minute and 1 month.</p>
<p>New values are applied for newly authenticated users.</p>
</td>
</tr>
<tr>
<td><label for="login-time-reset-input">Login Time Trigger</label></td>
<td>
<select id="login-time-reset-input">
<option value="true">After Last Use</option>
<option value="false">After Login</option>
</select>
<p>For when the login timer should start: starting from the last time MIND was used or from when the user has authenticated.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Logging</h2>
<div class="settings-table-container">
<table class="settings-table">
<tbody>
<tr>
<td><label for="log-level-input">Logging Level</label></td>
<td>
<select id="log-level-input">
<option value="20">Info</option>
<option value="10">Debug</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<div class="database-container">
<button id="download-logs-button" type="button">Download Debug Logs</button>
</div>
</form>
<form id="hosting-form">
<h2>Hosting</h2>
<div class="settings-table-container">
<table class="settings-table">
<tbody>
<tr>
<td><label for="host-input">Host</label></td>
<td>
<input type="text" id="host-input" required>
<p>Valid IPv4 address (default is '0.0.0.0' for all available interfaces).</p>
</td>
</tr>
<tr>
<td><label for="port-input">Port</label></td>
<td>
<input type="number" id="port-input" min="1" max="65535" required>
<p>The port used to access the web UI (default is '8080').</p>
</td>
</tr>
<tr>
<td><label for="url-prefix-input">URL Prefix</label></td>
<td>
<input type="text" id="url-prefix-input">
<p>For reverse proxy support (default is empty).</p>
</td>
</tr>
</tbody>
</table>
<button type="submit" id="save-hosting-button">Save and Restart</button>
</div>
<p>IMPORTANT: After saving the hosting settings, it is required to log into the admin panel within 1 minute (60 seconds) in order to keep the new hosting settings. Otherwise, MIND will revert the changes and go back to the old hosting settings.</p>
</form>
<h2>User Management</h2>
<div class="add-user-container">
<button id="add-user-button">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="256" height="256" x="0" y="0" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512" xml:space="preserve">
<g>
<g>
<path d="M480,224H288V32c0-17.673-14.327-32-32-32s-32,14.327-32,32v192H32c-17.673,0-32,14.327-32,32s14.327,32,32,32h192v192 c0,17.673,14.327,32,32,32s32-14.327,32-32V288h192c17.673,0,32-14.327,32-32S497.673,224,480,224z"></path>
</g>
</g>
</svg>
</button>
</div>
<div class="user-table-container">
<form id="add-user-form"></form>
<table id="user-table">
<thead>
<th>User</th>
<th></th>
<th>Actions</th>
</thead>
<tbody id="add-user-row" class="hidden">
<tr>
<td>
<input type="text" id="new-username-input" form="add-user-form" placeholder="Username" required>
</td>
<td>
<input type="password" id="new-password-input" form="add-user-form" placeholder="Password" required>
</td>
<td>
<button type="submit" form="add-user-form">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="256" height="256" x="0" y="0" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512" xml:space="preserve">
<g>
<g>
<path d="M480,224H288V32c0-17.673-14.327-32-32-32s-32,14.327-32,32v192H32c-17.673,0-32,14.327-32,32s14.327,32,32,32h192v192 c0,17.673,14.327,32,32,32s32-14.327,32-32V288h192c17.673,0,32-14.327,32-32S497.673,224,480,224z"></path>
</g>
</g>
</svg>
</button>
</td>
</tr>
</tbody>
<tbody id="user-list">
</tbody>
</table>
</div>
<h2>Database</h2>
<div class="database-container">
<button id="download-db-button">Download Database</button>
</div>
<form id="upload-database-form">
<div class="settings-table-container">
<table class="settings-table">
<tbody>
<tr>
<td><label for="database-file-input">Database File</label></td>
<td><input type="file" id="database-file-input" required></td>
</tr>
<tr>
<td><label for="copy-hosting-input">Keep Hosting Settings</label></td>
<td>
<input type="checkbox" id="copy-hosting-input">
<p>Keep the current hosting settings instead of using the settings in the uploaded database.</p>
</td>
</tr>
</tbody>
</table>
</div>
<button type="submit" id="upload-db-button">Import Database</button>
<p>Restore a backup.</p>
<p>Note: The uploaded file can be denied if it is not a valid database file, is too old or is for a newer version than this MIND instance.</p>
<p>IMPORTANT: After uploading the backup, it is required to log into the admin panel within 1 minute (60 seconds) in order to keep the new database file. Otherwise, MIND will revert the upload and go back to the old database.</p>
</form>
<h2>Power</h2>
<div class="database-container">
<button id="restart-button">Restart</button>
<button id="shutdown-button">Shutdown</button>
</div>
</div>
</main>
</body>
</html>