Commit f81a7ac0 authored by wudizhanche1000's avatar wudizhanche1000

Merge remote-tracking branch 'origin/v3' into v3

# Conflicts:
#	app/apps.service.ts
parents 4498e177 87a8c9c6
/bin/
/app/*.js /app/*.js
/app/*.js.map /app/*.js.map
/node_modules/ /node_modules/
......
...@@ -25,7 +25,6 @@ addons: ...@@ -25,7 +25,6 @@ addons:
cache: cache:
directories: directories:
- node_modules - node_modules
- app/node_modules
- $HOME/.electron - $HOME/.electron
- $HOME/.cache - $HOME/.cache
...@@ -34,11 +33,13 @@ before_install: ...@@ -34,11 +33,13 @@ before_install:
- chmod 600 $HOME/.ssh/id_ecdsa - chmod 600 $HOME/.ssh/id_ecdsa
install: install:
- npm install - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p bin; curl -L https://github.com/aria2/aria2/releases/download/release-1.27.1/aria2-1.27.1-osx-darwin.tar.bz2 | tar --strip-components=2 -C bin -jxf - aria2-1.27.1/bin/aria2c; fi
- npm prune
- npm install
- npm prune
script: script:
- npm run dist - npm run dist
deploy: deploy:
provider: script provider: script
......
# MyCard [![Build Status](https://travis-ci.org/mycard/mycard.svg?branch=v3)](https://travis-ci.org/mycard/mycard) [![Build status](https://ci.appveyor.com/api/projects/status/t4jyh0rkwh0nep7w?svg=true)](https://ci.appveyor.com/project/zh99998/mycard) [![NSP Status](https://nodesecurity.io/orgs/mycard/projects/62dd15a6-3927-49c2-8c30-1bc19d4a6e92/badge)](https://nodesecurity.io/orgs/mycard/projects/62dd15a6-3927-49c2-8c30-1bc19d4a6e92) # MyCard [![Build Status](https://travis-ci.org/mycard/mycard.svg?branch=v3)](https://travis-ci.org/mycard/mycard) [![Build status](https://ci.appveyor.com/api/projects/status/t4jyh0rkwh0nep7w?svg=true)](https://ci.appveyor.com/project/zh99998/mycard) [![NSP Status](https://nodesecurity.io/orgs/mycard/projects/62dd15a6-3927-49c2-8c30-1bc19d4a6e92/badge)](https://nodesecurity.io/orgs/mycard/projects/62dd15a6-3927-49c2-8c30-1bc19d4a6e92)
## Install Dependencies ## Install Dependencies
``` ```bash
npm install npm install
``` ```
## Build ## Build
``` ```bash
npm run tsc npm run tsc
npm run dist npm run dist
``` ```
## Debug ## Debug
``` ```bash
./node_modules/.bin/electron . ./node_modules/.bin/electron .
``` ```
## Install Dependencies (macOS)
```bash
mkdir -p bin
curl -L https://github.com/aria2/aria2/releases/download/release-1.27.1/aria2-1.27.1-osx-darwin.tar.bz2 | tar --strip-components=2 -C bin -jxf - aria2-1.27.1/bin/aria2c
```
## Install Dependencies (Windows)
```bash
mkdir -p bin
curl -L -o aria2-1.27.1-win-32bit-build1.zip https://github.com/aria2/aria2/releases/download/release-1.27.1/aria2-1.27.1-win-32bit-build1.zip
unzip -o aria2-1.28.0-win-32bit-build1.zip aria2-1.28.0-win-32bit-build1/aria2c.exe
mv aria2-1.28.0-win-32bit-build1/aria2c.exe bin
rm -rf aria2-1.28.0-win-32bit-build1 aria2-1.27.1-win-32bit-build1.zip
curl -L 'http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/i686/bsdtar-3.2.1-1-i686.pkg.tar.xz' | tar --strip-components=2 -C bin -Jxf - usr/bin/bsdtar.exe
curl -L 'http://downloads.sourceforge.net/project/msys2/Base/i686/msys2-base-i686-20161025.tar.xz' | tar --strip-components=3 -C bin -Jxf - msys32/usr/bin/msys-2.0.dll msys32/usr/bin/msys-bz2-1.dll msys32/usr/bin/msys-gcc_s-1.dll msys32/usr/bin/msys-iconv-2.dll msys32/usr/bin/msys-lzma-5.dll msys32/usr/bin/msys-lzo2-2.dll msys32/usr/bin/msys-nettle-6.dll msys32/usr/bin/msys-xml2-2.dll msys32/usr/bin/msys-z.dll
```
\ No newline at end of file
...@@ -20,7 +20,6 @@ environment: ...@@ -20,7 +20,6 @@ environment:
cache: cache:
- node_modules - node_modules
- app\node_modules
- '%APPDATA%\npm-cache' - '%APPDATA%\npm-cache'
- '%USERPROFILE%\.electron' - '%USERPROFILE%\.electron'
...@@ -31,9 +30,17 @@ init: ...@@ -31,9 +30,17 @@ init:
- ps: $fileContent += $env:priv_key.Replace(' ', "`n") - ps: $fileContent += $env:priv_key.Replace(' ', "`n")
- ps: $fileContent += "`n-----END EC PRIVATE KEY-----`n" - ps: $fileContent += "`n-----END EC PRIVATE KEY-----`n"
- ps: Set-Content c:\users\appveyor\.ssh\id_ecdsa $fileContent - ps: Set-Content c:\users\appveyor\.ssh\id_ecdsa $fileContent
- git config --global core.autocrlf input
install: install:
- set PATH=%PATH%;C:\MinGW\msys\1.0\bin # tar xz
- mkdir -p bin
- curl -L -o aria2-1.28.0-win-32bit-build1.zip https://github.com/aria2/aria2/releases/download/release-1.28.0/aria2-1.28.0-win-32bit-build1.zip
- unzip -o aria2-1.28.0-win-32bit-build1.zip aria2-1.28.0-win-32bit-build1/aria2c.exe
- mv aria2-1.28.0-win-32bit-build1/aria2c.exe bin
- rm -rf aria2-1.28.0-win-32bit-build1 aria2-1.27.1-win-32bit-build1.zip
- curl -L 'http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/i686/bsdtar-3.2.1-1-i686.pkg.tar.xz' | tar --strip-components=2 -C bin -Jxf - usr/bin/bsdtar.exe
- curl -L 'http://downloads.sourceforge.net/project/msys2/Base/i686/msys2-base-i686-20161025.tar.xz' | tar --strip-components=3 -C bin -Jxf - msys32/usr/bin/msys-2.0.dll msys32/usr/bin/msys-bz2-1.dll msys32/usr/bin/msys-gcc_s-1.dll msys32/usr/bin/msys-iconv-2.dll msys32/usr/bin/msys-lzma-5.dll msys32/usr/bin/msys-lzo2-2.dll msys32/usr/bin/msys-nettle-6.dll msys32/usr/bin/msys-xml2-2.dll msys32/usr/bin/msys-z.dll
- ps: Install-Product node - ps: Install-Product node
- npm install - npm install
- npm prune - npm prune
...@@ -57,4 +64,4 @@ deploy: ...@@ -57,4 +64,4 @@ deploy:
folder: folder:
secure: hOfOYpwk3SlvYd2YXf/NiA== secure: hOfOYpwk3SlvYd2YXf/NiA==
on: on:
appveyor_repo_tag: true appveyor_repo_tag: true
\ No newline at end of file
...@@ -2,19 +2,20 @@ ...@@ -2,19 +2,20 @@
const {ipcMain, app, BrowserWindow} = require('electron'); const {ipcMain, app, BrowserWindow} = require('electron');
const {autoUpdater} = require("electron-auto-updater"); const {autoUpdater} = require("electron-auto-updater");
const child_process = require('child_process');
const path = require('path');
if (process.platform == 'darwin') { if (process.platform == 'darwin') {
try { try {
autoUpdater.setFeedURL("https://wudizhanche.mycard.moe/update"); autoUpdater.setFeedURL("https://wudizhanche.mycard.moe/update");
} catch (err) { } catch (err) {
} }
} }
autoUpdater.on('error', (event)=>console.log('error', event)); autoUpdater.on('error', (event)=>console.log('error', event));
autoUpdater.on('checking-for-update', (event)=>console.log('checking-for-update', event)); autoUpdater.on('checking-for-update', (event)=>console.log('checking-for-update'));
autoUpdater.on('update-available', (event)=>console.log('update-available', event)); autoUpdater.on('update-available', (event)=>console.log('update-available'));
autoUpdater.on('update-not-available', (event)=>console.log('update-not-available', event)); autoUpdater.on('update-not-available', (event)=>console.log('update-not-available'));
let updateWindow; let updateWindow;
autoUpdater.on('update-downloaded', (event)=> { autoUpdater.on('update-downloaded', (event)=> {
...@@ -34,78 +35,6 @@ autoUpdater.on('update-downloaded', (event)=> { ...@@ -34,78 +35,6 @@ autoUpdater.on('update-downloaded', (event)=> {
}) })
}); });
const child_process = require('child_process');
const path = require('path');
// this should be placed at top of main.js to handle setup events quickly
if (handleSquirrelEvent() || handleElevate()) {
// squirrel event handled and app will exit in 1000ms, so don't do anything else
return;
}
function handleSquirrelEvent() {
if (process.argv.length === 1) {
return false;
}
const ChildProcess = require('child_process');
const path = require('path');
const appFolder = path.resolve(process.execPath, '..');
const rootAtomFolder = path.resolve(appFolder, '..');
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
const exeName = path.basename(process.execPath);
const spawn = function (command, args) {
let spawnedProcess, error;
try {
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
} catch (error) {
}
return spawnedProcess;
};
const spawnUpdate = function (args) {
return spawn(updateDotExe, args);
};
const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
// Optionally do things such as:
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus
// Install desktop and start menu shortcuts
spawnUpdate(['--createShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers
// Remove desktop and start menu shortcuts
spawnUpdate(['--removeShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated
app.quit();
return true;
}
}
function handleElevate() { function handleElevate() {
if (process.argv[1] == '-e') { if (process.argv[1] == '-e') {
app.dock.hide(); app.dock.hide();
...@@ -119,26 +48,23 @@ function handleElevate() { ...@@ -119,26 +48,23 @@ function handleElevate() {
} }
} }
if (handleElevate()) {
return;
}
function createAria2c() { function createAria2c() {
let aria2c_path; let aria2c_path;
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
aria2c_path = path.join(process.execPath, '..', '..', 'aria2c.exe'); aria2c_path = path.join(process.resourcesPath, 'bin', 'aria2c.exe');
break; break;
case 'darwin': case 'darwin':
aria2c_path = 'aria2c'; // for debug aria2c_path = path.join(process.resourcesPath, 'bin', 'aria2c');
break; break;
default: default:
throw 'unsupported platform'; throw 'unsupported platform';
} }
//--split=10 --min-split-size=1M --max-connection-per-server=10 return child_process.spawn(aria2c_path, ['--enable-rpc', '--rpc-allow-origin-all', "--continue", "--split=10", "--min-split-size=1M", "--max-connection-per-server=10"], {stdio: 'ignore'});
let aria2c = child_process.spawn(aria2c_path,
['--enable-rpc', '--rpc-allow-origin-all', "--continue", "--split=10", "--min-split-size=1M", "--max-connection-per-server=10"],
{stdio: 'ignore'});
aria2c.on('data', (data)=> {
console.log(data);
});
return aria2c;
} }
const aria2c = createAria2c(); const aria2c = createAria2c();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"description": "mycard", "description": "mycard",
"author": "zh99998 <zh99998@gmail.com>", "author": "zh99998 <zh99998@gmail.com>",
"homepage": "https://mycard.moe", "homepage": "https://mycard.moe",
"version": "3.0.0-dev.6", "version": "3.0.0-dev.7",
"repository": "github:mycard/mycard", "repository": "github:mycard/mycard",
"scripts": { "scripts": {
"pack": "tsc && build --dir", "pack": "tsc && build --dir",
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
"@angular/router-deprecated": "latest", "@angular/router-deprecated": "latest",
"@angular/upgrade": "latest", "@angular/upgrade": "latest",
"angular2-in-memory-web-api": "latest", "angular2-in-memory-web-api": "latest",
"electron-auto-updater": "latest",
"aria2": "latest", "aria2": "latest",
"bootstrap": "next", "bootstrap": "next",
"core-js": "latest", "core-js": "latest",
"electron-sudo": "github:mycard/electron-sudo", "electron-auto-updater": "latest",
"electron-sudo": "github:mycard/electron-sudo#patch-1",
"font-awesome": "latest", "font-awesome": "latest",
"ini": "latest", "ini": "latest",
"mkdirp": "latest", "mkdirp": "latest",
...@@ -69,15 +69,6 @@ ...@@ -69,15 +69,6 @@
"extraResources": [ "extraResources": [
"bin" "bin"
], ],
"publish": [
{
"provider": "generic",
"url": "https://wudizhanche.mycard.moe/downloads"
},
{
"provider": "github"
}
],
"win": { "win": {
"target": [ "target": [
"nsis" "nsis"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment