Fix Stack Overflow in torrent-to-transmission.user.js
This commit is contained in:
@@ -19,12 +19,12 @@
|
|||||||
async function getConfig() {
|
async function getConfig() {
|
||||||
let config = await GM_getValue('transmissionConfig');
|
let config = await GM_getValue('transmissionConfig');
|
||||||
if (config) return JSON.parse(config);
|
if (config) return JSON.parse(config);
|
||||||
return await askForConfig();
|
return await askForConfigSimple();
|
||||||
}
|
}
|
||||||
async function setConfig(config) {
|
async function setConfig(config) {
|
||||||
await GM_setValue('transmissionConfig', JSON.stringify(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):');
|
let ipport = prompt('Transmission IP und Port (z.B. 192.168.1.100:9091):');
|
||||||
if (!ipport) return null;
|
if (!ipport) return null;
|
||||||
let user = prompt('Benutzername (leer lassen, falls nicht benötigt):');
|
let user = prompt('Benutzername (leer lassen, falls nicht benötigt):');
|
||||||
@@ -656,7 +656,12 @@
|
|||||||
responseType: 'arraybuffer',
|
responseType: 'arraybuffer',
|
||||||
onload: function(response) {
|
onload: function(response) {
|
||||||
const arrayBuffer = response.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);
|
const fileList = parseTorrentFileList(arrayBuffer);
|
||||||
showPathDialog(function(dir, selectedFiles) {
|
showPathDialog(function(dir, selectedFiles) {
|
||||||
// selectedFiles: Array von bools, true = gewünscht
|
// selectedFiles: Array von bools, true = gewünscht
|
||||||
|
|||||||
Reference in New Issue
Block a user