showing info in dashboard

This commit is contained in:
metacryst
2026-01-12 17:24:45 -06:00
parent 63304bd281
commit 942e479185
6 changed files with 125 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ import cors from 'cors';
import cookieParser from 'cookie-parser';
import http from 'http';
import fs from 'fs';
import os from 'os';
import chalk from 'chalk';
import moment from 'moment';
import path from 'path';
@@ -21,6 +22,7 @@ class Server {
auth;
UIPath = path.join(__dirname, '../ui')
DBPath = path.join(__dirname, '../db')
ComalPath = path.join(os.homedir(), 'Sites/comalyr.com')
registerRoutes(router) {
/* Stripe */
@@ -35,10 +37,33 @@ class Server {
/* Site */
router.post('/signup', this.verifySignupToken, this.newUserSubmission)
router.get('/db/images/*', this.getUserImage)
router.get('/app/comaldata', this.getComalData)
router.get('/*', this.get)
return router
}
getComalData = async (req, res, next) => {
try {
const pathOne = path.join(this.ComalPath, "db", "join.json");
const pathTwo = path.join(this.ComalPath, "db", "contact.json");
const [joinRaw, contactRaw] = await Promise.all([
fs.promises.readFile(pathOne, "utf8"),
fs.promises.readFile(pathTwo, "utf8")
]);
const join = joinRaw.trim() ? JSON.parse(joinRaw) : [];
const contact = contactRaw.trim() ? JSON.parse(contactRaw) : [];
res.json({
join,
contact
});
} catch (err) {
next(err);
}
}
verifySignupToken = (req, res, next) => {
const { token } = req.query;
if (!token) {