Переглянути джерело

disabled UI placeholders. working NO_AUTH.

lllllllillllllillll 1 рік тому
батько
коміт
935cf1e995
4 змінених файлів з 163 додано та 89 видалено
  1. 16 1
      controllers/account.js
  2. 1 1
      views/account.html
  3. 2 2
      views/partials/navbar.html
  4. 144 85
      views/settings.html

+ 16 - 1
controllers/account.js

@@ -1,8 +1,23 @@
 import { User } from "../database/models.js";
 import { User } from "../database/models.js";
 
 
+const no_auth = process.env.NO_AUTH || false;
+
 export const Account = async (req, res) => {
 export const Account = async (req, res) => {
     
     
-
+    if (no_auth && req.hostname == 'localhost') { 
+        res.render("account", {
+            first_name: 'Localhost',
+            last_name: 'Localhost',
+            name: 'Localhost',
+            id: 0,
+            email: 'admin@localhost',
+            role: 'admin',
+            avatar: 'L',
+            alert: '',
+        });
+        return;
+    }
+    
     let user = await User.findOne({ where: { UUID: req.session.UUID }});
     let user = await User.findOne({ where: { UUID: req.session.UUID }});
 
 
     res.render("account", {
     res.render("account", {

+ 1 - 1
views/account.html

@@ -29,7 +29,7 @@
 						<div class="row g-2 align-items-center">
 						<div class="row g-2 align-items-center">
 						<div class="col">
 						<div class="col">
 							<h2 class="page-title">
 							<h2 class="page-title">
-							Settings
+							Account
 							</h2>
 							</h2>
 						</div>
 						</div>
 						</div>
 						</div>

+ 2 - 2
views/partials/navbar.html

@@ -103,7 +103,7 @@
         </button>
         </button>
 
 
         <div class="nav-item dropdown d-none d-md-flex me-2">
         <div class="nav-item dropdown d-none d-md-flex me-2">
-          <a href="#" class="nav-link px-0" data-bs-toggle="dropdown" tabindex="-1" aria-label="Show notifications">
+          <a href="#" class="nav-link px-0 text-muted" data-bs-toggle="dropdown" tabindex="-1" aria-label="Show notifications"  disabled>
             <!-- Download SVG icon from http://tabler-icons.io/i/bell -->
             <!-- Download SVG icon from http://tabler-icons.io/i/bell -->
             <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" /> <path d="M9 17v1a3 3 0 0 0 6 0v-1" /> </svg>
             <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" /> <path d="M9 17v1a3 3 0 0 0 6 0v-1" /> </svg>
             <!-- <span class="badge bg-red"></span> -->
             <!-- <span class="badge bg-red"></span> -->
@@ -282,7 +282,7 @@
               <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="1.5"  stroke-linecap="round"  stroke-linejoin="round"  class="icon-tabler icons-tabler-outline icon-tabler-layout-grid"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M14 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M14 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /></svg>
               <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="1.5"  stroke-linecap="round"  stroke-linejoin="round"  class="icon-tabler icons-tabler-outline icon-tabler-layout-grid"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M14 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /><path d="M14 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" /></svg>
             </button>
             </button>
             <button class="btn-action" title="List View" data-hx-post="/dashboard/view" data-hx-trigger="mousedown" data-hx-target="#" name="list" id="AppState">
             <button class="btn-action" title="List View" data-hx-post="/dashboard/view" data-hx-trigger="mousedown" data-hx-target="#" name="list" id="AppState">
-              <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="1.5"  stroke-linecap="round"  stroke-linejoin="round"  class="icon-tabler icons-tabler-outline icon-tabler-list"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l11 0" /><path d="M9 12l11 0" /><path d="M9 18l11 0" /><path d="M5 6l0 .01" /><path d="M5 12l0 .01" /><path d="M5 18l0 .01" /></svg>
+              <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="1.5"  stroke-linecap="round"  stroke-linejoin="round"  class="icon-tabler icons-tabler-outline icon-tabler-layout-grid"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l11 0" /><path d="M9 12l11 0" /><path d="M9 18l11 0" /><path d="M5 6l0 .01" /><path d="M5 12l0 .01" /><path d="M5 18l0 .01" /></svg>
             </button>
             </button>
             <div class="dropdown">
             <div class="dropdown">
               <a href="#" class="btn-action dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
               <a href="#" class="btn-action dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

+ 144 - 85
views/settings.html

@@ -8,114 +8,173 @@
 		<!-- CSS files -->
 		<!-- CSS files -->
 		<link href="/css/tabler.min.css" rel="stylesheet"/>
 		<link href="/css/tabler.min.css" rel="stylesheet"/>
 		<script src="/js/htmx.min.js"></script>
 		<script src="/js/htmx.min.js"></script>
+
 		<style>
 		<style>
 			@import url('/fonts/inter.css');
 			@import url('/fonts/inter.css');
 			:root {
 			:root {
-				--tblr-font-sans-serif: 'Inter Var', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
+			  --tblr-font-sans-serif: 'Inter Var', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
 			}
 			}
 			body {
 			body {
-				font-feature-settings: "cv03", "cv04", "cv11";
+			  font-feature-settings: "cv03", "cv04", "cv11";
 			}
 			}
-		</style>
+		  </style>
 	</head>
 	</head>
 	<body >
 	<body >
 		<div class="page">
 		<div class="page">
-		<!-- Navbar -->
-		<%- include('partials/navbar.html') %>
-		<div class="page-wrapper">
-			<!-- Page header -->
-			<div class="page-header d-print-none">
-			<div class="container-xl">
-				<div class="row g-2 align-items-center">
-				<div class="col">
-					<h2 class="page-title">
-					Settings
-					</h2>
-				</div>
+			<!-- Navbar -->
+			<%- include('partials/navbar.html') %>
+			<div class="page-wrapper">
+				<!-- Page header -->
+				<div class="page-header d-print-none">
+					<div class="container-xl">
+						<div class="row g-2 align-items-center">
+						<div class="col">
+							<h2 class="page-title">
+							Settings
+							</h2>
+						</div>
+						</div>
+					</div>
 				</div>
 				</div>
-			</div>
-			</div>
-			<!-- Page body -->
-			<div class="page-body">
-				<div class="container-xl">
-				  <div class="card">
-					<div class="row g-0">
-						<%- include('partials/sidebar.html') %>
-					  	<div class="col d-flex flex-column">
-					  
-							<div class="card-body">
-							<h2 class="">Settings</h2>
-							<!-- <p class="text-muted mb-4">Configure server below</p> -->
-							
-							<!-- <div class="row align-items-center">
-								<div class="col">
-									<a href="./QuickConnect.bat" class="btn" download="QuickConnect.bat">
-										<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-windows" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M17.8 20l-12 -1.5c-1 -.1 -1.8 -.9 -1.8 -1.9v-9.2c0 -1 .8 -1.8 1.8 -1.9l12 -1.5c1.2 -.1 2.2 .8 2.2 1.9v12.1c0 1.2 -1.1 2.1 -2.2 1.9z"></path> <path d="M12 5l0 14"></path> <path d="M4 12l16 0"></path> </svg>
-										Windows QuickConnect
-									</a>
-								</div>
-							</div> -->
+				<!-- Page body -->
+				<div class="page-body">
+					<div class="container-xl">
+						<div class="card">
+							<div class="row g-0">
+								
+								<%- include('partials/sidebar.html') %>
+								
+								<div class="col d-flex flex-column">
+									<div class="card-body">
+										<h2 class="mb-4">Settings</h2>
+										
+										
 
 
-							
+										<h3 class="mt-5">Container Links</h3>
+										<label class="text-muted mb-2">Choose the default behaviour for container links. Enter IP address or Domain before enabling.</label>
+										<div class="row align-items-center">
+											<div class="col-auto">
+												<label class="form-check form-switch form-switch-lg">
+													<input class="form-check-input" type="checkbox" id="submit" name="links" hx-trigger="click" hx-post="/settings/links" hx-swap="none" disabled>
+													<span class="form-check-label form-check-label-on text-warning">
+														Custom
+													</span>
+													<span class="form-check-label form-check-label-off text-success">
+														Localhost
+													</span>
+												</label>
+											</div>
+											<div class="col-6">
+												<input type="text" class="form-control" name="ip" placeholder="IP Address or Domain">
+											</div>
+										</div>
+
+										<h3 class="mt-5">User Registration</h3>
+										<label class="text-muted mb-2">Allow other users to register.</label>
+										<div class="row align-items-center">
+											<div class="col-auto">
+												<label class="form-check form-switch form-switch-lg">
+													<input class="form-check-input" type="checkbox" id="submit" name="registration" hx-trigger="click" hx-post="/settings/registration" hx-swap="none" disabled>
+													<span class="form-check-label form-check-label-on text-success">
+														Enabled
+													</span>
+													<span class="form-check-label form-check-label-off text-danger">
+														Disabled
+													</span>
+												</label>
+											</div>
+											<div class="col-6">
+												<input type="text" class="form-control" name="secret" placeholder="Registration Secret">
+											</div>
+										</div>
 
 
-							<h3 class="mt-5">Container Links</h3>
-							<label class="text-muted mb-2">Choose the default behaviour for container links. Enter IP address or Domain before enabling.</label>
-							<form id="container_links">
-								<div class="row align-items-center">
-									<div class="col-auto">
-										<label class="form-check form-switch form-switch-lg">
-											<input class="form-check-input" type="checkbox" id="submit" name="links" hx-trigger="click" hx-post="/settings/links" hx-swap="none">
-											<span class="form-check-label form-check-label-on text-warning">
-												Custom
-											</span>
-											<span class="form-check-label form-check-label-off text-success">
-												Localhost
-											</span>
-										</label>
-									</div>
-									<div class="col-6">
-										<input type="text" class="form-control" name="ip" placeholder="IP Address or Domain">
-									</div>
-								</div>
-							</form>
 
 
+										<h3 class="mt-5">Remote Hosts</h3>
+										<label class="text-muted mb-2">Host #2</label>
+										<div class="row align-items-center">
+											<div class="col-auto">
+												<label class="form-check form-switch form-switch-lg">
+													<input class="form-check-input" type="checkbox" id="submit" name="registration" hx-trigger="click" hx-post="/settings/registration" hx-swap="none" disabled>
+													<span class="form-check-label form-check-label-on text-success">
+														Enabled
+													</span>
+													<span class="form-check-label form-check-label-off text-danger">
+														Disabled
+													</span>
+												</label>
+											</div>
+											<div class="col-2">
+												<input type="text" class="form-control" name="secret" placeholder="Tag">
+											</div>
+											<div class="col-6">
+												<input type="text" class="form-control" name="secret" placeholder="Host IP">
+											</div>
+										</div>
+										
+										<label class="text-muted mb-2">Host #3</label>
+										<div class="row align-items-center">
+											<div class="col-auto">
+												<label class="form-check form-switch form-switch-lg">
+													<input class="form-check-input" type="checkbox" id="submit" name="registration" hx-trigger="click" hx-post="/settings/registration" hx-swap="none" disabled>
+													<span class="form-check-label form-check-label-on text-success">
+														Enabled
+													</span>
+													<span class="form-check-label form-check-label-off text-danger">
+														Disabled
+													</span>
+												</label>
+											</div>
+											<div class="col-2">
+												<input type="text" class="form-control" name="secret" placeholder="Tag">
+											</div>
+											<div class="col-6">
+												<input type="text" class="form-control" name="secret" placeholder="Host IP">
+											</div>
+										</div>
+
+										<label class="text-muted mb-2">Host #4</label>
+										<div class="row align-items-center">
+											<div class="col-auto">
+												<label class="form-check form-switch form-switch-lg">
+													<input class="form-check-input" type="checkbox" id="submit" name="registration" hx-trigger="click" hx-post="/settings/registration" hx-swap="none" disabled>
+													<span class="form-check-label form-check-label-on text-success">
+														Enabled
+													</span>
+													<span class="form-check-label form-check-label-off text-danger">
+														Disabled
+													</span>
+												</label>
+											</div>
+											<div class="col-2">
+												<input type="text" class="form-control" name="secret" placeholder="Tag">
+											</div>
+											<div class="col-6">
+												<input type="text" class="form-control" name="secret" placeholder="Host IP">
+											</div>
+										</div>
 
 
-							<h3 class="mt-5">User Registration</h3>
-							<label class="text-muted mb-2">Allow other users to register.</label>
-							<form id="registration">
-								<div class="row align-items-center">
-									<div class="col-auto">
-										<label class="form-check form-switch form-switch-lg">
-											<input class="form-check-input" type="checkbox" id="submit" name="registration" hx-trigger="click" hx-post="/settings/registration" hx-swap="none" RegistrationEnabled>
-											<span class="form-check-label form-check-label-on text-success">
-												Enabled
-											</span>
-											<span class="form-check-label form-check-label-off text-danger">
-												Disabled
-											</span>
-										</label>
 									</div>
 									</div>
-									<div class="col-6">
-										<input type="text" class="form-control" name="secret" placeholder="Registration Secret">
+									<div class="card-footer bg-transparent mt-auto">
+										<div class="btn-list justify-content-end">
+											<a href="#" class="btn">
+												Cancel
+											</a>
+											<a href="#" class="btn btn-primary">
+												Submit
+											</a>
+										</div>
 									</div>
 									</div>
 								</div>
 								</div>
-							</form>
-
 							</div>
 							</div>
-	  
-					  	</div>
-					  
+						</div>
 					</div>
 					</div>
-				  </div>
 				</div>
 				</div>
-			  </div>
-
-			<%- include('partials/footer.html') %>
-		</div>
+				<%- include('partials/footer.html') %>
+			</div>
 		</div>
 		</div>
 		<!-- Libs JS -->
 		<!-- Libs JS -->
 		<!-- Tabler Core -->
 		<!-- Tabler Core -->
 		<script src="/js/tabler.min.js" defer></script>
 		<script src="/js/tabler.min.js" defer></script>
 		<script src="/js/demo.min.js" defer></script>
 		<script src="/js/demo.min.js" defer></script>
 	</body>
 	</body>
-	</html>
+</html>