Remove: node in manager.js #86

This commit is contained in:
Cutls 2019-06-15 01:05:53 +09:00
parent 5672ccfa37
commit 861ee3250d
2 changed files with 8 additions and 16 deletions

View File

@ -310,15 +310,9 @@ function login(url) {
localStorage.setItem("client_secret", json["client_secret"]); localStorage.setItem("client_secret", json["client_secret"]);
$("#auth").show(); $("#auth").show();
$("#add").hide(); $("#add").hide();
const { postMessage(["openUrl", auth], "*")
shell
} = require('electron');
shell.openExternal(auth);
var electron = require("electron");
var ipc = electron.ipcRenderer;
if ($('#linux:checked').val() == "on") { } else { if ($('#linux:checked').val() == "on") { } else {
ipc.send('quit', 'go'); postMessage(["sendSinmpleIpc", "quit"], "*")
} }
} }
} }
@ -407,16 +401,13 @@ function misskeyAuth(url, mkc) {
httpreq.onreadystatechange = function () { httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) { if (httpreq.readyState === 4) {
var json = httpreq.response; var json = httpreq.response;
const {
shell
} = require('electron');
var token = json.token; var token = json.token;
$("#auth").show(); $("#auth").show();
$("#code").val(token); $("#code").val(token);
$("#add").hide(); $("#add").hide();
$("#misskey").prop("checked", false); $("#misskey").prop("checked", false);
localStorage.setItem("domain_tmp", url); localStorage.setItem("domain_tmp", url);
shell.openExternal(json.url); postMessage(["openUrl", json.url], "*")
} }
} }
} }

View File

@ -1,9 +1,10 @@
var electron = require("electron"); var electron = require("electron");
const shell = electron.shell;
var ipc = electron.ipcRenderer; var ipc = electron.ipcRenderer;
onmessage = function (e) { onmessage = function (e) {
if (e.data[0] == "openUrl") { if (e.data[0] == "openUrl") {
urls = url.match(/https?:\/\/(.+)/); urls = e.data[1].match(/https?:\/\/(.+)/);
if(urls){ if (urls) {
shell.openExternal(e.data[1]); shell.openExternal(e.data[1]);
} }
} else if (e.data[0] == "sendSinmpleIpc") { } else if (e.data[0] == "sendSinmpleIpc") {
@ -15,10 +16,10 @@ onmessage = function (e) {
//version.js //version.js
ipc.send("getPlatform", "") ipc.send("getPlatform", "")
ipc.on('platform', function (event, arg) { ipc.on('platform', function (event, arg) {
localStorage.setItem("platform",arg) localStorage.setItem("platform", arg)
}) })
ipc.on('winstore', function (event, arg) { ipc.on('winstore', function (event, arg) {
localStorage.setItem("winstore",arg) localStorage.setItem("winstore", arg)
}) })
ipc.on('reload', function (event, arg) { ipc.on('reload', function (event, arg) {