2018-08-05 02:26:34 +10:00
|
|
|
<!doctype html>
|
2018-08-24 01:15:57 +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>
|
2018-08-24 01:15:57 +10:00
|
|
|
<style>
|
|
|
|
body{
|
2018-08-05 02:26:34 +10:00
|
|
|
font-family:'Open Sans';
|
|
|
|
-webkit-app-region: drag;
|
|
|
|
cursor: move;
|
|
|
|
padding:10px;
|
2018-08-24 01:15:57 +10:00
|
|
|
text-align:right;
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2018-08-24 01:15:57 +10:00
|
|
|
#start{
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
width:100vw;
|
|
|
|
height: calc(100vh - 2.5rem);
|
|
|
|
text-align:center;
|
|
|
|
}
|
|
|
|
#checkbox{
|
|
|
|
text-align:left;
|
|
|
|
}
|
|
|
|
a,button,input,label,i{
|
2018-08-05 02:26:34 +10:00
|
|
|
-webkit-app-region: no-drag;
|
2018-08-24 01:15:57 +10:00
|
|
|
}
|
|
|
|
#updskip{
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.skipbtn{
|
|
|
|
display:block;
|
|
|
|
float:left;
|
|
|
|
width:200px;
|
|
|
|
height:200px;
|
|
|
|
border:1px solid;
|
|
|
|
margin-left:5px;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
border: 1px solid;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
.skipbtn:hover{
|
|
|
|
background-color: #b3e5fc;
|
|
|
|
transition: all 0.3s ease-in-out;
|
|
|
|
}
|
|
|
|
#prog{
|
|
|
|
font-size:200%;
|
|
|
|
}
|
|
|
|
</style>
|
2018-08-05 02:26:34 +10:00
|
|
|
<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-24 01:15:57 +10: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-->
|
|
|
|
<div id="start">
|
|
|
|
<div id="box" class="show">
|
|
|
|
<h2>TheDesk</h2>
|
2018-09-05 01:04:56 +10:00
|
|
|
<p>Get latest TheDesk</p>
|
2018-08-24 01:15:57 +10:00
|
|
|
<span id="now"></span>→<b id="ver"></b><br>
|
|
|
|
<span id="det"></span><br>
|
2018-09-05 01:04:56 +10:00
|
|
|
<button id="update" class="waves-effect btn" onclick="update('true')" style="margin-left:15px;">Start</button>
|
2018-08-24 01:15:57 +10:00
|
|
|
<div id="checkbox">
|
|
|
|
Options:<br>
|
2018-09-05 01:04:56 +10:00
|
|
|
<input type="checkbox" class="filled-in" id="updator" value="true" onchange="alert('Durling unzippng, TheDesk may freeze. It takes several seconds.')" />
|
|
|
|
<label for="updator">Unzip(for Win)</label><br>
|
2018-08-24 01:15:57 +10:00
|
|
|
<input type="checkbox" class="filled-in" id="rewrite" value="true" />
|
2018-09-05 01:04:56 +10:00
|
|
|
<label for="rewrite">Not rewrite</label><br>
|
2018-08-24 01:15:57 +10:00
|
|
|
</div>
|
2018-09-05 01:04:56 +10:00
|
|
|
Some problems?<br>Please download on <a href="https://thedesk.top">Oficial HP</a>.
|
2018-08-24 01:15:57 +10:00
|
|
|
</div>
|
|
|
|
<div id="skipper" class="hide">
|
2018-09-05 01:04:56 +10:00
|
|
|
<h4>You may lose a cool experience!</h4>
|
|
|
|
Skip this update<br>
|
2018-08-24 01:15:57 +10:00
|
|
|
<div id="updskip">
|
2018-09-05 01:04:56 +10:00
|
|
|
<a onclick="window.close();" class="pointer skipbtn waves-effect waves-light"><div>Until next TL loading</div></a>
|
|
|
|
<a onclick="nextv();" class="pointer skipbtn waves-effect waves-light"><div>Until next version</div></a>
|
2018-08-24 01:15:57 +10:00
|
|
|
</div>
|
2018-09-05 01:04:56 +10:00
|
|
|
<a class="pointer waves-effect" onclick="skipper();" style="margin-top:5px">Continue updating</a>
|
2018-08-24 01:15:57 +10:00
|
|
|
</div>
|
|
|
|
<div id="dlnow" class="hide">
|
2018-09-05 01:04:56 +10:00
|
|
|
<h4>Downloading...</h4>
|
2018-08-24 01:15:57 +10:00
|
|
|
<h4 id="prog"></h4>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript" src="./js/common/about.js"></script>
|
2018-08-05 02:26:34 +10:00
|
|
|
<script type="text/javascript" src="./js/platform/end.js"></script>
|
|
|
|
<script>
|
2018-08-24 01:15:57 +10:00
|
|
|
function skipper(){
|
|
|
|
$("#dlnow").addClass("hide");
|
|
|
|
$("#box").toggleClass("show");
|
|
|
|
if($("#box").hasClass("hide") && $("#skipper").hasClass("hide")){
|
|
|
|
$("#skipper").removeClass("hide");
|
|
|
|
$("#skipper").addClass("show");
|
|
|
|
}else{
|
|
|
|
$("#box").toggleClass("hide");
|
|
|
|
$("#skipper").toggleClass("hide");
|
|
|
|
$("#skipper").toggleClass("show");
|
|
|
|
}
|
|
|
|
}
|
2018-08-05 02:26:34 +10:00
|
|
|
var electron = require("electron");
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
verck();
|
2018-08-24 01:15:57 +10:00
|
|
|
function update(sel){
|
|
|
|
$("#box").toggleClass("show");
|
|
|
|
$("#box").toggleClass("hide");
|
|
|
|
$("#dlnow").toggleClass("hide");
|
|
|
|
$("#dlnow").toggleClass("show");
|
|
|
|
$("#prog").text("");
|
|
|
|
if($('#rewrite:checked').val()=="true"){
|
|
|
|
var versioning=true;
|
|
|
|
}else{
|
|
|
|
var versioning=false;
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2018-08-24 01:15:57 +10:00
|
|
|
if($('#updator:checked').val()=="true"){
|
|
|
|
var zip=true;
|
|
|
|
}else{
|
|
|
|
var zip=false;
|
|
|
|
}
|
|
|
|
ipc.send('download-btn', [sel,enc(localStorage.getItem("next-ver")),zip,versioning]);
|
|
|
|
}
|
2018-08-05 02:26:34 +10:00
|
|
|
function quit(){
|
|
|
|
ipc.send('quit', 'go');
|
|
|
|
}
|
|
|
|
ipc.on('prog', function (event, arg) {
|
2018-08-24 01:15:57 +10:00
|
|
|
console.log(arg);
|
|
|
|
$("body").css('background','linear-gradient(#fff 0%,#fff '+(1-arg)*100+'%, #d7ccc8 '+(1-arg)*100+'%, #d7ccc8 100%)');
|
|
|
|
$("#prog").text(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(){
|
2018-08-24 01:15:57 +10:00
|
|
|
var remote=electron.remote;
|
|
|
|
var platform=remote.process.platform;
|
|
|
|
if(platform!="win32"){
|
|
|
|
$('#updator').prop("disabled",true)
|
|
|
|
}
|
2018-08-05 02:26:34 +10:00
|
|
|
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) {
|
2018-08-24 01:15:57 +10:00
|
|
|
console.log(json);
|
2018-08-05 02:26:34 +10:00
|
|
|
$("#ver").text(json.desk);
|
|
|
|
localStorage.setItem("next-ver",json.desk);
|
2018-08-24 01:15:57 +10:00
|
|
|
$("#det").html(json.detail);
|
2018-08-05 02:26:34 +10:00
|
|
|
$("#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;
|
|
|
|
}
|
2018-08-24 01:15:57 +10:00
|
|
|
</script>
|