End-to-end debugging against a live Premiere Pro 2025 + auth-enabled mam-api
surfaced four real bugs that made v1.0.0 install cleanly but never load,
plus the missing auth flow. All four are fixed and the panel is verified
connected (status dot green, Reconnect button shown, project list populated).
- manifest.xml: a comment in the <Resources> block contained "--" (inside
"--enable-nodejs"/"--mixed-context"), which is illegal per the XML spec.
CEP 12's strict parser logged
ERROR XPATH Double hyphen within comment
and skipped the panel entirely. Comment rewritten without double hyphens.
- manifest.xml: lacked the Version="X.Y" attribute on <ExtensionManifest>
and used a non-standard AbstractionLayers/empty <ExtensionList/>
structure. CEP rejected it with
Unsupported Manifest version ''
Manifest rewritten to the standard CSXS 7.0 schema (ExtensionList +
DispatchInfoList + RequiredRuntimeList), matching the working AMPP
panel template.
- main.js: re-declared `const csInterface = new CSInterface()` at top
level even though CSInterface.js already declared the same binding.
CEP 12 shares script-realm lexical scope across <script> tags, so the
second const threw
Identifier 'csInterface' has already been declared
The throw fired before setupEventListeners(), so the Connect button's
click handler was never attached. This is the root cause of the
original "clicking Connect does nothing" symptom; everything else was
secondary. Removed the duplicate declaration; main.js now uses the
binding from CSInterface.js.
- No auth support against AUTH_ENABLED=true servers. mam-api supports
Bearer tokens (POST /api/v1/tokens), so added:
• API token input field (password-masked) next to Server URL
• localStorage persistence on every keystroke
• window.fetch monkey-patch that injects
Authorization: Bearer <token>
on every request whose URL starts with the configured server.
Signed S3 download URLs are NOT touched.
Drive-by fixes that came out of the same debugging pass:
- Server URL input listener was 'change' (fires on blur); switched to
'input' so typing-then-clicking-Connect immediately commits.
- restoreSettings() now strips trailing slashes from the stored URL so
older saved values like 'http://host/' stop producing //api/v1 404s.
- CSS selector `input[type="text"].server-url` didn't match the new
password input → the token field was unstyled and effectively invisible.
Generalized to `input.server-url`; restructured the connection bar into
`.connection-controls--stacked` (flex column) of two `.server-input-row`
rows so two input fields fit cleanly.
- Build scripts now parse ExtensionBundleVersion from both element form
(<ExtensionBundleVersion>X</...>) and attribute form
(ExtensionBundleVersion="X"), since the manifest rewrite switched
schemas.
Version bumped 1.0.0 → 1.0.1. New artifacts committed at
services/premiere-plugin/build/releases/v1.0.1/ (.exe 2 MB, .zxp 35 KB).
v1.0.0 left in place so editors who downloaded it can verify they're on
the broken version.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
102 lines
3.7 KiB
JavaScript
102 lines
3.7 KiB
JavaScript
#!/usr/bin/env node
|
|
// Build a signed .zxp for the Dragonflight Premiere panel.
|
|
//
|
|
// - Reads version from ../CSXS/manifest.xml (<ExtensionBundleVersion>)
|
|
// - Generates a self-signed cert on first run (cert/dragonflight-selfsigned.p12)
|
|
// - Stages the panel bundle into stage/ (excludes build/ + dev cruft)
|
|
// - Calls zxp-sign-cmd to sign + package into dist/
|
|
//
|
|
// Usage: node build-zxp.mjs
|
|
// Output: dist/dragonflight-premiere-panel-<version>.zxp
|
|
|
|
import { mkdirSync, existsSync, readFileSync, writeFileSync, rmSync, cpSync, readdirSync, statSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { dirname, join, resolve } from 'node:path';
|
|
import { randomBytes } from 'node:crypto';
|
|
import zxp from 'zxp-sign-cmd';
|
|
|
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
const PANEL_DIR = resolve(HERE, '..');
|
|
const MANIFEST = join(PANEL_DIR, 'CSXS', 'manifest.xml');
|
|
const CERT_DIR = join(HERE, 'cert');
|
|
const CERT_FILE = join(CERT_DIR, 'dragonflight-selfsigned.p12');
|
|
const PASS_FILE = join(CERT_DIR, 'cert-passphrase.txt');
|
|
const STAGE_DIR = join(HERE, 'stage');
|
|
const DIST_DIR = join(HERE, 'dist');
|
|
|
|
// Top-level entries to exclude from the staged bundle.
|
|
const EXCLUDE = new Set(['build', 'install-windows.ps1', '.git', '.gitignore', 'node_modules']);
|
|
|
|
function readVersion() {
|
|
const xml = readFileSync(MANIFEST, 'utf8');
|
|
// Accept either <ExtensionBundleVersion>X.Y.Z</ExtensionBundleVersion> (the
|
|
// namespace-style manifest) or ExtensionBundleVersion="X.Y.Z" (the attribute
|
|
// form used by the CSXS 7.0+ schema).
|
|
const m = xml.match(/<ExtensionBundleVersion>([^<]+)<\/ExtensionBundleVersion>/)
|
|
|| xml.match(/\bExtensionBundleVersion\s*=\s*"([^"]+)"/);
|
|
if (!m) throw new Error(`Could not find ExtensionBundleVersion in ${MANIFEST}`);
|
|
return m[1].trim();
|
|
}
|
|
|
|
async function ensureCert() {
|
|
mkdirSync(CERT_DIR, { recursive: true });
|
|
if (existsSync(CERT_FILE) && existsSync(PASS_FILE)) {
|
|
return readFileSync(PASS_FILE, 'utf8').trim();
|
|
}
|
|
console.log('No signing cert found — generating self-signed cert (one-time)…');
|
|
const passphrase = randomBytes(24).toString('base64url');
|
|
writeFileSync(PASS_FILE, passphrase + '\n', { mode: 0o600 });
|
|
await zxp.selfSignedCert({
|
|
country: 'US',
|
|
province: 'WA',
|
|
org: 'Wild Dragon LLC',
|
|
name: 'Wild Dragon LLC',
|
|
password: passphrase,
|
|
output: CERT_FILE,
|
|
validityDays: 365 * 25,
|
|
});
|
|
console.log(` wrote ${CERT_FILE}`);
|
|
console.log(` wrote ${PASS_FILE}`);
|
|
console.log(' >> COMMIT both files so future builds reuse them. <<');
|
|
return passphrase;
|
|
}
|
|
|
|
function stageBundle() {
|
|
if (existsSync(STAGE_DIR)) rmSync(STAGE_DIR, { recursive: true, force: true });
|
|
mkdirSync(STAGE_DIR, { recursive: true });
|
|
for (const entry of readdirSync(PANEL_DIR)) {
|
|
if (EXCLUDE.has(entry)) continue;
|
|
const src = join(PANEL_DIR, entry);
|
|
const dst = join(STAGE_DIR, entry);
|
|
cpSync(src, dst, { recursive: true });
|
|
}
|
|
}
|
|
|
|
async function signZxp(version, passphrase) {
|
|
mkdirSync(DIST_DIR, { recursive: true });
|
|
const output = join(DIST_DIR, `dragonflight-premiere-panel-${version}.zxp`);
|
|
if (existsSync(output)) rmSync(output);
|
|
await zxp.sign({
|
|
input: STAGE_DIR,
|
|
output,
|
|
cert: CERT_FILE,
|
|
password: passphrase,
|
|
});
|
|
const bytes = statSync(output).size;
|
|
console.log(`Built ${output} (${(bytes / 1024).toFixed(1)} KB)`);
|
|
return output;
|
|
}
|
|
|
|
async function main() {
|
|
const version = readVersion();
|
|
console.log(`Dragonflight Premiere panel — ZXP build v${version}`);
|
|
const passphrase = await ensureCert();
|
|
stageBundle();
|
|
await signZxp(version, passphrase);
|
|
rmSync(STAGE_DIR, { recursive: true, force: true });
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error('ZXP build failed:', err);
|
|
process.exit(1);
|
|
});
|