File Name
diff --git a/App/_locales/en/messages.json b/App/_locales/en/messages.json index 44f66af..8a0ef61 100644 --- a/App/_locales/en/messages.json +++ b/App/_locales/en/messages.json @@ -90,7 +90,7 @@ "UI_save": { "message": "Save", - "description": "for download pannel" + "description": "for download panel" }, "UI_saveas": { @@ -103,6 +103,11 @@ "description": "" }, + "UI_adv": { + "message": "Advanced", + "description": "" + }, + "UI_fileName": { "message": "File Name", "description": "" diff --git a/App/_locales/zh_CN/messages.json b/App/_locales/zh_CN/messages.json index 268e3ea..344606c 100644 --- a/App/_locales/zh_CN/messages.json +++ b/App/_locales/zh_CN/messages.json @@ -103,6 +103,12 @@ "description": "" }, + + "UI_adv": { + "message": "高级", + "description": "" + }, + "UI_fileName": { "message": "文件名", "description": "" diff --git a/App/_locales/zh_TW/messages.json b/App/_locales/zh_TW/messages.json index a22648d..64ac825 100644 --- a/App/_locales/zh_TW/messages.json +++ b/App/_locales/zh_TW/messages.json @@ -103,6 +103,12 @@ "description": "" }, + + "UI_adv": { + "message": "進階", + "description": "" + }, + "UI_fileName": { "message": "檔案名稱", "description": "" diff --git a/App/common.js b/App/common.js index b4fee0b..1339d90 100644 --- a/App/common.js +++ b/App/common.js @@ -10,7 +10,7 @@ var fileTypeFilterB = ""; var urlFilterB = ""; var mon; -function sendTo(url, fileName, filePath, header) { +function sendTo(url, fileName, filePath, header, server) { // check whether config is set browser.storage.local.get("initialize", item => { if (!item.initialize || (item.initialize == undefined)) { @@ -18,49 +18,70 @@ function sendTo(url, fileName, filePath, header) { notify(browser.i18n.getMessage("error_setConfig")); } else { - browser.storage.local.get(config.command.guess, function(item) { - var secure = false; - if (item.protocol.toLowerCase == "https" || item.protocol.toLowerCase == "wss") - secure = true; - var options = { - host: item.host, - port: item.port, - secure: secure, - secret: item.token, - path: "/" + item.interf - }; - - var aria2 = new Aria2(options); - // check whether aria2 is runnning - isRunning(item, aria2); - - // Send TO Aria2 - filePath = filePath.replace(/\\/g, '\\\\'); - item.path = item.path.replace(/\\/g, '\\\\'); - var params = {}; - if (header != "[]") - params.header = header; - params.out = fileName; - if (filePath != "") { - // file path from download panel - params.dir = filePath; - } - else if (item.path != "") { - // file path from setting - params.dir = item.path; - } - if (item.protocol.toLowerCase() == "ws" || item.protocol.toLowerCase() == "wss") { - aria2.open().then( - function (res) { - aria2.addUri([url], params).then( - function (res) { - monitor(options); - notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); - aria2.close(); - }, - function (err) { - // retry again after 3 seconds - setTimeout( () => { + if (server == "1") { + browser.storage.local.get(config.command.guess, function(item) { + var secure = false; + if (item.protocol.toLowerCase == "https" || item.protocol.toLowerCase == "wss") + secure = true; + var options = { + host: item.host, + port: item.port, + secure: secure, + secret: item.token, + path: "/" + item.interf + }; + + var aria2 = new Aria2(options); + // check whether aria2 is runnning + isRunning(item, aria2); + + // Send TO Aria2 + filePath = filePath.replace(/\\/g, '\\\\'); + item.path = item.path.replace(/\\/g, '\\\\'); + var params = {}; + if (header != "[]") + params.header = header; + params.out = fileName; + if (filePath != "") { + // file path from download panel + params.dir = filePath; + } + else if (item.path != "") { + // file path from setting + params.dir = item.path; + } + if (item.protocol.toLowerCase() == "ws" || item.protocol.toLowerCase() == "wss") { + aria2.open().then( + function (res) { + aria2.addUri([url], params).then( + function (res) { + monitor(options); + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.addUri([url], params).then( + function (res) { + monitor(options); + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); + }, + function (err) { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + aria2.close(); + } + ); + }, 3000); + } + ); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.open().then( () => { aria2.addUri([url], params).then( function (res) { monitor(options); @@ -73,57 +94,244 @@ function sendTo(url, fileName, filePath, header) { aria2.close(); } ); - }, 3000); - } - ); - }, - function (err) { - // retry again after 3 seconds - setTimeout( () => { - aria2.open().then( () => { + }, (err) => { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + }); + }, 3000); + } + ); + } + else { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { aria2.addUri([url], params).then( function (res) { - monitor(options); notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); - aria2.close(); }, function (err) { console.log('Error', err); notify(browser.i18n.getMessage("error_connect")); - aria2.close(); } ); - }, (err) => { - console.log('Error', err); - notify(browser.i18n.getMessage("error_connect")); - }); - }, 3000); - } - ); - } - else { - aria2.addUri([url], params).then( - function (res) { - notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); - }, - function (err) { - // retry again after 3 seconds - setTimeout( () => { + }, 3000); + } + ); + } + console.log("default", url, params); + }); + } + else if(server == "2") { + browser.storage.local.get(config.command.s2, function(item) { + var secure = false; + if (item.protocol2.toLowerCase == "https" || item.protocol2.toLowerCase == "wss") + secure = true; + var options = { + host: item.host2, + port: item.port2, + secure: secure, + secret: item.token2, + path: "/" + item.interf2 + }; + + var aria2 = new Aria2(options); + + // Send TO Aria2 + filePath = filePath.replace(/\\/g, '\\\\'); + item.path2 = item.path2.replace(/\\/g, '\\\\'); + var params = {}; + if (header != "[]") + params.header = header; + params.out = fileName; + if (filePath != "") { + // file path from download panel + params.dir = filePath; + } + else if (item.path2 != "") { + // file path from setting + params.dir = item.path2; + } + if (item.protocol2.toLowerCase() == "ws" || item.protocol2.toLowerCase() == "wss") { + aria2.open().then( + function (res) { aria2.addUri([url], params).then( function (res) { notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); }, function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); + }, + function (err) { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + aria2.close(); + } + ); + }, 3000); + } + ); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.open().then( () => { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); + }, + function (err) { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + aria2.close(); + } + ); + }, (err) => { console.log('Error', err); notify(browser.i18n.getMessage("error_connect")); + }); + }, 3000); + } + ); + } + else { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + }, + function (err) { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + } + ); + }, 3000); + } + ); + } + console.log("rpc2", url, params); + }); + } + else if(server == "3") { + browser.storage.local.get(config.command.s3, function(item) { + var secure = false; + if (item.protocol3.toLowerCase == "https" || item.protocol3.toLowerCase == "wss") + secure = true; + var options = { + host: item.host3, + port: item.port3, + secure: secure, + secret: item.token3, + path: "/" + item.interf3 + }; + + var aria2 = new Aria2(options); + + // Send TO Aria2 + filePath = filePath.replace(/\\/g, '\\\\'); + item.path3 = item.path3.replace(/\\/g, '\\\\'); + var params = {}; + if (header != "[]") + params.header = header; + params.out = fileName; + if (filePath != "") { + // file path from download panel + params.dir = filePath; + } + else if (item.path3 != "") { + // file path from setting + params.dir = item.path3; + } + if (item.protocol3.toLowerCase() == "ws" || item.protocol3.toLowerCase() == "wss") { + aria2.open().then( + function (res) { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); + }, + function (err) { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + aria2.close(); + } + ); + }, 3000); } ); - }, 3000); - } - ); - } - console.log(url, params); - }); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.open().then( () => { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + aria2.close(); + }, + function (err) { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + aria2.close(); + } + ); + }, (err) => { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + }); + }, 3000); + } + ); + } + else { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + }, + function (err) { + // retry again after 3 seconds + setTimeout( () => { + aria2.addUri([url], params).then( + function (res) { + notify(browser.i18n.getMessage("success_connect", fileName) + "\n\n" + url); + }, + function (err) { + console.log('Error', err); + notify(browser.i18n.getMessage("error_connect")); + } + ); + }, 3000); + } + ); + } + console.log("rpc3", url, params); + }); + } } }); } @@ -190,7 +398,7 @@ function handleMessage(request, sender, sendResponse) { }); break; case "download": - sendTo(request.url, request.fileName, request.filePath, request.header); + sendTo(request.url, request.fileName, request.filePath, request.header, request.server); sendResponse({ response: "send success" }); diff --git a/App/config.js b/App/config.js index a56829a..80768eb 100644 --- a/App/config.js +++ b/App/config.js @@ -20,12 +20,32 @@ config.command = { chgLog: true, badge: true, cmDownPanel: true, - ua: true, + ua: false, minFileSize: 0, typeFilterA: "", urlFilterA: "", typeFilterB: "", urlFilterB: "", }; + }, + get s2() { + return { + path2: "", + protocol2: "ws", + host2: "127.0.0.1", + port2: "6800", + interf2: "jsonrpc", + token2: "", + }; + }, + get s3() { + return { + path3: "", + protocol3: "ws", + host3: "127.0.0.1", + port3: "6800", + interf3: "jsonrpc", + token3: "", + }; } }; diff --git a/App/data/DownloadPanel/index.html b/App/data/DownloadPanel/index.html index f2b4310..592b4f3 100644 --- a/App/data/DownloadPanel/index.html +++ b/App/data/DownloadPanel/index.html @@ -73,14 +73,7 @@ top: 166px; font-size: 13.3px; } -.gwd-div-3yxp { - height: 200px; - width: 400px; -} -.gwd-div-3lnz { - height: 200px; - width: 400px; -} + .gwd-button-1rg2 { left: 91px; } @@ -238,199 +231,6 @@ width: 400px; height: 200px; } -.dots { - position: relative; - width: 100%; - top: 100px; -} -.dots span:nth-child(1) { - animation-delay: 0.1s; - -webkit-animation-delay: 0.1s; - -moz-animation-delay: 0.1s; -} -.dots span:nth-child(1)::after { - left: -10px; -} -.dots span:nth-child(2) { - animation-delay: 0.2s; - -webkit-animation-delay: 0.2s; - -moz-animation-delay: 0.2s; -} -.dots span:nth-child(2)::after { - left: -20px; -} -.dots span:nth-child(3) { - animation-delay: 0.3s; - -webkit-animation-delay: 0.3s; - -moz-animation-delay: 0.3s; -} -.dots span:nth-child(3)::after { - left: -30px; -} -.dots span:nth-child(4) { - animation-delay: 0.4s; - -webkit-animation-delay: 0.4s; - -moz-animation-delay: 0.4s; -} -.dots span:nth-child(4)::after { - left: -40px; -} -.dots span:nth-child(5) { - animation-delay: 0.5s; - -webkit-animation-delay: 0.5s; - -moz-animation-delay: 0.5s; -} -.dots span:nth-child(5)::after { - left: -50px; -} -.dots span:nth-child(6) { - animation-delay: 0.6s; - -webkit-animation-delay: 0.6s; - -moz-animation-delay: 0.6s; -} -.dots span:nth-child(6)::after { - left: -60px; -} -.dots span:nth-child(7) { - animation-delay: 0.7s; - -webkit-animation-delay: 0.7s; - -moz-animation-delay: 0.7s; -} -.dots span:nth-child(7)::after { - left: -70px; -} -.dots span:nth-child(8) { - animation-delay: 0.8s; - -webkit-animation-delay: 0.8s; - -moz-animation-delay: 0.8s; -} -.dots span:nth-child(8)::after { - left: -80px; -} -.dots span:nth-child(9) { - animation-delay: 0.9s; - -webkit-animation-delay: 0.9s; - -moz-animation-delay: 0.9s; -} -.dots span:nth-child(9)::after { - left: -90px; -} -.dots span:nth-child(10) { - animation-delay: 1s; - -webkit-animation-delay: 1s; - -moz-animation-delay: 1s; -} -.dots span:nth-child(10)::after { - left: -100px; -} -.dots span { - display: inline-block; - position: absolute; - animation-duration: 4s; - -webkit-animation-duration: 4s; - -moz-animation-duration: 4s; - animation-iteration-count: infinite; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; -} -.dots span::after { - content: ""; - position: absolute; - display: inline-block; - background-color: rgb(21, 112, 166); - width: 5px; - height: 5px; - border-radius: 50%; -} -.dots.animate span { - animation-name: dots; - -webkit-animation-name: dots; - -moz-animation-name: dots; -} -@keyframes dots { - 0%, 20% { - left: 0px; - animation-timing-function: ease-out; - -webkit-animation-timing-function: ease-out; - -moz-animation-timing-function: ease-out; - opacity: 0; - } - 25% { - opacity: 1; - } - 35% { - left: 45%; - animation-timing-function: linear; - -webkit-animation-timing-function: linear; - -moz-animation-timing-function: linear; - } - 65% { - left: 55%; - animation-timing-function: ease-in; - -webkit-animation-timing-function: ease-in; - -moz-animation-timing-function: ease-in; - } - 75% { - opacity: 1; - } - 80%, - 100% { - left: 100%; - opacity: 0; - } -} -@-webkit-keyframes dots { - 0%, 20% { - left: 0px; - -webkit-animation-timing-function: ease-out; - opacity: 0; - } - 25% { - opacity: 1; - } - 35% { - left: 45%; - -webkit-animation-timing-function: linear; - } - 65% { - left: 55%; - -webkit-animation-timing-function: ease-in; - } - 75% { - opacity: 1; - } - 80%, - 100% { - left: 100%; - opacity: 0; - } -} -@-moz-keyframes dots { - 0%, 20% { - left: 0px; - -moz-animation-timing-function: ease-out; - opacity: 0; - } - 25% { - opacity: 1; - } - 35% { - left: 45%; - -moz-animation-timing-function: linear; - } - 65% { - left: 55%; - -moz-animation-timing-function: ease-in; - } - 75% { - opacity: 1; - } - 80%, - 100% { - left: 100%; - opacity: 0; - } -} .gwd-p-icch { position: absolute; top: 76px; @@ -454,20 +254,63 @@ .gwd-p-13lk { top: 52px; width: 357px; -} +} + +.s1 { + position: absolute; + top: 200px; + width: 354px; + left: 20px; + border-image-source: none; + border-image-width: initial; + border-image-outset: initial; + border-image-repeat: initial; + border-color: rgb(131, 131, 131); + border-style: solid; + border-width: 1px; + border-radius: 2px; + display: none; +} + +.s1:focus { + outline: none; + transition: 0.4s; + -webkit-transition: 0.4s; + -moz-transition: 0.4s; + border: 1px solid rgb(111, 161, 217) !important; + box-shadow: rgb(111, 161, 217) 0px 0px 3px !important; +} + +.head { + position: absolute; + top: 230px; + width: 346px; + left: 20px; + height: 50px; + border-image-source: none; + border-image-width: initial; + border-image-outset: initial; + border-image-repeat: initial; + border-color: rgb(131, 131, 131); + border-style: solid; + border-width: 1px; + border-radius: 2px; + display: none; +} +
-File Name
Downloading
+ +You need to download and start Aria2 by youself, complete at least + "Protocol," "Host," "Port" and "Interface" below and then click the "Save" + button.
+If you don't want to start Aria2 manually, just write a program to start + Aria2 in the background and register it to the system's "autostart" or "uri + scheme."
+ You can find the sample files here. +Default Download Path: | ++ |
+ | Download path of Aria2(only) | +
Protocol: | ++ |
+ | RPC connection protocol of Aria2 | +
Host: | ++ |
+ | RPC host of Aria2. You can use ip or domain name. | +
Port: | ++ |
+ | Aria2 RPC port | +
Interface: | ++ |
+ | Aria2 RPC path. Default value is "jsonrpc" | +
Token: | ++ |
+ | Aria2 RPC secret, optional. | +
You need to download and start Aria2 by youself, complete at least + "Protocol," "Host," "Port" and "Interface" below and then click the "Save" + button.
+If you don't want to start Aria2 manually, just write a program to start + Aria2 in the background and register it to the system's "autostart" or "uri + scheme."
+ You can find the sample files here. +Default Download Path: | ++ |
+ | Download path of Aria2(only) | +
Protocol: | ++ |
+ | RPC connection protocol of Aria2 | +
Host: | ++ |
+ | RPC host of Aria2. You can use ip or domain name. | +
Port: | ++ |
+ | Aria2 RPC port | +
Interface: | ++ |
+ | Aria2 RPC path. Default value is "jsonrpc" | +
Token: | ++ |
+ | Aria2 RPC secret, optional. | +