fix: redundant padding character in usercss id

This commit is contained in:
Lewis Crichton 2023-09-10 13:51:45 +01:00
parent 141b1a7041
commit b1bdc48769
No known key found for this signature in database
2 changed files with 5 additions and 1 deletions

View file

@ -83,6 +83,10 @@ export async function compileUsercss(fileName: string) {
// In default and USO, it has no special meaning, so we'll just leave it as a number. // In default and USO, it has no special meaning, so we'll just leave it as a number.
varsToPass[k] = varsToPass[k] === "1" ? "true" : "false"; varsToPass[k] = varsToPass[k] === "1" ? "true" : "false";
} }
if (v.type === "range") {
varsToPass[k] = `${varsToPass[k]}${v.units ?? "px"}`;
}
} }
try { try {

View file

@ -34,5 +34,5 @@ export async function getUserCssId(header: UserstyleHeader): Promise<string> {
const idHash = await window.crypto.subtle.digest("SHA-256", new Uint8Array([...nameHash, ...namespaceHash])); const idHash = await window.crypto.subtle.digest("SHA-256", new Uint8Array([...nameHash, ...namespaceHash]));
return window.btoa(String.fromCharCode(...new Uint8Array(idHash))); return window.btoa(String.fromCharCode(...new Uint8Array(idHash))).substring(0, 43); // base64 adds one more padding character
} }