From 8ba054c786cfed447132f6d03fd36274364535fb Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 16 Jul 2024 15:59:33 -0400 Subject: [PATCH] Encode secret --- libretranslate/templates/app.js.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretranslate/templates/app.js.template b/libretranslate/templates/app.js.template index b2f5c39..ca1eb96 100644 --- a/libretranslate/templates/app.js.template +++ b/libretranslate/templates/app.js.template @@ -41,7 +41,7 @@ document.addEventListener('DOMContentLoaded', function(){ filesTranslation: true, frontendTimeout: 500, - apiSecret: atob("{{ api_secret }}") + apiSecret: "{{ api_secret }}" }, mounted: function() { const self = this; @@ -244,7 +244,7 @@ document.addEventListener('DOMContentLoaded', function(){ data.append("format", self.isHtml ? "html" : "text"); data.append("alternatives", 3); data.append("api_key", localStorage.getItem("api_key") || ""); - if (self.apiSecret) data.append("secret", self.apiSecret); + if (self.apiSecret) data.append("secret", atob(self.apiSecret)); request.open('POST', BaseUrl + '/translate', true);