Close the last three UI leftovers: shared staff HTML, cookie domain, stock Swagger label.
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
verae-staff-ui holds one review template for CS and access-staff. Staff cookies take STAFF_COOKIE_DOMAIN for a reverse-proxy host. /docs stays vendor Swagger with an integrator banner only.
This commit is contained in:
parent
b68fefdea8
commit
d8efffe8be
23 changed files with 368 additions and 44 deletions
27
packages/verae-staff-ui/src/load.js
Normal file
27
packages/verae-staff-ui/src/load.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export function reviewHtmlPath(fallback) {
|
||||
const env = process.env.STAFF_UI_HTML;
|
||||
const shared = path.join(HERE, '..', 'public', 'review.html');
|
||||
const sibling = path.join(HERE, '..', '..', 'verae-staff-ui', 'public', 'review.html');
|
||||
for (const p of [env, shared, sibling, fallback]) {
|
||||
if (p && fs.existsSync(p)) return p;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
export function loadReviewHtml(opts, fallback) {
|
||||
const file = reviewHtmlPath(fallback);
|
||||
let html = fs.readFileSync(file, 'utf8');
|
||||
const map = {
|
||||
'{{TITLE}}': opts.title || 'Staff review',
|
||||
'{{KICKER}}': opts.kicker || 'staff',
|
||||
'{{LEDE}}': opts.lede || 'Review prepaid balance, credits, usage, and payments in dollars.',
|
||||
};
|
||||
for (const [k, v] of Object.entries(map)) html = html.split(k).join(v);
|
||||
return html;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue