add feistel encryption

This commit is contained in:
2026-04-11 04:36:14 +04:00
parent 4bb8e394ef
commit b2cc83538b
6 changed files with 62 additions and 8 deletions
+2
View File
@@ -5,6 +5,7 @@ import { resolveKey } from "./auth";
import sql from "../db";
import { sparklineFromPings, pickBestRegion } from "../utils/sparkline";
import { PLAN_LABELS, REGION_COLORS, REGION_LABELS, REGIONS, planTier } from "../../../shared/plans";
import { encodeId } from "../../../shared/feistel";
async function hashFile(path: string): Promise<string> {
const bytes = await Bun.file(path).bytes();
@@ -311,6 +312,7 @@ export const dashboard = new Elysia()
const acc = accountRows[0];
const monitorCount = monitorCountRows[0].count;
for (const inv of invoices) inv.public_id = encodeId(inv.id);
return html("settings", { nav: "settings", account: acc, apiKeys, accountId, loginKey, isSubKey, monitorCount, invoices });
})
+2 -2
View File
@@ -194,10 +194,10 @@
<div class="flex items-center gap-3">
<span class="text-xs text-gray-500"><%= date %></span>
<% if (inv.status === 'pending' || inv.status === 'underpaid' || inv.status === 'confirming') { %>
<a href="/dashboard/checkout/<%= inv.id %>" class="text-xs text-blue-400 hover:text-blue-300">View</a>
<a href="/dashboard/checkout/<%= inv.public_id %>" class="text-xs text-blue-400 hover:text-blue-300">View</a>
<% } else if (inv.status === 'paid') { %>
<span class="text-xs text-green-500/70">Paid</span>
<a href="/dashboard/checkout/<%= inv.id %>/receipt" target="_blank" class="text-xs text-blue-400 hover:text-blue-300 transition-colors">Receipt</a>
<a href="/dashboard/checkout/<%= inv.public_id %>/receipt" target="_blank" class="text-xs text-blue-400 hover:text-blue-300 transition-colors">Receipt</a>
<% } %>
</div>
</div>