diff --git a/torrent-to-transmission.user.js b/torrent-to-transmission.user.js index e69078e..429d619 100644 --- a/torrent-to-transmission.user.js +++ b/torrent-to-transmission.user.js @@ -19,12 +19,12 @@ async function getConfig() { let config = await GM_getValue('transmissionConfig'); if (config) return JSON.parse(config); - return await askForConfig(); + return await askForConfigSimple(); } async function setConfig(config) { await GM_setValue('transmissionConfig', JSON.stringify(config)); } - async function askForConfig() { + async function askForConfigSimple() { let ipport = prompt('Transmission IP und Port (z.B. 192.168.1.100:9091):'); if (!ipport) return null; let user = prompt('Benutzername (leer lassen, falls nicht benötigt):'); @@ -656,7 +656,12 @@ responseType: 'arraybuffer', onload: function(response) { const arrayBuffer = response.response; - const base64 = btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer))); + const bytes = new Uint8Array(arrayBuffer); + let binary = ''; + for (let i = 0; i < bytes.byteLength; i++) { + binary += String.fromCharCode(bytes[i]); + } + const base64 = btoa(binary); const fileList = parseTorrentFileList(arrayBuffer); showPathDialog(function(dir, selectedFiles) { // selectedFiles: Array von bools, true = gewünscht