Release v2.19.1: repair managed font references
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m17s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 32s

This commit is contained in:
lzstealth committed 2026-10-24 20:26:00 +01:00
1 parent 90253e98a4
commit 9ca372429b
11 files changed
+212 -23

No files matched your search

+11 -4
View File
@@ -1,4 +1,5 @@
const crypto = require('crypto');
const { BASE_FONT_FAMILIES } = require('./font-families');
const REFERENCE_TYPES_BY_FIELD = {
source_id: 'api-request',
@@ -34,7 +35,10 @@ function addReference(references, seen, ownerKey, referenceType, value) {
if (!Number.isFinite(numericValue)) return;
referenceValue = String(numericValue);
}
if (referenceType === 'font-family') referenceValue = normalizeFontFamily(referenceValue);
if (referenceType === 'font-family') {
referenceValue = normalizeFontFamily(referenceValue);
if (BASE_FONT_FAMILIES.has(referenceValue)) return;
}
if (!referenceValue) return;
const key = String(ownerKey || '') + '\u0000' + referenceType + '\u0000' + referenceValue;
if (seen.has(key)) return;
@@ -75,10 +79,13 @@ function collectValueReferences(value, ownerKey, references, seen) {
if (normalized) addReference(references, seen, ownerKey, 'media', normalized);
});
const fontFamilies = /font-family\s*:\s*(?:"([^"]+)"|'([^']+)'|([^;}"']+))/gi;
const fontValue = value.replace(/&(?:quot|apos|#0*34|#0*39|#x0*22|#x0*27);/gi, function (entity) {
return /^&(?:quot|#0*34|#x0*22);$/i.test(entity) ? '"' : "'";
});
const fontFamilies = /font-family\s*:\s*((?:"[^"]*"|'[^']*'|[^;}"'])+)/gi;
let match;
while ((match = fontFamilies.exec(value))) {
getFontFamilyCandidates(match[1] || match[2] || match[3]).forEach(function (family) {
while ((match = fontFamilies.exec(fontValue))) {
getFontFamilyCandidates(match[1]).forEach(function (family) {
addReference(references, seen, ownerKey, 'font-family', family);
});
}