mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-11-03 12:20:36 +00:00
Refactor(database): use gorm+sqlite instead of bbolt Feat: Add delete short link functionality Fix: Load correct configuration template during meta config conversion
16 lines
482 B
TypeScript
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);
|
|
}
|