mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-05-09 20:25:14 +02:00
Format
This commit is contained in:
parent
8d575241fe
commit
8a13dea681
@ -1,5 +1,5 @@
|
||||
import {getMatch, type Match, MatchMediaType} from '~/lib/match';
|
||||
import {Other, Redirect} from '~/lib/settings';
|
||||
import { getMatch, type Match, MatchMediaType } from '~/lib/match';
|
||||
import { Other, Redirect } from '~/lib/settings';
|
||||
|
||||
async function main() {
|
||||
let match: Match | null;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {matches, MatchMediaType} from '~/lib/match';
|
||||
import { matches, MatchMediaType } from '~/lib/match';
|
||||
import Hls from 'hls.js';
|
||||
import {UrlReferer} from '~/lib/settings';
|
||||
import { UrlReferer } from '~/lib/settings';
|
||||
|
||||
async function playNative(url: string, domain: string, videoElem: HTMLVideoElement) {
|
||||
await UrlReferer.set(new URL(url).hostname, domain);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { unpack } from './util/userspace';
|
||||
import { Hosters, Redirect, TmpHost } from './settings';
|
||||
import {lastPathSegment} from "~/lib/util/extract";
|
||||
import { lastPathSegment } from '~/lib/util/extract';
|
||||
|
||||
export interface Match {
|
||||
name: string;
|
||||
@ -10,12 +10,16 @@ export interface Match {
|
||||
regex: RegExp[];
|
||||
notice?: string;
|
||||
|
||||
match(match: RegExpMatchArray): Promise<string | {[MatchMediaType.Hls]: string} | {[MatchMediaType.Native]: string} | null>;
|
||||
match(
|
||||
match: RegExpMatchArray
|
||||
): Promise<
|
||||
string | { [MatchMediaType.Hls]: string } | { [MatchMediaType.Native]: string } | null
|
||||
>;
|
||||
}
|
||||
|
||||
export enum MatchMediaType {
|
||||
Hls = 'hls',
|
||||
Native = 'native',
|
||||
Native = 'native'
|
||||
}
|
||||
|
||||
export const Doodstream: Match = {
|
||||
@ -134,7 +138,7 @@ export const LoadX: Match = {
|
||||
const videoSource: string = responseJson['videoSource'];
|
||||
|
||||
// extension of extracted url is '.txt', so we have to manually specify that it's a hls
|
||||
return {[MatchMediaType.Hls]: videoSource.replace('\\/', '/')};
|
||||
return { [MatchMediaType.Hls]: videoSource.replace('\\/', '/') };
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
export function lastPathSegment(path: string): string {
|
||||
while (path.endsWith('/')) {
|
||||
path = path.slice(0, -1);
|
||||
}
|
||||
return path.substring(path.lastIndexOf('/') + 1);
|
||||
while (path.endsWith('/')) {
|
||||
path = path.slice(0, -1);
|
||||
}
|
||||
return path.substring(path.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user