thedesk/app/update.html
2018-07-30 02:35:29 +09:00

92 lines
3.1 KiB
HTML

<!doctype html>
<html lang="en">
<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>
<h5>Latest TheDesk[TheDesk <span id="ver"></span>]</h5>
<span id="det"></span><br>
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>
<p id="prog"></p>
<div class="progress">
<div class="determinate" style="width: 0%"></div>
</div><br>
Delivered by Amazon Web Services(S3/CloudFront)<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>
<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+"%");
$("#prog").text("Downloading:"+Math.floor(arg*100)+"%");
})
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>