Skip to content

Commit

Permalink
Merge branch 'dev' into release2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashuaidehao committed Jan 14, 2021
2 parents edb073e + 84ef2dd commit 3db3730
Show file tree
Hide file tree
Showing 118 changed files with 9,966 additions and 7,644 deletions.
2 changes: 1 addition & 1 deletion neo
Submodule neo updated 220 files
3 changes: 3 additions & 0 deletions neo3-gui/neo3-gui/ClientApp/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/components/*
public/*
main.js
14 changes: 14 additions & 0 deletions neo3-gui/neo3-gui/ClientApp/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
rules: {
"no-console": ["warn", { allow: ["warn", "error"] }],
},
parserOptions: {
parser: "babel-eslint",
ecmaVersion: 6,
},
};
2 changes: 2 additions & 0 deletions neo3-gui/neo3-gui/ClientApp/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"javascript.autoImports": false,
"react-i18n.i18nPaths": "build\\locales,public\\locales,build-electron\\win-unpacked\\locales,build-electron\\win-unpacked\\resources\\app.asar\\build\\locales"
}
30 changes: 18 additions & 12 deletions neo3-gui/neo3-gui/ClientApp/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
const { override, addDecoratorsLegacy, disableEsLint, setWebpackTarget, addWebpackModuleRule } = require('customize-cra');
const {
override,
addDecoratorsLegacy,
disableEsLint,
setWebpackTarget,
addWebpackModuleRule,
} = require("customize-cra");

module.exports = override(
addDecoratorsLegacy(),
disableEsLint(),
setWebpackTarget("electron-renderer"),//support native api
// addWebpackModuleRule({
// test: /\walletStore.js?$/,
// use: {
// loader: 'babel-loader',
// },
// exclude: /node_modules/,
// })
);
addDecoratorsLegacy(),
disableEsLint(),
setWebpackTarget("electron-renderer") //support native api
// addWebpackModuleRule({
// test: /\walletStore.js?$/,
// use: {
// loader: 'babel-loader',
// },
// exclude: /node_modules/,
// })
);
214 changes: 104 additions & 110 deletions neo3-gui/neo3-gui/ClientApp/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,130 +2,124 @@
// import nodeManager from "./src/node-manager";

const {
app,
shell,
Menu,
BrowserWindow,
globalShortcut,
session,
} = require('electron') // eslint-disable-line import/no-extraneous-dependencies
const path = require('path')
const url = require('url')
app,
shell,
Menu,
BrowserWindow,
globalShortcut,
session,
} = require("electron"); // eslint-disable-line import/no-extraneous-dependencies
const path = require("path");
const url = require("url");

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
const gotTheLock = app.requestSingleInstanceLock()

let mainWindow;
const gotTheLock = app.requestSingleInstanceLock();

// adapted from https://github.com/chentsulin/electron-react-boilerplate
const installExtensions = () => {
const installer = require('electron-devtools-installer') // eslint-disable-line import/no-extraneous-dependencies
const extensions = ['REACT_DEVELOPER_TOOLS', 'MOBX_DEVTOOLS']
const installer = require("electron-devtools-installer"); // eslint-disable-line import/no-extraneous-dependencies
const extensions = ["REACT_DEVELOPER_TOOLS", "MOBX_DEVTOOLS"];

return Promise.all(
extensions.map(name => installer.default(installer[name])),
).catch(console.error)
}
return Promise.all(
extensions.map((name) => installer.default(installer[name]))
).catch(console.error);
};

function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1100,
height: 700,
resizable: false,
webPreferences: {
javascript: true,
plugins: true,
nodeIntegration: false,
webSecurity: false,
preload: path.join(__dirname, './preload.js')
}
})

// and load the index.html of the app.
if (process.env.NODE_ENV === "development") {
console.log("development");
mainWindow.loadURL(`http://localhost:3000/`);
// Open the DevTools.
mainWindow.webContents.openDevTools();
} else {
//Hide toolBar
Menu.setApplicationMenu(null)
mainWindow.loadURL(
url.format({
protocol: 'file',
slashes: true,
pathname: path.join(__dirname, '/build/index.html'),
}),
)
}

// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})

mainWindow.webContents.on('new-window', function (event, url) {
event.preventDefault()
})
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1100,
height: 700,
resizable: false,
webPreferences: {
javascript: true,
plugins: true,
nodeIntegration: false,
webSecurity: false,
preload: path.join(__dirname, "./preload.js"),
},
});

// and load the index.html of the app.
if (process.env.NODE_ENV === "development") {
console.log("development");
mainWindow.loadURL(`http://localhost:3000/`);
// Open the DevTools.
mainWindow.webContents.openDevTools();
} else {
//Hide toolBar
Menu.setApplicationMenu(null);
mainWindow.loadURL(
url.format({
protocol: "file",
slashes: true,
pathname: path.join(__dirname, "/build/index.html"),
})
);
}

// Emitted when the window is closed.
mainWindow.on("closed", function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});

mainWindow.webContents.on("new-window", function (event, url) {
event.preventDefault();
});
}

if (!gotTheLock) {
app.quit()
app.quit();
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
}
})

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
app.on("second-instance", (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});

if (process.env.NODE_ENV === 'development') {
// installExtensions().then(() => createWindow())
createWindow()
} else {
createWindow()
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on("ready", () => {
if (process.env.NODE_ENV === "development") {
// installExtensions().then(() => createWindow())
createWindow();
} else {
createWindow();
}
});

// Quit when all windows are closed.
app.on("window-all-closed", function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== "darwin") app.quit();
});

app.on("activate", function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) createWindow();
});

app.on("web-contents-created", (event, wc) => {
wc.on("before-input-event", (event, input) => {
// Windows/Linux hotkeys
if (process.platform !== "darwin") {
if (input.key === "F12") {
mainWindow.webContents.openDevTools();
event.preventDefault();
}
})



// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') app.quit()
})

app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) createWindow()
})

app.on('web-contents-created', (event, wc) => {
wc.on('before-input-event', (event, input) => {
// Windows/Linux hotkeys
if (process.platform !== 'darwin') {
if (input.key === 'F12') {
mainWindow.webContents.openDevTools()
event.preventDefault()
}
}
})
})
}
});
});
}



// In this file you can include the rest of your app's specific main process
// In this file you can include the rest of your app's specific main process
Loading

0 comments on commit 3db3730

Please sign in to comment.