@hatk/hatk 0.0.1-alpha.58 → 0.0.1-alpha.59
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/dist/opengraph.d.ts.map +1 -1
- package/dist/opengraph.js +9 -5
- package/package.json +1 -1
package/dist/opengraph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opengraph.d.ts","sourceRoot":"","sources":["../src/opengraph.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,4CAA4C;AAC5C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAC3B,QAAQ,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAAA;QAC3C,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CACpD;AAED,qDAAqD;AACrD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,UAAU,CAAA;IACnB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,CAAA;IAC5D,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,M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AC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAChD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC;;;oBAA7C,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC;EAEnG;AAkCD,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEhE;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;CAC9D,GAAG,IAAI,CAqDP;AAED,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BrF;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyC3E"}
|
package/dist/opengraph.js
CHANGED
|
@@ -83,8 +83,10 @@ export async function initOpengraph(ogDir) {
|
|
|
83
83
|
if (!resp.ok)
|
|
84
84
|
return null;
|
|
85
85
|
const buf = Buffer.from(await resp.arrayBuffer());
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// Force image/png for satori compatibility (satori doesn't support webp)
|
|
87
|
+
const contentType = resp.headers.get('content-type') || 'image/png';
|
|
88
|
+
const safeType = contentType.includes('webp') ? 'image/png' : contentType;
|
|
89
|
+
return `data:${safeType};base64,${buf.toString('base64')}`;
|
|
88
90
|
}
|
|
89
91
|
catch {
|
|
90
92
|
return null;
|
|
@@ -136,8 +138,10 @@ export function registerOgHandler(ogMod) {
|
|
|
136
138
|
if (!resp.ok)
|
|
137
139
|
return null;
|
|
138
140
|
const buf = Buffer.from(await resp.arrayBuffer());
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
// Force image/png for satori compatibility (satori doesn't support webp)
|
|
142
|
+
const contentType = resp.headers.get('content-type') || 'image/png';
|
|
143
|
+
const safeType = contentType.includes('webp') ? 'image/png' : contentType;
|
|
144
|
+
return `data:${safeType};base64,${buf.toString('base64')}`;
|
|
141
145
|
}
|
|
142
146
|
catch {
|
|
143
147
|
return null;
|
|
@@ -187,7 +191,7 @@ export async function handleOpengraphRequest(pathname) {
|
|
|
187
191
|
return png;
|
|
188
192
|
}
|
|
189
193
|
catch (err) {
|
|
190
|
-
console.error(`[opengraph] error in ${handler.name}:`, err.message);
|
|
194
|
+
console.error(`[opengraph] error in ${handler.name}:`, err.message, err.stack);
|
|
191
195
|
return null;
|
|
192
196
|
}
|
|
193
197
|
}
|