Skip to content

Commit

Permalink
Almost a complete rewrite, part 5. Almost ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
lllllllillllllillll committed Oct 28, 2024
1 parent ec4746e commit 4bdf1e3
Show file tree
Hide file tree
Showing 44 changed files with 2,060 additions and 924 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
* CSS and pages tweaks to make the style more consistent.
* Improved container cards to be more compact.
* Improved sponsors and credits pages.
* New - Secret supporter code.
* New - Secret code for sponsors.
* Fixed installs not appearing or appearing multiple times.
* Improved log view and fixed refresh button.
* Made app cards more compact.

* Updated container_card to only show exposed ports.


## v0.60 (June 9th 2024) - Permissions system and import templates
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM node:22-alpine
FROM node:23-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY package.json /app
WORKDIR /dweebui
COPY package.json /dweebui
RUN npm install
RUN npm install pm2 -g
COPY . /app
COPY . /dweebui
EXPOSE 8000
CMD ["pm2-runtime", "server.js"]
5 changes: 3 additions & 2 deletions controllers/account.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { User, ServerSettings } from '../database/config.js';
import { User, ServerSettings } from '../db/config.js';
import { Alert, getLanguage, Navbar, Sidebar, Footer } from '../utils/system.js';

export const Account = async function(req,res){

req.session.host = `${req.params.host || 1}`;

let container_links = await ServerSettings.findOne({ where: {key: 'container_links'}});
let user_registration = await ServerSettings.findOne({ where: {key: 'user_registration'}});


let user = await User.findOne({ where: {userID: req.session.userID}});

res.render("account",{
Expand Down
138 changes: 83 additions & 55 deletions controllers/apps.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Alert, getLanguage, Navbar, Footer } from '../utils/system.js';
import { Alert, getLanguage, Navbar, Footer, Capitalize } from '../utils/system.js';
import { readFileSync, readdirSync, renameSync, mkdirSync, unlinkSync, existsSync } from 'fs';
import { parse } from 'yaml';
import multer from 'multer';
Expand Down Expand Up @@ -26,6 +26,8 @@ export const searchApps = async function (req, res) {

export const Apps = async function(req,res){

req.session.host = `${req.params.host || 1}`;

let [apps_list, app_count] = ['', ''];
let page = Number(req.params.page) || 1;
let template = req.params.template || 'default';
Expand Down Expand Up @@ -154,14 +156,68 @@ export const Apps = async function(req,res){

export const submitApps = async function (req, res) {

let app_name = req.header('hx-trigger-name');

}




function CatagoryColor(category) {
switch (category) {
case 'Other':
return '<span class="badge bg-blue-lt">Other</span> ';
case 'Productivity':
return '<span class="badge bg-blue-lt">Productivity</span> ';
case 'Tools':
return '<span class="badge bg-blue-lt">Tools</span> ';
case 'Dashboard':
return '<span class="badge bg-blue-lt">Dashboard</span> ';
case 'Communication':
return '<span class="badge bg-azure-lt">Communication</span> ';
case 'Media':
return '<span class="badge bg-azure-lt">Media</span> ';
case 'CMS':
return '<span class="badge bg-azure-lt">CMS</span> ';
case 'Monitoring':
return '<span class="badge bg-indigo-lt">Monitoring</span> ';
case 'LDAP':
return '<span class="badge bg-purple-lt">LDAP</span> ';
case 'Arr':
return '<span class="badge bg-purple-lt">Arr</span> ';
case 'Database':
return '<span class="badge bg-red-lt">Database</span> ';
case 'Paid':
return '<span class="badge bg-red-lt" title="This is a paid product or contains paid features.">Paid</span> ';
case 'Gaming':
return '<span class="badge bg-pink-lt">Gaming</span> ';
case 'Finance':
return '<span class="badge bg-orange-lt">Finance</span> ';
case 'Networking':
return '<span class="badge bg-yellow-lt">Networking</span> ';
case 'Authentication':
return '<span class="badge bg-lime-lt">Authentication</span> ';
case 'Development':
return '<span class="badge bg-green-lt">Development</span> ';
case 'Media Server':
return '<span class="badge bg-teal-lt">Media Server</span> ';
case 'Downloaders':
return '<span class="badge bg-cyan-lt">Downloaders</span> ';
default:
return ''; // default to other if the category is not recognized
}
}



export const appsModals = async function (req, res) {
let app_name = req.header('hx-trigger-name');
let app_type = req.header('hx-trigger');
let action = req.params.action;
let modal = req.params.modal;

// console.log(`[submitApps] app_name: ${app_name} app_type: ${app_type} action: ${action}`);
// console.log(`[submitApps] app_name: ${app_name} app_type: ${app_type} modal: ${modal}`);

// Modal for compose files
if (action == 'view_install' && app_type == 'compose') {
if (modal == 'view_install' && app_type == 'compose') {
let compose = readFileSync(`appdata/compose/${app_name}/compose.yaml`, 'utf8');
let modal = readFileSync('views/partials/compose.html', 'utf8');
modal = modal.replace(/AppName/g, app_name);
Expand All @@ -170,8 +226,28 @@ export const submitApps = async function (req, res) {
return;
}

// More Info modal
if (modal == 'info' && app_type == 'json') {

let modal = readFileSync('views/partials/info.html', 'utf8');

let app_title = Capitalize(app_name);
modal = modal.replace(/AppTitle/g, app_title);

let result = templates_global.find(t => t.name == app_name);

modal = modal.replace(/AppDescription/g, result.description);

res.send(modal);
return;
}



// Modal for json templates
if (action == 'view_install' && app_type == 'json') {
if (modal == 'view_install' && app_type == 'json') {


let result = templates_global.find(t => t.name == app_name);
let name = result.name || result.title.toLowerCase();
let short_name = name.slice(0, 25) + "...";
Expand Down Expand Up @@ -317,7 +393,7 @@ export const submitApps = async function (req, res) {

}

let modal = readFileSync('views/partials/details.html', 'utf8');
let modal = readFileSync('views/partials/install.html', 'utf8');
modal = modal.replace(/AppName/g, name);
modal = modal.replace(/AppNote/g, note);
modal = modal.replace(/AppImage/g, image);
Expand Down Expand Up @@ -358,52 +434,4 @@ export const submitApps = async function (req, res) {

res.send(modal);
}
}




function CatagoryColor(category) {
switch (category) {
case 'Other':
return '<span class="badge bg-blue-lt">Other</span> ';
case 'Productivity':
return '<span class="badge bg-blue-lt">Productivity</span> ';
case 'Tools':
return '<span class="badge bg-blue-lt">Tools</span> ';
case 'Dashboard':
return '<span class="badge bg-blue-lt">Dashboard</span> ';
case 'Communication':
return '<span class="badge bg-azure-lt">Communication</span> ';
case 'Media':
return '<span class="badge bg-azure-lt">Media</span> ';
case 'CMS':
return '<span class="badge bg-azure-lt">CMS</span> ';
case 'Monitoring':
return '<span class="badge bg-indigo-lt">Monitoring</span> ';
case 'LDAP':
return '<span class="badge bg-purple-lt">LDAP</span> ';
case 'Arr':
return '<span class="badge bg-purple-lt">Arr</span> ';
case 'Database':
return '<span class="badge bg-red-lt">Database</span> ';
case 'Paid':
return '<span class="badge bg-red-lt" title="This is a paid product or contains paid features.">Paid</span> ';
case 'Gaming':
return '<span class="badge bg-pink-lt">Gaming</span> ';
case 'Finance':
return '<span class="badge bg-orange-lt">Finance</span> ';
case 'Networking':
return '<span class="badge bg-yellow-lt">Networking</span> ';
case 'Authentication':
return '<span class="badge bg-lime-lt">Authentication</span> ';
case 'Development':
return '<span class="badge bg-green-lt">Development</span> ';
case 'Media Server':
return '<span class="badge bg-teal-lt">Media Server</span> ';
case 'Downloaders':
return '<span class="badge bg-cyan-lt">Downloaders</span> ';
default:
return ''; // default to other if the category is not recognized
}
}
9 changes: 3 additions & 6 deletions controllers/credits.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { ServerSettings, User } from '../database/config.js';
import { ServerSettings, User } from '../db/config.js';
import { Alert, getLanguage, Navbar, Sidebar, Footer, Capitalize } from '../utils/system.js';
import { readdirSync, readFileSync } from 'fs';

export const Credits = async function (req, res) {

let language = await getLanguage(req);
let language = await getLanguage(req.session.userID);
let Language = Capitalize(language);
let selected = `<option value="${language}" selected hidden>${Language}</option>`;

let user = await User.findOne({ where: { userID: req.session.userID }});
let preferences = JSON.parse(user.preferences);
let hide_profile = preferences.hide_profile;

let checked = '';
if (hide_profile == true) { checked = 'checked'; }


let checked = ''; if (hide_profile == true) { checked = 'checked'; }

res.render("credits",{
alert: '',
Expand Down
Loading

0 comments on commit 4bdf1e3

Please sign in to comment.