-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'desktop' into mainnet-desktop
- Loading branch information
Showing
15 changed files
with
17,142 additions
and
6,103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,7 @@ | |
} | ||
|
||
|
||
|
||
// table | ||
@table-cell-padding: 10px; | ||
@table-cell-vertical-padding-large: 14px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
export default { | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div class="testnet-notice"> | ||
<div class="testnet-notice__container u-container u-container--large"> | ||
<span class="testnet-notice__icon">⚠️</span> | ||
<span class="testnet-notice__caption">Attention! <span class="u-display-ib">This is a testnet version</span></span> | ||
<span class="testnet-notice__icon">⚠️</span> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const config = require('./electron-builder.config'); | ||
|
||
config.nsis.artifactName = config.nsis.artifactName.replace('x64', 'x86'); | ||
config.win.artifactName = config.win.artifactName.replace('x64', 'x86'); | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const appName = 'minter-console'; | ||
|
||
module.exports = { | ||
"productName": "Minter Console", | ||
"appId": "com.minter.console", | ||
"directories": { | ||
"buildResources": "desktop", | ||
"output": "tmp/electron", | ||
}, | ||
"files": [ | ||
"dist/**/*", | ||
"desktop/electron.js", | ||
// "desktop/electron.dev.js", | ||
// "nuxt.config.js", | ||
".nuxt/**/*", | ||
], | ||
"publish": ["github"], | ||
// mac (zip) | ||
"mac": { | ||
"artifactName": `${appName}-\${version}-\${arch}-mac.\${ext}`, | ||
"icon": "desktop/icons/icon.icns", | ||
}, | ||
// mac dmg | ||
"dmg": { | ||
"artifactName": `${appName}-\${version}-\${arch}.\${ext}`, | ||
"contents": [ | ||
{ | ||
"x": 410, | ||
"y": 150, | ||
"type": "link", | ||
"path": "/Applications", | ||
}, | ||
{ | ||
"x": 130, | ||
"y": 150, | ||
"type": "file", | ||
}, | ||
], | ||
}, | ||
// win (portable) | ||
"win": { | ||
"artifactName": `${appName}-\${version}-portable-x64.\${ext}`, | ||
"icon": "desktop/icons/icon.ico", | ||
"target": ["portable", "nsis"], | ||
}, | ||
// win setup | ||
"nsis": { | ||
"artifactName": `${appName}-\${version}-setup-x64.\${ext}`, | ||
}, | ||
// linux | ||
"linux": { | ||
"artifactName": `${appName}-\${version}-\${arch}.\${ext}`, | ||
"icon": "desktop/icons", | ||
"category": "Office", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This file is used specifically and only for development. It installs | ||
* `electron-debug` & `vue-devtools`. There shouldn't be any need to | ||
* modify this file, but it can be used to extend your development | ||
* environment. | ||
*/ | ||
|
||
/* eslint-disable */ | ||
|
||
// Install `electron-debug` with `devtron` | ||
require('electron-debug/index')({ showDevTools: true }) | ||
|
||
// Install `vue-devtools` | ||
require('electron').app.on('ready', () => { | ||
// let installExtension = require('electron-devtools-installer') | ||
// installExtension.default(installExtension.VUEJS_DEVTOOLS) | ||
// .then(() => {}) | ||
// .catch(err => { | ||
// console.log('Unable to install `vue-devtools`: \n', err) | ||
// }) | ||
}) | ||
|
||
// Require `main` process to boot app | ||
require('./electron') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
/* | ||
** Nuxt | ||
*/ | ||
const path = require('path'); | ||
const argv = require('minimist')(process.argv.slice(2)); | ||
|
||
const HOST_NAME = argv.hostname || 'localhost'; | ||
const PORT = argv.port || 4000; | ||
|
||
|
||
|
||
// const esm = require('esm'); | ||
const {Nuxt} = require('@nuxt/core'); | ||
async function initNuxt() { | ||
let config = {}; //esm(module)('./nuxt.config.js') | ||
if (config.default) { | ||
config = config.default; | ||
} | ||
config.rootDir = path.resolve(__dirname, '..'); | ||
config.dev = false; | ||
config.mode = 'spa'; | ||
config.dir = { | ||
static: 'dist', | ||
}; | ||
config.server = { | ||
host: HOST_NAME, | ||
port: PORT, | ||
}; | ||
/** @type Nuxt */ | ||
let nuxt = new Nuxt(config); | ||
await nuxt.ready(); | ||
await nuxt.server.listen(); | ||
} | ||
|
||
const _NUXT_URL_ = `http://${HOST_NAME}:${PORT}/`; | ||
|
||
|
||
|
||
|
||
/* | ||
** Electron | ||
*/ | ||
|
||
const fs = require('fs'); | ||
const { app, BrowserWindow, Menu } = require('electron'); // eslint-disable-line | ||
|
||
/** | ||
* Set `__static` path to static files in production | ||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html | ||
*/ | ||
// if (process.env.NODE_ENV !== 'development') { | ||
// global.__static = require('path').join(__dirname, '/dist').replace(/\\/g, '\\\\') // eslint-disable-line | ||
// } | ||
|
||
let mainWindow; | ||
|
||
app.on('ready', async () => { | ||
try { | ||
await initNuxt(); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
// setTimeout(createWindow, 3000) | ||
createWindow(); | ||
createMenu(); | ||
}); | ||
|
||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
app.on('activate', () => { | ||
if (mainWindow === null) { | ||
createWindow(); | ||
} | ||
}); | ||
|
||
function createWindow() { | ||
/** | ||
* Initial window options | ||
*/ | ||
mainWindow = new BrowserWindow({ | ||
width: 1260, | ||
height: 700, | ||
useContentSize: true, | ||
webPreferences: { | ||
nodeIntegration: false, | ||
}, | ||
}); | ||
|
||
mainWindow.loadURL(_NUXT_URL_); | ||
|
||
if (process.env.NODE_ENV === 'development' || process.env.DEBUG === 'electron-builder') { | ||
mainWindow.webContents.openDevTools(); | ||
} | ||
|
||
// clear leveldb log if localStorage is empty | ||
mainWindow.on('close', async () => { | ||
let vuex = await mainWindow.webContents.executeJavaScript(`window.localStorage.getItem('vuex')`); | ||
vuex = vuex && JSON.parse(vuex); | ||
if (!vuex.auth.advanced && !vuex.auth.password) { | ||
const dbPath = path.join(app.getPath('userData'), 'Local Storage/leveldb'); | ||
const logs = findInDir(dbPath, '.log'); | ||
logs.forEach((filePath) => { | ||
fs.unlinkSync(filePath); | ||
}); | ||
} | ||
}); | ||
|
||
mainWindow.on('closed', () => { | ||
mainWindow = null; | ||
}); | ||
} | ||
|
||
function createMenu() { | ||
const template = [{ | ||
label: "Minter Console", | ||
submenu: [ | ||
{ label: "About", selector: "orderFrontStandardAboutPanel:" }, | ||
{ type: "separator" }, | ||
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}, | ||
]}, { | ||
label: "Edit", | ||
submenu: [ | ||
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" }, | ||
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" }, | ||
{ type: "separator" }, | ||
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" }, | ||
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" }, | ||
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" }, | ||
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }, | ||
]}, | ||
]; | ||
|
||
Menu.setApplicationMenu(Menu.buildFromTemplate(template)); | ||
} | ||
|
||
function findInDir(startPath, filter) { | ||
let result = []; | ||
|
||
if (!fs.existsSync(startPath)) { | ||
return result; | ||
} | ||
|
||
const files = fs.readdirSync(startPath); | ||
for (let i = 0; i < files.length; i++) { | ||
const filename = path.join(startPath, files[i]); | ||
const stat = fs.lstatSync(filename); | ||
if (stat.isDirectory()) { | ||
result = result.concat(findInDir(filename, filter)); //recurse | ||
} else if (filename.indexOf(filter) >= 0) { | ||
result.push(filename); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
/** | ||
* Auto Updater | ||
* | ||
* Uncomment the following code below and install `electron-updater` to | ||
* support auto updating. Code Signing with a valid certificate is required. | ||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating | ||
*/ | ||
|
||
/* | ||
import { autoUpdater } from 'electron-updater' | ||
autoUpdater.on('update-downloaded', () => { | ||
autoUpdater.quitAndInstall() | ||
}) | ||
app.on('ready', () => { | ||
if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates() | ||
}) | ||
*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const HOST_NAME = 'localhost'; | ||
const PORT = 4000; | ||
|
||
const initCli = function() { | ||
const cli = require('@nuxt/cli'); | ||
const path = require('path'); | ||
const _argv = []; | ||
_argv[0] = 'start'; | ||
_argv.push('--spa'); | ||
_argv.push(`--port=${PORT}`); | ||
_argv.push(`--hostname=${HOST_NAME}`); | ||
_argv.push(path.resolve(__dirname, '..')); | ||
cli.run(_argv); | ||
}; | ||
|
||
/* | ||
const initNuxt = async () => { | ||
const {Nuxt} = require('@nuxt/core'); | ||
let config = {}; | ||
config.rootDir = __dirname; | ||
config.dev = false; | ||
config.mode = 'spa'; | ||
/!** @type Nuxt *!/ | ||
let nuxt = new Nuxt(config); | ||
await nuxt.ready(); | ||
await nuxt.server.listen(PORT, HOST_NAME); | ||
}; | ||
*/ | ||
|
||
// initNuxt(); | ||
initCli(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.