Fix: 'about' preload #86

This commit is contained in:
Cutls 2019-06-15 18:52:28 +09:00
parent eba54d0906
commit a5f8e34ee6
7 changed files with 29 additions and 19 deletions

View File

@ -107,9 +107,9 @@
postMessage(["sendSinmpleIpc", "aboutData"], "*") postMessage(["sendSinmpleIpc", "aboutData"], "*")
function renderAbout(args) { function renderAbout(args) {
$("#now").text(localStorage.getItem("ver")); $("#now").text(localStorage.getItem("ver"));
$("#node").text(args.version); $("#node").text(args[0]);
$("#chrome").text(args.versions.chrome); $("#chrome").text(args[1]);
$("#electron").text(args.versions.electron); $("#electron").text(args[2]);
} }
if (location.search) { if (location.search) {
var m = location.search.match(/\?ver=([a-zA-Z-0-9.]+)/); var m = location.search.match(/\?ver=([a-zA-Z-0-9.]+)/);

View File

@ -1,3 +1 @@
//jQuery読む //jQuery読む
window.jQuery = window.$ = require('./js/common/jquery.js');
var Hammer = require('./js/common/hammer.min.js');

View File

@ -244,7 +244,7 @@ ipc.on('mess', function (event, arg) {
updateMess(arg) updateMess(arg)
}) })
//about.html //about.html
ipc.on('aboutData', function (event, arg) { ipc.on('aboutDataRender', function (event, arg) {
renderAbout(arg) renderAbout(arg)
}) })
var webviewDom = document.getElementById('webview'); var webviewDom = document.getElementById('webview');

View File

@ -1,4 +1,4 @@
var dirname = __dirname;
var dir = 'file://' + __dirname; var dir = 'file://' + __dirname;
var base = dir + '/view/'; var base = dir + '/view/';
// Electronのモジュール // Electronのモジュール
@ -179,13 +179,13 @@ function createWindow() {
//CSS //CSS
css.css(mainWindow); css.css(mainWindow);
//アップデータとダウンロード //アップデータとダウンロード
dl.dl(mainWindow, lang_path, base); dl.dl(mainWindow, lang_path, base, dirname);
//画像選択と画像処理 //画像選択と画像処理
img.img(mainWindow, dir); img.img(mainWindow, dir);
//NowPlaying //NowPlaying
np.TheDeskNowPlaying(mainWindow); np.TheDeskNowPlaying(mainWindow);
//その他system //その他system
systemFunc.system(mainWindow, dir, lang); systemFunc.system(mainWindow, dir, lang, dirname);
} }
// Electronの初期化完了後に実行 // Electronの初期化完了後に実行
app.on('ready', createWindow); app.on('ready', createWindow);

View File

@ -1,4 +1,4 @@
function dl(mainWindow, lang_path, base) { function dl(mainWindow, lang_path, base, dirname) {
const electron = require("electron"); const electron = require("electron");
const shell = electron.shell; const shell = electron.shell;
const fs = require("fs"); const fs = require("fs");
@ -16,7 +16,10 @@ function dl(mainWindow, lang_path, base) {
if (platform != "others") { if (platform != "others") {
updatewin = new BrowserWindow({ updatewin = new BrowserWindow({
webPreferences: { webPreferences: {
nodeIntegration: true webviewTag: false,
nodeIntegration: false,
contextIsolation: true,
preload: "../js/platform/preload.js"
}, },
width: 600, width: 600,
height: 400, height: 400,
@ -35,7 +38,7 @@ function dl(mainWindow, lang_path, base) {
}) })
//アプデDL //アプデDL
ipc.on('download-btn', (e, args) => { ipc.on('download-btn', (e, args) => {
function dl(url, file, dir,e) { function dl(url, file, dir, e) {
e.sender.webContents.send('mess', "ダウンロードを開始します。"); e.sender.webContents.send('mess', "ダウンロードを開始します。");
const opts = { const opts = {

View File

@ -73,7 +73,10 @@ function templete(lang, mainWindow, packaged, dir) {
var ver = app.getVersion() var ver = app.getVersion()
var window = new BrowserWindow({ var window = new BrowserWindow({
webPreferences: { webPreferences: {
nodeIntegration:true webviewTag: false,
nodeIntegration: false,
contextIsolation: true,
preload: "../js/platform/preload.js"
}, },
width: 300, height: 460, width: 300, height: 460,
"transparent": false, // ウィンドウの背景を透過 "transparent": false, // ウィンドウの背景を透過

View File

@ -1,4 +1,4 @@
function system(mainWindow, dir, lang) { function system(mainWindow, dir, lang, dirname) {
const electron = require("electron"); const electron = require("electron");
const app = electron.app; const app = electron.app;
const join = require('path').join; const join = require('path').join;
@ -145,19 +145,22 @@ function system(mainWindow, dir, lang) {
about(); about();
}); });
ipc.on('aboutData', (e, args) => { ipc.on('aboutData', (e, args) => {
e.sender.webContents.send('aboutDataRender', process); e.sender.webContents.send('aboutDataRender', [process.version, process.versions.chrome, process.versions.electron]);
}); });
function about() { function about() {
var ver = app.getVersion() var ver = app.getVersion()
var window = new BrowserWindow({ var window = new BrowserWindow({
webPreferences: { webPreferences: {
nodeIntegration: true webviewTag: false,
nodeIntegration: false,
contextIsolation: false,
preload: join(dirname,"js", "platform", "preload.js")
}, },
width: 300, width: 300,
height: 480, height: 480,
"transparent": false, // ウィンドウの背景を透過 "transparent": false, // ウィンドウの背景を透過
"frame": false, // 枠の無いウィンドウ "frame": true, // 枠の無いウィンドウ
"resizable": false "resizable": true
}); });
window.loadURL(dir + '/about.html?ver=' + ver); window.loadURL(dir + '/about.html?ver=' + ver);
return "true" return "true"
@ -182,7 +185,10 @@ function system(mainWindow, dir, lang) {
} }
var nanowindow = new BrowserWindow({ var nanowindow = new BrowserWindow({
webPreferences: { webPreferences: {
nodeIntegration: true webviewTag: false,
nodeIntegration: false,
contextIsolation: true,
preload: join(dirname,"js", "platform", "preload.js")
}, },
width: 350, width: 350,
height: 200, height: 200,