@camera.ui/go2rtc 0.0.76 → 1.9.14-cui.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +22 -0
- package/README.md +11 -86
- package/index.d.ts +10 -0
- package/index.js +38 -0
- package/package.json +43 -49
- package/CHANGELOG.md +0 -8
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -14
- package/dist/index.js.map +0 -1
- package/dist/install.d.ts +0 -2
- package/dist/install.js +0 -110
- package/dist/install.js.map +0 -1
- package/dist/utils.d.ts +0 -3
- package/dist/utils.js +0 -53
- package/dist/utils.js.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2026 seydx <hi@seydx.dev>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,100 +1,25 @@
|
|
|
1
1
|
# @camera.ui/go2rtc
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@camera.ui/go2rtc)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Prebuilt [go2rtc](https://github.com/seydx/go2rtc) binary for the camera.ui ecosystem.
|
|
6
6
|
|
|
7
|
-
```
|
|
8
|
-
npm install @camera.ui/go2rtc
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
The Go2RTC binary will be automatically downloaded during installation.
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
7
|
+
```js
|
|
16
8
|
import { go2rtcPath, isGo2rtcAvailable } from '@camera.ui/go2rtc';
|
|
17
9
|
|
|
18
|
-
// Get Go2RTC binary path
|
|
19
|
-
const go2rtc = go2rtcPath();
|
|
20
|
-
console.log('Go2RTC path:', go2rtc);
|
|
21
|
-
|
|
22
|
-
// Check if Go2RTC is available
|
|
23
10
|
if (isGo2rtcAvailable()) {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Platform Support
|
|
29
|
-
|
|
30
|
-
**Supported Platforms:**
|
|
31
|
-
- **Linux** - x64, ARM64, ARMv6, ARMv7, x86, MIPSEL
|
|
32
|
-
- **Windows** - x64, ARM64, x86
|
|
33
|
-
- **macOS** - Intel (x64), Apple Silicon (ARM64)
|
|
34
|
-
- **FreeBSD** - x64, ARM64
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
### Basic Usage
|
|
39
|
-
```typescript
|
|
40
|
-
import { go2rtcPath } from '@camera.ui/go2rtc';
|
|
41
|
-
import { spawn } from 'child_process';
|
|
42
|
-
|
|
43
|
-
const go2rtc = spawn(go2rtcPath(), ['-config', 'go2rtc.yaml']);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Check Availability
|
|
47
|
-
```typescript
|
|
48
|
-
import { isGo2rtcAvailable, go2rtcPath } from '@camera.ui/go2rtc';
|
|
49
|
-
|
|
50
|
-
if (!isGo2rtcAvailable()) {
|
|
51
|
-
console.error('Go2RTC not found');
|
|
52
|
-
process.exit(1);
|
|
11
|
+
spawn(go2rtcPath(), ['-config', '...']);
|
|
53
12
|
}
|
|
54
|
-
|
|
55
|
-
console.log('Using Go2RTC at:', go2rtcPath());
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Cross-Platform Installation
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# Force specific platform/architecture
|
|
62
|
-
npm_config_os=linux npm_config_cpu=arm64 npm install
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Examples:**
|
|
66
|
-
```bash
|
|
67
|
-
npm_config_os=linux npm_config_cpu=x64 # Linux x64
|
|
68
|
-
npm_config_os=linux npm_config_cpu=arm64 # Linux ARM64
|
|
69
|
-
npm_config_os=win32 npm_config_cpu=x64 # Windows x64
|
|
70
|
-
npm_config_os=darwin npm_config_cpu=arm64 # Apple Silicon
|
|
71
13
|
```
|
|
72
14
|
|
|
73
|
-
##
|
|
74
|
-
|
|
75
|
-
The installer automatically:
|
|
76
|
-
1. Detects your platform and architecture
|
|
77
|
-
2. Downloads the appropriate binary from camera.ui Go2RTC releases
|
|
78
|
-
3. Extracts and makes executable (Unix systems)
|
|
79
|
-
4. Cleans up temporary files
|
|
80
|
-
|
|
81
|
-
### Installation Log
|
|
82
|
-
```
|
|
83
|
-
Detected platform: linux / arm64
|
|
84
|
-
Downloading Go2Rtc v1.9.9-cui.18...
|
|
85
|
-
Extracting binary...
|
|
86
|
-
Making executable...
|
|
87
|
-
Done!
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Contributing
|
|
91
|
-
|
|
92
|
-
Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.
|
|
93
|
-
|
|
94
|
-
## License
|
|
15
|
+
## Supported platforms
|
|
95
16
|
|
|
96
|
-
|
|
17
|
+
| os | x64 | arm64 |
|
|
18
|
+
| ------- | --- | ----- |
|
|
19
|
+
| darwin | ✓ | ✓ |
|
|
20
|
+
| linux | ✓ | ✓ |
|
|
21
|
+
| win32 | ✓ | ✓ |
|
|
97
22
|
|
|
98
23
|
---
|
|
99
24
|
|
|
100
|
-
|
|
25
|
+
_Part of the camera.ui ecosystem._
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute path to the go2rtc binary for the current platform.
|
|
3
|
+
*
|
|
4
|
+
* @throws if no prebuilt binary is available for the current platform/arch
|
|
5
|
+
* (i.e. the matching optional dependency was not installed).
|
|
6
|
+
*/
|
|
7
|
+
export function go2rtcPath(): string;
|
|
8
|
+
|
|
9
|
+
/** Whether the go2rtc binary for the current platform is installed and present on disk. */
|
|
10
|
+
export function isGo2rtcAvailable(): boolean;
|
package/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { dirname, join } = require('node:path');
|
|
4
|
+
const { existsSync } = require('node:fs');
|
|
5
|
+
|
|
6
|
+
const pkg = require('./package.json');
|
|
7
|
+
|
|
8
|
+
const binaryName = pkg.camerauiBinary.binaryName;
|
|
9
|
+
const platformPackage = `${pkg.name}-${process.platform}-${process.arch}`;
|
|
10
|
+
const binaryFile = process.platform === 'win32' ? `${binaryName}.exe` : binaryName;
|
|
11
|
+
|
|
12
|
+
function resolveBinaryPath() {
|
|
13
|
+
try {
|
|
14
|
+
const manifest = require.resolve(`${platformPackage}/package.json`);
|
|
15
|
+
return join(dirname(manifest), binaryFile);
|
|
16
|
+
} catch {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`[${pkg.name}] No prebuilt binary available for ${process.platform}-${process.arch}. ` +
|
|
19
|
+
`Expected the optional dependency "${platformPackage}" to be installed.`,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Absolute path to the go2rtc binary for the current platform. Throws if unsupported. */
|
|
25
|
+
function go2rtcPath() {
|
|
26
|
+
return resolveBinaryPath();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Whether the go2rtc binary for the current platform is installed and present on disk. */
|
|
30
|
+
function isGo2rtcAvailable() {
|
|
31
|
+
try {
|
|
32
|
+
return existsSync(resolveBinaryPath());
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = { go2rtcPath, isGo2rtcAvailable };
|
package/package.json
CHANGED
|
@@ -1,67 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/go2rtc",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "camera.ui go2rtc
|
|
5
|
-
"author": "seydx (https://github.com/seydx
|
|
6
|
-
"type": "
|
|
3
|
+
"version": "1.9.14-cui.9",
|
|
4
|
+
"description": "camera.ui go2rtc binary",
|
|
5
|
+
"author": "seydx (https://github.com/seydx)",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"types": "index.d.ts",
|
|
7
9
|
"exports": {
|
|
8
10
|
".": {
|
|
9
|
-
"types": "./
|
|
10
|
-
"
|
|
11
|
-
"default": "./dist/index.js"
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"default": "./index.js"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"@typescript-eslint/parser": "^8.45.0",
|
|
32
|
-
"eslint": "^9.36.0",
|
|
33
|
-
"globals": "^16.4.0",
|
|
34
|
-
"prettier": "^3.6.2",
|
|
35
|
-
"typescript-eslint": "^8.45.0",
|
|
36
|
-
"@types/fs-extra": "^11.0.4",
|
|
37
|
-
"@types/node": "^24.6.1",
|
|
38
|
-
"@types/unzipper": "^0.10.11",
|
|
39
|
-
"concurrently": "^9.2.1",
|
|
40
|
-
"rimraf": "^6.0.1",
|
|
41
|
-
"typescript": "^5.9.3",
|
|
42
|
-
"updates": "^16.7.4"
|
|
43
|
-
},
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": "https://github.com/seydx/camera.ui/issues"
|
|
15
|
+
"files": [
|
|
16
|
+
"index.js",
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"camerauiBinary": {
|
|
21
|
+
"binaryName": "go2rtc",
|
|
22
|
+
"releaseRepo": "seydx/go2rtc",
|
|
23
|
+
"version": "v1.9.14-cui.9",
|
|
24
|
+
"targets": {
|
|
25
|
+
"darwin-x64": "go2rtc-darwin-x64-{ver}.zip",
|
|
26
|
+
"darwin-arm64": "go2rtc-darwin-arm64-{ver}.zip",
|
|
27
|
+
"linux-x64": "go2rtc-linux-x64-{ver}.zip",
|
|
28
|
+
"linux-arm64": "go2rtc-linux-arm64-{ver}.zip",
|
|
29
|
+
"win32-x64": "go2rtc-windows-x64-{ver}.zip",
|
|
30
|
+
"win32-arm64": "go2rtc-windows-arm64-{ver}.zip"
|
|
31
|
+
}
|
|
46
32
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
33
|
+
"optionalDependencies": {
|
|
34
|
+
"@camera.ui/go2rtc-darwin-arm64": "1.9.14-cui.9",
|
|
35
|
+
"@camera.ui/go2rtc-darwin-x64": "1.9.14-cui.9",
|
|
36
|
+
"@camera.ui/go2rtc-linux-arm64": "1.9.14-cui.9",
|
|
37
|
+
"@camera.ui/go2rtc-linux-x64": "1.9.14-cui.9",
|
|
38
|
+
"@camera.ui/go2rtc-win32-arm64": "1.9.14-cui.9",
|
|
39
|
+
"@camera.ui/go2rtc-win32-x64": "1.9.14-cui.9"
|
|
49
40
|
},
|
|
50
|
-
"homepage": "https://github.com/seydx/camera.ui#readme",
|
|
51
41
|
"keywords": [
|
|
52
42
|
"camera.ui",
|
|
53
43
|
"go2rtc",
|
|
54
|
-
"camera",
|
|
55
|
-
"streaming",
|
|
56
|
-
"video",
|
|
57
|
-
"audio",
|
|
58
|
-
"rtc",
|
|
59
44
|
"webrtc",
|
|
60
|
-
"
|
|
45
|
+
"rtc",
|
|
46
|
+
"streaming"
|
|
61
47
|
],
|
|
62
48
|
"license": "MIT",
|
|
63
49
|
"repository": {
|
|
64
50
|
"type": "git",
|
|
65
|
-
"url": "git+https://github.com/
|
|
51
|
+
"url": "git+https://github.com/cameraui/binaries.git",
|
|
52
|
+
"directory": "packages/go2rtc"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/cameraui/binaries/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/cameraui/binaries#readme",
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=22.0.0"
|
|
66
60
|
}
|
|
67
61
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
All notable changes to this project will be documented in this file.
|
|
2
|
-
|
|
3
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
4
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
-
|
|
6
|
-
## [1.0.0] - 2019-08-06
|
|
7
|
-
|
|
8
|
-
- Initial Release
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { getPlatform } from './utils.js';
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = dirname(__filename);
|
|
7
|
-
const go2rtcBinaryPath = resolve(__dirname, '../binary');
|
|
8
|
-
const go2rtcFile = 'go2rtc' + (getPlatform() === 'win32' ? '.exe' : '');
|
|
9
|
-
const go2rtcExtractedFilePath = resolve(go2rtcBinaryPath, go2rtcFile);
|
|
10
|
-
export const go2rtcPath = () => go2rtcExtractedFilePath;
|
|
11
|
-
export const isGo2rtcAvailable = () => {
|
|
12
|
-
return fs.existsSync(go2rtcExtractedFilePath);
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACzD,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxE,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAW,EAAE,CAAC,uBAAuB,CAAC;AAEhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAY,EAAE;IAC7C,OAAO,EAAE,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
package/dist/install.d.ts
DELETED
package/dist/install.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
import { dirname, extname, resolve } from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { pipeline } from 'stream/promises';
|
|
7
|
-
import { Open } from 'unzipper';
|
|
8
|
-
import { go2rtcPath } from './index.js';
|
|
9
|
-
import { getArchitecture, getPlatform } from './utils.js';
|
|
10
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
-
const __dirname = dirname(__filename);
|
|
12
|
-
const GO2RTC_VERSION = 'v1.9.9-cui.36';
|
|
13
|
-
const binaries = {
|
|
14
|
-
darwin: {
|
|
15
|
-
x64: `go2rtc-darwin-x64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
16
|
-
arm64: `go2rtc-darwin-arm64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
17
|
-
},
|
|
18
|
-
linux: {
|
|
19
|
-
x64: `go2rtc-linux-x64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
20
|
-
arm6: `go2rtc-linux-armv6-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
21
|
-
arm7: `go2rtc-linux-armv7-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
22
|
-
arm64: `go2rtc-linux-arm64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
23
|
-
ia32: `go2rtc-linux-x86-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
24
|
-
mipsel: `go2rtc-linux-mipsel-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
25
|
-
},
|
|
26
|
-
win32: {
|
|
27
|
-
x64: `go2rtc-windows-x64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
28
|
-
arm64: `go2rtc-windows-arm64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
29
|
-
ia32: `go2rtc-windows-x86-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
30
|
-
},
|
|
31
|
-
freebsd: {
|
|
32
|
-
arm64: `go2rtc-freebsd-arm64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
33
|
-
x64: `go2rtc-freebsd-x64-${GO2RTC_VERSION.replace('v', '')}.zip`,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const arch = getArchitecture();
|
|
37
|
-
const sysPlatform = getPlatform();
|
|
38
|
-
const filename = binaries[sysPlatform]?.[arch];
|
|
39
|
-
const releasesUrl = 'https://api.github.com/repos/seydx/go2rtc/releases';
|
|
40
|
-
console.log(`Detected platform: ${sysPlatform} / ${arch}`);
|
|
41
|
-
const go2rtcBinaryPath = resolve(__dirname, '../binary');
|
|
42
|
-
fs.ensureDirSync(go2rtcBinaryPath);
|
|
43
|
-
const go2rtcFilePath = resolve(go2rtcBinaryPath, filename);
|
|
44
|
-
const go2rtcExtractedFilePath = go2rtcPath();
|
|
45
|
-
const isZipUrl = (url) => {
|
|
46
|
-
const pathArray = new URL(url).pathname.split('/');
|
|
47
|
-
const fileName = pathArray[pathArray.length - 1];
|
|
48
|
-
return fileName !== undefined && extname(fileName) === '.zip';
|
|
49
|
-
};
|
|
50
|
-
const downloadFile = async (url) => {
|
|
51
|
-
console.log(`Downloading Go2Rtc ${GO2RTC_VERSION} to ${go2rtcFilePath}...`);
|
|
52
|
-
const { data } = await axios.get(url, {
|
|
53
|
-
onDownloadProgress: (progressEvent) => {
|
|
54
|
-
if (process.env.CI || !progressEvent.total) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const percent = Math.round((progressEvent.loaded / progressEvent.total) * 100) + '%';
|
|
58
|
-
process.stdout.write('\r' + percent);
|
|
59
|
-
if (progressEvent.loaded === progressEvent.total) {
|
|
60
|
-
process.stdout.write('\r');
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
timeout: 30 * 1000, // 30s
|
|
64
|
-
maxRedirects: 3,
|
|
65
|
-
responseType: 'stream',
|
|
66
|
-
});
|
|
67
|
-
await fs.ensureDir(go2rtcBinaryPath);
|
|
68
|
-
const streams = [data, fs.createWriteStream(go2rtcFilePath)];
|
|
69
|
-
await pipeline(streams);
|
|
70
|
-
if (isZipUrl(url)) {
|
|
71
|
-
console.log(`Extracting ${go2rtcFilePath} to ${go2rtcExtractedFilePath}...`);
|
|
72
|
-
const directory = await Open.file(go2rtcFilePath);
|
|
73
|
-
await new Promise((resolve, reject) => {
|
|
74
|
-
directory.files[0].stream().pipe(fs.createWriteStream(go2rtcExtractedFilePath)).on('error', reject).on('finish', resolve);
|
|
75
|
-
});
|
|
76
|
-
console.log(`Removing ${go2rtcFilePath}...`);
|
|
77
|
-
await fs.remove(go2rtcFilePath);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
console.log(`Renaming ${go2rtcFilePath} to ${go2rtcExtractedFilePath}...`);
|
|
81
|
-
await fs.rename(go2rtcFilePath, go2rtcExtractedFilePath);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const getReleaseAssets = async (version) => {
|
|
85
|
-
const response = await axios.get(`${releasesUrl}/tags/${version}`);
|
|
86
|
-
const assets = response.data.assets.map((asset) => asset.browser_download_url);
|
|
87
|
-
const files = assets.map((asset) => asset.split(`${version}/`)[1]);
|
|
88
|
-
return {
|
|
89
|
-
assets,
|
|
90
|
-
files,
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
const downloadGo2Rtc = async () => {
|
|
94
|
-
const release = await getReleaseAssets(GO2RTC_VERSION);
|
|
95
|
-
if (!filename || !release.assets.find((r) => r.endsWith(filename))) {
|
|
96
|
-
throw new Error(`No go2rtc binary found for architecture (${sysPlatform} / ${arch})`);
|
|
97
|
-
}
|
|
98
|
-
const downloadUrl = release.assets.find((r) => r.endsWith(filename));
|
|
99
|
-
await downloadFile(downloadUrl);
|
|
100
|
-
if (sysPlatform === 'linux' || sysPlatform === 'darwin') {
|
|
101
|
-
console.log(`Making ${go2rtcExtractedFilePath} executable...`);
|
|
102
|
-
fs.chmodSync(go2rtcExtractedFilePath, 0o755);
|
|
103
|
-
}
|
|
104
|
-
console.log('Done!');
|
|
105
|
-
};
|
|
106
|
-
downloadGo2Rtc().catch((error) => {
|
|
107
|
-
console.error('Error downloading Go2Rtc:', error);
|
|
108
|
-
process.exit(1);
|
|
109
|
-
});
|
|
110
|
-
//# sourceMappingURL=install.js.map
|
package/dist/install.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS1D,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,cAAc,GAAG,eAAe,CAAC;AAEvC,MAAM,QAAQ,GAAoB;IAChC,MAAM,EAAE;QACN,GAAG,EAAE,qBAAqB,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE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U,uBAAuB,gBAAgB,CAAC,CAAC;QAC/D,EAAE,CAAC,SAAS,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC/B,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;IAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/utils.d.ts
DELETED
package/dist/utils.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { arch, platform } from 'node:os';
|
|
3
|
-
export function getPlatform() {
|
|
4
|
-
if (process.env.npm_config_os) {
|
|
5
|
-
if (!process.env.npm_config_cpu) {
|
|
6
|
-
throw new Error('npm_config_cpu is required when npm_config_os is set');
|
|
7
|
-
}
|
|
8
|
-
return process.env.npm_config_os;
|
|
9
|
-
}
|
|
10
|
-
return platform();
|
|
11
|
-
}
|
|
12
|
-
export function getArchitecture() {
|
|
13
|
-
if (process.env.npm_config_cpu) {
|
|
14
|
-
if (!process.env.npm_config_os) {
|
|
15
|
-
throw new Error('npm_config_os is required when npm_config_cpu is set');
|
|
16
|
-
}
|
|
17
|
-
return process.env.npm_config_cpu;
|
|
18
|
-
}
|
|
19
|
-
const sysPlatform = getPlatform();
|
|
20
|
-
let sysArch = arch();
|
|
21
|
-
if (sysPlatform === 'win32') {
|
|
22
|
-
try {
|
|
23
|
-
const output = execSync('wmic cpu get architecture', { encoding: 'utf8' });
|
|
24
|
-
const architecture = output.trim().split('\n')[1].trim();
|
|
25
|
-
if (architecture === '5') {
|
|
26
|
-
sysArch = 'arm6';
|
|
27
|
-
}
|
|
28
|
-
else if (architecture === '7') {
|
|
29
|
-
sysArch = 'arm7';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
//
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else if (sysPlatform === 'linux') {
|
|
37
|
-
try {
|
|
38
|
-
const output = execSync('cat /proc/cpuinfo | grep "model name"', { encoding: 'utf8' });
|
|
39
|
-
const modelName = output.trim().split(':')[1].trim();
|
|
40
|
-
if (modelName.includes('ARMv6')) {
|
|
41
|
-
sysArch = 'arm6';
|
|
42
|
-
}
|
|
43
|
-
else if (modelName.includes('ARMv7')) {
|
|
44
|
-
sysArch = 'arm7';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
//
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return sysArch;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIzC,MAAM,UAAU,WAAW;IACzB,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,aAAgC,CAAC;IACtD,CAAC;IAED,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAA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