Browse Source

visual tweaks. fixed install logging.

lllllllillllllillll 1 year ago
parent
commit
0911a15ac4
10 changed files with 45 additions and 46 deletions
  1. 0 1
      Dockerfile
  2. 2 2
      README.md
  3. 2 0
      components/appCard.js
  4. 3 3
      controllers/register.js
  5. 24 27
      functions/install.js
  6. 3 4
      server.js
  7. 3 3
      views/account.ejs
  8. 1 1
      views/login.ejs
  9. 4 2
      views/register.ejs
  10. 3 3
      views/settings.ejs

+ 0 - 1
Dockerfile

@@ -1,7 +1,6 @@
 FROM node:21-alpine
 
 ENV NODE_ENV=production
-ENV DOCKER_BUILDKIT=1
 
 WORKDIR /app
 

+ 2 - 2
README.md

@@ -3,8 +3,8 @@ DweebUI is a web interface for managing Docker, with a zero-config dashboard for
 
 Alpha v0.20 ( :fire: Experimental :fire: )
 
-:warning: DweebUI is a management interface and should not be directly exposed to the internet:warning:   
-:warning: External access should be done through a VPN or secure SSH connection :warning:
+   
+[:warning: DweebUI is a management interface and should not be directly exposed to the internet :warning:](https://github.com/lllllllillllllillll/DweebUI/wiki/Exposing-DweebUI-to-the-Internet)
 
 [![GitHub Stars](https://img.shields.io/github/stars/lllllllillllllillll/DweebUI)](https://github.com/lllllllillllllillll)
 [![GitHub Activity](https://img.shields.io/github/commit-activity/y/lllllllillllllillll/DweebUI)](https://github.com/lllllllillllllillll)

+ 2 - 0
components/appCard.js

@@ -1,5 +1,7 @@
 export const appCard = (data) => {
 
+
+  // dont look at anything in here.
   let app_name = data.name || data.title.toLowerCase();
   let shortened_name = "";
   let shortened_desc = data.description.slice(0, 60) + "...";

+ 3 - 3
controllers/register.js

@@ -17,7 +17,7 @@ export const Register = function(req,res){
 
 export const submitRegister = async function(req,res){
 
-    let { name, username, email, password, confirmPassword, avatar, tos, secret } = req.body;
+    let { name, username, email, password, confirmPassword, avatar, warning, secret } = req.body;
 
 
     if (secret != SECRET) {
@@ -30,7 +30,7 @@ export const submitRegister = async function(req,res){
         });
     }
 
-    if((name && email && password && confirmPassword && username && tos) && (secret == SECRET) && (password == confirmPassword)){
+    if((name && email && password && confirmPassword && username && warning) && (secret == SECRET) && (password == confirmPassword)){
 
         async function userRole () {
             let userCount = await User.count();
@@ -94,7 +94,7 @@ export const submitRegister = async function(req,res){
     } else {
         // Redirect to the signup page.
         res.render("register",{
-            "error":"Please fill in all the fields and accept TOS.",
+            "error":"Please fill in all the fields and acknowledge security warning.",
         });
     }
 }

+ 24 - 27
functions/install.js

@@ -173,34 +173,31 @@ export const Install = async (req, res) => {
 
             } catch { console.log('error creating directory or compose file') }
 
-            try {
-                var compose = new DockerodeCompose(docker, `./appdata/${name}/docker-compose.yml`, `${name}`);
-
-                (async () => {
-                await compose.pull();
-                await compose.up().then(() => {
-                    req.app.locals.installCard = 'empty';
-                    console.log(req.app.locals.installCard)
-                });
-                const syslog = await Syslog.create({
-                    user: req.session.user,
-                    email: null,
-                    event: "App Installation",
-                    message: `${name} installed successfully`,
-                    ip: req.socket.remoteAddress
-                });
-                })();
-
-            } catch { 
-                const syslog = await Syslog.create({
-                    user: req.session.user,
-                    email: null,
-                    event: "App Installation",
-                    message: `${name} installation failed`,
-                    ip: req.socket.remoteAddress
-                });
-            }
+            var compose = new DockerodeCompose(docker, `./appdata/${name}/docker-compose.yml`, `${name}`);
 
+            (async () => {
+                try {
+                    await compose.pull();
+                    await compose.up().then(() => {
+                        const syslog = Syslog.create({
+                            user: req.session.user,
+                            email: null,
+                            event: "App Installation",
+                            message: `${name} installed successfully`,
+                            ip: req.socket.remoteAddress
+                        });
+                    });
+                } catch (err) {
+                    console.error(err);
+                    const syslog = await Syslog.create({
+                        user: req.session.user,
+                        email: null,
+                        event: "App Installation",
+                        message: `${name} installation failed: ${err}`,
+                        ip: req.socket.remoteAddress
+                    });
+                }
+            })();
         }
 
 

+ 3 - 4
server.js

@@ -22,7 +22,6 @@ let [cpu, ram, tx, rx, disk] = [0, 0, 0, 0, 0];
 let [hidden, clicked, dockerEvents] = ['', false, ''];
 let metricsInterval, cardsInterval, graphsInterval;
 let cardList = '';
-app.locals.installCard = 'test';
 const statsArray = {};
 
 // Socket.io admin ui
@@ -184,10 +183,10 @@ docker.getEvents((err, stream) => {
 });
 
 // Check for docker events
-setInterval( () => {
+setInterval(async () => {
     if (dockerEvents != '') {
-        getHidden();
-        containerCards();
+        await getHidden();
+        await containerCards();
         dockerEvents = '';
     }
 }, 1000);

+ 3 - 3
views/account.ejs

@@ -45,10 +45,10 @@
 						<h4 class="subheader">Business settings</h4>
 						<div class="list-group list-group-transparent">
 						<a href="/account" class="list-group-item list-group-item-action d-flex align-items-center active">Accounts</a>
-						<a href="#" class="list-group-item list-group-item-action d-flex align-items-center">My Notifications</a>
-						<a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Connected Apps</a>
+						<!-- <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">My Notifications</a>
+						<a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Connected Apps</a> -->
 						<a href="/settings" class="list-group-item list-group-item-action d-flex align-items-center">Settings</a>
-						<a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Billing & Invoices</a>
+						<!-- <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Billing & Invoices</a> -->
 						</div>
 						<h4 class="subheader mt-4">Experience</h4>
 						<div class="list-group list-group-transparent">

+ 1 - 1
views/login.ejs

@@ -19,7 +19,7 @@
     </style>
   </head>
   <body  class=" d-flex flex-column">
-    <script src="js/demo-theme.js"></script>
+    <script src="/js/demo-theme.js"></script>
     <div class="page page-center">
       <div class="container container-tight py-4">
         <div class="text-center mb-4">

+ 4 - 2
views/register.ejs

@@ -153,8 +153,10 @@
 
             <div class="mb-2">
               <label class="form-check">
-                <input type="checkbox" class="form-check-input" name="tos"/>
-                <span class="form-check-label">I understand that exposing DweebUI directly to the internet is a bad idea.</span>
+                <input type="checkbox" class="form-check-input" name="warning"/>
+                <span class="form-check-label">
+                  I understand that<a href="https://github.com/lllllllillllllillll/DweebUI/wiki/Exposing-DweebUI-to-the-Internet"> exposing DweebUI directly to the internet</a> is a bad idea.
+                </span>
               </label>
             </div>
 

+ 3 - 3
views/settings.ejs

@@ -45,10 +45,10 @@
 						  <h4 class="subheader">Business settings</h4>
 						  <div class="list-group list-group-transparent">
 						  <a href="/account" class="list-group-item list-group-item-action d-flex align-items-center">Account</a>
-						  <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">My Notifications</a>
-						  <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Connected Apps</a>
+						  <!-- <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">My Notifications</a>
+						  <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Connected Apps</a> -->
 						  <a href="/settings" class="list-group-item list-group-item-action d-flex align-items-center active">Settings</a>
-						  <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Billing & Invoices</a>
+						  <!-- <a href="#" class="list-group-item list-group-item-action d-flex align-items-center">Billing & Invoices</a> -->
 						  </div>
 						  <h4 class="subheader mt-4">Experience</h4>
 						  <div class="list-group list-group-transparent">