mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
chore: lint:fix
This commit is contained in:
parent
4d7fa7abb6
commit
e8a8a66397
5 changed files with 22 additions and 13 deletions
|
@ -219,7 +219,7 @@ function traverseParsedHtml(
|
|||
) {
|
||||
let js = node.children[0].data;
|
||||
// node.attribs[`data-scramjet-script-source-src`] = btoa(js);
|
||||
node.attribs[`data-scramjet-script-source-src`] = bytesToBase64(
|
||||
node.attribs["data-scramjet-script-source-src"] = bytesToBase64(
|
||||
new TextEncoder().encode(js)
|
||||
);
|
||||
const htmlcomment = /<!--[\s\S]*?-->/g;
|
||||
|
@ -272,12 +272,14 @@ export function rewriteSrcset(srcset: string, meta: URLMeta) {
|
|||
|
||||
function base64ToBytes(base64) {
|
||||
const binString = atob(base64);
|
||||
return Uint8Array.from(binString, (m) => m.codePointAt(0));
|
||||
|
||||
return Uint8Array.from(binString, (m) => m.codePointAt(0));
|
||||
}
|
||||
|
||||
function bytesToBase64(bytes: Uint8Array) {
|
||||
const binString = Array.from(bytes, (byte) =>
|
||||
String.fromCodePoint(byte)
|
||||
).join("");
|
||||
return btoa(binString);
|
||||
|
||||
return btoa(binString);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue