Add authenticated login and SSO protection

This commit is contained in:
inman committed 2026-05-29 15:54:13 +08:00
1 parent e36f28a668
commit 0648874801
50 files changed
+1853 -63

No files matched your search

+11
View File
@@ -53,6 +53,17 @@ export async function getAsset(id: string): Promise<Asset | null> {
return state.assets.find((asset) => asset.id === id) || null;
}
export async function getAssetByStoragePath(storagePath: string): Promise<Asset | null> {
const supabase = getSupabaseAdmin();
if (supabase) {
const { data, error } = await supabase.from("assets").select("*").eq("storage_path", storagePath).maybeSingle();
if (error) throw new Error(error.message);
return data ? assetFromRow(data) : null;
}
const state = await readState();
return state.assets.find((asset) => asset.storagePath === storagePath) || null;
}
export async function createAsset(input: AssetInput): Promise<Asset> {
const now = new Date().toISOString();
const asset: Asset = {