Land camera-native raw profiles, real ICC soft proofing and 16-bit proxies.
Camera profiles, proofing tables and the half-float sidecar all have to agree with the pixels the editor actually grades, so they land together with the preset filter menu that was unusable while thumbnails streamed in. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -89,6 +89,18 @@ db.exec(`
|
||||
|
||||
CREATE INDEX IF NOT EXISTS gallery_reviews_token ON gallery_reviews(token);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS gallery_settings (
|
||||
token TEXT PRIMARY KEY,
|
||||
password_hash TEXT NOT NULL DEFAULT '',
|
||||
password_salt TEXT NOT NULL DEFAULT '',
|
||||
expires_at INTEGER,
|
||||
watermark TEXT NOT NULL DEFAULT '',
|
||||
allow_downloads INTEGER NOT NULL DEFAULT 1,
|
||||
download_cap INTEGER NOT NULL DEFAULT 0,
|
||||
download_count INTEGER NOT NULL DEFAULT 0,
|
||||
updated_at INTEGER NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS invites (
|
||||
token TEXT PRIMARY KEY,
|
||||
email TEXT NOT NULL DEFAULT '',
|
||||
@@ -607,6 +619,71 @@ export function picksByOwner(ownerId) {
|
||||
}));
|
||||
}
|
||||
|
||||
const gallerySettingsStmt = db.prepare('SELECT * FROM gallery_settings WHERE token = ?');
|
||||
const upsertGallerySettings = db.prepare(`
|
||||
INSERT INTO gallery_settings
|
||||
(token, password_hash, password_salt, expires_at, watermark, allow_downloads, download_cap, download_count, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON CONFLICT(token) DO UPDATE SET
|
||||
password_hash = excluded.password_hash,
|
||||
password_salt = excluded.password_salt,
|
||||
expires_at = excluded.expires_at,
|
||||
watermark = excluded.watermark,
|
||||
allow_downloads = excluded.allow_downloads,
|
||||
download_cap = excluded.download_cap,
|
||||
updated_at = excluded.updated_at
|
||||
`);
|
||||
const deleteGallerySettings = db.prepare('DELETE FROM gallery_settings WHERE token = ?');
|
||||
const bumpGalleryDownload = db.prepare(
|
||||
'UPDATE gallery_settings SET download_count = download_count + 1 WHERE token = ?',
|
||||
);
|
||||
const readGalleryDownloads = db.prepare(
|
||||
'SELECT download_count FROM gallery_settings WHERE token = ?',
|
||||
);
|
||||
|
||||
/** Access rules for a public proofing link; defaults when none were saved. */
|
||||
export function gallerySettingsFor(token) {
|
||||
const row = gallerySettingsStmt.get(token);
|
||||
return {
|
||||
passwordHash: row?.password_hash ?? '',
|
||||
passwordSalt: row?.password_salt ?? '',
|
||||
expiresAt: row?.expires_at ?? null,
|
||||
watermark: row?.watermark ?? '',
|
||||
allowDownloads: row ? Boolean(row.allow_downloads) : true,
|
||||
downloadCap: row?.download_cap ?? 0,
|
||||
downloadCount: row?.download_count ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The download counter is deliberately preserved across settings edits: an
|
||||
* owner tightening or loosening a cap must not hand out a fresh allowance.
|
||||
*/
|
||||
export function saveGallerySettings(token, settings) {
|
||||
upsertGallerySettings.run(
|
||||
token,
|
||||
settings.passwordHash ?? '',
|
||||
settings.passwordSalt ?? '',
|
||||
settings.expiresAt ?? null,
|
||||
settings.watermark ?? '',
|
||||
settings.allowDownloads === false ? 0 : 1,
|
||||
Math.max(0, Math.round(settings.downloadCap ?? 0)),
|
||||
0,
|
||||
Date.now(),
|
||||
);
|
||||
return gallerySettingsFor(token);
|
||||
}
|
||||
|
||||
export function clearGallerySettings(token) {
|
||||
deleteGallerySettings.run(token);
|
||||
}
|
||||
|
||||
/** Counts a gallery download and reports the new total, or 0 when uncapped. */
|
||||
export function noteGalleryDownload(token) {
|
||||
bumpGalleryDownload.run(token);
|
||||
return readGalleryDownloads.get(token)?.download_count ?? 0;
|
||||
}
|
||||
|
||||
export function galleryPick(token, photoId, clientId, clientName, picked) {
|
||||
if (!picked) {
|
||||
q.deletePick.run(token, photoId, clientId);
|
||||
|
||||
Reference in New Issue
Block a user