switching networks works, established server functions

This commit is contained in:
metacryst
2026-01-16 05:22:52 -06:00
parent d2982543d0
commit d3df5bb6cb
31 changed files with 410 additions and 310 deletions

View File

@@ -3,9 +3,13 @@ import chalk from 'chalk';
import path from 'path';
import {nodeModels, edgeModels} from './model/import.js'
import Edge from "./model/edge.js"
import { fileURLToPath } from "url"
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default class Database {
PERSONAL_DATA_PATH = path.join(__dirname, '../../db/personal')
nodes = new Array(10000).fill(0);
edges = new Array(10000).fill(0);

View File

@@ -1,3 +1,5 @@
import path from 'path';
import fs from 'fs';
import argon2 from 'argon2';
import { z } from 'zod';
@@ -15,6 +17,7 @@ export default class Member {
firstName: z.string(),
lastName: z.string(),
password: z.string(),
apps: z.array(z.string()),
created: z.string()
})
@@ -48,6 +51,17 @@ export default class Member {
return members
}
async getPersonalData(id) {
const filePath = path.join(global.db.PERSONAL_DATA_PATH, id, "db.json");
const [raw] = await Promise.all([
fs.promises.readFile(filePath, "utf8"),
]);
const result = raw.trim() ? JSON.parse(raw) : [];
return result
}
getByID(id) {
if(typeof id === 'string') {
id = id.split("-")[1]