Add, Fix: percent, versioning, start
This commit is contained in:
parent
6fbfdf0323
commit
429a5c764f
|
@ -34,11 +34,12 @@ function dl(mainWindow, lang_path, base, dirname) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//アプデDL
|
//アプデDL
|
||||||
ipc.on('download-btn', (e, args) => {
|
ipc.on('download-btn', async (e, args) => {
|
||||||
function dl(url, file, dir, e) {
|
function dl(url, file, dir, e) {
|
||||||
e.sender.webContents.send('mess', 'ダウンロードを開始します。')
|
e.sender.webContents.send('mess', 'ダウンロードを開始します。')
|
||||||
const opts = {
|
const opts = {
|
||||||
directory: dir,
|
directory: dir,
|
||||||
|
filename: file,
|
||||||
openFolderWhenDone: true,
|
openFolderWhenDone: true,
|
||||||
onProgress: function(event) {
|
onProgress: function(event) {
|
||||||
e.sender.webContents.send('prog', event)
|
e.sender.webContents.send('prog', event)
|
||||||
|
@ -54,29 +55,27 @@ function dl(mainWindow, lang_path, base, dirname) {
|
||||||
}
|
}
|
||||||
var platform = process.platform
|
var platform = process.platform
|
||||||
var bit = process.arch
|
var bit = process.arch
|
||||||
dialog.showSaveDialog(
|
var options = {
|
||||||
null,
|
title: 'Save',
|
||||||
{
|
defaultPath: app.getPath('home') + '/' + args[1]
|
||||||
title: 'Save',
|
}
|
||||||
defaultPath: app.getPath('home') + '/' + args[1]
|
const file = await dialog.showSaveDialog(null, options)
|
||||||
},
|
const savedFiles = file.filePath
|
||||||
savedFiles => {
|
console.log(savedFiles)
|
||||||
console.log(savedFiles)
|
if (!savedFiles) {
|
||||||
if (!savedFiles) {
|
return false
|
||||||
return false
|
}
|
||||||
}
|
if (platform == 'win32') {
|
||||||
if (platform == 'win32') {
|
var m = savedFiles.match(/(.+)\\(.+)$/)
|
||||||
var m = savedFiles.match(/(.+)\\(.+)$/)
|
} else {
|
||||||
} else {
|
var m = savedFiles.match(/(.+)\/(.+)$/)
|
||||||
var m = savedFiles.match(/(.+)\/(.+)$/)
|
}
|
||||||
}
|
//console.log(m);
|
||||||
//console.log(m);
|
if (isExistFile(savedFiles)) {
|
||||||
if (isExistFile(savedFiles)) {
|
fs.unlinkSync(savedFiles)
|
||||||
fs.unlinkSync(savedFiles)
|
}
|
||||||
}
|
console.log(m)
|
||||||
dl(args[0], args[1], m[1], e)
|
dl(args[0], m[2], m[1], e)
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function isExistFile(file) {
|
function isExistFile(file) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"hardwareAcceleration": "Disable hardware acceleration",
|
"hardwareAcceleration": "Disable hardware acceleration",
|
||||||
"hardwareAccelerationWarn": "Auto restarted",
|
"hardwareAccelerationWarn": "Auto restarted",
|
||||||
"theme": "Themes",
|
"theme": "Themes",
|
||||||
"popup": "Popup notification(on Windows)",
|
"popup": "Popup notification",
|
||||||
"popupwarn": "Hide to set \"0\"",
|
"popupwarn": "Hide to set \"0\"",
|
||||||
"s": "sec",
|
"s": "sec",
|
||||||
"nativenotf": "Native notification",
|
"nativenotf": "Native notification",
|
||||||
|
@ -38,6 +38,7 @@
|
||||||
"useragentWarn":"Restart when changed",
|
"useragentWarn":"Restart when changed",
|
||||||
"frame": "Window frame",
|
"frame": "Window frame",
|
||||||
"frameWarn": "If 'off', the window looks cool.",
|
"frameWarn": "If 'off', the window looks cool.",
|
||||||
|
"downloadWin": "Versioning(o Windows downloader)",
|
||||||
"absolute": "absolute value",
|
"absolute": "absolute value",
|
||||||
"srcUrl": "Search engine",
|
"srcUrl": "Search engine",
|
||||||
"srcUrlWarn": "{q} will be replaced to query.",
|
"srcUrlWarn": "{q} will be replaced to query.",
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
"useragentWarn":"再起動すんで。",
|
"useragentWarn":"再起動すんで。",
|
||||||
"frame": "ウィンドウのフレーム",
|
"frame": "ウィンドウのフレーム",
|
||||||
"frameWarn": "フレーム無しやとタイトルバーがシュッとするで。再起動すんで。",
|
"frameWarn": "フレーム無しやとタイトルバーがシュッとするで。再起動すんで。",
|
||||||
|
"downloadWin": "バージョニングする(Windowsのダウンローダ)",
|
||||||
"absolute": "絶対指定",
|
"absolute": "絶対指定",
|
||||||
"srcUrl": "検索エンジン",
|
"srcUrl": "検索エンジン",
|
||||||
"srcUrlWarn": "{q}が検索文字列になるで。",
|
"srcUrlWarn": "{q}が検索文字列になるで。",
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
"useragentWarn":"再起動します。",
|
"useragentWarn":"再起動します。",
|
||||||
"frame": "ウィンドウのフレーム",
|
"frame": "ウィンドウのフレーム",
|
||||||
"frameWarn": "フレーム無しだと、タイトルバーのデザインがクールになります。再起動します。",
|
"frameWarn": "フレーム無しだと、タイトルバーのデザインがクールになります。再起動します。",
|
||||||
|
"downloadWin": "バージョニングする(Windowsのダウンローダ)",
|
||||||
"absolute": "絶対指定",
|
"absolute": "絶対指定",
|
||||||
"srcUrl": "検索エンジン",
|
"srcUrl": "検索エンジン",
|
||||||
"srcUrlWarn": "{q}が検索文字列に置換されます。",
|
"srcUrlWarn": "{q}が検索文字列に置換されます。",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
let ver = '20.2.0 (Kawaii)'
|
let ver = '20.2.1 (Kawaii)'
|
||||||
if (process.argv.indexOf('--automatic') === -1) {
|
if (process.argv.indexOf('--automatic') === -1) {
|
||||||
let input = require('readline-sync').question('version string [empty: ' + ver + ' (default)]? ')
|
let input = require('readline-sync').question('version string [empty: ' + ver + ' (default)]? ')
|
||||||
if (input) {
|
if (input) {
|
||||||
|
|
|
@ -162,6 +162,16 @@ var envConstruction = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
id: 'download',
|
||||||
|
storage: 'dl-win',
|
||||||
|
checkbox: true,
|
||||||
|
setValue: 'no',
|
||||||
|
text: {
|
||||||
|
head: '@@downloadWin@@',
|
||||||
|
desc: 'ex: TheDesk-1.0.0-setup.exe',
|
||||||
|
checkbox: yesno
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
var tlConstruction = [
|
var tlConstruction = [
|
||||||
|
|
|
@ -166,22 +166,42 @@
|
||||||
if (sel == "install") {
|
if (sel == "install") {
|
||||||
if (bit == "x64") {
|
if (bit == "x64") {
|
||||||
var url = json["winx64"];
|
var url = json["winx64"];
|
||||||
var file = "TheDesk-setup.exe";
|
if(localStorage.getItem("dl-win") == "yes") {
|
||||||
|
var file = "TheDesk-" + json.unique + "-setup.exe";
|
||||||
|
} else {
|
||||||
|
var file = "TheDesk-setup.exe";
|
||||||
|
}
|
||||||
} else if (bit == "ia32") {
|
} else if (bit == "ia32") {
|
||||||
var url = json["winia32"];
|
var url = json["winia32"];
|
||||||
var file = "TheDesk-setup-ia32.exe";
|
if(localStorage.getItem("dl-win") == "yes") {
|
||||||
|
var file = "TheDesk-" + json.unique + "-setup-ia32.exe";
|
||||||
|
} else {
|
||||||
|
var file = "TheDesk-setup-ia32.exe";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (sel == "portable") {
|
} else if (sel == "portable") {
|
||||||
if (bit == "x64") {
|
if (bit == "x64") {
|
||||||
var url = json["winx64p"];
|
var url = json["winx64p"];
|
||||||
var file = "TheDesk.exe";
|
if(localStorage.getItem("dl-win") == "yes") {
|
||||||
|
var file = "TheDesk-" + json.unique + ".exe";
|
||||||
|
} else {
|
||||||
|
var file = "TheDesk.exe";
|
||||||
|
}
|
||||||
} else if (bit == "ia32") {
|
} else if (bit == "ia32") {
|
||||||
var url = json["winia32p"];
|
var url = json["winia32p"];
|
||||||
var file = "TheDesk-ia32.exe";
|
if(localStorage.getItem("dl-win") == "yes") {
|
||||||
|
var file = "TheDesk-" + json.unique + "-ia32.exe";
|
||||||
|
} else {
|
||||||
|
var file = "TheDesk-ia32.exe";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (sel == "linux") {
|
} else if (sel == "linux") {
|
||||||
var url = json["linuxx64"];
|
var url = json["linuxx64"];
|
||||||
var file = "thedesk.zip";
|
if(localStorage.getItem("dl-win") == "yes") {
|
||||||
|
var file = "thedesk-" + json.unique_linux + ".zip";
|
||||||
|
} else {
|
||||||
|
var file = "thedesk.zip";
|
||||||
|
}
|
||||||
} else if (sel == "linuxdeb") {
|
} else if (sel == "linuxdeb") {
|
||||||
var url = json["linuxdeb"];
|
var url = json["linuxdeb"];
|
||||||
var file = "thedesk_" + json.unique_linux + "_amd64.deb";
|
var file = "thedesk_" + json.unique_linux + "_amd64.deb";
|
||||||
|
@ -199,9 +219,8 @@
|
||||||
postMessage(["sendSinmpleIpc", "quit"], "*");
|
postMessage(["sendSinmpleIpc", "quit"], "*");
|
||||||
}
|
}
|
||||||
function updateProg(arg) {
|
function updateProg(arg) {
|
||||||
console.log(arg);
|
$(".determinate").css("width", arg.percent * 100 + "%");
|
||||||
$(".determinate").css("width", arg * 100 + "%");
|
$("#prog").text(Math.floor(arg.percent * 100) + "%");
|
||||||
$("#prog").text(Math.floor(arg * 100) + "%");
|
|
||||||
}
|
}
|
||||||
function updateMess(arg) {
|
function updateMess(arg) {
|
||||||
console.log(arg);
|
console.log(arg);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user