mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-10 10:06:15 -08:00
chore(lint): satisfy CI lint and CodeQL in DASH support files
- replace shell-built tar/npm commands with execFileSync arg arrays in the fixture generator (CodeQL: uncontrolled shell command) - give jest stub methods explicit bodies (no-empty-function) - compact the diagnostic label switches in WebPlayerViewComponent to stay under the max-lines budget Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95bd7f7fe0
commit
c19c639ef2
3 files changed
+26
-29
No files matched your search
@@ -26,7 +26,7 @@
|
||||
* Usage: node apps/web-e2e/src/fixtures/dash/generate-fixture.mjs
|
||||
*/
|
||||
|
||||
import { execFileSync, execSync } from 'node:child_process';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { chmodSync, mkdtempSync, readdirSync, rmSync } from 'node:fs';
|
||||
import { createRequire } from 'node:module';
|
||||
import { tmpdir } from 'node:os';
|
||||
@@ -110,14 +110,17 @@ function resolvePackager() {
|
||||
function fetchPackagerViaNpmPack() {
|
||||
const workDir = mkdtempSync(join(tmpdir(), 'shaka-packager-'));
|
||||
console.log(`Fetching shaka-packager via npm pack into ${workDir} ...`);
|
||||
execSync('npm pack shaka-packager --silent', {
|
||||
execFileSync('npm', ['pack', 'shaka-packager', '--silent'], {
|
||||
cwd: workDir,
|
||||
stdio: ['ignore', 'ignore', 'inherit'],
|
||||
});
|
||||
const tarball = readdirSync(workDir).find((name) =>
|
||||
name.endsWith('.tgz')
|
||||
);
|
||||
execSync(`tar -xzf ${JSON.stringify(tarball)}`, { cwd: workDir });
|
||||
if (!tarball) {
|
||||
throw new Error('npm pack did not produce a shaka-packager tarball.');
|
||||
}
|
||||
execFileSync('tar', ['-xzf', tarball], { cwd: workDir });
|
||||
|
||||
const binaryName = {
|
||||
darwin: { arm64: 'packager-osx-arm64', x64: 'packager-osx-x64' },
|
||||
|
||||
@@ -59,7 +59,9 @@ class MockShakaPlayer {
|
||||
return [];
|
||||
}
|
||||
|
||||
selectAudioTrack() {}
|
||||
selectAudioTrack() {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getTextTracks() {
|
||||
return [];
|
||||
@@ -79,7 +81,9 @@ MockShakaPlayer.isBrowserSupported = () => true;
|
||||
const shaka = {
|
||||
Player: MockShakaPlayer,
|
||||
polyfill: {
|
||||
installAll() {},
|
||||
installAll() {
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
__instances: [],
|
||||
__reset() {
|
||||
|
||||
@@ -370,34 +370,24 @@ export class WebPlayerViewComponent {
|
||||
}
|
||||
|
||||
private formatPlayer(player: PlaybackDiagnostic['player']): string {
|
||||
switch (player) {
|
||||
case 'videojs':
|
||||
return 'Video.js';
|
||||
case 'html5':
|
||||
return 'HTML5';
|
||||
case 'artplayer':
|
||||
return 'ArtPlayer';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
const labels: Record<string, string> = {
|
||||
videojs: 'Video.js',
|
||||
html5: 'HTML5',
|
||||
artplayer: 'ArtPlayer',
|
||||
};
|
||||
return (player && labels[player]) || '';
|
||||
}
|
||||
|
||||
private formatDiagnosticSource(
|
||||
source: PlaybackDiagnostic['source']
|
||||
): string {
|
||||
switch (source) {
|
||||
case 'hls':
|
||||
return 'HLS.js';
|
||||
case 'mpegts':
|
||||
return 'mpegts.js';
|
||||
case 'native':
|
||||
return 'Native media element';
|
||||
case 'shaka':
|
||||
return 'Shaka Player';
|
||||
case 'source':
|
||||
return 'Stream metadata';
|
||||
default:
|
||||
return source;
|
||||
}
|
||||
const labels: Record<string, string> = {
|
||||
hls: 'HLS.js',
|
||||
mpegts: 'mpegts.js',
|
||||
native: 'Native media element',
|
||||
shaka: 'Shaka Player',
|
||||
source: 'Stream metadata',
|
||||
};
|
||||
return labels[source] ?? source;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user