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) { }).then(function (mess) {
console.table(mess); console.table(mess);
if (mess) { if (mess) {
var electron = require("electron"); var platform = localStorage.getItem("platform");
var remote = electron.remote;
var platform = remote.process.platform;
if (platform == "darwin") { if (platform == "darwin") {
var newest = mess.desk_mac; var newest = mess.desk_mac;
} else { } else {
@ -132,15 +130,13 @@ function verck(ver) {
localStorage.removeItem("instance") localStorage.removeItem("instance")
if (localStorage.getItem("new-ver-skip")) { if (localStorage.getItem("new-ver-skip")) {
if (localStorage.getItem("next-ver") != newest) { if (localStorage.getItem("next-ver") != newest) {
var ipc = electron.ipcRenderer; postMessage(["sendSinmpleIpc", "update"], "*")
ipc.send('update', "true");
} else { } else {
console.warn(lang.lang_version_skipver); console.warn(lang.lang_version_skipver);
todo(lang.lang_version_skipver); todo(lang.lang_version_skipver);
} }
} else { } else {
var ipc = electron.ipcRenderer; postMessage(["sendSinmpleIpc", "update"], "*")
ipc.send('update', "true");
} }
} }
} }
@ -173,28 +169,28 @@ function verck(ver) {
} else { } else {
var toot = ""; var toot = "";
} }
if (obj.Ver != "") { if (obj.ver != "") {
if (obj.Ver == ver) { if (obj.ver == ver) {
show = true; show = true;
} else { } else {
show = false; show = false;
} }
} }
if (obj.Domain != "") { if (obj.domain != "") {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem("multi");
if (multi) { if (multi) {
show = false; show = false;
var accts = JSON.parse(multi); var accts = JSON.parse(multi);
Object.keys(accts).forEach(function (key) { Object.keys(accts).forEach(function (key) {
var acct = accts[key]; var acct = accts[key];
if (acct.domain == obj.Domain) { if (acct.domain == obj.domain) {
show = true; show = true;
} }
}); });
} }
} }
if (show) { 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"]); localStorage.setItem("client_secret", json["client_secret"]);
$("#auth").show(); $("#auth").show();
$("#masara").hide(); $("#masara").hide();
const { shell } = require('electron'); postMessage(["openUrl", auth], "*")
shell.openExternal(auth);
if ($('#linux:checked').val() == "on") { if ($('#linux:checked').val() == "on") {
} else { } else {
var electron = require("electron"); postMessage(["sendSinmpleIpc", "quit"], "*")
var ipc = electron.ipcRenderer;
ipc.send('quit', 'go');
} }
} }
} }

View File

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

View File

@ -2,7 +2,10 @@ var electron = require("electron");
var ipc = electron.ipcRenderer; var ipc = electron.ipcRenderer;
onmessage = function (e) { onmessage = function (e) {
if (e.data[0] == "openUrl") { 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") { } else if (e.data[0] == "sendSinmpleIpc") {
ipc.send(e.data[1], "") ipc.send(e.data[1], "")
} else if (e.data[0] == "dialogStore") { } else if (e.data[0] == "dialogStore") {