thedesk/app/view/make/update.sample.html

303 lines
9.5 KiB
HTML
Raw Permalink Normal View History

2019-10-25 02:04:53 +11:00
<!DOCTYPE html>
2019-05-06 20:10:03 +10:00
<html lang="@@lang@@">
2019-10-25 02:04:53 +11:00
<head>
<title>Update - TheDesk</title>
2020-02-08 02:25:31 +11:00
<link href="../../@@node_base@@/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet" />
2019-10-25 02:04:53 +11:00
<link href="../../css/master.css" type="text/css" rel="stylesheet" />
<meta charset="utf-8" />
@@comment-start@@
<script type="text/javascript">
2020-05-03 00:32:46 +10:00
var _jipt = []
_jipt.push(['project', 'thedesk'])
2019-10-25 02:04:53 +11:00
</script>
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
@@comment-end@@
<style>
body {
2020-05-03 00:32:46 +10:00
font-family: 'Open Sans';
2019-10-25 02:04:53 +11:00
-webkit-app-region: drag;
cursor: move;
padding: 10px;
text-align: right;
}
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
#start {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: calc(100vh - 2.5rem);
text-align: center;
}
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
#checkbox {
text-align: left;
}
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
a,
button,
input,
label,
i {
-webkit-app-region: no-drag;
}
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
#updskip {
display: flex;
justify-content: center;
align-items: center;
2020-02-10 01:35:49 +11:00
flex-direction: column;
2019-10-25 02:04:53 +11:00
}
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
.skipbtn {
display: block;
2020-02-10 01:35:49 +11:00
width: 100%;
height: 100px;
2019-10-25 02:04:53 +11:00
border: 1px solid;
margin-left: 5px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid #c26363;
overflow: hidden;
2020-02-10 01:35:49 +11:00
color: #c26363;
margin-bottom: 5px;
font-size: 1.5rem;
2019-10-25 02:04:53 +11:00
}
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
.skipbtn:hover {
background-color: #c26363;
transition: all 0.3s ease-in-out;
2020-05-03 00:32:46 +10:00
color: white;
2019-10-25 02:04:53 +11:00
}
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
#prog {
font-size: 200%;
}
</style>
2020-02-08 02:25:31 +11:00
<link href="../../@@node_base@@/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" rel="stylesheet" />
@@pwa@@
2019-10-25 02:04:53 +11:00
</head>
2019-05-19 17:39:30 +10:00
2019-10-25 02:04:53 +11:00
<body>
2020-02-08 02:25:31 +11:00
<script type="text/javascript" src="../../@@node_base@@/jquery/dist/jquery.js"></script>
2019-10-25 02:04:53 +11:00
<script type="text/javascript" src="../../js/platform/first.js"></script>
2020-02-08 02:25:31 +11:00
<script type="text/javascript" src="../../@@node_base@@/materialize-css/dist/js/materialize.js"></script>
2019-10-25 02:04:53 +11:00
<i class="material-icons pointer waves-effect" onclick="about();">info</i>
<i class="material-icons pointer waves-effect" onclick="skipper();">clear</i>
<!--a href="update.html">Reload</a-->
2020-09-07 01:14:51 +10:00
<div id="start" style="filter: brightness(100%)">
2019-10-25 02:04:53 +11:00
<div id="box" class="show">
<h2>TheDesk</h2>
<p>@@updatehere@@</p>
<span id="now"></span><b id="ver"></b><br />
<a href="" id="github" class="btn waves-effect grey darken-1"><i class="fab fa-github left"></i>@@checkWhatIsNew@@</a><br />
2020-05-03 00:32:46 +10:00
<button class="waves-effect btn windows hide" onclick="update('install')" style="margin-left: 15px;">@@installer@@</button>
<button class="waves-effect btn windows hide" onclick="update('portable')" style="margin-left: 15px;">@@portable@@</button>
<button class="waves-effect btn linux hide" onclick="update('linux')" style="margin-left: 15px;">@@linux@@</button>
<button class="waves-effect btn linux hide" onclick="update('linuxdeb')" style="margin-left: 15px;">@@linuxdeb@@</button>
<button class="waves-effect btn linux hide" onclick="update('linuxsnap')" style="margin-left: 15px;">@@linuxsnap@@</button>
<button class="waves-effect btn mac hide" onclick="update('mac')" style="margin-left: 15px;">@@download@@</button>
2019-10-25 02:04:53 +11:00
<br />
@@problem1@@<br />@@problem2@@
</div>
<div id="skipper" class="hide">
<h4>@@skipupd@@</h4>
@@sureupd@@<br />
<div id="updskip">
<a onclick="window.close();" class="pointer skipbtn waves-effect waves-light">
<div>@@nexttl@@</div>
</a>
<a onclick="nextv();" class="pointer skipbtn waves-effect waves-light">
<div>@@nextver@@</div>
</a>
</div>
2020-05-03 00:32:46 +10:00
<a class="pointer waves-effect" onclick="skipper();" style="margin-top: 5px;">@@continue@@</a>
2019-10-25 02:04:53 +11:00
</div>
2020-05-03 00:32:46 +10:00
<div id="dlnow" class="hide" style="width: 70%;">
2019-10-25 02:04:53 +11:00
<h4>@@dlnow@@</h4>
<h4 id="prog"></h4>
<div class="progress">
2020-05-03 00:32:46 +10:00
<div class="determinate" style="width: 0%;"></div>
2019-10-25 02:04:53 +11:00
</div>
</div>
</div>
<script type="text/javascript" src="../../js/common/about.js"></script>
<script type="text/javascript" src="../../js/platform/end.js"></script>
<script>
function skipper() {
2020-05-03 00:32:46 +10:00
$('#dlnow').addClass('hide')
$('#box').toggleClass('show')
if ($('#box').hasClass('hide') && $('#skipper').hasClass('hide')) {
$('#skipper').removeClass('hide')
$('#skipper').addClass('show')
2019-10-25 02:04:53 +11:00
} else {
2020-05-03 00:32:46 +10:00
$('#box').toggleClass('hide')
$('#skipper').toggleClass('hide')
$('#skipper').toggleClass('show')
2019-10-25 02:04:53 +11:00
}
}
2020-05-03 00:32:46 +10:00
verck()
2019-10-25 02:04:53 +11:00
function update(sel) {
2020-05-03 00:32:46 +10:00
$('#box').toggleClass('show')
$('#box').toggleClass('hide')
$('#dlnow').toggleClass('hide')
$('#dlnow').toggleClass('show')
$('#prog').text('')
var bit = localStorage.getItem('bit')
var start = 'https://thedesk.top/ver.json'
2019-10-25 02:04:53 +11:00
fetch(start, {
2020-05-03 00:32:46 +10:00
method: 'GET',
headers: { 'content-type': 'application/json' },
2019-10-25 02:04:53 +11:00
})
2020-05-03 00:32:46 +10:00
.then(function (response) {
2019-10-31 02:30:26 +11:00
if (!response.ok) {
2020-05-03 00:32:46 +10:00
response.text().then(function (text) {
setLog(response.url, response.status, text)
})
}
return response.json()
2019-10-25 02:04:53 +11:00
})
2020-05-03 00:32:46 +10:00
.catch(function (error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
2019-10-25 02:04:53 +11:00
})
2020-05-03 00:32:46 +10:00
.then(function (json) {
if (sel == 'install') {
if (bit == 'x64') {
var url = json['winx64']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '-setup.exe'
2020-04-07 15:00:20 +10:00
} else {
2020-05-03 00:32:46 +10:00
var file = 'TheDesk-setup.exe'
2020-04-07 15:00:20 +10:00
}
2020-05-03 00:32:46 +10:00
var filesize = json.winx64_size
} else if (bit == 'ia32') {
var url = json['winia32']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '-setup-ia32.exe'
2020-04-07 15:00:20 +10:00
} else {
2020-05-03 00:32:46 +10:00
var file = 'TheDesk-setup-ia32.exe'
2020-04-07 15:00:20 +10:00
}
2020-05-03 00:32:46 +10:00
var filesize = json.winia32_size
2019-10-25 02:04:53 +11:00
}
2020-05-03 00:32:46 +10:00
} else if (sel == 'portable') {
if (bit == 'x64') {
var url = json['winx64p']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '.exe'
2020-04-07 15:00:20 +10:00
} else {
2020-05-03 00:32:46 +10:00
var file = 'TheDesk.exe'
2020-04-07 15:00:20 +10:00
}
2020-05-03 00:32:46 +10:00
var filesize = json.winx64p_size
} else if (bit == 'ia32') {
var url = json['winia32p']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '-ia32.exe'
2020-04-07 15:00:20 +10:00
} else {
2020-05-03 00:32:46 +10:00
var file = 'TheDesk-ia32.exe'
2020-04-07 15:00:20 +10:00
}
2020-05-03 00:32:46 +10:00
var filesize = json.winia32p_size
2019-10-25 02:04:53 +11:00
}
2020-05-03 00:32:46 +10:00
} else if (sel == 'linux') {
var url = json['linuxx64']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'thedesk-' + json.unique_linux + '.zip'
2020-04-07 15:00:20 +10:00
} else {
2020-05-03 00:32:46 +10:00
var file = 'thedesk.zip'
2020-04-07 15:00:20 +10:00
}
2020-05-03 00:32:46 +10:00
var filesize = json.linuxx64_size
} else if (sel == 'linuxdeb') {
var url = json['linuxdeb']
var file = 'thedesk_' + json.unique_linux + '_amd64.deb'
var filesize = json.linuxdeb_size
} else if (sel == 'linuxsnap') {
var url = json['linuxsnap']
var file = 'thedesk_' + json.unique_linux + '_amd64.snap'
var filesize = json.linuxsnap_size
} else if (sel == 'mac') {
var url = json['mac']
var file = 'TheDesk-' + json.unique_mac + '.dmg'
var filesize = json.mac_size
2019-10-25 02:04:53 +11:00
}
2020-05-03 00:32:46 +10:00
postMessage(['downloadButton', [url, file, filesize]], '*')
})
2019-10-25 02:04:53 +11:00
}
function quit() {
2020-05-03 00:32:46 +10:00
postMessage(['sendSinmpleIpc', 'quit'], '*')
2019-10-25 02:04:53 +11:00
}
function updateProg(arg) {
2020-05-03 00:32:46 +10:00
$('.determinate').css('width', arg[0].percent * 100 + '%')
$('#prog').html(`${Math.floor(arg[0].percent * 100)}%<br />(${Math.floor(arg[0].percent*arg[1]/1024/1024*10)/10} MB / ${Math.floor(arg[1]/1024/1024*10)/10} MB)`)
2019-10-25 02:04:53 +11:00
}
function updateMess(arg) {
2020-05-03 00:32:46 +10:00
console.log(arg)
$('#prog').text(arg)
2019-10-25 02:04:53 +11:00
}
function verck() {
2020-05-03 00:32:46 +10:00
var platform = localStorage.getItem('platform')
var bit = localStorage.getItem('bit')
if (platform == 'win32') {
$('.windows').removeClass('hide')
} else if (platform == 'linux') {
$('.linux').removeClass('hide')
} else if (platform == 'darwin') {
$('.mac').removeClass('hide')
2019-10-25 02:04:53 +11:00
}
2020-05-03 00:32:46 +10:00
var start = 'https://thedesk.top/ver.json'
2019-10-25 02:04:53 +11:00
fetch(start, {
2020-05-03 00:32:46 +10:00
method: 'GET',
headers: { 'content-type': 'application/json' },
2019-10-25 02:04:53 +11:00
})
2020-05-03 00:32:46 +10:00
.then(function (response) {
2019-10-31 02:30:26 +11:00
if (!response.ok) {
2020-05-03 00:32:46 +10:00
response.text().then(function (text) {
setLog(response.url, response.status, text)
})
}
return response.json()
2019-10-25 02:04:53 +11:00
})
2020-05-03 00:32:46 +10:00
.catch(function (error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
2019-10-25 02:04:53 +11:00
})
2020-05-03 00:32:46 +10:00
.then(function (json) {
console.log(json)
if (platform == 'win32') {
$('#ver').text(json.desk)
localStorage.setItem('next-ver', json.desk)
var url = 'https://github.com/cutls/TheDesk/releases/tag/v' + json.unique
} else if (platform == 'linux') {
$('#ver').text(json.desk_linux)
localStorage.setItem('next-ver', json.desk_linux)
var url = 'https://github.com/cutls/TheDesk/releases/tag/v' + json.unique_linux
} else if (platform == 'darwin') {
$('#ver').text(json.desk_mac)
localStorage.setItem('next-ver', json.desk_mac)
var url = 'https://github.com/cutls/TheDesk/releases/tag/v' + json.unique_mac
2019-10-25 02:04:53 +11:00
}
2019-05-19 17:39:30 +10:00
2020-05-03 00:32:46 +10:00
$('#github').attr('href', url)
2019-05-19 17:39:30 +10:00
2020-05-03 00:32:46 +10:00
$('#now').text(localStorage.getItem('ver'))
})
2019-10-25 02:04:53 +11:00
}
function nextv() {
2020-05-03 00:32:46 +10:00
localStorage.setItem('new-ver-skip', 'true')
window.close()
2019-10-25 02:04:53 +11:00
}
function enc(ver) {
2020-05-03 00:32:46 +10:00
var ver = ver.replace(/\s/g, '')
var ver = ver.replace(/\(/g, '-')
var ver = ver.replace(/\)/g, '')
var ver = ver.replace(/\[/g, '_')
var ver = ver.replace(/\]/g, '')
return ver
2019-10-25 02:04:53 +11:00
}
</script>
</body>
</html>