1
0
mirror of https://github.com/bestnite/sub2clash.git synced 2025-11-03 12:20:36 +00:00
Files
sub2clash/server/frontend/src/utils.ts
nite 86b74f30e7 Refactor(frontend): Refactor frontend using Lit
Refactor(database): use gorm+sqlite instead of bbolt
Feat: Add delete short link functionality
Fix: Load correct configuration template during meta config conversion
2025-10-19 03:13:10 +11:00

16 lines
482 B
TypeScript

export function base64EncodeUnicode(str: string) {
const bytes = new TextEncoder().encode(str);
let binary = "";
bytes.forEach((b) => (binary += String.fromCharCode(b)));
return btoa(binary);
}
export function base64decodeUnicode(str: string) {
const binaryString = atob(str);
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return new TextDecoder().decode(bytes);
}