@zzclub/pipeline 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -193,6 +193,13 @@ describe("extractImageUrls", () => {
|
|
|
193
193
|
});
|
|
194
194
|
|
|
195
195
|
describe("replaceImageUrls", () => {
|
|
196
|
+
test("replaces large Base64 sources and preserves literal replacement URLs", () => {
|
|
197
|
+
const src = `data:image/png;base64,${"A".repeat(3_400_000)}`;
|
|
198
|
+
const url = "https://example.com/image.png?value=$&";
|
|
199
|
+
expect(replaceImageUrls(`<img src="${src}" data-src="${src}">`, { [src]: url }))
|
|
200
|
+
.toBe(`<img src="${url}" data-src="${url}">`);
|
|
201
|
+
});
|
|
202
|
+
|
|
196
203
|
test("replaces URLs using the mapping", () => {
|
|
197
204
|
const html = '<img src="https://old.com/img.png">';
|
|
198
205
|
const result = replaceImageUrls(html, { "https://old.com/img.png": "https://new.com/img.png" });
|
package/src/providers/wechat.ts
CHANGED
|
@@ -276,8 +276,8 @@ export function replaceImageUrls(html: string, imageUrlMap: Record<string, strin
|
|
|
276
276
|
if (!orig || !wx) {
|
|
277
277
|
continue;
|
|
278
278
|
}
|
|
279
|
-
|
|
280
|
-
replaced = replaced.
|
|
279
|
+
// Base64 图片地址可能数 MB,按字面替换,避免超大正则及替换串转义。
|
|
280
|
+
replaced = replaced.replaceAll(orig, () => wx);
|
|
281
281
|
}
|
|
282
282
|
return replaced;
|
|
283
283
|
}
|
package/src/render-branding.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function resolveRenderBranding(config: PipelineConfig, account: string):
|
|
|
16
16
|
const branding = config.render.branding;
|
|
17
17
|
const selected = branding.accounts[account];
|
|
18
18
|
const visual = getVisualParams(account);
|
|
19
|
-
const logo = selected?.logo ?? branding.logo ?? config.imgx.icon;
|
|
19
|
+
const logo = process.env.ZZHUB_PIPELINE_BRANDING_LOGO?.trim() || (selected?.logo ?? branding.logo ?? config.imgx.icon);
|
|
20
20
|
return {
|
|
21
21
|
logo: logo === null ? resolveInputPath(visual?.fallback_icon ?? join(ICONS_DIR, "logo.png")) : resolveBrandLogo(logo),
|
|
22
22
|
footerText: selected?.footerText ?? branding.footerText ?? visual?.footer ?? config.wx.accounts[account]?.name ?? "",
|