Add: login auth open url #86

This commit is contained in:
Cutls 2019-06-15 01:01:07 +09:00
parent 65e691cda8
commit 5672ccfa37
4 changed files with 15 additions and 25 deletions

View File

@ -115,9 +115,7 @@ function verck(ver) {
}).then(function (mess) {
console.table(mess);
if (mess) {
var electron = require("electron");
var remote = electron.remote;
var platform = remote.process.platform;
var platform = localStorage.getItem("platform");
if (platform == "darwin") {
var newest = mess.desk_mac;
} else {
@ -132,15 +130,13 @@ function verck(ver) {
localStorage.removeItem("instance")
if (localStorage.getItem("new-ver-skip")) {
if (localStorage.getItem("next-ver") != newest) {
var ipc = electron.ipcRenderer;
ipc.send('update', "true");
postMessage(["sendSinmpleIpc", "update"], "*")
} else {
console.warn(lang.lang_version_skipver);
todo(lang.lang_version_skipver);
}
} else {
var ipc = electron.ipcRenderer;
ipc.send('update', "true");
postMessage(["sendSinmpleIpc", "update"], "*")
}
}
}
@ -173,28 +169,28 @@ function verck(ver) {
} else {
var toot = "";
}
if (obj.Ver != "") {
if (obj.Ver == ver) {
if (obj.ver != "") {
if (obj.ver == ver) {
show = true;
} else {
show = false;
}
}
if (obj.Domain != "") {
if (obj.domain != "") {
var multi = localStorage.getItem("multi");
if (multi) {
show = false;
var accts = JSON.parse(multi);
Object.keys(accts).forEach(function (key) {
var acct = accts[key];
if (acct.domain == obj.Domain) {
if (acct.domain == obj.domain) {
show = true;
}
});
}
}
if (show) {
M.toast({ html: escapeHTML(obj.Text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 })
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 })
}
}

View File

@ -79,15 +79,11 @@ function login(url) {
localStorage.setItem("client_secret", json["client_secret"]);
$("#auth").show();
$("#masara").hide();
const { shell } = require('electron');
shell.openExternal(auth);
postMessage(["openUrl", auth], "*")
if ($('#linux:checked').val() == "on") {
} else {
var electron = require("electron");
var ipc = electron.ipcRenderer;
ipc.send('quit', 'go');
postMessage(["sendSinmpleIpc", "quit"], "*")
}
}
}

View File

@ -47,11 +47,7 @@ $(document).on('click', 'a', e => {
udgEx(ats[2] + "@" + ats[1], "main");
return false
} else {
const {
shell
} = require('electron');
shell.openExternal(url);
postMessage(["openUrl", url], "*")
}
@ -64,7 +60,6 @@ $(document).on('click', 'a', e => {
//alert("If you recieve this alert, let the developer(Cutls@kirishima.cloud) know it with a screenshot.");
url = "https://thedesk.top";
}
//shell.openExternal(url);
postMessage(["openUrl", url], "*")
} else {

View File

@ -2,7 +2,10 @@ var electron = require("electron");
var ipc = electron.ipcRenderer;
onmessage = function (e) {
if (e.data[0] == "openUrl") {
shell.openExternal(e.data[1]);
urls = url.match(/https?:\/\/(.+)/);
if(urls){
shell.openExternal(e.data[1]);
}
} else if (e.data[0] == "sendSinmpleIpc") {
ipc.send(e.data[1], "")
} else if (e.data[0] == "dialogStore") {