thedesk/app/update.html

92 lines
3.2 KiB
HTML
Raw Normal View History

2018-08-05 02:26:34 +10:00
<!doctype html>
2018-08-11 01:58:00 +10:00
<html lang="en">
2018-08-05 02:26:34 +10:00
<head>
<title>Update - TheDesk</title>
<link href="./css/materialize.css" type="text/css" rel="stylesheet">
<link href="./css/master.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Open+Sans:300" rel="stylesheet">
<meta charset="utf-8">
</head>
<body>
<style>
body{
font-family:'Open Sans';
-webkit-app-region: drag;
cursor: move;
padding:10px;
}
a,button{
-webkit-app-region: no-drag;
}</style>
<script type="text/javascript" src="./js/common/jquery.js"></script>
<script type="text/javascript" src="./js/platform/first.js"></script>
<script type="text/javascript" src="./js/common/materialize.js"></script>
2018-08-11 01:58:00 +10:00
<h5>Latest TheDesk[TheDesk <span id="ver"></span>]</h5>
2018-08-05 02:26:34 +10:00
<span id="det"></span><br>
2018-08-11 01:58:00 +10:00
Current version<span id="now"></span><br>
TheDesk will be quit TheDesk after downloading.<br>
<button id="update" class="waves-effect btn" onclick="update('true')">Download</button>
2018-08-05 02:26:34 +10:00
<p id="prog"></p>
<div class="progress">
<div class="determinate" style="width: 0%"></div>
</div><br>
2018-08-11 01:58:00 +10:00
<b>On Windows, TheDesk will self-unzip and launch the latest file. Durling unzippng, TheDesk may freeze. It takes several seconds.</b><br>
Visit a releasenote of <a href="https://github.com/cutls/TheDesk/blob/master/LATEST.md">GitHub</a><br><br>
Skip this uodate(<a onclick="window.close();" class="pointer">until next TL loading</a>/<a onclick="nextv();" class="pointer">until next version</a>)<br>
<a onclick="quit()" class="pointer">Quit</a><br>
<a onclick="about()" class="pointer">About TheDesk</a><br>
Some problems? Please download on <a href="https://thedesk.top">TheDesk HP</a>
2018-08-05 02:26:34 +10:00
<script type="text/javascript" src="./js/common/about.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script>
<script>
var electron = require("electron");
var ipc = electron.ipcRenderer;
verck();
function update(sel){
$("#prog").text("");
ipc.send('download-btn', [sel,enc(localStorage.getItem("next-ver"))]);
}
function quit(){
ipc.send('quit', 'go');
}
ipc.on('prog', function (event, arg) {
console.log(arg);
$(".determinate").css('width',arg*100+"%");
2018-08-11 01:58:00 +10:00
$("#prog").text("Downloading:"+Math.floor(arg*100)+"%");
2018-08-05 02:26:34 +10:00
})
ipc.on('mess', function (event, arg) {
console.log(arg);
$("#prog").text(arg);
})
function verck(){
var start="https://thedesk.top/ver.json";
fetch(start, {
method: 'GET',
headers: {'content-type': 'application/json'},
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
$("#ver").text(json.desk);
localStorage.setItem("next-ver",json.desk);
$("#det").text(json.detail);
$("#now").text(localStorage.getItem("ver"));
});
}
function nextv(){
localStorage.setItem("new-ver-skip","true");
window.close();
}
function enc(ver){
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;
}
</script>