mirror of https://github.com/Kylart/KawAnime.git
hanged postinstall script for macos
This commit is contained in:
parent
52bb9a0dc8
commit
1b954788e5
|
@ -12,7 +12,7 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-11
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -27,7 +27,11 @@ jobs:
|
|||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- run: brew install boost mpv
|
||||
|
||||
- run: npm install
|
||||
- run: npm run collect:dylibs
|
||||
- run: npm run dist:mac
|
||||
- run: npm test
|
||||
- name: Download a Build Artifact
|
||||
|
|
|
@ -44,4 +44,5 @@ public/*.node
|
|||
public/mpv/*
|
||||
# Temporary
|
||||
!public/mpv/*.dll
|
||||
!public/mpv/.gitkeep
|
||||
!public/mpv/.gitkeep
|
||||
!public/mpv/macos
|
Binary file not shown.
|
@ -5,17 +5,18 @@
|
|||
* We need to place it to public/mpv/mpvjs.node
|
||||
*/
|
||||
|
||||
const { createWriteStream, renameSync, unlinkSync } = require('fs')
|
||||
const { createWriteStream, renameSync, unlinkSync, copyFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
const https = require('https')
|
||||
const { URL } = require('url')
|
||||
|
||||
const targz = require('targz')
|
||||
const rimraf = require('rimraf')
|
||||
const { platform } = require('os')
|
||||
|
||||
const LATEST_RELEASE_VERSION = 'v0.3.0'
|
||||
|
||||
const BASE_URL = `https://github.com/Kagami/mpv.js/releases/download`
|
||||
const BASE_URL = 'https://github.com/Kagami/mpv.js/releases/download'
|
||||
|
||||
const BINARY_NAME = 'mpvjs.node'
|
||||
|
||||
|
@ -75,17 +76,24 @@ function saveFile (response) {
|
|||
response.on('end', decompress)
|
||||
}
|
||||
|
||||
https.get(url, function (response) {
|
||||
// Following redirect
|
||||
if (response.statusCode > 300 && response.statusCode < 400 && response.headers.location) {
|
||||
const { hostname } = new URL(response.headers.location)
|
||||
if (platform === 'darwin') {
|
||||
copyFileSync(
|
||||
join(TARGET_DIR, 'macos', BINARY_NAME),
|
||||
join(TARGET_DIR, BINARY_NAME)
|
||||
)
|
||||
} else {
|
||||
https.get(url, function (response) {
|
||||
// Following redirect
|
||||
if (response.statusCode > 300 && response.statusCode < 400 && response.headers.location) {
|
||||
const { hostname } = new URL(response.headers.location)
|
||||
|
||||
if (hostname) {
|
||||
https.get(response.headers.location, saveFile)
|
||||
if (hostname) {
|
||||
https.get(response.headers.location, saveFile)
|
||||
} else {
|
||||
throw new Error('Error while redirecting.')
|
||||
}
|
||||
} else {
|
||||
throw new Error('Error while redirecting.')
|
||||
saveFile(response)
|
||||
}
|
||||
} else {
|
||||
saveFile(response)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue