Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac37f3cb1a | ||
|
|
b29b502aad | ||
|
|
2498da1214 | ||
|
|
202497cf3e | ||
|
|
1392d38044 | ||
|
|
145f693d8d | ||
|
|
e4a61d3127 | ||
|
|
efc3aafd8a | ||
|
|
5728c1782a |
No files matched your search
+1
-1
@@ -136,7 +136,7 @@ export async function buildApp({ config, db, realtime, fetchImpl, reporter: give
|
||||
});
|
||||
|
||||
await registerAuthRoutes(app, { db, config, sessions });
|
||||
await registerMeRoutes(app, { db, sessions });
|
||||
await registerMeRoutes(app, { db, sessions, broadcaster });
|
||||
await registerCalendarRoutes(app, { sessions, calendar: new CalendarService({ db, secrets, ...(fetchImpl && { fetchImpl }) }) });
|
||||
await registerOrgRoutes(app, { db, sessions });
|
||||
await registerEventRoutes(app, { db, sessions, sports, broadcaster });
|
||||
|
||||
@@ -17,4 +17,27 @@ export interface CropBias {
|
||||
scale: number;
|
||||
dAngle: number;
|
||||
scene: "ball" | "group" | "person" | null;
|
||||
/**
|
||||
* Where the crop sits on the person, not how much smaller it is.
|
||||
* 0 is the top of the body, 1 is the feet. Under 1 means the legs were cut.
|
||||
*/
|
||||
cut?: number | null;
|
||||
/** Space above the head, as a fraction of the body. Negative: the head is cut. */
|
||||
head?: number | null;
|
||||
/** How much of the body's width the side edges remove (arms and hands). */
|
||||
sides?: number | null;
|
||||
}
|
||||
|
||||
/** Where a crop sits on a person. Null when the body box is too small to read. */
|
||||
export function frameIntent(crop: Box, subject: Box): { cut: number; head: number; sides: number } | null {
|
||||
const height = subject.y1 - subject.y0;
|
||||
const width = subject.x1 - subject.x0;
|
||||
if (height < 0.08 || width < 0.02) return null;
|
||||
const cut = (crop.y1 - subject.y0) / height;
|
||||
if (cut < 0.2 || cut > 1.45) return null;
|
||||
const head = (subject.y0 - crop.y0) / height;
|
||||
const left = Math.max(0, crop.x0 - subject.x0) / width;
|
||||
const right = Math.max(0, subject.x1 - crop.x1) / width;
|
||||
const round = (n: number) => Math.round(n * 1000) / 1000;
|
||||
return { cut: round(cut), head: round(head), sides: round((left + right) / 2) };
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* "Only the best" (docs/photo-editing-rules.md §5): for clients that want a short gallery of the match, not every
|
||||
* usable frame. The match is cut into short windows, and each window may add its share of the gallery size, with
|
||||
* the share it did not use carried forward (half-time adds nothing, a busy spell may take a little more). Within a
|
||||
* the share it did not use carried forward (half-time adds nothing, a busy spell may take a little more).
|
||||
* The asked size is a target: a rich match may pass it by about 15% (never more than 25 frames); a thin one stays under. Within a
|
||||
* window the frames with the most action win: the ball in play, a duel or a celebration, a subject big in the
|
||||
* frame and sharp; one frame per burst, and not two from the same few seconds. Anything well below the match's
|
||||
* typical frame is left out even when the window has room.
|
||||
@@ -65,6 +66,15 @@ const median = (xs: number[]) => {
|
||||
return s[Math.floor(s.length / 2)]!;
|
||||
};
|
||||
|
||||
/**
|
||||
* How many frames a gallery may reach. The asked size is the target: about 15% more when the match is rich,
|
||||
* at least 2 and never more than 25 past it, so a short gallery stays close and a long one can breathe.
|
||||
*/
|
||||
export function galleryCeiling(count: number): number {
|
||||
const extra = Math.min(25, Math.max(2, Math.round(count * 0.15)));
|
||||
return count + extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decides the windows that have closed and are not decided yet. `decided` holds the candidates already decided
|
||||
* (chosen or not), so earlier choices count against the gallery size.
|
||||
@@ -75,11 +85,14 @@ export function curate(candidates: Candidate[], decided: { id: string; chosen: b
|
||||
const settleMs = opts.settleMs ?? 60_000;
|
||||
const done = new Map(decided.map((d) => [d.id, d.chosen]));
|
||||
let chosenSoFar = [...done.values()].filter(Boolean).length;
|
||||
const cap = Math.round(opts.count * 1.1);
|
||||
const cap = galleryCeiling(opts.count);
|
||||
const perWindow = (opts.count * windowMs) / opts.durationMs;
|
||||
// The match's typical frame, for the floor: half of the median of the frames with a subject.
|
||||
const windows = Math.max(1, opts.durationMs / windowMs);
|
||||
// The match's typical frame. The floor drops weak frames; only a frame at or above the typical one may use the slack.
|
||||
const scored = candidates.map((c) => ({ c, s: actionScore(c) }));
|
||||
const floor = scored.filter((x) => x.s > 0).length >= 10 ? 0.5 * median(scored.filter((x) => x.s > 0).map((x) => x.s)) : 0;
|
||||
const positives = scored.filter((x) => x.s > 0).map((x) => x.s);
|
||||
const typical = positives.length >= 10 ? median(positives) : Number.POSITIVE_INFINITY;
|
||||
const floor = positives.length >= 10 ? 0.5 * typical : 0;
|
||||
|
||||
const byWindow = new Map<number, typeof scored>();
|
||||
for (const x of scored) {
|
||||
@@ -98,15 +111,29 @@ export function curate(candidates: Candidate[], decided: { id: string; chosen: b
|
||||
const end = opts.start + (w + 1) * windowMs;
|
||||
if (end + settleMs > opts.now) break;
|
||||
// The share up to the end of this window, minus what was already chosen; at most three windows' worth at once.
|
||||
const target = Math.min(cap, Math.round(perWindow * (w + 1)));
|
||||
const room = Math.max(0, Math.min(target - chosenSoFar, Math.ceil(3 * perWindow), cap - chosenSoFar));
|
||||
const target = Math.min(opts.count, Math.round(perWindow * (w + 1)));
|
||||
const room = Math.max(0, Math.min(target - chosenSoFar, Math.ceil(3 * perWindow), opts.count - chosenSoFar));
|
||||
const ranked = list.filter((x) => x.s > 0 && x.s >= floor).sort((a, b) => b.s - a.s);
|
||||
const chosen: Candidate[] = [];
|
||||
const fits = (c: Candidate) => !chosen.some((o) => o.burst === c.burst || Math.abs(o.at - c.at) < minGapMs);
|
||||
for (const { c } of ranked) {
|
||||
if (chosen.length >= room) break;
|
||||
if (chosen.some((o) => o.burst === c.burst || Math.abs(o.at - c.at) < minGapMs)) continue;
|
||||
if (!fits(c)) continue;
|
||||
chosen.push(c);
|
||||
}
|
||||
// Slack follows the match, about 15% by the end. A quiet spell leaves it; a rich window may spend up to two frames of it.
|
||||
const slackByNow = Math.round(((cap - opts.count) * (w + 1)) / windows);
|
||||
const alreadyOver = Math.max(0, chosenSoFar - opts.count);
|
||||
let extraLeft = Math.min(2, Math.max(0, slackByNow - alreadyOver), cap - chosenSoFar - chosen.length);
|
||||
if (extraLeft > 0 && typical !== Number.POSITIVE_INFINITY) {
|
||||
for (const { c, s } of ranked) {
|
||||
if (extraLeft <= 0) break;
|
||||
if (chosen.includes(c)) continue;
|
||||
if (s < typical || !fits(c)) continue;
|
||||
chosen.push(c);
|
||||
extraLeft -= 1;
|
||||
}
|
||||
}
|
||||
chosenSoFar += chosen.length;
|
||||
out.push({ window: w, ids: list.map((x) => x.c.id), chosen: chosen.sort((a, b) => a.at - b.at).map((c) => c.id) });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { EditCommand } from "@photoreport/contracts";
|
||||
import type { Db } from "../db.js";
|
||||
import type { Box } from "../composition/compose.js";
|
||||
import type { CropBias, FoldedCrop } from "./cropBias.js";
|
||||
import { type CropBias, type FoldedCrop, frameIntent } from "./cropBias.js";
|
||||
import { TONE_KEYS, WB_KEYS } from "./look.js";
|
||||
|
||||
export type { CropBias, FoldedCrop } from "./cropBias.js";
|
||||
@@ -11,8 +11,8 @@ export { TONE_KEYS, WB_KEYS };
|
||||
* Learning from corrections (docs/photo-editing-rules.md §4): when someone changes what the autopilot did to a
|
||||
* photo — in Revelar or by writing a soft crop into the file in Lightroom / Photo Mechanic — the difference is
|
||||
* kept (one row per photo, the latest state wins). The autopilot then applies the consistent part of the recent
|
||||
* differences for the same photographer to its next edits: tone, white balance, and crop geometry (shift, scale,
|
||||
* angle), including a looser frame when they consistently open the crop.
|
||||
* differences for the same photographer to its next edits: tone, white balance, and where the crop sits on the
|
||||
* person (legs cut, space above the head, arms taken off), with a plain tighter or looser frame only as fallback.
|
||||
*
|
||||
* Creative looks are left alone. A correction counts only when most recent ones agree on the direction.
|
||||
*/
|
||||
@@ -38,6 +38,9 @@ const CROP_DY = "__crop.dy";
|
||||
const CROP_SCALE = "__crop.scale";
|
||||
const CROP_ANGLE = "__crop.dAngle";
|
||||
const CROP_SCENE = "__crop.scene";
|
||||
const CROP_CUT = "__crop.cut";
|
||||
const CROP_HEAD = "__crop.head";
|
||||
const CROP_SIDES = "__crop.sides";
|
||||
|
||||
const SCENE_CODE: Record<"ball" | "group" | "person", number> = { ball: 1, group: 2, person: 3 };
|
||||
const SCENE_FROM: Record<number, "ball" | "group" | "person"> = { 1: "ball", 2: "group", 3: "person" };
|
||||
@@ -65,19 +68,21 @@ const area = (b: Box) => (b.x1 - b.x0) * (b.y1 - b.y0);
|
||||
const cx = (b: Box) => (b.x0 + b.x1) / 2;
|
||||
const cy = (b: Box) => (b.y0 + b.y1) / 2;
|
||||
|
||||
export function cropBiasOf(auto: FoldedCrop, final: FoldedCrop, scene: CropBias["scene"] = null): CropBias | null {
|
||||
export function cropBiasOf(auto: FoldedCrop, final: FoldedCrop, scene: CropBias["scene"] = null, subject: Box | null = null): CropBias | null {
|
||||
if (area(auto.rect) <= 0) return null;
|
||||
const scale = Math.sqrt(area(final.rect) / area(auto.rect));
|
||||
const dx = cx(final.rect) - cx(auto.rect);
|
||||
const dy = cy(final.rect) - cy(auto.rect);
|
||||
const dAngle = final.angle - auto.angle;
|
||||
if (Math.abs(dx) < 0.005 && Math.abs(dy) < 0.005 && Math.abs(scale - 1) < 0.03 && Math.abs(dAngle) < 0.15) return null;
|
||||
const onPerson = subject ? frameIntent(final.rect, subject) : null;
|
||||
if (!onPerson && Math.abs(dx) < 0.005 && Math.abs(dy) < 0.005 && Math.abs(scale - 1) < 0.03 && Math.abs(dAngle) < 0.15) return null;
|
||||
return {
|
||||
dx: Math.round(dx * 1000) / 1000,
|
||||
dy: Math.round(dy * 1000) / 1000,
|
||||
scale: Math.round(scale * 1000) / 1000,
|
||||
dAngle: Math.round(dAngle * 100) / 100,
|
||||
scene,
|
||||
...(onPerson ?? {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,6 +92,9 @@ function packBias(deltas: Record<string, number>, bias: CropBias): void {
|
||||
deltas[CROP_SCALE] = bias.scale;
|
||||
deltas[CROP_ANGLE] = bias.dAngle;
|
||||
if (bias.scene) deltas[CROP_SCENE] = SCENE_CODE[bias.scene];
|
||||
if (typeof bias.cut === "number") deltas[CROP_CUT] = bias.cut;
|
||||
if (typeof bias.head === "number") deltas[CROP_HEAD] = bias.head;
|
||||
if (typeof bias.sides === "number") deltas[CROP_SIDES] = bias.sides;
|
||||
}
|
||||
|
||||
export function unpackBias(deltas: Record<string, number>): CropBias | null {
|
||||
@@ -99,6 +107,9 @@ export function unpackBias(deltas: Record<string, number>): CropBias | null {
|
||||
scale,
|
||||
dAngle: typeof deltas[CROP_ANGLE] === "number" ? deltas[CROP_ANGLE]! : 0,
|
||||
scene: typeof sceneCode === "number" ? (SCENE_FROM[sceneCode] ?? null) : null,
|
||||
...(typeof deltas[CROP_CUT] === "number" ? { cut: deltas[CROP_CUT]! } : {}),
|
||||
...(typeof deltas[CROP_HEAD] === "number" ? { head: deltas[CROP_HEAD]! } : {}),
|
||||
...(typeof deltas[CROP_SIDES] === "number" ? { sides: deltas[CROP_SIDES]! } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -117,6 +128,7 @@ export function correctionOf(
|
||||
auto: FoldedEdits,
|
||||
final: FoldedEdits,
|
||||
scene: CropBias["scene"] = null,
|
||||
subject: Box | null = null,
|
||||
): { deltas: Record<string, number>; cropScale: number | null; cropBias: CropBias | null } | null {
|
||||
const deltas: Record<string, number> = {};
|
||||
for (const k of TONE_KEYS) {
|
||||
@@ -129,7 +141,7 @@ export function correctionOf(
|
||||
const d = final.values[k]! - auto.values[k]!;
|
||||
if (Math.abs(d) <= limitOf(k).max) deltas[k] = Math.round(d * 1000) / 1000;
|
||||
}
|
||||
const cropBias = auto.crop && final.crop ? cropBiasOf(auto.crop, final.crop, scene) : null;
|
||||
const cropBias = auto.crop && final.crop ? cropBiasOf(auto.crop, final.crop, scene, subject) : null;
|
||||
const cropScale = cropBias ? cropBias.scale : null;
|
||||
if (cropBias) packBias(deltas, cropBias);
|
||||
if (!Object.keys(toneOffsets(deltas)).length && !cropBias) return null;
|
||||
@@ -147,9 +159,11 @@ export async function recordCorrection(db: Db, photoId: string): Promise<boolean
|
||||
if (!edits.some((e) => e.clientId !== "autopilot")) return false;
|
||||
const auto = fold(edits.filter((e) => e.clientId === "autopilot").map((e) => e.command as EditCommand));
|
||||
const final = fold(edits.map((e) => e.command as EditCommand));
|
||||
const reason = (photo.autopilot as { reason?: string } | null)?.reason;
|
||||
const stored = photo.autopilot as { reason?: string; subject?: Box } | null;
|
||||
const reason = stored?.reason;
|
||||
const scene = reason === "ball" || reason === "group" || reason === "person" ? reason : null;
|
||||
const c = correctionOf(auto, final, scene);
|
||||
const subject = stored?.subject && typeof stored.subject.x0 === "number" ? stored.subject : null;
|
||||
const c = correctionOf(auto, final, scene, subject);
|
||||
if (!c) {
|
||||
await db.developCorrection.deleteMany({ where: { photoId } });
|
||||
return false;
|
||||
@@ -165,6 +179,16 @@ export async function recordCorrection(db: Db, photoId: string): Promise<boolean
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Median of the values that exist, when most of them sit near it. Absolute (a cut on the body), not a direction. */
|
||||
function agreed(xs: (number | null | undefined)[], tol: number): number | null {
|
||||
const nums = xs.filter((x): x is number => typeof x === "number");
|
||||
if (nums.length < MIN_SAMPLES) return null;
|
||||
const m = median(nums);
|
||||
const agree = nums.filter((x) => Math.abs(x - m) <= tol).length / nums.length;
|
||||
if (agree < AGREEMENT) return null;
|
||||
return Math.round(m * 1000) / 1000;
|
||||
}
|
||||
|
||||
const median = (xs: number[]) => {
|
||||
const s = [...xs].sort((a, b) => a - b);
|
||||
const m = Math.floor(s.length / 2);
|
||||
@@ -225,14 +249,18 @@ export function styleOf(
|
||||
const mAng = median(angs);
|
||||
const agreeDx = dxs.filter((x) => Math.sign(x) === Math.sign(mDx) || Math.abs(mDx) < 0.01).length / dxs.length;
|
||||
const agreeDy = dys.filter((x) => Math.sign(x) === Math.sign(mDy) || Math.abs(mDy) < 0.01).length / dys.length;
|
||||
if ((Math.abs(mDx) >= 0.01 && agreeDx >= AGREEMENT) || (Math.abs(mDy) >= 0.01 && agreeDy >= AGREEMENT) || cropFactor) {
|
||||
const cut = agreed(pool.map((b) => b.cut), 0.1);
|
||||
const head = agreed(pool.map((b) => b.head), 0.06);
|
||||
const sides = agreed(pool.map((b) => b.sides), 0.08);
|
||||
if ((Math.abs(mDx) >= 0.01 && agreeDx >= AGREEMENT) || (Math.abs(mDy) >= 0.01 && agreeDy >= AGREEMENT) || cropFactor || cut !== null) {
|
||||
cropBias = {
|
||||
dx: Math.abs(mDx) >= 0.01 && agreeDx >= AGREEMENT ? Math.round(Math.max(-0.12, Math.min(0.12, mDx)) * 1000) / 1000 : 0,
|
||||
dy: Math.abs(mDy) >= 0.01 && agreeDy >= AGREEMENT ? Math.round(Math.max(-0.12, Math.min(0.12, mDy)) * 1000) / 1000 : 0,
|
||||
scale: cropFactor ?? 1,
|
||||
dAngle: Math.abs(mAng) >= 0.2 ? Math.round(Math.max(-3, Math.min(3, mAng)) * 100) / 100 : 0,
|
||||
...(cut !== null ? { cut, head, sides: sides ?? 0 } : {}),
|
||||
};
|
||||
if (!cropFactor && cropBias.dx === 0 && cropBias.dy === 0 && cropBias.dAngle === 0) cropBias = null;
|
||||
if (!cropFactor && cropBias.dx === 0 && cropBias.dy === 0 && cropBias.dAngle === 0 && cut === null) cropBias = null;
|
||||
}
|
||||
} else {
|
||||
// Legacy rows that only stored cropScale.
|
||||
|
||||
@@ -20,7 +20,7 @@ import { bestOf, FOCUS_SHARP, groupBursts, reportagePickCount } from "./bursts.j
|
||||
import { curate, matchMinutes } from "./curate.js";
|
||||
import { type LearntStyle, learntStyle } from "./learning.js";
|
||||
import { detailForCrop, lookValues } from "./look.js";
|
||||
import { exportTargets, MELHORES_GAP_MS, picksNeeded } from "./targets.js";
|
||||
import { exportTargets, galleryReceivers, MELHORES_GAP_MS, picksNeeded, type GalleryExport } from "./targets.js";
|
||||
|
||||
const STALE_RUNNING_MS = 10 * 60_000;
|
||||
/** A burst is decided once no new frame of it has arrived for this long. */
|
||||
@@ -63,6 +63,8 @@ export interface AutopilotRecord {
|
||||
chosen?: boolean;
|
||||
/** "ball": the picture cuts the ball, so it is not delivered. */
|
||||
hold?: "ball";
|
||||
/** Per destination gallery: true when this frame was picked for it, false when its window decided against it. */
|
||||
gallery?: Record<string, boolean>;
|
||||
/**
|
||||
* Planned develop/crop ops from analysis. Applied only when this frame is picked for the burst — never on the
|
||||
* near-duplicates left unflagged.
|
||||
@@ -374,15 +376,42 @@ export class AutopilotService {
|
||||
.filter((p) => (p.autopilot as unknown as AutopilotRecord | null)?.curated)
|
||||
.map((p) => ({ id: p.id, chosen: !!(p.autopilot as unknown as AutopilotRecord).chosen }));
|
||||
const targets = exportTargets(settings);
|
||||
const galleries = settings.galleries ?? [];
|
||||
// With 2+ exports, curate on the best frame; delivery below assigns best/2nd/… to each target.
|
||||
// Separate gallery sizes curate to the largest, and each smaller one keeps its own spread.
|
||||
const candidates = candidatesOf(ranked, settings.burstGapSec * 1000, true, "best");
|
||||
const decisions = curate(candidates, decided, {
|
||||
count: settings.bestCount,
|
||||
const curateOpts = {
|
||||
start: event.startsAt.getTime(),
|
||||
durationMs: matchMinutes(event.sport) * 60_000,
|
||||
now: now.getTime(),
|
||||
minGapMs: MELHORES_GAP_MS,
|
||||
};
|
||||
const decisions = curate(candidates, decided, {
|
||||
count: galleries.length ? Math.max(...galleries.map((g) => g.count)) : settings.bestCount,
|
||||
...curateOpts,
|
||||
});
|
||||
const chosenBy = new Map<string, Set<string>>();
|
||||
const seenBy = new Map<string, Set<string>>();
|
||||
if (galleries.length) {
|
||||
const max = Math.max(...galleries.map((g) => g.count));
|
||||
const bigChosen = new Set(decisions.flatMap((d) => d.chosen));
|
||||
const bigSeen = new Set(decisions.flatMap((d) => d.ids));
|
||||
for (const g of galleries) {
|
||||
if (g.count !== max) continue;
|
||||
chosenBy.set(g.targetId, bigChosen);
|
||||
seenBy.set(g.targetId, bigSeen);
|
||||
}
|
||||
for (const g of galleries) {
|
||||
if (g.count === max) continue;
|
||||
const earlier = photos.flatMap((p) => {
|
||||
const flag = (p.autopilot as unknown as AutopilotRecord | null)?.gallery?.[g.targetId];
|
||||
return flag === undefined ? [] : [{ id: p.id, chosen: flag }];
|
||||
});
|
||||
const parts = curate(candidates, earlier, { count: g.count, ...curateOpts });
|
||||
chosenBy.set(g.targetId, new Set(parts.flatMap((d) => d.chosen)));
|
||||
seenBy.set(g.targetId, new Set(parts.flatMap((d) => d.ids)));
|
||||
}
|
||||
}
|
||||
const records = new Map(photos.map((p) => [p.id, p.autopilot as unknown as AutopilotRecord | null]));
|
||||
// Frames that were not their burst's candidate are decided with it.
|
||||
const burstOf = new Map<string, string[]>();
|
||||
@@ -400,12 +429,13 @@ export class AutopilotService {
|
||||
for (const id of ids) {
|
||||
const rec = records.get(id);
|
||||
if (!rec || rec.curated) continue;
|
||||
await db.photo.update({ where: { id }, data: { autopilot: { ...rec, curated: true, chosen: chosen.has(id) } as object } });
|
||||
const gallery = galleryMarks(id, galleries, chosenBy, seenBy, rec.gallery);
|
||||
await db.photo.update({ where: { id }, data: { autopilot: { ...rec, curated: true, chosen: chosen.has(id), ...(gallery ? { gallery } : {}) } as object } });
|
||||
nowCurated.push(id);
|
||||
}
|
||||
const when = new Map(photos.map((p) => [p.id, p.capturedAt]));
|
||||
chosenCount += chosen.size;
|
||||
if (targets.length && this.deps.deliveries && event.createdById) {
|
||||
if (!galleries.length && targets.length && this.deps.deliveries && event.createdById) {
|
||||
// Per chosen moment (burst): rank i → export i. Same photo never to two destinations.
|
||||
for (const momentId of chosen) {
|
||||
const burstIds = burstOf.get(momentId) ?? [momentId];
|
||||
@@ -427,6 +457,33 @@ export class AutopilotService {
|
||||
}
|
||||
if (d.window >= 0) log.info({ eventId, window: d.window, candidates: d.ids.length, chosen: chosen.size }, "autopilot: best of the window");
|
||||
}
|
||||
if (galleries.length && this.deps.deliveries && event.createdById) {
|
||||
const when = new Map(photos.map((p) => [p.id, p.capturedAt]));
|
||||
const moments = new Set<string>();
|
||||
for (const [targetId, picked] of chosenBy) {
|
||||
const seen = seenBy.get(targetId);
|
||||
for (const id of picked) if (seen?.has(id)) moments.add(id);
|
||||
}
|
||||
for (const momentId of moments) {
|
||||
if (!takenHere([momentId], when, event).length) continue;
|
||||
for (const targetId of galleryReceivers(momentId, galleries, chosenBy)) {
|
||||
await this.deps.deliveries
|
||||
.enqueue({ organizationId: event.organizationId, targetId, photoIds: [momentId], again: false, requestedById: event.createdById })
|
||||
.catch((err: unknown) => log.warn({ err, targetId }, "autopilot: delivery not queued"));
|
||||
}
|
||||
}
|
||||
// Windows already closed before these galleries existed still need their decision recorded.
|
||||
for (const [targetId, seen] of seenBy) {
|
||||
for (const id of seen) {
|
||||
const rec = records.get(id);
|
||||
if (!rec?.curated || rec.gallery?.[targetId] !== undefined) continue;
|
||||
const gallery = galleryMarks(id, galleries, chosenBy, seenBy, rec.gallery);
|
||||
if (!gallery) continue;
|
||||
rec.gallery = gallery;
|
||||
await db.photo.update({ where: { id }, data: { autopilot: { ...rec, gallery } as object } });
|
||||
}
|
||||
}
|
||||
}
|
||||
return chosenCount;
|
||||
}
|
||||
}
|
||||
@@ -435,6 +492,24 @@ export class AutopilotService {
|
||||
* The photos of a decided window that go to the second client: the picked ones (by the autopilot or a person) the
|
||||
* gallery did not take. Never a chosen one, so no photo reaches both clients.
|
||||
*/
|
||||
/** Gallery flags for a frame whose window was decided this pass. Unmentioned destinations stay as they were. */
|
||||
function galleryMarks(
|
||||
id: string,
|
||||
galleries: readonly GalleryExport[],
|
||||
chosenBy: ReadonlyMap<string, ReadonlySet<string>>,
|
||||
seenBy: ReadonlyMap<string, ReadonlySet<string>>,
|
||||
previous: Record<string, boolean> | undefined,
|
||||
): Record<string, boolean> | undefined {
|
||||
const flags: Record<string, boolean> = { ...previous };
|
||||
let touched = false;
|
||||
for (const g of galleries) {
|
||||
if (!seenBy.get(g.targetId)?.has(id)) continue;
|
||||
flags[g.targetId] = chosenBy.get(g.targetId)?.has(id) ?? false;
|
||||
touched = true;
|
||||
}
|
||||
return touched ? flags : undefined;
|
||||
}
|
||||
|
||||
export function restOf(ids: readonly string[], chosen: ReadonlySet<string>, flags: ReadonlyMap<string, string>): string[] {
|
||||
return ids.filter((id) => !chosen.has(id) && flags.get(id) === "PICK");
|
||||
}
|
||||
|
||||
@@ -31,3 +31,23 @@ export function picksNeeded(settings: AutopilotSettings): number {
|
||||
|
||||
/** Melhores spacing between two sends to the same destination (ms). */
|
||||
export const MELHORES_GAP_MS = 5_000;
|
||||
|
||||
export interface GalleryExport {
|
||||
targetId: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destinations that receive this frame. A frame picked for a smaller gallery also goes to every larger one,
|
||||
* so the short gallery is part of the long one. A frame only the long gallery picked stays out of the short one.
|
||||
*/
|
||||
export function galleryReceivers(momentId: string, galleries: readonly GalleryExport[], chosen: ReadonlyMap<string, ReadonlySet<string>>): string[] {
|
||||
if (!galleries.length) return [];
|
||||
const max = Math.max(...galleries.map((g) => g.count));
|
||||
const hit = galleries.filter((g) => chosen.get(g.targetId)?.has(momentId));
|
||||
const ids = new Set(hit.map((g) => g.targetId));
|
||||
if (hit.some((g) => g.count < max)) {
|
||||
for (const g of galleries) if (g.count === max) ids.add(g.targetId);
|
||||
}
|
||||
return [...ids];
|
||||
}
|
||||
@@ -74,6 +74,35 @@ export function biasCrop(r: Box, subject: Box, bias: { dx: number; dy: number; s
|
||||
return { x0, y0, x1: x0 + w, y1: y0 + h };
|
||||
}
|
||||
|
||||
/**
|
||||
* Place the crop on the person the way the photographer does: the bottom at `cut` (1 = feet, less = legs removed),
|
||||
* the top at `head` above the head, the sides eating `sides` of the body. The crop keeps the shape of `base`.
|
||||
* Unlike `biasCrop`, the body is allowed to leave the frame: that is the correction being copied.
|
||||
*/
|
||||
export function frameOnSubject(base: Box, subject: Box, intent: { cut?: number | null; head?: number | null; sides?: number | null }): Box {
|
||||
const sh = Math.max(0.05, subject.y1 - subject.y0);
|
||||
const sw = Math.max(0.02, subject.x1 - subject.x0);
|
||||
const cut = Math.min(1.25, Math.max(0.4, intent.cut ?? (base.y1 - subject.y0) / sh));
|
||||
const head = Math.min(0.4, Math.max(-0.1, intent.head ?? (subject.y0 - base.y0) / sh));
|
||||
const sides = Math.min(0.4, Math.max(0, intent.sides ?? 0));
|
||||
let y1 = Math.min(1, Math.max(0.2, subject.y0 + cut * sh));
|
||||
let y0 = Math.min(y1 - 0.12, Math.max(0, subject.y0 - head * sh));
|
||||
if (y0 < 0) y0 = 0;
|
||||
const ratio = (base.x1 - base.x0) / Math.max(0.05, base.y1 - base.y0);
|
||||
let height = y1 - y0;
|
||||
let width = height * ratio;
|
||||
if (width > 1) {
|
||||
width = 1;
|
||||
height = width / ratio;
|
||||
y0 = Math.max(0, y1 - height);
|
||||
}
|
||||
const cx = (subject.x0 + sides * sw / 2 + subject.x1 - sides * sw / 2) / 2;
|
||||
let x0 = cx - width / 2;
|
||||
if (x0 < 0) x0 = 0;
|
||||
if (x0 + width > 1) x0 = Math.max(0, 1 - width);
|
||||
return { x0, y0, x1: x0 + width, y1: y0 + height };
|
||||
}
|
||||
|
||||
/** Expand `r` by `factor` (>1) about the subject's centre, without leaving the photo. */
|
||||
function looser(r: Box, subject: Box, factor: number): Box {
|
||||
const w = Math.min(1, (r.x1 - r.x0) * factor);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { EditCommand } from "@photoreport/contracts";
|
||||
import { type Box, type Detections, type FocusHint, clipsBall, compose, minCropWidth, planCrop } from "./compose.js";
|
||||
import { biasCrop, constrainRotated, tighter } from "./geometry.js";
|
||||
import { biasCrop, constrainRotated, frameOnSubject, tighter } from "./geometry.js";
|
||||
import { type Look, WB_KEYS, TONE_KEYS, detailForCrop, lookValues, toneApplied } from "../autopilot/look.js";
|
||||
import type { CropBias } from "../autopilot/cropBias.js";
|
||||
|
||||
@@ -96,7 +96,15 @@ export function planFrame(input: {
|
||||
let rect = composition.rect;
|
||||
const bias = input.cropBias;
|
||||
const factor = bias?.scale ?? input.cropFactor ?? null;
|
||||
if (bias && (bias.dx || bias.dy || (factor && factor !== 1))) {
|
||||
if (bias && typeof bias.cut === "number") {
|
||||
// The photographer's cut on the body (legs, head, arms), not a uniform shrink.
|
||||
rect = frameOnSubject(composition.rect, composition.subject, bias);
|
||||
if (bias.dx) {
|
||||
const w = rect.x1 - rect.x0;
|
||||
const x0 = Math.min(Math.max(0, rect.x0 + bias.dx), 1 - w);
|
||||
rect = { ...rect, x0, x1: x0 + w };
|
||||
}
|
||||
} else if (bias && (bias.dx || bias.dy || (factor && factor !== 1))) {
|
||||
rect = biasCrop(composition.rect, composition.subject, { dx: bias.dx, dy: bias.dy, scale: factor ?? 1 });
|
||||
} else if (factor && factor !== 1) {
|
||||
rect = factor < 1 ? tighter(composition.rect, composition.subject, factor) : biasCrop(composition.rect, composition.subject, { dx: 0, dy: 0, scale: factor });
|
||||
|
||||
@@ -591,8 +591,8 @@ export class DeliveryService {
|
||||
}
|
||||
const client = this.client(item.target);
|
||||
await client.ensureFolder(folder);
|
||||
// The author as the service shows it: the photographer's name from the IPTC creator ("Peter Spark / PhotoReport.pt").
|
||||
const creator = typeof iptc?.values.creator === "string" ? iptc.values.creator.split(" / ")[0]!.trim() : "";
|
||||
// ZeroZero's Autor / Fotógrafo is this whole line ("Peter Spark / Kapta+"), not only the name before the slash.
|
||||
const creator = typeof iptc?.values.creator === "string" ? iptc.values.creator.trim() : "";
|
||||
const remote = await client.upload(folder + fileName, data, { author: creator || item.photo.uploader?.name || undefined });
|
||||
const remotePath = typeof remote === "string" ? remote : folder + fileName;
|
||||
// "synced-…" means the desk already had this file, so this attempt did not put a new image up.
|
||||
|
||||
@@ -93,6 +93,14 @@ export function withCameraRatingChecked(exif: unknown): Record<string, unknown>
|
||||
return { ...base, [CAMERA_RATING_CHECKED]: true };
|
||||
}
|
||||
|
||||
const CAPTURE_CLOCK_CHECKED = "captureClockChecked";
|
||||
|
||||
/** Marks a photo whose capture time was compared again with the file, so the winter-offset repair does not repeat. */
|
||||
export function withCaptureClockChecked(exif: unknown): Record<string, unknown> {
|
||||
const base = exif && typeof exif === "object" && !Array.isArray(exif) ? { ...(exif as Record<string, unknown>) } : {};
|
||||
return { ...base, [CAPTURE_CLOCK_CHECKED]: true };
|
||||
}
|
||||
|
||||
const TIME_ZONE = "Europe/Lisbon";
|
||||
|
||||
/** Offset of a time zone at a given UTC instant, in minutes (Lisbon: 0 in winter, 60 in summer). */
|
||||
@@ -112,9 +120,17 @@ function zoneOffsetMinutes(utc: Date, timeZone: string): number {
|
||||
return Math.round((asUtc - utc.getTime()) / 60000);
|
||||
}
|
||||
|
||||
/** Lisbon's offset at a wall-clock moment, in minutes. Two passes settle the hour around a DST change. */
|
||||
function lisbonOffsetMinutes(wallUtc: number): number {
|
||||
let guess = wallUtc - zoneOffsetMinutes(new Date(wallUtc), TIME_ZONE) * 60000;
|
||||
guess = wallUtc - zoneOffsetMinutes(new Date(guess), TIME_ZONE) * 60000;
|
||||
return Math.round((wallUtc - guess) / 60000);
|
||||
}
|
||||
|
||||
/**
|
||||
* EXIF stores wall-clock time. Use the offset the camera wrote (OffsetTimeOriginal, recent bodies) and
|
||||
* otherwise assume the camera is set to Lisbon time, the norm for our coverage.
|
||||
* A body often keeps +01:00 after the clock is set to winter time. That offset is ignored: the clock is Lisbon.
|
||||
*/
|
||||
export function parseExifDate(value: unknown, offset?: unknown, subSec?: unknown): Date | undefined {
|
||||
if (typeof value !== "string") return undefined;
|
||||
@@ -127,12 +143,10 @@ export function parseExifDate(value: unknown, offset?: unknown, subSec?: unknown
|
||||
const off = typeof offset === "string" ? /^([+-])(\d{2}):(\d{2})$/.exec(offset.trim()) : null;
|
||||
if (off) {
|
||||
const minutes = (Number(off[2]) * 60 + Number(off[3])) * (off[1] === "-" ? -1 : 1);
|
||||
return new Date(wall - minutes * 60000);
|
||||
const lisbon = lisbonOffsetMinutes(wall);
|
||||
if (!(minutes === 60 && lisbon === 0)) return new Date(wall - minutes * 60000);
|
||||
}
|
||||
// Two passes settle the offset around DST changes.
|
||||
let guess = new Date(wall - zoneOffsetMinutes(new Date(wall), TIME_ZONE) * 60000);
|
||||
guess = new Date(wall - zoneOffsetMinutes(guess, TIME_ZONE) * 60000);
|
||||
return guess;
|
||||
return new Date(wall - lisbonOffsetMinutes(wall) * 60000);
|
||||
}
|
||||
|
||||
const str = (v: unknown) => (typeof v === "string" && v.trim() !== "" ? v.trim().replace(/\0+$/, "") : undefined);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { stripNulBytes } from "../lib/sanitize.js";
|
||||
import type { Broadcaster } from "../realtime.js";
|
||||
import { LocalStorage, sha256File, UrlSigner, VARIANT_SIZE } from "../storage/storage.js";
|
||||
import { readEmbeddedIptc } from "./embedded.js";
|
||||
import { cullFromCameraRating, readCameraInfo, withCameraRatingChecked } from "./exif.js";
|
||||
import { cullFromCameraRating, readCameraInfo, withCameraRatingChecked, withCaptureClockChecked } from "./exif.js";
|
||||
import { jpegFileComplete } from "./jpeg.js";
|
||||
|
||||
export const ACCEPTED_EXTENSIONS = new Set([".jpg", ".jpeg"]);
|
||||
@@ -496,6 +496,60 @@ export class IngestService {
|
||||
return applied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Photos stored an hour early because the camera still writes +01:00 in winter. Re-read the stored file
|
||||
* (the original, or the preview the desktop sent, which keeps the camera's clock) and, when it moves by
|
||||
* that hour, put the capture time right and let the autopilot decide the frame again.
|
||||
*/
|
||||
async backfillCaptureClock(limit = 100): Promise<number> {
|
||||
const { db, storage, log } = this.deps;
|
||||
const rows = await db.$queryRaw<
|
||||
Array<{ id: string; storage_key: string; captured_at: Date | null; taken_at: Date; autopilot: unknown; exif: unknown }>
|
||||
>`
|
||||
SELECT id, storage_key, captured_at, taken_at, autopilot, exif
|
||||
FROM photos
|
||||
WHERE status = 'READY'
|
||||
AND created_at > now() - interval '3 days'
|
||||
AND (
|
||||
exif IS NULL
|
||||
OR jsonb_typeof(exif::jsonb) <> 'object'
|
||||
OR COALESCE((exif::jsonb->>'captureClockChecked')::boolean, false) IS NOT TRUE
|
||||
)
|
||||
ORDER BY created_at DESC
|
||||
LIMIT ${limit}
|
||||
`;
|
||||
let fixed = 0;
|
||||
for (const row of rows) {
|
||||
const camera = await readCameraInfo(storage.resolve(row.storage_key)).catch(() => null);
|
||||
const next = camera?.capturedAt ?? null;
|
||||
const prev = row.captured_at ? new Date(row.captured_at).getTime() : null;
|
||||
const hourOff = next && prev !== null && Math.abs(next.getTime() - prev - 3_600_000) < 2_000;
|
||||
const autopilot = row.autopilot && typeof row.autopilot === "object" && !Array.isArray(row.autopilot) ? { ...(row.autopilot as Record<string, unknown>) } : null;
|
||||
if (hourOff && autopilot) {
|
||||
delete autopilot.curated;
|
||||
delete autopilot.chosen;
|
||||
delete autopilot.gallery;
|
||||
}
|
||||
const taken = new Date(row.taken_at).getTime();
|
||||
await db.photo.update({
|
||||
where: { id: row.id },
|
||||
data: {
|
||||
exif: withCaptureClockChecked(row.exif) as Prisma.InputJsonValue,
|
||||
...(hourOff && next
|
||||
? {
|
||||
capturedAt: next,
|
||||
...(prev !== null && Math.abs(taken - prev) < 2_000 ? { takenAt: next } : {}),
|
||||
...(autopilot ? { autopilot: autopilot as Prisma.InputJsonValue } : {}),
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
if (hourOff) fixed++;
|
||||
}
|
||||
if (rows.length) log.info({ scanned: rows.length, fixed }, "ingest: capture clock repair");
|
||||
return fixed;
|
||||
}
|
||||
|
||||
private async makeDerivatives(orgId: string, sha256: string, storageKey: string): Promise<{ width: number; height: number }> {
|
||||
const { storage } = this.deps;
|
||||
const source = storage.resolve(storageKey);
|
||||
|
||||
@@ -15,6 +15,16 @@ import { splitStoredPlace } from "../sports/providers.js";
|
||||
import { claimInbox } from "./adopt.js";
|
||||
|
||||
const HOUR = 3600_000;
|
||||
|
||||
/** An older app does not send `galleries`. Keep the sizes already stored instead of clearing them. */
|
||||
function keptGalleries(next: AutopilotSettings | null, current: Prisma.JsonValue): AutopilotSettings | typeof Prisma.DbNull {
|
||||
if (!next) return Prisma.DbNull;
|
||||
if (next.galleries !== undefined) return next;
|
||||
if (!current || typeof current !== "object" || Array.isArray(current)) return next;
|
||||
const kept = (current as { galleries?: AutopilotSettings["galleries"] }).galleries;
|
||||
if (!Array.isArray(kept) || kept.length === 0) return next;
|
||||
return { ...next, galleries: kept };
|
||||
}
|
||||
const OrgParams = z.object({ orgId: z.uuid() });
|
||||
const EventParams = z.object({ eventId: z.uuid() });
|
||||
|
||||
@@ -242,7 +252,7 @@ export async function registerEventRoutes(app: FastifyInstance, deps: { db: Db;
|
||||
...(startsAt && { startsAt }),
|
||||
...window,
|
||||
...(iptcTemplate && { iptcTemplate }),
|
||||
...(autopilot !== undefined && { autopilot: autopilot ?? Prisma.DbNull }),
|
||||
...(autopilot !== undefined && { autopilot: keptGalleries(autopilot, current.autopilot) }),
|
||||
...(archived !== undefined && { archivedAt: archived ? (current.archivedAt ?? new Date()) : null }),
|
||||
},
|
||||
include,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { MODULES } from "@photoreport/contracts";
|
||||
import { DeskCommand, MODULES } from "@photoreport/contracts";
|
||||
import type { FastifyInstance } from "fastify";
|
||||
import { z } from "zod";
|
||||
import { currentUserId, requireAuth } from "../auth/guard.js";
|
||||
import type { SessionService } from "../auth/sessions.js";
|
||||
import type { Db } from "../db.js";
|
||||
import { notFound } from "../lib/errors.js";
|
||||
import { silentBroadcaster, type Broadcaster } from "../realtime.js";
|
||||
|
||||
const PreferencesBody = z.object({
|
||||
editorModules: z
|
||||
@@ -13,8 +14,9 @@ const PreferencesBody = z.object({
|
||||
.transform((mods) => [...new Set(mods)]),
|
||||
});
|
||||
|
||||
export async function registerMeRoutes(app: FastifyInstance, deps: { db: Db; sessions: SessionService }) {
|
||||
export async function registerMeRoutes(app: FastifyInstance, deps: { db: Db; sessions: SessionService; broadcaster?: Broadcaster }) {
|
||||
const { db } = deps;
|
||||
const broadcaster = deps.broadcaster ?? silentBroadcaster;
|
||||
const authenticate = requireAuth(deps.sessions);
|
||||
|
||||
app.get("/v1/me", { preHandler: authenticate }, async (req) => {
|
||||
@@ -52,4 +54,11 @@ export async function registerMeRoutes(app: FastifyInstance, deps: { db: Db; ses
|
||||
});
|
||||
return { editorModules: prefs.editorModules };
|
||||
});
|
||||
|
||||
/** The assistant asks the open PhotoReport of this person to change module, photo or tool. */
|
||||
app.post("/v1/me/desk", { preHandler: authenticate }, async (req) => {
|
||||
const command = DeskCommand.parse(req.body);
|
||||
broadcaster.desk(currentUserId(req), command);
|
||||
return { ok: true as const };
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIBRARY_CHANNEL, type LibraryMessage, roomForOrg, roomForUser } from "@photoreport/contracts";
|
||||
import { LIBRARY_CHANNEL, type DeskCommand, type LibraryMessage, roomForOrg, roomForUser } from "@photoreport/contracts";
|
||||
import type { Server as HttpServer } from "node:http";
|
||||
import pg from "pg";
|
||||
import { Server } from "socket.io";
|
||||
@@ -8,17 +8,23 @@ import type { Db } from "./db.js";
|
||||
/** Anything that can push library messages to the people of an organization. */
|
||||
export interface Broadcaster {
|
||||
library(organizationId: string, message: LibraryMessage): void;
|
||||
/** The open PhotoReport of this user: change module, photo or tool. */
|
||||
desk(userId: string, command: DeskCommand): void;
|
||||
close(): Promise<void>;
|
||||
}
|
||||
|
||||
export const silentBroadcaster: Broadcaster = { library: () => {}, close: async () => {} };
|
||||
export const silentBroadcaster: Broadcaster = { library: () => {}, desk: () => {}, close: async () => {} };
|
||||
|
||||
/** Records messages; used by tests. */
|
||||
export class MemoryBroadcaster implements Broadcaster {
|
||||
readonly sent: { organizationId: string; message: LibraryMessage }[] = [];
|
||||
readonly deskSent: { userId: string; command: DeskCommand }[] = [];
|
||||
library(organizationId: string, message: LibraryMessage): void {
|
||||
this.sent.push({ organizationId, message });
|
||||
}
|
||||
desk(userId: string, command: DeskCommand): void {
|
||||
this.deskSent.push({ userId, command });
|
||||
}
|
||||
async close(): Promise<void> {}
|
||||
}
|
||||
|
||||
@@ -27,6 +33,8 @@ export class MemoryBroadcaster implements Broadcaster {
|
||||
* delivers to its own sockets, the ingest worker only publishes. No Redis, no sticky sessions.
|
||||
*/
|
||||
const PG_CHANNEL = "photoreport_realtime";
|
||||
/** Window instructions, delivered to one person's sockets (not the whole organization). */
|
||||
const DESK_CHANNEL = "photoreport_desk";
|
||||
/** NOTIFY payloads are limited to 8000 bytes; batch updates are split so each message fits. */
|
||||
const IDS_PER_MESSAGE = 100;
|
||||
|
||||
@@ -113,8 +121,14 @@ export function attachRealtime(
|
||||
if (closed) return;
|
||||
const client = new pg.Client({ connectionString: deps.databaseUrl });
|
||||
client.on("notification", (n) => {
|
||||
if (n.channel !== PG_CHANNEL || !n.payload) return;
|
||||
if (!n.payload) return;
|
||||
try {
|
||||
if (n.channel === DESK_CHANNEL) {
|
||||
const { userId, command } = JSON.parse(n.payload) as { userId: string; command: DeskCommand };
|
||||
io.to(roomForUser(userId)).emit("desk", command);
|
||||
return;
|
||||
}
|
||||
if (n.channel !== PG_CHANNEL) return;
|
||||
const { organizationId, message } = JSON.parse(n.payload) as Envelope;
|
||||
io.to(roomForOrg(organizationId)).emit(LIBRARY_CHANNEL, message);
|
||||
} catch (err) {
|
||||
@@ -132,6 +146,7 @@ export function attachRealtime(
|
||||
return;
|
||||
}
|
||||
await client.query(`LISTEN ${PG_CHANNEL}`);
|
||||
await client.query(`LISTEN ${DESK_CHANNEL}`);
|
||||
listener = client;
|
||||
};
|
||||
const ready = listen().catch((err) => {
|
||||
@@ -139,8 +154,18 @@ export function attachRealtime(
|
||||
if (!closed) retry = setTimeout(() => void listen().catch(onError), 1000);
|
||||
});
|
||||
|
||||
const desk = (userId: string, command: DeskCommand) => {
|
||||
if (closed) return;
|
||||
const q = pool.query("SELECT pg_notify($1, $2)", [DESK_CHANNEL, JSON.stringify({ userId, command })]).catch((err) => {
|
||||
if (closed && isPoolEndedError(err)) return;
|
||||
onError(err);
|
||||
});
|
||||
trackPending(pending)(q);
|
||||
};
|
||||
|
||||
return {
|
||||
library: publisher(pool, onError, () => closed, trackPending(pending)),
|
||||
desk,
|
||||
close: async () => {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
@@ -159,8 +184,17 @@ export function createRemoteBroadcaster(databaseUrl: string, onError: (err: unkn
|
||||
const pool = new pg.Pool({ connectionString: databaseUrl, max: 1 });
|
||||
let closed = false;
|
||||
const pending = new Set<Promise<unknown>>();
|
||||
const desk = (userId: string, command: DeskCommand) => {
|
||||
if (closed) return;
|
||||
const q = pool.query("SELECT pg_notify($1, $2)", [DESK_CHANNEL, JSON.stringify({ userId, command })]).catch((err) => {
|
||||
if (closed && isPoolEndedError(err)) return;
|
||||
onError(err);
|
||||
});
|
||||
trackPending(pending)(q);
|
||||
};
|
||||
return {
|
||||
library: publisher(pool, onError, () => closed, trackPending(pending)),
|
||||
desk,
|
||||
close: async () => {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
|
||||
@@ -186,8 +186,10 @@ invoices.start();
|
||||
// Photos that arrived before on-camera stars were read: apply Rating from the original in storage.
|
||||
const ratingBackfill = setInterval(() => {
|
||||
void ingest.backfillCameraRatings(25).catch((err) => log.warn({ err }, "ingest: camera rating backfill failed"));
|
||||
void ingest.backfillCaptureClock(100).catch((err) => log.warn({ err }, "ingest: capture clock repair failed"));
|
||||
}, 60_000);
|
||||
void ingest.backfillCameraRatings(25).catch((err) => log.warn({ err }, "ingest: camera rating backfill failed"));
|
||||
void ingest.backfillCaptureClock(100).catch((err) => log.warn({ err }, "ingest: capture clock repair failed"));
|
||||
log.info({ ingestRoot: config.INGEST_ROOT, storage: config.STORAGE_ROOT }, "worker started");
|
||||
|
||||
/** Drain in-flight jobs before ending the Prisma/pg pool (BIT-31189). Leave headroom under PM2 kill_timeout. */
|
||||
|
||||
@@ -5,7 +5,7 @@ import sharp from "sharp";
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { AutopilotService } from "../src/autopilot/service.js";
|
||||
import { bestOf, groupBursts, reportagePickCount } from "../src/autopilot/bursts.js";
|
||||
import { type Candidate, actionScore, curate } from "../src/autopilot/curate.js";
|
||||
import { type Candidate, actionScore, curate, galleryCeiling } from "../src/autopilot/curate.js";
|
||||
import { correctionOf, fold, learntStyle, recordCorrection, styleOf } from "../src/autopilot/learning.js";
|
||||
import type { Detections } from "../src/composition/compose.js";
|
||||
import type { SubjectDetector } from "../src/composition/detect.js";
|
||||
@@ -103,7 +103,10 @@ describe("only the best", () => {
|
||||
const opts = { count: 30, start, durationMs: 105 * min, now: start + 200 * min };
|
||||
const all = curate(frames, [], opts).flatMap((d) => d.chosen);
|
||||
expect(all.length).toBeGreaterThanOrEqual(28);
|
||||
expect(all.length).toBeLessThanOrEqual(33);
|
||||
expect(all.length).toBeLessThanOrEqual(galleryCeiling(30));
|
||||
expect(galleryCeiling(30)).toBe(35);
|
||||
expect(galleryCeiling(100)).toBe(115);
|
||||
expect(galleryCeiling(300)).toBe(325);
|
||||
expect(all).toContain(great.id);
|
||||
expect(all).not.toContain(twin.id);
|
||||
expect(all).not.toContain(rejected.id);
|
||||
@@ -163,6 +166,23 @@ describe("learning from corrections", () => {
|
||||
expect(openStyle.cropFactor).toBeGreaterThan(1);
|
||||
expect(openStyle.cropBias?.dx).toBeCloseTo(0.02, 2);
|
||||
});
|
||||
|
||||
it("learns where the crop cuts the person, not only the ratio", () => {
|
||||
const subject = { x0: 0.3, y0: 0.15, x1: 0.7, y1: 0.95 };
|
||||
const auto = fold([crop(0.1, 0.9)]);
|
||||
// Bottom at the waist: (0.55 - 0.15) / 0.8 = 0.5. Sides eat into the body.
|
||||
const final = fold([{ command: "crop.set", params: { rect: { x0: 0.38, y0: 0.12, x1: 0.62, y1: 0.55 }, angle: 0, aspect: null } }]);
|
||||
const c = correctionOf(auto, final, "person", subject);
|
||||
expect(c?.cropBias?.cut).toBeCloseTo(0.5, 2);
|
||||
expect(c?.cropBias?.sides).toBeGreaterThan(0.08);
|
||||
const rows = [0.5, 0.52, 0.48, 0.51, 0.49].map((cut) => ({
|
||||
deltas: { "__crop.scale": 0.8, "__crop.dx": 0, "__crop.dy": 0, "__crop.dAngle": 0, "__crop.cut": cut, "__crop.head": 0.04, "__crop.sides": 0.12 },
|
||||
cropScale: 0.8,
|
||||
}));
|
||||
const style = styleOf(rows, null);
|
||||
expect(style.cropBias?.cut).toBeCloseTo(0.5, 2);
|
||||
expect(style.cropBias?.sides).toBeCloseTo(0.12, 2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("autopilot", () => {
|
||||
|
||||
@@ -585,7 +585,7 @@ describe("delivery", () => {
|
||||
method: "POST",
|
||||
url: `/v1/orgs/${orgId}/delivery-targets`,
|
||||
headers: bearer(token),
|
||||
payload: { name: "ZeroZero", kind: "ZEROZERO", baseUrl: "https://fotos.zerozero.pt", username: "kapta", password: "zz-pass", folderTemplate: "zerozero", fileNameTemplate: "PS_{home} x {away}_{n}.jpg", longEdge: 3000, jpegQuality: 92 },
|
||||
payload: { name: "ZeroZero", kind: "ZEROZERO", baseUrl: "https://fotos.zerozero.pt", username: "kapta", password: "zz-pass", folderTemplate: "zerozero", fileNameTemplate: "PS_{home} x {away}_{n}.jpg", longEdge: 3000, jpegQuality: 92, iptcOverrides: { creator: "Peter Spark / Kapta+", credit: "Peter Spark / Kapta+", copyright: "Peter Spark / Kapta+", source: "Peter Spark / Kapta+" } },
|
||||
});
|
||||
expect(created.statusCode).toBe(201);
|
||||
const targetId = (created.json() as { id: string }).id;
|
||||
@@ -619,7 +619,7 @@ describe("delivery", () => {
|
||||
expect(items.map((i) => i.remotePath).sort()).toEqual(["12627747/img-1", "12627747/img-2"]);
|
||||
expect((await ctx.db.event.findUniqueOrThrow({ where: { id: event.id } })).zerozeroGameId).toBe("12627747");
|
||||
const first = [...zz.uploads.values()].find((u) => u.meta.filename?.endsWith("_1.jpg"))!;
|
||||
expect(first.meta).toMatchObject({ match_id: "12627747", artist: "Peter Spark", filename: "PS_SC Torreense x Sunderland_1.jpg", filetype: "image/jpeg" });
|
||||
expect(first.meta).toMatchObject({ match_id: "12627747", artist: "Peter Spark / Kapta+", filename: "PS_SC Torreense x Sunderland_1.jpg", filetype: "image/jpeg" });
|
||||
expect(first.data.length).toBe(first.length);
|
||||
expect((await sharp(first.data).metadata()).width).toBe(3000);
|
||||
// Signed in once for the whole batch.
|
||||
|
||||
@@ -20,9 +20,11 @@ async function jpeg(opts: { color?: string; taken?: string; width?: number; heig
|
||||
}
|
||||
|
||||
describe("EXIF dates", () => {
|
||||
it("reads Lisbon wall-clock time, honouring the camera offset when present", () => {
|
||||
it("reads Lisbon wall-clock time, and ignores a summer offset left on in winter", () => {
|
||||
expect(parseExifDate("2026:09:23 21:14:07")?.toISOString()).toBe("2026-09-23T20:14:07.000Z"); // summer, UTC+1
|
||||
expect(parseExifDate("2026:12:05 21:14:07")?.toISOString()).toBe("2026-12-05T21:14:07.000Z"); // winter, UTC+0
|
||||
expect(parseExifDate("2026:09:23 21:14:07", "+01:00")?.toISOString()).toBe("2026-09-23T20:14:07.000Z");
|
||||
expect(parseExifDate("2026:11:07 16:07:06", "+01:00")?.toISOString()).toBe("2026-11-07T16:07:06.000Z");
|
||||
expect(parseExifDate("2026:09:23 21:14:07", "+02:00", "25")?.toISOString()).toBe("2026-09-23T19:14:07.250Z");
|
||||
expect(parseExifDate("0000:00:00 00:00:00")).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { AutopilotSettings } from "@photoreport/contracts";
|
||||
import { exportTargets, picksNeeded } from "../src/autopilot/targets.js";
|
||||
import { exportTargets, galleryReceivers, picksNeeded } from "../src/autopilot/targets.js";
|
||||
|
||||
const a = "11111111-1111-4111-8111-111111111111";
|
||||
const b = "22222222-2222-4222-8222-222222222222";
|
||||
@@ -27,3 +27,29 @@ describe("picksNeeded", () => {
|
||||
expect(picksNeeded(AutopilotSettings.parse({ enabled: true, picksPerBurst: 2 }))).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("galleryReceivers", () => {
|
||||
const zz = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
|
||||
const liga = "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb";
|
||||
const galleries = [
|
||||
{ targetId: zz, count: 30 },
|
||||
{ targetId: liga, count: 100 },
|
||||
];
|
||||
|
||||
it("sends a short-gallery frame to the short client and to the larger one", () => {
|
||||
const chosen = new Map<string, Set<string>>([
|
||||
[zz, new Set(["p1"])],
|
||||
[liga, new Set(["p1", "p2"])],
|
||||
]);
|
||||
expect(galleryReceivers("p1", galleries, chosen).sort()).toEqual([liga, zz].sort());
|
||||
expect(galleryReceivers("p2", galleries, chosen)).toEqual([liga]);
|
||||
});
|
||||
|
||||
it("puts a frame only the short gallery picked into the larger gallery too", () => {
|
||||
const chosen = new Map<string, Set<string>>([
|
||||
[zz, new Set(["p1"])],
|
||||
[liga, new Set()],
|
||||
]);
|
||||
expect(galleryReceivers("p1", galleries, chosen).sort()).toEqual([liga, zz].sort());
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { deskPath, type DeskCommand } from "@photoreport/contracts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { deskState } from "./desk.js";
|
||||
|
||||
const show = (patch: Partial<DeskCommand>): DeskCommand => ({ module: "library", ...patch });
|
||||
|
||||
describe("deskPath", () => {
|
||||
it("opens the library at the front page", () => {
|
||||
expect(deskPath(show({ module: "library" }))).toBe("/");
|
||||
});
|
||||
|
||||
it("opens one photo in develop", () => {
|
||||
expect(deskPath(show({ module: "develop", photoId: "11111111-1111-4111-8111-111111111111" }))).toBe("/develop/11111111-1111-4111-8111-111111111111");
|
||||
});
|
||||
|
||||
it("opens a shop tab", () => {
|
||||
expect(deskPath(show({ module: "shop", section: "orders" }))).toBe("/shop?tab=orders");
|
||||
});
|
||||
});
|
||||
|
||||
describe("deskState", () => {
|
||||
it("asks develop to start on the crop", () => {
|
||||
expect(deskState(show({ module: "develop", tool: "crop" }))).toEqual({ crop: true });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { deskPath, type DeskCommand } from "@photoreport/contracts";
|
||||
|
||||
export { deskPath };
|
||||
export type { DeskCommand };
|
||||
|
||||
/** Where a develop tool is asked for. Crop and white balance already open from this state. */
|
||||
export function deskState(command: DeskCommand): { crop?: boolean; picking?: boolean; spotting?: boolean } | null {
|
||||
if (command.tool === "crop") return { crop: true };
|
||||
if (command.tool === "wb") return { picking: true };
|
||||
if (command.tool === "spot") return { spotting: true };
|
||||
return null;
|
||||
}
|
||||
@@ -9,7 +9,8 @@ interface UpdateInfo {
|
||||
notes: string | null;
|
||||
}
|
||||
|
||||
const EVERY_MS = 6 * 3600_000;
|
||||
/** How often an open app looks again. A new shell installs itself; this only has to notice it soon. */
|
||||
const EVERY_MS = 60_000;
|
||||
|
||||
type Listen = (event: string, handler: () => void) => Promise<() => void>;
|
||||
|
||||
@@ -98,9 +99,9 @@ export async function askServer(apiUrl = API_URL): Promise<ServerUpdate | null>
|
||||
const message = (err: unknown) => (err instanceof Error ? err.message : String(err));
|
||||
|
||||
/**
|
||||
* Desktop only: a new version of the app's shell, installed with one click (it restarts). When the installed shell
|
||||
* cannot do that (its own check fails, or it was built without the update key), the page asks the server itself and
|
||||
* offers the full installer instead, with the reason, so an update is never missed in silence.
|
||||
* Desktop only: a new version of the app's shell installs itself and restarts. When the installed shell cannot do
|
||||
* that (its own check fails, or it was built without the update key), the page asks the server itself and offers
|
||||
* the full installer instead, with the reason, so an update is never missed in silence.
|
||||
*/
|
||||
export function UpdateNotice({
|
||||
invoke = desktopInvoke,
|
||||
@@ -118,18 +119,32 @@ export function UpdateNotice({
|
||||
const [state, setState] = useState<"idle" | "installing" | "failed">("idle");
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [dismissed, setDismissed] = useState(false);
|
||||
const started = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!enabled) return;
|
||||
let alive = true;
|
||||
const install = (found: UpdateInfo) => {
|
||||
setUpdate(found);
|
||||
setManual(null);
|
||||
if (started.current) return;
|
||||
started.current = true;
|
||||
setState("installing");
|
||||
setError(null);
|
||||
invoke("update_install").catch((err: unknown) => {
|
||||
if (!alive) return;
|
||||
started.current = false;
|
||||
setState("failed");
|
||||
setError(message(err));
|
||||
});
|
||||
};
|
||||
const check = async () => {
|
||||
let reason: string | null = null;
|
||||
try {
|
||||
const found = await invoke<UpdateInfo | null>("update_check");
|
||||
if (!alive) return;
|
||||
if (found) {
|
||||
setUpdate(found);
|
||||
setManual(null);
|
||||
install(found);
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -156,20 +171,26 @@ export function UpdateNotice({
|
||||
<div role="status" className="flex flex-wrap items-center gap-3 border-b border-black bg-[#1d2a3a] px-4 py-1.5 text-[12px] text-ink">
|
||||
<span>{t.update.available(update.version, update.currentVersion)}</span>
|
||||
{update.notes && <span className="truncate text-muted">{update.notes}</span>}
|
||||
<button
|
||||
className="ml-auto h-7 bg-accent px-3 text-[12px] font-semibold text-white hover:bg-accent-strong disabled:opacity-50"
|
||||
disabled={state === "installing"}
|
||||
onClick={() => {
|
||||
setState("installing");
|
||||
setError(null);
|
||||
invoke("update_install").catch((err: unknown) => {
|
||||
setState("failed");
|
||||
setError(message(err));
|
||||
});
|
||||
}}
|
||||
>
|
||||
{state === "installing" ? t.update.installing : t.update.install}
|
||||
</button>
|
||||
{state === "failed" ? (
|
||||
<button
|
||||
className="ml-auto h-7 bg-accent px-3 text-[12px] font-semibold text-white hover:bg-accent-strong"
|
||||
onClick={() => {
|
||||
started.current = false;
|
||||
setState("installing");
|
||||
setError(null);
|
||||
started.current = true;
|
||||
invoke("update_install").catch((err: unknown) => {
|
||||
started.current = false;
|
||||
setState("failed");
|
||||
setError(message(err));
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t.update.install}
|
||||
</button>
|
||||
) : (
|
||||
<span className="ml-auto text-muted">{t.update.installing}</span>
|
||||
)}
|
||||
{state === "failed" && (
|
||||
<span className="text-danger">
|
||||
{t.update.failed}
|
||||
|
||||
@@ -64,12 +64,11 @@ describe("interface update notice", () => {
|
||||
});
|
||||
|
||||
describe("update notice", () => {
|
||||
it("offers a newer shell and installs it", async () => {
|
||||
it("installs a newer shell as soon as it finds one", async () => {
|
||||
const invoke = vi.fn(async (cmd: string) => (cmd === "update_check" ? { version: "0.3.0", currentVersion: "0.2.0", notes: "Catálogo local" } : null)) as unknown as Invoke;
|
||||
render(<UpdateNotice invoke={invoke} enabled server={async () => null} />);
|
||||
expect(await screen.findByText("Nova versão da app: 0.3.0 (tens a 0.2.0).")).toBeTruthy();
|
||||
fireEvent.click(screen.getByText("Instalar e reiniciar"));
|
||||
expect(invoke).toHaveBeenCalledWith("update_install");
|
||||
await waitFor(() => expect(invoke).toHaveBeenCalledWith("update_install"));
|
||||
});
|
||||
|
||||
it("offers the installer when the app cannot update itself, with the reason", async () => {
|
||||
|
||||
+12
-2
@@ -562,7 +562,7 @@ export const t = {
|
||||
selectionBursts: "As escolhidas de cada sequência",
|
||||
selectionBest: "Só as melhores do jogo",
|
||||
bestCount: "Fotos na galeria (aprox.)",
|
||||
bestHelp: "Uma galeria curta de momentos de jogo: bola em jogo, duelos e festejos, jogadores grandes e nítidos no enquadramento, espalhados pelo jogo (a cada 5 minutos entram as melhores desse período). Numa sequência fica a de frente e com os olhos abertos, quando dá para distinguir. Aquecimento e intervalo ficam de fora; as fotos com estrelas têm prioridade e as rejeitadas nunca vão.",
|
||||
bestHelp: "Uma galeria curta de momentos de jogo: bola em jogo, duelos e festejos, jogadores grandes e nítidos no enquadramento, espalhados pelo jogo (a cada 5 minutos entram as melhores desse período). O número é a meta: num jogo rico pode ir um pouco acima (cerca de 15%, nunca mais de 25 fotos), num jogo fraco fica aquém. Numa sequência fica a de frente e com os olhos abertos, quando dá para distinguir. Aquecimento e intervalo ficam de fora; as fotos com estrelas têm prioridade e as rejeitadas nunca vão.",
|
||||
restTarget: "As outras escolhidas para",
|
||||
restHelp:
|
||||
"Cada foto vai só para um cliente. A galeria acima leva a segunda melhor de cada sequência escolhida; todas as outras escolhidas seguem para aqui quando fecha cada período de 5 minutos.",
|
||||
@@ -572,6 +572,16 @@ export const t = {
|
||||
nothingLearnt: "Corrige no Revelar as fotos que o piloto editou: ao fim de 5 correções no mesmo sentido, passa a editar como tu.",
|
||||
tighter: (pct: number) => `recorte ${pct}% mais apertado`,
|
||||
looser: (pct: number) => `recorte ${pct}% mais aberto`,
|
||||
cutBody: (cut: number) => {
|
||||
if (cut < 0.55) return "Cortas as pessoas pelo peito";
|
||||
if (cut < 0.72) return "Cortas as pessoas pela cintura";
|
||||
if (cut < 0.88) return "Cortas as pessoas a meio da perna";
|
||||
if (cut < 1.02) return "Deixas o corpo inteiro";
|
||||
return "Deixas chão por baixo dos pés";
|
||||
},
|
||||
cutHead: "Cortas a cabeça",
|
||||
headroom: "Deixas espaço por cima da cabeça",
|
||||
cutArms: "Tiras os braços do enquadramento",
|
||||
forget: "Esquecer",
|
||||
controls: {
|
||||
"light.exposure": "Exposição",
|
||||
@@ -879,7 +889,7 @@ export const t = {
|
||||
update: {
|
||||
available: (v: string, current: string) => `Nova versão da app: ${v} (tens a ${current}).`,
|
||||
install: "Instalar e reiniciar",
|
||||
installing: "A instalar…",
|
||||
installing: "A instalar a nova versão. A app reinicia sozinha.",
|
||||
failed: "Não foi possível instalar. Tenta mais tarde.",
|
||||
manual: "Esta instalação não se atualiza sozinha: descarrega o instalador e abre-o (só desta vez).",
|
||||
download: "Descarregar instalador",
|
||||
|
||||
@@ -194,8 +194,12 @@ export function Learnt({ api, event }: { api: ApiClient; event: EventSummary })
|
||||
{L.controls[k] ?? k} {fmt(k, v)}
|
||||
</li>
|
||||
))}
|
||||
{style.cropFactor && style.cropFactor < 0.97 && <li>{L.tighter(Math.round((1 - style.cropFactor) * 100))}</li>}
|
||||
{style.cropFactor && style.cropFactor > 1.03 && <li>{L.looser(Math.round((style.cropFactor - 1) * 100))}</li>}
|
||||
{typeof style.cropBias?.cut === "number" && <li>{L.cutBody(style.cropBias.cut)}</li>}
|
||||
{typeof style.cropBias?.head === "number" && style.cropBias.head < -0.02 && <li>{L.cutHead}</li>}
|
||||
{typeof style.cropBias?.head === "number" && style.cropBias.head > 0.08 && <li>{L.headroom}</li>}
|
||||
{typeof style.cropBias?.sides === "number" && style.cropBias.sides > 0.08 && <li>{L.cutArms}</li>}
|
||||
{typeof style.cropBias?.cut !== "number" && style.cropFactor && style.cropFactor < 0.97 && <li>{L.tighter(Math.round((1 - style.cropFactor) * 100))}</li>}
|
||||
{typeof style.cropBias?.cut !== "number" && style.cropFactor && style.cropFactor > 1.03 && <li>{L.looser(Math.round((style.cropFactor - 1) * 100))}</li>}
|
||||
</ul>
|
||||
<p className="text-faint">
|
||||
{L.learntHelp(style.samples, style.venue)}{" "}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import type { PhotoSummary } from "@photoreport/contracts";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { Grid } from "./Grid.js";
|
||||
|
||||
function photo(id: string): PhotoSummary {
|
||||
return {
|
||||
id,
|
||||
eventId: "e1",
|
||||
originalName: `${id}.jpg`,
|
||||
name: `${id}.jpg`,
|
||||
sha256: `sha-${id}`,
|
||||
originalStored: true,
|
||||
status: "READY",
|
||||
width: 600,
|
||||
height: 400,
|
||||
capturedAt: "2026-09-23T20:00:00Z",
|
||||
cameraModel: null,
|
||||
lens: null,
|
||||
focalLength: null,
|
||||
aperture: null,
|
||||
exposureTime: null,
|
||||
iso: null,
|
||||
rating: 0,
|
||||
flag: "NONE",
|
||||
colorLabel: "NONE",
|
||||
players: [],
|
||||
uploader: null,
|
||||
developSeq: 0,
|
||||
urls: { thumb: "", preview: "", source: "" },
|
||||
};
|
||||
}
|
||||
|
||||
describe("grid", () => {
|
||||
it("opens the photo on a double-click", () => {
|
||||
const onOpen = vi.fn();
|
||||
render(
|
||||
<Grid
|
||||
photos={[photo("a")]}
|
||||
selected={new Set()}
|
||||
focus={null}
|
||||
srcFor={() => ""}
|
||||
onPick={() => {}}
|
||||
onSelectMany={() => {}}
|
||||
onOpen={onOpen}
|
||||
/>,
|
||||
);
|
||||
fireEvent.doubleClick(screen.getByRole("button", { name: /a\.jpg/ }));
|
||||
expect(onOpen).toHaveBeenCalledWith("a");
|
||||
});
|
||||
});
|
||||
@@ -171,6 +171,8 @@ export function Grid(props: {
|
||||
const dy = e.clientY - current.y;
|
||||
if (!current.moved && Math.hypot(dx, dy) < DRAG_PX) return;
|
||||
current.moved = true;
|
||||
// Capture only once the drag is real. Capturing on the first press steals the second click, so a double-click never opens the photo.
|
||||
if (!section.hasPointerCapture(e.pointerId)) section.setPointerCapture(e.pointerId);
|
||||
const left = Math.min(current.x, e.clientX);
|
||||
const top = Math.min(current.y, e.clientY);
|
||||
const width = Math.abs(e.clientX - current.x);
|
||||
@@ -197,7 +199,6 @@ export function Grid(props: {
|
||||
base: [...props.selected],
|
||||
moved: false,
|
||||
};
|
||||
e.currentTarget.setPointerCapture(e.pointerId);
|
||||
}}
|
||||
onPointerMove={moveBand}
|
||||
onPointerUp={(e) => {
|
||||
@@ -256,6 +257,7 @@ export function Loupe({
|
||||
total,
|
||||
faces = [],
|
||||
onMenu,
|
||||
onClose,
|
||||
}: {
|
||||
photo: PhotoSummary;
|
||||
src: string;
|
||||
@@ -264,6 +266,8 @@ export function Loupe({
|
||||
total: number;
|
||||
faces?: LoupeFace[];
|
||||
onMenu?: (id: string, e: React.MouseEvent) => void;
|
||||
/** Double-click returns to the grid. */
|
||||
onClose?: () => void;
|
||||
}) {
|
||||
// Desktop app: previews seen once show again without a network; never seen, the thumbnail stands in.
|
||||
const preview = useCachedImage(src, isDesktop());
|
||||
@@ -288,7 +292,8 @@ export function Loupe({
|
||||
return (
|
||||
<section
|
||||
aria-label="Lupa"
|
||||
className="relative flex h-full min-h-[420px] items-center justify-center bg-[#121213] p-6"
|
||||
className="relative flex h-full min-h-0 flex-1 items-center justify-center bg-[#121213]"
|
||||
onDoubleClick={() => onClose?.()}
|
||||
onContextMenu={(e) => {
|
||||
if (!onMenu) {
|
||||
e.preventDefault();
|
||||
@@ -298,13 +303,13 @@ export function Loupe({
|
||||
onMenu(photo.id, e);
|
||||
}}
|
||||
>
|
||||
<span className="relative inline-block max-h-full max-w-full">
|
||||
<span className="relative flex h-full max-h-full w-full items-center justify-center">
|
||||
<img
|
||||
src={shown}
|
||||
onError={() => setFailed(true)}
|
||||
alt={photo.name}
|
||||
draggable={false}
|
||||
className="pointer-events-none block max-h-[calc(100vh-14rem)] max-w-full object-contain shadow-[0_2px_12px_rgba(0,0,0,0.7)]"
|
||||
className="pointer-events-none block max-h-full max-w-full object-contain"
|
||||
/>
|
||||
{softCrop && <SoftCropGuide crop={softCrop} />}
|
||||
{faces.map((f) => (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIBRARY_CHANNEL, type LibraryMessage } from "@photoreport/contracts";
|
||||
import { LIBRARY_CHANNEL, type DeskCommand, type LibraryMessage } from "@photoreport/contracts";
|
||||
import type { ApiClient } from "@photoreport/sdk";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { io } from "socket.io-client";
|
||||
@@ -40,6 +40,9 @@ export function useLibraryLive(api: ApiClient, onMessage: (message: LibraryMessa
|
||||
socket.on("disconnect", () => setState("offline"));
|
||||
socket.on("connect_error", () => setState("offline"));
|
||||
socket.on(LIBRARY_CHANNEL, (message: LibraryMessage) => handler.current(message));
|
||||
socket.on("desk", (command: DeskCommand) => {
|
||||
window.dispatchEvent(new CustomEvent("photoreport-desk", { detail: command }));
|
||||
});
|
||||
return () => {
|
||||
socket.close();
|
||||
};
|
||||
|
||||
@@ -684,16 +684,18 @@ export function DevelopPage() {
|
||||
// R in the library: the photo opens here with the crop tool on, once it is loaded (opening a photo turns it off).
|
||||
const location = useLocation();
|
||||
// W: with the white balance eyedropper.
|
||||
const asked = location.state as { crop?: boolean; picking?: boolean } | null;
|
||||
const asked = location.state as { crop?: boolean; picking?: boolean; spotting?: boolean } | null;
|
||||
const cropAsked = asked?.crop === true;
|
||||
const pickAsked = asked?.picking === true;
|
||||
const spotAsked = asked?.spotting === true;
|
||||
const loadedId = session?.loaded ? session.photoId : null;
|
||||
useEffect(() => {
|
||||
if ((!cropAsked && !pickAsked) || !loadedId || loadedId !== current?.id) return;
|
||||
if ((!cropAsked && !pickAsked && !spotAsked) || !loadedId || loadedId !== current?.id) return;
|
||||
if (canEdit && cropAsked) setCropping(true);
|
||||
if (canEdit && pickAsked) setPicking(true);
|
||||
if (canEdit && spotAsked) setSpotting(true);
|
||||
navigate(".", { replace: true, state: null });
|
||||
}, [cropAsked, pickAsked, loadedId, current?.id, canEdit, navigate]);
|
||||
}, [cropAsked, pickAsked, spotAsked, loadedId, current?.id, canEdit, navigate]);
|
||||
|
||||
// Entering crop on a photo that was never cropped: it starts with the default aspect (the last one chosen).
|
||||
const defaulted = useRef(new Set<string>());
|
||||
|
||||
@@ -191,6 +191,15 @@ export function LibraryPage() {
|
||||
[api, orgId, state.scope],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const onOpen = (ev: Event) => {
|
||||
const id = (ev as CustomEvent<string>).detail;
|
||||
if (typeof id === "string" && id) void open(id).catch(() => setError(t.unexpectedError));
|
||||
};
|
||||
window.addEventListener("photoreport-open-event", onOpen);
|
||||
return () => window.removeEventListener("photoreport-open-event", onOpen);
|
||||
}, [open]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!orgId) return;
|
||||
let alive = true;
|
||||
@@ -768,7 +777,7 @@ export function LibraryPage() {
|
||||
)}
|
||||
|
||||
<div
|
||||
className={`min-h-0 flex-1 ${sheet ? "flex flex-col overflow-hidden" : "overflow-y-auto"} ${dragging ? "outline outline-2 -outline-offset-4 outline-accent" : ""}`}
|
||||
className={`min-h-0 flex-1 ${sheet || loupe ? "flex flex-col overflow-hidden" : "overflow-y-auto"} ${dragging ? "outline outline-2 -outline-offset-4 outline-accent" : ""}`}
|
||||
onDragOver={(e) => {
|
||||
if (!e.dataTransfer.types.includes("Files")) return;
|
||||
e.preventDefault();
|
||||
@@ -875,6 +884,7 @@ export function LibraryPage() {
|
||||
index={visibleIds.indexOf(focus.id)}
|
||||
total={visibleIds.length}
|
||||
faces={loupeFaces}
|
||||
onClose={() => setLoupe(false)}
|
||||
{...(canCull ? { onMenu: onPhotoMenu } : {})}
|
||||
/>
|
||||
) : visible.length || suggested.length ? (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { hasRole } from "@photoreport/sdk";
|
||||
import { NavLink, Outlet } from "react-router";
|
||||
import { useEffect } from "react";
|
||||
import { NavLink, Outlet, useNavigate } from "react-router";
|
||||
import { deskPath, deskState, type DeskCommand } from "../desk.js";
|
||||
import { useAuth } from "../auth.js";
|
||||
import { Bell } from "../components/Bell.js";
|
||||
import { Logo } from "../components/ui.js";
|
||||
@@ -140,6 +142,7 @@ export function Shell() {
|
||||
</div>
|
||||
</details>
|
||||
</header>
|
||||
<DeskHost />
|
||||
<UpdateNotice />
|
||||
<UiReadyNotice />
|
||||
<LocalDeliveries />
|
||||
@@ -156,6 +159,22 @@ export function Shell() {
|
||||
);
|
||||
}
|
||||
|
||||
/** Follows the assistant: the open window changes module, photo or tool. */
|
||||
function DeskHost() {
|
||||
const navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
const onDesk = (ev: Event) => {
|
||||
const command = (ev as CustomEvent<DeskCommand>).detail;
|
||||
if (!command || typeof command.module !== "string") return;
|
||||
navigate(deskPath(command), { state: deskState(command) });
|
||||
if (command.eventId) window.dispatchEvent(new CustomEvent("photoreport-open-event", { detail: command.eventId }));
|
||||
};
|
||||
window.addEventListener("photoreport-desk", onDesk);
|
||||
return () => window.removeEventListener("photoreport-desk", onDesk);
|
||||
}, [navigate]);
|
||||
return null;
|
||||
}
|
||||
|
||||
function initials(name: string): string {
|
||||
return name
|
||||
.split(/\s+/)
|
||||
|
||||
@@ -19,7 +19,7 @@ What the shell adds today:
|
||||
- Works without network: when the server can't be reached at start-up, the window opens the copy of the web app
|
||||
bundled in the installer (photo engine included), so the catalogue, local FTP and editing originals on disk go on;
|
||||
edits wait in the offline queue.
|
||||
- Updates itself (`src/updater.rs`): a notice offers each new shell version; one click installs it and restarts.
|
||||
- Updates itself (`src/updater.rs`): a new shell version installs itself and the app restarts.
|
||||
|
||||
Replaces `PhotoReport_Studio` (Flutter) and the archived `bridge.photoreport.pt`.
|
||||
|
||||
@@ -35,7 +35,8 @@ are in the app's config folder (`catalog.json`, `catalog-cache.json`, `local-ind
|
||||
## Updates
|
||||
|
||||
The web app inside the window updates with every web deploy. The shell checks
|
||||
`<API>/v1/desktop/update/{target}/{arch}/{version}` at start and every 6 hours; the API reads the latest
|
||||
`<API>/v1/desktop/update/{target}/{arch}/{version}` at start and about once a minute, and installs a newer
|
||||
signed shell at once; the API reads the latest
|
||||
`desktop-v*` release on Gitea (`DESKTOP_RELEASES_API`, `DESKTOP_RELEASES_TOKEN`, read-only) and passes the
|
||||
installer through, so the private repository stays private. Installers are signed with the release key
|
||||
(`tauri signer generate`): the private key and its password are the Gitea secrets `TAURI_SIGNING_PRIVATE_KEY` and
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@photoreport/desktop",
|
||||
"version": "0.3.31",
|
||||
"version": "0.3.32",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "photoreport-desktop"
|
||||
version = "0.3.31"
|
||||
version = "0.3.32"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
description = "PhotoReport desktop: the web app in a native shell, with keychain sign-in and (later) local FTP and the native engine."
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "PhotoReport",
|
||||
"version": "0.3.31",
|
||||
"version": "0.3.32",
|
||||
"identifier": "pt.photoreport.desktop",
|
||||
"build": {
|
||||
"devUrl": "http://localhost:5173",
|
||||
|
||||
@@ -10,11 +10,13 @@ import { registerAccount } from "./tools/account.js";
|
||||
import { registerDelivery } from "./tools/delivery.js";
|
||||
import { registerDevelop } from "./tools/develop.js";
|
||||
import { registerLibrary } from "./tools/library.js";
|
||||
import { registerScreen } from "./tools/screen.js";
|
||||
import { registerTeach } from "./tools/teach.js";
|
||||
|
||||
export function createServer(): McpServer {
|
||||
const server = new McpServer({ name: "photoreport", version: "0.1.0" });
|
||||
registerAccount(server);
|
||||
registerScreen(server);
|
||||
registerLibrary(server);
|
||||
registerDevelop(server);
|
||||
registerDelivery(server);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import type { DeskCommand } from "@photoreport/contracts";
|
||||
import * as z from "zod/v4";
|
||||
import { api, ensureSession } from "../session.js";
|
||||
import { guard, text, type Server } from "../result.js";
|
||||
|
||||
const exec = promisify(execFile);
|
||||
|
||||
/** Brings the installed PhotoReport window forward. The command still goes to whichever copy is signed in. */
|
||||
async function raiseApp(): Promise<string> {
|
||||
try {
|
||||
if (process.platform === "darwin") {
|
||||
await exec("open", ["-a", "PhotoReport"]);
|
||||
return "PhotoReport is in front.";
|
||||
}
|
||||
if (process.platform === "win32") {
|
||||
await exec("cmd", ["/c", "start", "", "PhotoReport"]);
|
||||
return "PhotoReport was asked to open.";
|
||||
}
|
||||
} catch {
|
||||
return "PhotoReport is not installed under that name. Open it yourself. The signed-in window still follows.";
|
||||
}
|
||||
return "Open PhotoReport. The signed-in window still follows.";
|
||||
}
|
||||
|
||||
const Modules = ["library", "develop", "metadata", "delivery", "shop", "print", "archive", "faces", "numbers", "help", "preferences", "members"] as const;
|
||||
|
||||
export function registerScreen(server: Server): void {
|
||||
server.registerTool(
|
||||
"photoreport_show",
|
||||
{
|
||||
title: "Open a PhotoReport window",
|
||||
description:
|
||||
"Opens the PhotoReport application on this computer and moves the signed-in window. Use it to change tabs and to open a photo. module is library, develop, metadata, delivery, shop, print, archive, faces, numbers, help, preferences or members. photoId opens that photo in Revelar. eventId opens that event in the library. tool crop, spot or wb opens that tool on the photo. section is a shop tab (orders, products) or a metadata section (iptc, codes, people, faces). Example: open this photo and start the crop. The photographer sees the window move. Do this before saying a photo was shown.",
|
||||
inputSchema: z.object({
|
||||
module: z.enum(Modules),
|
||||
photoId: z.string().optional(),
|
||||
eventId: z.string().optional(),
|
||||
tool: z.enum(["crop", "spot", "wb"]).optional(),
|
||||
section: z.string().max(40).optional(),
|
||||
}),
|
||||
annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: true },
|
||||
},
|
||||
async (input) =>
|
||||
guard(async () => {
|
||||
await ensureSession();
|
||||
const raised = await raiseApp();
|
||||
const command: DeskCommand = { module: input.module };
|
||||
if (input.photoId) command.photoId = input.photoId;
|
||||
if (input.eventId) command.eventId = input.eventId;
|
||||
if (input.tool) command.tool = input.tool;
|
||||
if (input.section) command.section = input.section;
|
||||
await api.desk(command);
|
||||
const where = [input.module, input.photoId, input.eventId, input.tool, input.section].filter(Boolean).join(" · ");
|
||||
return text(`${raised} Showing ${where}. If the window was signed out, sign in and call this again.`);
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ measurement, the median of the last 60 corrections, at the same venue when there
|
||||
- only the controls it sets itself (tone, white balance) and crop tightness, never a creative look;
|
||||
- only with 5 or more corrections, and only when at least 70% of them go the same way (one odd photo changes
|
||||
nothing); tiny differences are noise and very large ones creative choices, both ignored;
|
||||
- the crop only gets tighter, never cutting into the subject (looser would eat the margins the subject needs).
|
||||
- the crop is read on the person, not only as a ratio: where the bottom cuts the body (chest, waist, mid-leg, feet), space above the head, and whether the sides take the arms. When those agree, the next crop is placed the same way on the next person. A plain tighter or looser frame is only the fallback when the body position was not known. A learnt crop still may not slice a ball the frame had kept whole.
|
||||
|
||||
The autopilot's panel in the app shows what it has learnt and has "Esquecer". The burst picks are not learnt yet.
|
||||
|
||||
@@ -168,7 +168,9 @@ With autopilot "only the best", windows still shape the first pass (`apps/api/sr
|
||||
|
||||
- the match (from kick-off, its typical length by sport: football 115 min with the break, handball 80) is cut
|
||||
into 5-minute windows; each window may add its share of the gallery, and a share it did not use (the break,
|
||||
a quiet spell) carries forward, at most three windows' worth at once; at most 10% over the size in all;
|
||||
a quiet spell) carries forward, at most three windows' worth at once. The size is a target (`galleryCeiling`):
|
||||
a rich match may add about 15% (at least 2 frames, never more than 25 past the number) from frames at or above
|
||||
the match's typical one; a thin match stays under;
|
||||
- one candidate per burst (its best frame), ranked by game moment: the frame score, more with the ball in play
|
||||
(×1.3), a duel or a celebration (several people in the subject), less when the subject is small (far away);
|
||||
the photographer's stars count (+20% each), a rejected frame never goes;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { z } from "zod";
|
||||
|
||||
/** Modules the assistant can open. `library` is the front page. */
|
||||
export const DESK_MODULES = ["library", "develop", "metadata", "delivery", "shop", "print", "archive", "faces", "numbers", "help", "preferences", "members"] as const;
|
||||
|
||||
/**
|
||||
* One instruction for the PhotoReport window that is open and signed in as this person.
|
||||
* The API delivers it on the realtime socket. It does not change photos by itself.
|
||||
*/
|
||||
export const DeskCommand = z.object({
|
||||
module: z.enum(DESK_MODULES),
|
||||
photoId: z.uuid().optional(),
|
||||
eventId: z.uuid().optional(),
|
||||
/** Develop only: open that tool on the photo. */
|
||||
tool: z.enum(["crop", "spot", "wb"]).optional(),
|
||||
/** Shop tab or metadata section, when that module has one. */
|
||||
section: z.string().max(40).optional(),
|
||||
});
|
||||
export type DeskCommand = z.infer<typeof DeskCommand>;
|
||||
|
||||
/** Where the window should go. Library is `/`, not `/library`. */
|
||||
export function deskPath(command: DeskCommand): string {
|
||||
if (command.module === "library") return "/";
|
||||
if (command.module === "develop") return command.photoId ? `/develop/${command.photoId}` : "/develop";
|
||||
if (command.module === "shop" && command.section) return `/shop?tab=${encodeURIComponent(command.section)}`;
|
||||
if (command.module === "metadata" && command.section) return `/metadata?s=${encodeURIComponent(command.section)}`;
|
||||
return `/${command.module}`;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from "./commands.js";
|
||||
export * from "./desk.js";
|
||||
export * from "./controls.js";
|
||||
export * from "./library.js";
|
||||
export * from "./shop.js";
|
||||
|
||||
@@ -69,6 +69,20 @@ export const AutopilotSettings = z.object({
|
||||
*/
|
||||
selection: z.enum(["bursts", "best"]).default("bursts"),
|
||||
bestCount: z.number().int().min(5).max(300).default(30),
|
||||
/**
|
||||
* One gallery size per destination ("only the best"). The match is spread to the largest count; a smaller
|
||||
* gallery receives its own spread, and those frames also go to every larger gallery. Empty: every destination
|
||||
* shares `bestCount`, one frame of each burst each.
|
||||
*/
|
||||
galleries: z
|
||||
.array(
|
||||
z.object({
|
||||
targetId: z.string().uuid(),
|
||||
count: z.number().int().min(5).max(300),
|
||||
}),
|
||||
)
|
||||
.max(10)
|
||||
.optional(),
|
||||
/**
|
||||
* Legacy second export. With two destinations, each burst's best goes to `deliverTargetId` and the second best
|
||||
* to this one when `deliverTargetIds` is empty. Prefer `deliverTargetIds`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BundleInput, BundleSummary, PressAccountInput, PressAccountSummary, PressStatement, NotificationView, AffiliateInput, AffiliateSummary, EarningsOverview, EarningsSettings, MemberPayoutInput, MyEarnings, PayeeAccount, PayoutInput, PayoutView, CodeGeneratorSettings, CodeLine, ConfirmFaceGroup, DeliveryItemSummary, DevelopState, EditLogEntry, FaceGroupSummary, GalleryInput, GalleryPhotosChange, GallerySummary, Module, OrderView, PhotoPatch, PhotoSummary, PostEdits, PrinterSummary, PrintEventInput, PrintEventSummary, PrintJobSummary, ProductInput, ProofingReport, ProductSummary, SiteInfo, SiteInput, StationSummary } from "@photoreport/contracts";
|
||||
import type { BundleInput, BundleSummary, PressAccountInput, PressAccountSummary, PressStatement, NotificationView, AffiliateInput, AffiliateSummary, EarningsOverview, EarningsSettings, MemberPayoutInput, MyEarnings, PayeeAccount, PayoutInput, PayoutView, CodeGeneratorSettings, CodeLine, ConfirmFaceGroup, DeliveryItemSummary, DeskCommand, DevelopState, EditLogEntry, FaceGroupSummary, GalleryInput, GalleryPhotosChange, GallerySummary, Module, OrderView, PhotoPatch, PhotoSummary, PostEdits, PrinterSummary, PrintEventInput, PrintEventSummary, PrintJobSummary, ProductInput, ProofingReport, ProductSummary, SiteInfo, SiteInput, StationSummary } from "@photoreport/contracts";
|
||||
import type { AgendaEntry, ArchiveStorage, CardScan, FaceIdentify, FaceRoster, CloudFolderSummary, CloudSource, CloudTreeFolder, InvoiceSummary, AutopilotStyle, DeliveryTarget, DeliveryTargetInput, JerseySample, JerseyStats, PersonSummary, PhotoFace, PhotoLookup, ShopSettings, SquadPerson, DeviceGrant, FtpAccount, FtpPlan, EventInput, EventSquads, EventSummary, FtpTargetAccount, IptcIssue, SportsCompetition, SportsFixture, SportsPlayer, SportsTeam, Me, Member, PhotoQuery, RealEstateFrame, RealEstateGrouping, Role, ZerozeroGame } from "./types.js";
|
||||
|
||||
/**
|
||||
@@ -241,6 +241,11 @@ export class ApiClient {
|
||||
return this.request<Me>("GET", "/v1/me");
|
||||
}
|
||||
|
||||
/** Asks the open PhotoReport of this person to show a module, a photo or a tool. */
|
||||
desk(command: DeskCommand) {
|
||||
return this.request<{ ok: true }>("POST", "/v1/me/desk", command);
|
||||
}
|
||||
|
||||
updateEditorModules(editorModules: Module[]) {
|
||||
return this.request<{ editorModules: Module[] }>("PUT", "/v1/me/preferences", { editorModules });
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ export interface AutopilotStyle {
|
||||
offsets: Record<string, number>;
|
||||
cropFactor: number | null;
|
||||
/** Centre shift / open / straighten from crop corrections (in-app or Lightroom soft crop). */
|
||||
cropBias: { dx: number; dy: number; scale: number; dAngle: number } | null;
|
||||
cropBias: { dx: number; dy: number; scale: number; dAngle: number; cut?: number | null; head?: number | null; sides?: number | null } | null;
|
||||
}
|
||||
|
||||
export interface DeliveryTargetInput {
|
||||
|
||||
Reference in new issue
Block a user