Files
flatrender/services/content/FlatRender.ContentSvc/Models/ScanModels.cs
T
soroush.asadi 1ff6e494c0
Build backend images / build content-svc (push) Failing after 19s
Build backend images / build file-svc (push) Failing after 1m53s
Build backend images / build gateway (push) Failing after 16s
Build backend images / build identity-svc (push) Failing after 7m1s
Build backend images / build notification-svc (push) Failing after 7m24s
Build backend images / build render-svc (push) Failing after 3m12s
Build backend images / build studio-svc (push) Failing after 43s
@
feat: AE template scanner + scene editor + AEP bundle pipeline

Scene editor (admin): per-project Scenes / Shared Colors / Color Presets
manager (ProjectScenes) reachable from each project.

AEP bundle pipeline: upload .aep or .zip → stored once per template at
templates/{project_id}/(bundle.zip|template.aep); render claim probes and
returns is_bundle+md5; node-agent extracts the bundle, locates the .aep
(zip-slip guarded), and caches by md5 so repeated renders extract once.

AE template scanner ("read scenes/colours/configs from the AEP"):
- content-svc importer: POST /v1/projects/{id}/scan/{preview,apply} —
  review-diff-then-merge into scenes/elements/colours (manual edits kept).
- render-svc Go quick-scan: stdlib RIFX parser extracts comp names+durations
  (no AE) → POST /v1/template-scans/{id}/quick.
- render-svc AE scan jobs + node-agent runner: queue → node runs scan.jsx
  (reverse of legacy JSXGenerator conventions: frfinal/frshare/frl_/frd_) →
  posts ScanResult back. Migration 26_render_scan_jobs.
- admin UI: "اسکن از افترافکت" with quick/full engines + diff-review modal.

Verified: importer preview/apply, Go quick-scan end-to-end (synthetic .aep →
scene imported), bundle extract unit tests, RIFX parser unit tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@
2026-06-04 10:39:45 +03:30

81 lines
3.0 KiB
C#

namespace FlatRender.ContentSvc.Models;
// ── Canonical scan result ────────────────────────────────────────────────────
// Produced by either engine (the AE-JSX scanner on a render node, or the headless
// Go quick-scan) and consumed by AepImportService. Both engines emit this shape;
// the Go scan simply leaves colour/font/text fields null.
public record ScanResult(
string? Source, // "ae-jsx" | "go-parser"
string? RenderComp, // final render comp name, e.g. "frfinal"
List<ScanScene>? Scenes,
List<ScanColor>? SharedColors
);
public record ScanScene(
string Key, // AE comp name
string? Title,
string? SceneType, // Normal | Config | DesignStart | DesignEnd
decimal? DefaultDurationSec,
decimal? MinDurationSec,
decimal? MaxDurationSec,
int? Sort,
List<ScanElement>? Elements, // frl_/frd_ editable layers
List<ScanColor>? Colors // per-scene frd_ colour zones
);
public record ScanElement(
string Key, // AE layer name (frl_… / frd_…)
string? Title,
string? Type, // Text | TextArea | Media | Audio | … (content_element_type)
string? DefaultValue,
string? FontFace,
string? FontFaceName,
int? FontSize,
string? Justify, // LEFT_JUSTIFY | CENTER_JUSTIFY | RIGHT_JUSTIFY | FULL_JUSTIFY
int? PositionInContainer,
bool? IsTextBox,
int? MaxSize,
bool? VideoSupport,
int? Width,
int? Height,
bool? IsHidden,
string? DirectionLayerKey,
int? Sort
);
public record ScanColor(
string ElementKey, // AE frd_ layer name / shared colour key
string? Title,
string? AttrValue, // fill | stroke | tracking | dropshadow
string? DefaultColor, // #RRGGBB
int? Sort
);
// ── Import request + diff ─────────────────────────────────────────────────────
public record ScanApplyOptions(
bool RemoveOrphanScenes = false, // soft-delete scenes not present in the scan
bool RemoveOrphanElements = false, // delete elements/colours not present in the scan
bool OverwriteExisting = true // refresh matched items from the scan (null scan fields are kept)
);
public record ScanImportRequest(
ScanResult Scan,
ScanApplyOptions? Options
);
public record SceneDiff(
string Key, string Title, string Status, // added | changed | unchanged | orphan
int ElementsAdded, int ElementsChanged, int ElementsRemoved,
int ColorsAdded, int ColorsChanged, int ColorsRemoved
);
public record ImportDiff(
bool Applied,
int ScenesAdded, int ScenesChanged, int ScenesUnchanged, int ScenesOrphan,
int SharedColorsAdded, int SharedColorsChanged, int SharedColorsRemoved,
List<SceneDiff> Scenes,
List<string> OrphanSceneKeys
);