Closed StringKe closed 5 years ago
index.js
import { app, BrowserWindow, ipcMain } from 'electron';
import fs from 'fs';
if (process.env.NODE_ENV !== 'development') {
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\');
}
let mainWindow;
const winURL = process.env.NODE_ENV === 'development'
? 'http://localhost:9080/index.html'
: `file://${__dirname}/index.html`;
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
class Browser {
createWindow() {
mainWindow = new BrowserWindow({
show: false,
height: 620,
width: 1240,
minHeight: 430,
minWidth: 800,
useContentSize: true,
frame: false,
webSecurity: false,
allowRunningInsecureContent: true,
fullscreenWindowTitle: false,
webPreferences: {
plugins: true,
},
});
mainWindow.loadURL(winURL);
mainWindow.once('ready-to-show', () => {
mainWindow.show();
});
}
start() {
const flashPath = app.getPath('pepperFlashSystemPlugin');
if (flashPath && ['dll', 'so', 'plugin'].forEach(item => flashPath.endsWith(item))) {
app.commandLine.appendSwitch('ppapi-flash-path', flashPath);
}
app.on('ready', this.createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (mainWindow === null) {
this.createWindow();
}
});
this.listenRender();
}
listenRender() {
ipcMain.on('fun-minWindow', (event, obj) => {
mainWindow.minimize();
});
ipcMain.on('fun-closeWindow', (event, obj) => {
app.quit();
app.exit(0);
});
ipcMain.on('fun-reStart', (event, obj) => {
app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) });
app.exit(0);
});
ipcMain.on('fun-maxWindow', (event, obj) => {
if (mainWindow.isMaximized()) {
mainWindow.unmaximize();
mainWindow.setSize(1000, 560);
} else {
mainWindow.maximize();
}
});
}
}
new Browser().start();
Perhaps https://github.com/electron/electron/issues/8469#issuecomment-277086664 explains this behavior.
Perhaps #8469 (comment) explains this behavior.
I use electron to make a browser. In theory, I should read the flash that the user has installed. Otherwise, I will update my program every time the flash is updated.
Duplicate of https://github.com/electron/electron/issues/8469
Electron does not implement this directly, it just calls https://cs.chromium.org/chromium/src/chrome/common/chrome_paths.cc?type=cs&q=FILE_PEPPER_FLASH_SYSTEM_PLUGIN&sq=package:chromium&g=0&l=308
Preflight Checklist
Issue Details
Expected Behavior
load flash plugin and no exception
Actual Behavior
To Reproduce
in win7
Screenshots
Additional Information
none