This commit is contained in:
crusader 2018-10-02 10:32:32 +09:00
parent b6657ac2a0
commit ea0af6c32b
14 changed files with 84 additions and 77 deletions

View File

@ -1,5 +1,5 @@
import * as Path from 'path';
import fileUrl = require('file-url');
const fileUrl = require('file-url');
/**
* Resolve and encode the path information into a URL.

View File

@ -1,8 +1,6 @@
import * as Path from 'path';
import * as Fs from 'fs';
const fileUriToPath: (uri: string) => string = require('file-uri-to-path');
const sourceMapSupport = require('source-map-support');
import * as sourceMapSupport from 'source-map-support';
/**
* This array tells the source map logic which files that we can expect to
@ -16,6 +14,8 @@ const sourceMapSupport = require('source-map-support');
const knownFilesWithSourceMap = ['renderer.js', 'main.js'];
function retrieveSourceMap(source: string) {
const fileUriToPath: (uri: string) => string = require('file-uri-to-path');
// This is a happy path in case we know for certain that we won't be
// able to resolve a source map for the given location.
if (!knownFilesWithSourceMap.some(file => source.endsWith(file))) {
@ -89,6 +89,7 @@ function prepareStackTrace(error: Error, frames: ReadonlyArray<any>) {
/** Enable source map support in the current process. */
export function enableSourceMaps() {
sourceMapSupport.install({
environment: 'node',
handleUncaughtExceptions: false,
@ -125,7 +126,7 @@ function sourceMappedStackTrace(error: Error): string | undefined {
// in our weak map. In order to get around that we'll eagerly access the
// stack, forcing our handler to run which should ensure that the native
// frames are stored in our weak map.
(error.stack || '').toString();
(error.stack || '').toString();
frames = stackFrameMap.get(error);
}

View File

@ -27,7 +27,7 @@
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets/image"
],
"styles": [
"node_modules/primeicons/primeicons.css",

View File

@ -10,7 +10,6 @@ const channel = getReleaseChannel();
const s = JSON.stringify;
function getReplacements() {
console.log(`channel: ${channel}`);
return {
__DARWIN__: process.platform === 'darwin',
__WIN32__: process.platform === 'win32',

View File

@ -1,22 +1,3 @@
#!/bin/bash
old_exec="/opt/Wire/wire";
# Warn if old package is still installed
if test -e "${old_exec}"; then
echo "WARNING: It seems that there are files from the old Wire package on"
echo "your machine. We highly recommend that you remove the old version"
echo "and then reinstall this package. You can remove the old package with"
echo "the following command:"
echo "sudo apt-get remove wire"
fi
# Clean up old invalid links
if [ -L '/usr/local/bin/wire' ] || [ -L '/usr/local/bin/<%= executable %>' ]; then
echo "Removing old invalid symlinks"
if [ -L '/usr/local/bin/wire' ] && [ "$(readlink '/usr/local/bin/wire')" = "${old_exec}" ]; then rm -f /usr/local/bin/wire; fi
if [ -L '/usr/local/bin/<%= executable %>' ] && [ "$(readlink '/usr/local/bin/<%= executable %>')" = '/opt/<% productFilename %>/<%= executable %>' ]; then rm -f '/usr/local/bin/<%= executable %>'; fi
fi
# Link to the binary
ln -sf '/opt/${productFilename}/${executable}' '/usr/bin/${executable}'
setcap cap_net_raw,cap_net_admin=eip '/opt/${productFilename}/bin/probe'

18
config/package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "overflow-network-scanner-app",
"version": "0.0.1",
"author": {
"name": "LOAFLE",
"email": "rnd@loafle.com",
"url": "https://www.loafle.com"
},
"homepage": "https://www.loafle.com",
"description": "Desktop App for overFlow Network Scanner",
"dependencies": {
"electron-devtools-installer": "^2.2.4",
"electron-window-state": "^5.0.1",
"file-url": "^2.0.2",
"rxjs": "^6.2.2",
"sqlite3": "^4.0.2"
}
}

View File

@ -1,5 +1,6 @@
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ElectronConnectWebpackPlugin = require('electron-connect-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
@ -57,6 +58,11 @@ module.exports = function () {
};
config.plugins = [
PROD ? new webpack.NoEmitOnErrorsPlugin() : null,
PROD ? new CopyWebpackPlugin(
[
'config/package.json'
]
) : null,
new webpack.DefinePlugin(
Object.assign({}, replacements, {
__PROCESS_KIND__: JSON.stringify('main'),

View File

@ -2,13 +2,21 @@
"appId": "com.loafle.overflow.scanner",
"productName": "overFlow Network Scanner",
"copyright": "Copyright © 2016 LOAFLE",
"asar": false,
"compression": "normal",
"npmRebuild": false,
"npmSkipBuildFromSource": false,
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
"directories": {
"app": "./build/dist",
"output": "./build/package"
},
"files": [
{
"filter": [
"**/*",
"!*.ts",
"!*.scss",
"!*.code-workspace",
"!@overflow/",
"!build/",
@ -27,50 +35,37 @@
"!tslint.json",
"!webpack.js",
"!yarn.lock"
],
"from": "./build/dist",
"to": "."
},
"packages.json"
]
}
],
"extraFiles": [
{
"from": "config/_database.sqlite",
"to": "./bin/database.sqlite"
}
],
"asar": true,
"compression": "normal",
"npmRebuild": false,
"npmSkipBuildFromSource": false,
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
"linux": {
"target": [
{
"target": "deb",
"arch": [
"x64",
"ia32"
"x64"
]
}
],
"executableName": "overFlow-Network-Scanner",
"icon": "config/build/linux/icon/overflow.png",
"executableName": "overFlow-NetworkScanner",
"icon": "config/build/linux/icon/overflow_512.png",
"synopsis": "overFlow Network Scanner",
"category": "Utility",
"extraFiles": [
{
"from": "config/build/linux/bin/probe-${os}-${arch}",
"to": "./bin"
"to": "./bin/probe"
}
]
},
"deb": {
"depends": [
"gconf2",
"gconf-service",
"libnotify4",
"libappindicator1",
"libxtst6",
"libnss3",
"libpcap"
],
"afterInstall": "config/build/linux/after-install.tpl",
"afterRemove": "config/build/linux/after-remove.tpl"
"afterInstall": "config/build/linux/after-install.tpl"
},
"mac": {
"category": "public.app-category.utilities",

View File

@ -1,12 +1,13 @@
{
"name": "scanner-app",
"version": "0.0.0",
"name": "overflow-network-scanner-app",
"version": "0.0.1",
"author": {
"name": "LOAFLE",
"email": "rnd@loafle.com",
"url": "https://www.loafle.com"
},
"homepage": "https://www.loafle.com",
"description": "Desktop App for overFlow Network Scanner",
"scripts": {
"postinstall": "yarn electron:builder:install-app-deps",
"ng": "ng",
@ -59,9 +60,11 @@
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.10.4",
"@types/source-map-support": "^0.4.1",
"@types/sqlite3": "^3.1.3",
"awesome-typescript-loader": "^5.2.0",
"codelyzer": "~4.2.1",
"copy-webpack-plugin": "^4.5.2",
"core-js": "^2.5.4",
"cross-env": "^5.2.0",
"d3": "^5.7.0",

View File

@ -74,7 +74,7 @@ export class AppWindow {
'build',
'linux',
'icon',
'overflow_512.png'
'overflow_512_shadow.png'
);
}

View File

@ -1,13 +1,14 @@
import { app, Menu, ipcMain, BrowserWindow, shell } from 'electron';
import * as fse from 'fs-extra';
import * as path from 'path';
import * as ChildProcess from 'child_process';
import { shellNeedsPatching, updateEnvironmentForProcess } from '@overflow/core/shell';
import { parseAppURL } from '@overflow/core/parse-app-url';
import {
enableSourceMaps,
withSourceMappedStack,
} from '@overflow/core/source-map-support';
// import {
// enableSourceMaps,
// withSourceMappedStack,
// } from '@overflow/core/source-map-support';
import { now } from '@overflow/core/now';
import { IMenuItem } from '@overflow/core/menu-item';
@ -23,7 +24,7 @@ import { IMenuItemState } from '../commons/model/menu-update';
import * as sqlite3 from 'sqlite3';
enableSourceMaps();
// enableSourceMaps();
let mainWindow: AppWindow | null = null;
@ -48,12 +49,12 @@ function handleUncaughtException(error: Error) {
// showUncaughtException(isLaunchError, error);
}
process.on('uncaughtException', (error: Error) => {
error = withSourceMappedStack(error);
// process.on('uncaughtException', (error: Error) => {
// error = withSourceMappedStack(error);
// reportError(error);
handleUncaughtException(error);
});
// // reportError(error);
// handleUncaughtException(error);
// });
const handlingSquirrelEvent = false;
// if (__WIN32__ && process.argv.length > 1) {
@ -181,7 +182,9 @@ app.on('ready', () => {
return;
}
const dbPath = path.join(__dirname, '..', '..', '_database.sqlite');
const dbPath = __DEV__ ?
path.join(__dirname, '..', '..', 'config', '_database.sqlite')
: path.join(__dirname, '..', '..', 'bin', 'database.sqlite');
const db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (err: Error) => {
if (err) {
@ -190,6 +193,11 @@ app.on('ready', () => {
console.log('Connected to the database.');
});
if (!__DEV__) {
const probePath = path.join(__dirname, '..', '..', 'bin', 'probe');
ChildProcess.spawn(probePath);
}
readyTime = now() - launchTime;
// setAsDefaultProtocolClient('x-github-client');

View File

@ -574,6 +574,12 @@
version "2.53.43"
resolved "https://nexus.loafle.net/repository/npm-all/@types/selenium-webdriver/-/selenium-webdriver-2.53.43.tgz#2de3d718819bc20165754c4a59afb7e9833f6707"
"@types/source-map-support@^0.4.1":
version "0.4.1"
resolved "https://nexus.loafle.net/repository/npm-all/@types/source-map-support/-/source-map-support-0.4.1.tgz#ad77158e8c6695a16629ef82b9fb9dfe7c610ac0"
dependencies:
"@types/node" "*"
"@types/sqlite3@^3.1.3":
version "3.1.3"
resolved "https://nexus.loafle.net/repository/npm-all/@types/sqlite3/-/sqlite3-3.1.3.tgz#580d547203b8ad6e11aa6a6769c8ca5d7e197d13"
@ -790,12 +796,6 @@ amdefine@>=0.0.4:
version "1.0.1"
resolved "https://nexus.loafle.net/repository/npm-all/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
angular-page-visibility@^6.1.3:
version "6.1.3"
resolved "https://nexus.loafle.net/repository/npm-all/angular-page-visibility/-/angular-page-visibility-6.1.3.tgz#d2cfaa5a73aec195f393be03cf9fc45f9b293e16"
dependencies:
tslib "^1.9.0"
ansi-align@^2.0.0:
version "2.0.0"
resolved "https://nexus.loafle.net/repository/npm-all/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f"
@ -6504,10 +6504,6 @@ rx@^4.1.0:
version "4.1.0"
resolved "https://nexus.loafle.net/repository/npm-all/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
rxjs-compat@^6.3.3:
version "6.3.3"
resolved "https://nexus.loafle.net/repository/npm-all/rxjs-compat/-/rxjs-compat-6.3.3.tgz#2ab3b9ac0dac0c073749d55fef9c03ea1df2045c"
rxjs@^6.0.0, rxjs@^6.2.2:
version "6.3.3"
resolved "https://nexus.loafle.net/repository/npm-all/rxjs/-/rxjs-6.3.3.tgz#3c6a7fa420e844a81390fb1158a9ec614f4bad55"