diff --git a/app/config/server.ts b/app/config/server.ts index b6f32a410..eea8a18d6 100644 --- a/app/config/server.ts +++ b/app/config/server.ts @@ -31,6 +31,9 @@ declare global { // google only GOOGLE_API_KEY?: string; GOOGLE_URL?: string; + + // google tag manager + GTM_ID?: string; } } } diff --git a/app/global.d.ts b/app/global.d.ts index 7ddf5868b..e2daf9ba9 100644 --- a/app/global.d.ts +++ b/app/global.d.ts @@ -19,6 +19,7 @@ declare interface Window { }; fs: { writeBinaryFile(path: string, data: Uint8Array): Promise; + writeTextFile(path: string, data: string): Promise; }; notification: { requestPermission(): Promise; diff --git a/app/utils.ts b/app/utils.ts index b484e8386..1184d407d 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -8,10 +8,12 @@ export function trimTopic(topic: string) { // Fix an issue where double quotes still show in the Indonesian language // This will remove the specified punctuation from the end of the string // and also trim quotes from both the start and end if they exist. - return topic - // fix for gemini - .replace(/^["“”*]+|["“”*]+$/g, "") - .replace(/[,。!?”“"、,.!?*]*$/, ""); + return ( + topic + // fix for gemini + .replace(/^["“”*]+|["“”*]+$/g, "") + .replace(/[,。!?”“"、,.!?*]*$/, "") + ); } export async function copyToClipboard(text: string) { @@ -57,10 +59,7 @@ export async function downloadAs(text: string, filename: string) { if (result !== null) { try { - await window.__TAURI__.fs.writeBinaryFile( - result, - new Uint8Array([...text].map((c) => c.charCodeAt(0))), - ); + await window.__TAURI__.fs.writeTextFile(result, text); showToast(Locale.Download.Success); } catch (error) { showToast(Locale.Download.Failed);