more branding options and fix gitignore

This commit is contained in:
KingKDot
2026-07-12 15:23:23 -05:00
parent 26702510eb
commit ddc8b970d5
11 changed files with 183 additions and 20 deletions
+30
View File
@@ -2216,3 +2216,33 @@ export function getDatabaseFileSizeBytes(): number {
}
}
export type BrandingImage = {
kind: string;
contentType: string;
bytes: Uint8Array;
updatedAt: number;
};
export function getBrandingImage(kind: string): BrandingImage | null {
const row = db.query<any>(
`SELECT kind, content_type, bytes, updated_at FROM branding_images WHERE kind=?`,
).get(kind);
if (!row) return null;
return {
kind: String(row.kind),
contentType: String(row.content_type),
bytes: new Uint8Array(row.bytes),
updatedAt: Number(row.updated_at),
};
}
export function saveBrandingImage(kind: string, contentType: string, bytes: Uint8Array): BrandingImage {
const updatedAt = Date.now();
db.run(
`INSERT INTO branding_images (kind, content_type, bytes, updated_at) VALUES (?, ?, ?, ?)
ON CONFLICT(kind) DO UPDATE SET content_type=excluded.content_type, bytes=excluded.bytes, updated_at=excluded.updated_at`,
kind, contentType, bytes, updatedAt,
);
return { kind, contentType, bytes, updatedAt };
}
+9
View File
@@ -380,6 +380,15 @@ db.run(`
);
`);
db.run(`
CREATE TABLE IF NOT EXISTS branding_images (
kind TEXT PRIMARY KEY,
content_type TEXT NOT NULL,
bytes BLOB NOT NULL,
updated_at INTEGER NOT NULL
);
`);
db.run(`
CREATE TABLE IF NOT EXISTS saved_scripts (
id TEXT PRIMARY KEY,