thedesk/app/js/common/version.js

69 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-01-28 23:22:43 +11:00
//バージョンチェッカー
function verck(ver) {
2018-05-26 02:37:35 +10:00
if(localStorage.getItem("ver")!=ver){
localStorage.setItem("ver", ver);
console.log("Thank you for your update");
$(document).ready(function(){
$('#releasenote').modal('open');
verp=ver.replace( '(', '');
verp=verp.replace( '.', '-');
2018-06-12 01:44:28 +10:00
verp=verp.replace( '.', '-');
2018-05-26 02:37:35 +10:00
verp=verp.replace( '[', '-');
verp=verp.replace( ']', '');
verp=verp.replace( ')', '');
verp=verp.replace( ' ', '_');
2018-06-12 01:44:28 +10:00
console.log(verp);
2018-05-26 02:37:35 +10:00
$("#release-"+verp).show();
});
}
2018-03-14 05:31:31 +11:00
var l = 5;
2018-07-07 03:51:48 +10:00
// 生成する文字列に含める文字セット
var c = "abcdefghijklmnopqrstuvwxyz0123456789";
2018-03-14 05:31:31 +11:00
var cl = c.length;
var r = "";
for(var i=0; i<l; i++){
r += c[Math.floor(Math.random()*cl)];
}
var start = "https://thedesk.top/ver.json";
2018-01-28 23:22:43 +11:00
fetch(start, {
method: 'GET'
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(mess) {
console.log(mess);
if (mess) {
2018-07-07 03:51:48 +10:00
var electron = require("electron");
var remote=electron.remote;
var platform=remote.process.platform;
if(platform=="darwin"){
var newest=mess.desk_mac;
}else{
var newest=mess.desk;
}
if (newest == ver) {
2018-07-29 17:37:54 +10:00
todo(lang_version_usever[lang].replace("{{ver}}" ,mess.desk));
2018-01-28 23:22:43 +11:00
//betaならアプデチェックしない
2018-07-28 07:25:12 +10:00
} else if (ver.indexOf("beta")==-1) {
2018-02-25 19:41:34 +11:00
localStorage.removeItem("instance")
2018-07-22 23:03:46 +10:00
if(localStorage.getItem("new-ver-skip")){
if(localStorage.getItem("next-ver")!=newest){
var ipc = electron.ipcRenderer;
ipc.send('update', "true");
}else{
2018-07-29 17:37:54 +10:00
todo(lang_version_skipver[lang]);
2018-07-22 23:03:46 +10:00
}
}else{
var ipc = electron.ipcRenderer;
ipc.send('update', "true");
}
2018-01-28 23:22:43 +11:00
}
}
});
}