switching networks works, established server functions
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user