This commit is contained in:
seb
2026-11-01 05:38:45 +01:00
parent 8f9c941699
commit bf081f875d
2 changed files with 18 additions and 8 deletions

View File

@@ -14,7 +14,6 @@ import {
parseFullHash,
articleErrorStatus,
interpolateString,
interpolateObjects,
} from './shared.js';
/**
@@ -434,7 +433,16 @@ export function register(app, basePath = '') {
? content
: [];
const interpolatedObjects = interpolateObjects(objects, article);
const interpolatedObjects = objects.map(obj => {
const cloned = { ...obj };
if (typeof cloned.text === 'string') {
cloned.text = interpolateString(cloned.text, article);
}
if (typeof cloned.code === 'string') {
cloned.code = interpolateString(cloned.code, article);
}
return cloned;
});
const printPayload = await renderLabel({
width: template.width,

View File

@@ -96,10 +96,12 @@ export function register(app, basePath = '') {
try {
const templates = await db.list(req.user.id);
res.status(200).json({ labeltemplates: templates.map((t) => {
res.status(200).json({
labeltemplates: templates.map((t) => {
const { content, ...rest } = serializeTemplate(t);
return rest;
}) });
})
});
} catch (error) {
const status = labeltemplateErrorStatus(error);
if (status === 500) console.error('List label templates failed:', error);