@camera.ui/go2rtc 0.0.8 → 0.0.10
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/binary/go2rtc +0 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/install.js +1 -1
- package/dist/install.js.map +1 -1
- package/package.json +16 -7
- package/scripts/install.js +126 -0
package/binary/go2rtc
ADDED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const platform = os_1.default.platform();
|
|
11
|
-
const go2rtcBinaryPath = path_1.default.resolve(__dirname, 'binary');
|
|
11
|
+
const go2rtcBinaryPath = path_1.default.resolve(__dirname, '../binary');
|
|
12
12
|
const go2rtcFile = 'go2rtc' + (platform === 'win32' ? '.exe' : '');
|
|
13
13
|
const go2rtcExtractedFilePath = path_1.default.resolve(go2rtcBinaryPath, go2rtcFile);
|
|
14
14
|
const go2rtcPath = () => go2rtcExtractedFilePath;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AAExB,MAAM,QAAQ,GAAG,YAAE,CAAC,QAAQ,EAAE,CAAC;AAE/B,MAAM,gBAAgB,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AAExB,MAAM,QAAQ,GAAG,YAAE,CAAC,QAAQ,EAAE,CAAC;AAE/B,MAAM,gBAAgB,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC9D,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACnE,MAAM,uBAAuB,GAAG,cAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEpE,MAAM,UAAU,GAAG,GAAW,EAAE,CAAC,uBAAuB,CAAC;AAAnD,QAAA,UAAU,cAAyC;AAEzD,MAAM,iBAAiB,GAAG,GAAY,EAAE;IAC7C,OAAO,kBAAE,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B"}
|
package/dist/install.js
CHANGED
|
@@ -36,7 +36,7 @@ const platform = os_1.default.platform();
|
|
|
36
36
|
const filename = binaries[platform]?.[arch];
|
|
37
37
|
const releasesUrl = 'https://api.github.com/repos/AlexxIT/go2rtc/releases';
|
|
38
38
|
console.log(`Detected platform: ${platform} / ${arch}`);
|
|
39
|
-
const go2rtcBinaryPath = path_1.default.resolve(__dirname, 'binary');
|
|
39
|
+
const go2rtcBinaryPath = path_1.default.resolve(__dirname, '../binary');
|
|
40
40
|
const go2rtcFilePath = path_1.default.resolve(go2rtcBinaryPath, filename);
|
|
41
41
|
const go2rtcExtractedFilePath = (0, _1.go2rtcPath)();
|
|
42
42
|
const isZipUrl = (url) => {
|
package/dist/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":";;;;;;AAEA,kDAAkD;AAClD,wDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AACxB,8CAA2C;AAC3C,wDAAgC;AAEhC,wBAA+B;AAQ/B,MAAM,QAAQ,GAAoB;IAChC,MAAM,EAAE;QACN,GAAG,EAAE,sBAAsB;QAC3B,KAAK,EAAE,sBAAsB;KAC9B;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AAC,CAAC;IACrF,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAE,CAAC;IAEtE,MAAM,YAAY,CAAC,WAAW,CAAC,CAAC;IAEhC,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,UAAU,uBAAuB,gBAAgB,CAAC,CAAC;QAC/D,kBAAE,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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/go2rtc",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "camera.ui go2rtc",
|
|
3
|
+
"version": "0.0.10",
|
|
4
|
+
"description": "camera.ui go2rtc package",
|
|
5
5
|
"author": "seydx (https://github.com/seydx/camera.ui)",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -14,20 +14,21 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "rimraf dist && tsc",
|
|
16
16
|
"format": "prettier --write 'src/' --ignore-unknown --no-error-on-unmatched-pattern",
|
|
17
|
-
"
|
|
17
|
+
"postinstall": "node scripts/install.js",
|
|
18
18
|
"lint": "eslint --fix --ext .js,.ts .",
|
|
19
19
|
"update": "updates --update ./",
|
|
20
20
|
"install-updates": "npm i --save",
|
|
21
21
|
"prepublishOnly": "npm i --package-lock-only && npm run lint && npm run format && npm run build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"axios": "^1.6.
|
|
24
|
+
"axios": "^1.6.8",
|
|
25
25
|
"fs-extra": "11.2.0",
|
|
26
26
|
"unzipper": "^0.10.14"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@rushstack/eslint-patch": "^1.7.2",
|
|
30
|
-
"@types/
|
|
30
|
+
"@types/fs-extra": "^11.0.4",
|
|
31
|
+
"@types/node": "^20.11.28",
|
|
31
32
|
"@types/ws": "^8.5.10",
|
|
32
33
|
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
33
34
|
"@typescript-eslint/parser": "^7.2.0",
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
"prettier": "^3.2.5",
|
|
39
40
|
"rimraf": "^5.0.5",
|
|
40
41
|
"typescript": "^5.4.2",
|
|
41
|
-
"updates": "^
|
|
42
|
+
"updates": "^16.0.0"
|
|
42
43
|
},
|
|
43
44
|
"bugs": {
|
|
44
45
|
"url": "https://github.com/seydx/camera.ui/issues"
|
|
@@ -48,7 +49,15 @@
|
|
|
48
49
|
},
|
|
49
50
|
"homepage": "https://github.com/seydx/camera.ui#readme",
|
|
50
51
|
"keywords": [
|
|
51
|
-
"camera.ui"
|
|
52
|
+
"camera.ui",
|
|
53
|
+
"go2rtc",
|
|
54
|
+
"camera",
|
|
55
|
+
"streaming",
|
|
56
|
+
"video",
|
|
57
|
+
"audio",
|
|
58
|
+
"rtc",
|
|
59
|
+
"webrtc",
|
|
60
|
+
"mse"
|
|
52
61
|
],
|
|
53
62
|
"license": "MIT",
|
|
54
63
|
"repository": {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const axios = require('axios');
|
|
4
|
+
const fs = require('fs-extra');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { pipeline } = require('stream/promises');
|
|
8
|
+
const unzipper = require('unzipper');
|
|
9
|
+
|
|
10
|
+
const binaries = {
|
|
11
|
+
darwin: {
|
|
12
|
+
x64: 'go2rtc_mac_amd64.zip',
|
|
13
|
+
arm64: 'go2rtc_mac_arm64.zip',
|
|
14
|
+
},
|
|
15
|
+
linux: {
|
|
16
|
+
x64: 'go2rtc_linux_amd64',
|
|
17
|
+
arm: 'go2rtc_linux_arm',
|
|
18
|
+
armv6: 'go2rtc_linux_armv6',
|
|
19
|
+
arm64: 'go2rtc_linux_arm64',
|
|
20
|
+
i386: 'go2rtc_linux_i386',
|
|
21
|
+
mipsel: 'go2rtc_linux_mipsel',
|
|
22
|
+
},
|
|
23
|
+
win32: {
|
|
24
|
+
x64: 'go2rtc_win64.zip',
|
|
25
|
+
arm64: 'go2rtc_win_arm64.zip',
|
|
26
|
+
i386: 'go2rtc_win32.zip',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const GO2RTC_VERSION = 'v1.8.5';
|
|
31
|
+
const arch = os.arch();
|
|
32
|
+
const platform = os.platform();
|
|
33
|
+
const filename = binaries[platform]?.[arch];
|
|
34
|
+
const releasesUrl = 'https://api.github.com/repos/AlexxIT/go2rtc/releases';
|
|
35
|
+
|
|
36
|
+
console.log(`Detected platform: ${platform} / ${arch}`);
|
|
37
|
+
|
|
38
|
+
const go2rtcBinaryPath = path.resolve(__dirname, '../binary');
|
|
39
|
+
const go2rtcFilePath = path.resolve(go2rtcBinaryPath, filename || '');
|
|
40
|
+
const go2rtcExtractedFileName = 'go2rtc' + (platform === 'win32' ? '.exe' : '');
|
|
41
|
+
const go2rtcExtractedFilePath = path.resolve(go2rtcBinaryPath, go2rtcExtractedFileName);
|
|
42
|
+
|
|
43
|
+
const isZipUrl = (url) => {
|
|
44
|
+
const pathArray = new URL(url).pathname.split('/');
|
|
45
|
+
const fileName = pathArray[pathArray.length - 1];
|
|
46
|
+
|
|
47
|
+
return fileName !== undefined && path.extname(fileName) === '.zip';
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const downloadFile = async (url) => {
|
|
51
|
+
console.log(`Downloading Go2Rtc ${GO2RTC_VERSION} to ${go2rtcFilePath}...`);
|
|
52
|
+
|
|
53
|
+
const { data } = await axios.get(url, {
|
|
54
|
+
onDownloadProgress: (progressEvent) => {
|
|
55
|
+
if (process.env.CI || !progressEvent.total) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const percent = Math.round((progressEvent.loaded / progressEvent.total) * 100) + '%';
|
|
60
|
+
process.stdout.write('\r' + percent);
|
|
61
|
+
|
|
62
|
+
if (progressEvent.loaded === progressEvent.total) {
|
|
63
|
+
process.stdout.write('\r');
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
timeout: 30 * 1000, // 30s
|
|
67
|
+
maxRedirects: 3,
|
|
68
|
+
responseType: 'stream',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
await fs.ensureDir(go2rtcBinaryPath);
|
|
72
|
+
|
|
73
|
+
const streams = [data, fs.createWriteStream(go2rtcFilePath)];
|
|
74
|
+
|
|
75
|
+
await pipeline(streams);
|
|
76
|
+
|
|
77
|
+
if (isZipUrl(url)) {
|
|
78
|
+
console.log(`Extracting ${go2rtcFilePath} to ${go2rtcExtractedFilePath}...`);
|
|
79
|
+
|
|
80
|
+
const directory = await unzipper.Open.file(go2rtcFilePath);
|
|
81
|
+
|
|
82
|
+
await new Promise((resolve, reject) => {
|
|
83
|
+
directory.files[0].stream().pipe(fs.createWriteStream(go2rtcExtractedFilePath)).on('error', reject).on('finish', resolve);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
console.log(`Removing ${go2rtcFilePath}...`);
|
|
87
|
+
|
|
88
|
+
await fs.remove(go2rtcFilePath);
|
|
89
|
+
} else {
|
|
90
|
+
console.log(`Renaming ${go2rtcFilePath} to ${go2rtcExtractedFilePath}...`);
|
|
91
|
+
await fs.rename(go2rtcFilePath, go2rtcExtractedFilePath);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const getReleaseAssets = async (version) => {
|
|
96
|
+
const response = await axios.get(`${releasesUrl}/tags/${version}`);
|
|
97
|
+
|
|
98
|
+
const assets = response.data.assets.map((asset) => asset.browser_download_url);
|
|
99
|
+
const files = assets.map((asset) => asset.split(`${version}/`)[1]);
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
assets,
|
|
103
|
+
files,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const downloadGo2Rtc = async () => {
|
|
108
|
+
const release = await getReleaseAssets(GO2RTC_VERSION);
|
|
109
|
+
|
|
110
|
+
if (!filename || !release.assets.find((r) => r.endsWith(filename))) {
|
|
111
|
+
throw new Error(`No go2rtc binary found for architecture (${platform} / ${arch})`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const downloadUrl = release.assets.find((r) => r.endsWith(filename));
|
|
115
|
+
|
|
116
|
+
await downloadFile(downloadUrl);
|
|
117
|
+
|
|
118
|
+
if (platform === 'linux' || platform === 'darwin') {
|
|
119
|
+
console.log(`Making ${go2rtcExtractedFilePath} executable...`);
|
|
120
|
+
fs.chmodSync(go2rtcExtractedFilePath, 0o755);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
console.log('Done!');
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
downloadGo2Rtc();
|