Skip to content

Commit

Permalink
Merge pull request #1007 from chiflix/mac
Browse files Browse the repository at this point in the history
fix(deps): replace axios with fetch
  • Loading branch information
ipy authored Oct 7, 2019
2 parents 31841c9 + ce84303 commit b1d0b30
Show file tree
Hide file tree
Showing 21 changed files with 677 additions and 315 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ jobs:
npm test
npm run build --if-present
env:
NO_NOTARIZE: true
CI: true
245 changes: 245 additions & 0 deletions electron-builder-mas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
{
"appId": "org.splayer.splayerx",
"productName": "SPlayer",
"publish": [
{
"provider": "github",
"owner": "chiflix",
"repo": "splayerx"
}
],
"afterPack": "scripts/after-pack.js",
"compression": "maximum",
"directories": {
"output": "build"
},
"electronVersion": "5.0.11",
"electronDist": "node_modules/@chiflix/electron/dist",
"electronDownload": {
"mirror": "https://github.com/chiflix/electron/releases/download/v",
"isVerifyChecksum": false,
"version": "5.0.11"
},
"files": [
"dist/electron/**/*"
],
"mac": {
"hardenedRuntime": false,
"asarUnpack": [
"node_modules/osx-mouse-cocoa"
],
"icon": "icons/icon.icns",
"fileAssociations": [
{
"name": "Video",
"ext": [
"3g2",
"3gp",
"3gp2",
"3gpp",
"amv",
"asf",
"bik",
"bin",
"crf",
"divx",
"drc",
"dv",
"dvr-ms",
"evo",
"gvi",
"gxf",
"m1v",
"m2v",
"m2t",
"m2ts",
"mp2",
"mp2v",
"mp4v",
"mpe",
"mpeg",
"mpeg1",
"mpeg2",
"mpeg4",
"mpv2",
"mts",
"mtv",
"mxf",
"mxg",
"nsv",
"nuv",
"ogg",
"ogm",
"ogv",
"ogx",
"ps",
"rec",
"rpl",
"thp",
"tod",
"tp",
"tts",
"txd",
"vro",
"wm",
"wtv",
"xesc"
],
"role": "Viewer",
"icon": "build/icons/others.icns"
},
{
"name": "DAT",
"ext": [
"dat"
],
"role": "Viewer",
"icon": "build/icons/dat.icns"
},
{
"name": "WEBM",
"ext": [
"webm"
],
"role": "Viewer",
"icon": "build/icons/webm.icns"
},
{
"name": "VOB",
"ext": [
"vob"
],
"role": "Viewer",
"icon": "build/icons/vob.icns"
},
{
"name": "TS",
"ext": [
"ts"
],
"role": "Viewer",
"icon": "build/icons/ts.icns"
},
{
"name": "RM",
"ext": [
"rm"
],
"role": "Viewer",
"icon": "build/icons/rm.icns"
},
{
"name": "MPG",
"ext": [
"mpg"
],
"role": "Viewer",
"icon": "build/icons/mpg.icns"
},
{
"name": "F4V",
"ext": [
"f4v"
],
"role": "Viewer",
"icon": "build/icons/f4v.icns"
},
{
"name": "AVI",
"ext": [
"avi"
],
"role": "Viewer",
"icon": "build/icons/avi.icns"
},
{
"name": "FLV",
"ext": [
"flv"
],
"role": "Viewer",
"icon": "build/icons/flv.icns"
},
{
"name": "M4V",
"ext": [
"m4v"
],
"role": "Viewer",
"icon": "build/icons/m4v.icns"
},
{
"name": "MKV",
"ext": [
"mkv"
],
"role": "Viewer",
"icon": "build/icons/mkv.icns"
},
{
"name": "MOV",
"ext": [
"mov"
],
"role": "Viewer",
"icon": "build/icons/mov.icns"
},
{
"name": "MP4",
"ext": [
"mp4"
],
"role": "Viewer",
"icon": "build/icons/mp4.icns"
},
{
"name": "RMVB",
"ext": [
"rmvb"
],
"role": "Viewer",
"icon": "build/icons/rmvb.icns"
},
{
"name": "WMV",
"ext": [
"wmv"
],
"role": "Viewer",
"icon": "build/icons/wmv.icns"
},
{
"name": "SRT",
"ext": [
"srt"
],
"role": "Viewer",
"icon": "build/icons/srt.icns"
},
{
"name": "ASS",
"ext": [
"ass"
],
"role": "Viewer",
"icon": "build/icons/ass.icns"
},
{
"name": "VTT",
"ext": [
"vtt"
],
"role": "Viewer",
"icon": "build/icons/vtt.icns"
},
{
"name": "SSA",
"ext": [
"ssa"
],
"role": "Viewer",
"icon": "build/icons/ssa.icns"
}
]
}
}
2 changes: 1 addition & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
]
},
"mac": {
"hardenedRuntime": false,
"hardenedRuntime": true,
"icon": "icons/icon.icns",
"target": [
"dmg"
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"node": "^12"
},
"scripts": {
"build": "node .electron-vue/build.js && electron-builder --p never",
"build:appx": "cross-env ENVIRONMENT_NAME=APPX node .electron-vue/build.js && electron-builder --p never -w appx",
"build": "node .electron-vue/build.js && electron-builder -p never",
"build:appx": "cross-env ENVIRONMENT_NAME=APPX node .electron-vue/build.js && electron-builder -p never -w appx",
"build:mas": "scripts/mas-build.sh mas",
"build:mas-dev": "scripts/mas-build.sh mas-dev",
"build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"start": "npm run stage",
"dev": "cross-env SAGI_API=sagi-api:8443 ACCOUNT_API=http://dev.account.splayer.work node .electron-vue/dev-runner.js",
"dev": "cross-env SAGI_API=sagi-api:8443 node .electron-vue/dev-runner.js",
"stage": "node .electron-vue/dev-runner.js",
"install-app-deps": "electron-builder install-app-deps",
"lint": "eslint --ext .ts,.js,.vue -f ./node_modules/eslint-friendly-formatter src test",
Expand All @@ -38,13 +38,8 @@
"@sentry/electron": "^0.17.1",
"@sentry/integrations": "^5.1.2",
"@tensorflow/tfjs": "^1.2.2",
"@types/chardet": "^0.5.0",
"@types/franc": "^4.0.0",
"@types/fs-extra": "^7.0.0",
"@types/lodash": "^4.14.134",
"@types/lolex": "^3.1.1",
"abort-controller": "^3.0.0",
"ass-compiler": "github:YvonTre/ass-compiler",
"axios": "^0.19.0",
"chardet": "^0.7.0",
"configcat-js": "^1.1.19",
"electron-json-storage": "github:ipy/electron-json-storage",
Expand All @@ -63,6 +58,7 @@
"lolex": "^3.0.0",
"lottie-web": "^5.5.4",
"mkdirp": "^0.5.1",
"node-fetch": "^2.6.0",
"nzh": "^1.0.4",
"os-locale": "^3.0.1",
"p-queue": "^6.0.0",
Expand All @@ -77,7 +73,6 @@
"vue": "^2.6.10",
"vue-analytics": "^5.16.1",
"vue-async-computed": "^3.5.1",
"vue-axios": "^2.1.4",
"vue-devtools": "5.1.0",
"vue-electron": "^1.0.6",
"vue-electron-json-storage": "^1.0.1",
Expand Down Expand Up @@ -114,6 +109,11 @@
"@chiflix/electron": "5.0.11",
"@sentry/webpack-plugin": "^1.6.2",
"@types/chai": "^4.1.7",
"@types/chardet": "^0.5.0",
"@types/franc": "^4.0.0",
"@types/fs-extra": "^7.0.0",
"@types/lodash": "^4.14.134",
"@types/lolex": "^3.1.1",
"@types/mkdirp": "^0.5.2",
"@types/mocha": "^5.2.7",
"@types/node": "^12.7.4",
Expand Down
6 changes: 3 additions & 3 deletions scripts/mas-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Reinstall the electron mas version
ELECTRON_VERSION=`node -p -e "require('./package.json').devDependencies['@chiflix/electron']"`
ELECTRON_VERSION=${ELECTRON_VERSION/^/''}
force_no_cache='true' npm_config_platform=mas npm i @chiflix/electron@$ELECTRON_VERSION
force_no_cache='true' npm_config_platform=mas npm i @chiflix/electron@$ELECTRON_VERSION --save-exact

node .electron-vue/build.js

rev=`git rev-list --count HEAD`

electron-builder --p never -m $1 \
-c electron-builder.json \
electron-builder -p never -m $1 \
-c electron-builder-mas.json \
-c.mac.provisioningProfile="build/$1.provisionprofile" \
-c.mac.bundleVersion="$rev" \
-c.mac.category="public.app-category.entertainment"
4 changes: 2 additions & 2 deletions scripts/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ require('dotenv').config();
const { notarize } = require('electron-notarize');

exports.default = async function notarizing(context) {
if (process.env.NO_NOTARIZE) return;
if (!process.env.APPLEIDPASS) return;

const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin' && electronPlatformName !== 'mas') {
if (electronPlatformName !== 'darwin') { // dmg only
return;
}

Expand Down
14 changes: 6 additions & 8 deletions src/main/helpers/AudioGrabService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { EventEmitter } from 'events';
import { splayerx } from 'electron';
import path from 'path';
import fs from 'fs';
import axios from 'axios';
import { credentials, Metadata } from 'grpc';

import { TranslationClient } from 'sagi-api/translation/v1/translation_grpc_pb';
Expand All @@ -20,6 +19,7 @@ import {
StreamingTranslationRequestConfig,
} from 'sagi-api/translation/v1/translation_pb';
import { IAudioStream } from '@/plugins/mediaTasks/mediaInfoQueue';
import { getIP } from '../../shared/utils';

type JobData = {
videoSrc: string,
Expand Down Expand Up @@ -199,14 +199,12 @@ export default class AudioGrabService extends EventEmitter {
metadata.set('uuid', uuid);
metadata.set('agent', agent);
if (token) {
metadata.set('Authorization', token);
metadata.set('token', token);
}
console.log(metadata); // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/no-explicit-any
axios.get('https://ip.xindong.com/myip', { responseType: 'text' }).then((response: any) => {
metadata.set('clientip', response.data);
cb(null, metadata);
}, () => {
getIP().then((ip) => {
metadata.set('clientip', ip);
}).finally(() => {
console.log(metadata); // eslint-disable-line
cb(null, metadata);
});
};
Expand Down
Loading

0 comments on commit b1d0b30

Please sign in to comment.