nixamp 0.58.1 → 0.59.0
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/dist/ai-label.d.ts +6 -0
- package/dist/ai-label.js +1 -0
- package/dist/follow-page.js +1 -1
- package/dist/label-routes.js +3 -1
- package/dist/music-hub.d.ts +97 -0
- package/dist/music-hub.js +215 -0
- package/dist/music-store.d.ts +2 -0
- package/dist/music-store.js +4 -2
- package/dist/server.d.ts +9 -0
- package/dist/server.js +92 -6
- package/dist/store-routes.js +5 -4
- package/package.json +1 -1
- package/src/ai-label.ts +3 -0
- package/src/follow-page.ts +1 -1
- package/src/label-routes.ts +3 -1
- package/src/music-hub.ts +210 -0
- package/src/music-store.ts +6 -2
- package/src/server.ts +85 -6
- package/src/store-routes.ts +5 -4
- package/web/dist/assets/{ar-CBn9fObz.js → ar-BGz59p0i.js} +1 -1
- package/web/dist/assets/chunk-Q2XQMA4B-BaoaSqsD.js +1 -0
- package/web/dist/assets/{cs-BvEScz92.js → cs-DKsmGQfn.js} +1 -1
- package/web/dist/assets/{da-uKElVtgi.js → da-VBBFYTgq.js} +1 -1
- package/web/dist/assets/{de-DXEoI1GG.js → de-DocjfCJV.js} +1 -1
- package/web/dist/assets/{es-Q-QEZFh2.js → es-ScAWdKuT.js} +1 -1
- package/web/dist/assets/{fi-ClJkdfXs.js → fi-BCjOujwG.js} +1 -1
- package/web/dist/assets/{fr-DWmNoP1h.js → fr-EO9zGot_.js} +1 -1
- package/web/dist/assets/{hi-DGQOrveg.js → hi-DOv37S1y.js} +1 -1
- package/web/dist/assets/{hls-OR5FY6YP-CxI-FwpW.js → hls-OR5FY6YP-B-70I17r.js} +1 -1
- package/web/dist/assets/{hu-DGcKM8DB.js → hu-BMxwsXKm.js} +1 -1
- package/web/dist/assets/{id-D18Cz5RW.js → id-DDfdVuoK.js} +1 -1
- package/web/dist/assets/{it-WQxuRjlI.js → it-BbbFjt9-.js} +1 -1
- package/web/dist/assets/{main-cry6C8KD.js → main-BMYkP1N_.js} +2 -2
- package/web/dist/assets/modulepreload-polyfill-P2Xu9kJm.js +1 -0
- package/web/dist/assets/{mpegts-7CN75AI2-D-6xFZI-.js → mpegts-7CN75AI2-D-bdbDNw.js} +1 -1
- package/web/dist/assets/{mpegts-D2ZKeEby.js → mpegts-C_-pZIIG.js} +1 -1
- package/web/dist/assets/music-CmI2KJ1Y.js +1 -0
- package/web/dist/assets/music-jouma3VD.css +1 -0
- package/web/dist/assets/{nl-BvOA9QBr.js → nl-CO-MkYd-.js} +1 -1
- package/web/dist/assets/radio-DmVc3wpH.js +1 -0
- package/web/dist/assets/{ru-Cx4tgP1k.js → ru-C48YQfIR.js} +1 -1
- package/web/dist/assets/{station-BzLUgyQ0.js → station-DtY1LOm5.js} +1 -1
- package/web/dist/assets/{sv-f0zj1AdU.js → sv--HR26-tY.js} +1 -1
- package/web/dist/assets/{uk-DpGYtFFI.js → uk-p55LkwrK.js} +1 -1
- package/web/dist/assets/{vi-Cxf7VqJQ.js → vi-DPS8isVc.js} +1 -1
- package/web/dist/assets/vod-BzQvQVLd.js +1 -0
- package/web/dist/assets/watch-B9LW8D1C.js +1 -0
- package/web/dist/assets/{zh-DyuYbygO.js → zh-Dw9Ji9b2.js} +1 -1
- package/web/dist/index.html +4 -3
- package/web/dist/music.html +43 -0
- package/web/dist/radio.html +3 -2
- package/web/dist/station.html +3 -2
- package/web/dist/sw.js +30 -27
- package/web/dist/vod.html +3 -2
- package/web/dist/watch.html +3 -2
- package/web/dist/assets/chunk-Q2XQMA4B-PTuZPMen.js +0 -1
- package/web/dist/assets/radio-DV3h4YZS.js +0 -1
- package/web/dist/assets/vod-Bbg_gWbl.js +0 -1
- package/web/dist/assets/watch-Bygo4bPY.js +0 -1
package/src/follow-page.ts
CHANGED
|
@@ -112,7 +112,7 @@ export async function handleFollowPage(request: IncomingMessage, response: Serve
|
|
|
112
112
|
if (!me) {
|
|
113
113
|
send(response, 200, page(`Follow ${target.name}`, `<h1>Follow ${escape(target.name)}</h1>
|
|
114
114
|
<p class="by">Sign in to nixamp.com to follow the artists you hear on the radio.</p>
|
|
115
|
-
<a class="go" href="/
|
|
115
|
+
<a class="go" href="/music/me">Sign in to nixamp.com</a>
|
|
116
116
|
<small>Signed in, open this page again (or press Follow on the artist's page) to follow.</small>${back}`), method);
|
|
117
117
|
return true;
|
|
118
118
|
}
|
package/src/label-routes.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { createReadStream, statSync } from "node:fs";
|
|
|
11
11
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
12
12
|
import { ROSTER, type AiLabel, type PublicArtist } from "./ai-label.ts";
|
|
13
13
|
import { covers, PRICES, type GrantVerifier } from "./music-store.ts";
|
|
14
|
+
import { serverId } from "./music-hub.ts";
|
|
14
15
|
import { writeZip, zipSize } from "./zip-stream.ts";
|
|
15
16
|
import { StationError } from "./stations.ts";
|
|
16
17
|
import { adCsp, withPageAd, type GuideAds } from "./station-guide.ts";
|
|
@@ -30,7 +31,8 @@ export function isPublicLabelPath(path: string): boolean {
|
|
|
30
31
|
|
|
31
32
|
/** nixamp.com's page that sells this: a song, an album or everything by the artist. */
|
|
32
33
|
export function buyLink(site: string, server: string, kind: "song" | "album" | "artist", artist: string, album = "", n = 0): string {
|
|
33
|
-
|
|
34
|
+
// The server goes by its opaque id (music-hub.ts): no link names the machine the music is on.
|
|
35
|
+
const query = new URLSearchParams({ server: /^https:\/\//.test(server) ? serverId(server) : server, kind, artist, ...(kind !== "artist" ? { album } : {}), ...(kind === "song" ? { n: String(n) } : {}) });
|
|
34
36
|
return `${site}/buy?${query.toString()}`;
|
|
35
37
|
}
|
|
36
38
|
|
package/src/music-hub.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nixamp.com/music: every AI label's catalogue in one place.
|
|
3
|
+
*
|
|
4
|
+
* The music lives on the servers that make it (server1 and any other nixamp
|
|
5
|
+
* with a label); nixamp.com is where people listen, browse, follow and buy.
|
|
6
|
+
* This gathers each server's /api/v1/label and its public stations, gives
|
|
7
|
+
* every server a short opaque id (so no page or link names the machine), and
|
|
8
|
+
* hands covers, portraits and words through itself.
|
|
9
|
+
*
|
|
10
|
+
* GET /api/v1/music the merged catalogue
|
|
11
|
+
* GET /api/v1/music/file/<server>/<path> a cover, portrait, profile or words, through nixamp.com
|
|
12
|
+
* POST /api/v1/music/released a server says an album or song landed: its followers hear
|
|
13
|
+
*/
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
16
|
+
|
|
17
|
+
/** A server's opaque id: the first 10 hex of the SHA-256 of its https origin. Both sides can work it out. */
|
|
18
|
+
export function serverId(base: string): string {
|
|
19
|
+
return createHash("sha256").update(base.replace(/\/+$/, "")).digest("hex").slice(0, 10);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The followable id of an artist, as /follow and live.streaming's /radio use it. */
|
|
23
|
+
export function artistFollowId(name: string): string {
|
|
24
|
+
const slug = name.split(/\s*;\s*/)[0]!.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60) || "artist";
|
|
25
|
+
return `artist:${slug}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface LabelArtist { key: string; name: string; genre: string; bio: string; members?: Array<{ slug: string; name: string; role: string; bio: string }>; albums: Array<{ key: string; title: string; year: number; concept: string; cover: boolean; complete: boolean; songs: Array<{ n: number; title: string; seconds: number; lyrics?: string }> }> }
|
|
29
|
+
interface LabelView { holder: string; genres: Array<{ genre: string; station: string; artists: LabelArtist[] }> }
|
|
30
|
+
interface GuideStation { id: string; name: string; page: string; state: string; group?: string; nowPlaying: { title: string; artist: string } | null }
|
|
31
|
+
|
|
32
|
+
export interface HubStation { server: string; id: string; name: string; state: string; listen: string; token: string; nowPlaying: { title: string; artist: string } | null }
|
|
33
|
+
export interface HubArtist extends LabelArtist { server: string; follow: string }
|
|
34
|
+
export interface HubCatalogue {
|
|
35
|
+
holders: string[];
|
|
36
|
+
genres: Array<{ genre: string; stations: HubStation[]; artists: HubArtist[] }>;
|
|
37
|
+
/** Every AI station on the servers, by genre or not (lo-fi, the bands...). */
|
|
38
|
+
stations: HubStation[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface MusicHubOptions {
|
|
42
|
+
/** The servers whose labels are gathered: the directory and the guide's peers. */
|
|
43
|
+
peers: () => string[];
|
|
44
|
+
fetcher?: typeof fetch;
|
|
45
|
+
now?: () => number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class MusicHub {
|
|
49
|
+
private cache: { at: number; value: Promise<HubCatalogue> } | null = null;
|
|
50
|
+
private bases = new Map<string, string>();
|
|
51
|
+
|
|
52
|
+
constructor(private readonly options: MusicHubOptions) {}
|
|
53
|
+
|
|
54
|
+
private now(): number {
|
|
55
|
+
return this.options.now?.() ?? Date.now();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The https origin behind an opaque id, among the servers known now. */
|
|
59
|
+
resolve(id: string): string {
|
|
60
|
+
if (!/^[a-f0-9]{10}$/.test(id)) return "";
|
|
61
|
+
if (!this.bases.has(id)) for (const base of this.options.peers()) this.bases.set(serverId(base), base);
|
|
62
|
+
return this.bases.get(id) ?? "";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The catalogue, gathered at most once a minute (a slow or gone server is left out, not waited on). */
|
|
66
|
+
catalogue(): Promise<HubCatalogue> {
|
|
67
|
+
if (this.cache && this.now() - this.cache.at < 60_000) return this.cache.value;
|
|
68
|
+
const value = this.gather().catch((error: unknown) => { this.cache = null; throw error; });
|
|
69
|
+
this.cache = { at: this.now(), value };
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private async read<T>(url: string): Promise<T | null> {
|
|
74
|
+
try {
|
|
75
|
+
const response = await (this.options.fetcher ?? fetch)(url, { signal: AbortSignal.timeout(6_000), headers: { accept: "application/json" } });
|
|
76
|
+
return response.ok ? await response.json() as T : null;
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private async gather(): Promise<HubCatalogue> {
|
|
83
|
+
const peers = [...new Set(this.options.peers())];
|
|
84
|
+
const holders = new Set<string>();
|
|
85
|
+
const genres = new Map<string, { genre: string; stations: HubStation[]; artists: HubArtist[] }>();
|
|
86
|
+
const stations: HubStation[] = [];
|
|
87
|
+
await Promise.all(peers.map(async (base) => {
|
|
88
|
+
const id = serverId(base);
|
|
89
|
+
this.bases.set(id, base);
|
|
90
|
+
const [label, guide] = await Promise.all([
|
|
91
|
+
this.read<LabelView>(`${base}/api/v1/label`),
|
|
92
|
+
this.read<{ stations?: GuideStation[] }>(`${base}/api/v1/stations/guide?local=1`),
|
|
93
|
+
]);
|
|
94
|
+
// A station is heard through its own server; the page's token is its listen key.
|
|
95
|
+
const byId = new Map<string, HubStation>();
|
|
96
|
+
for (const one of guide?.stations ?? []) {
|
|
97
|
+
if (one.group && one.group !== "ai") continue;
|
|
98
|
+
let page: URL;
|
|
99
|
+
try { page = new URL(one.page); } catch { continue; }
|
|
100
|
+
if (page.origin !== base) continue;
|
|
101
|
+
const station: HubStation = { server: id, id: one.id, name: one.name, state: one.state, listen: `${base}/api/v1/stations/${one.id}`, token: page.searchParams.get("t") ?? "", nowPlaying: one.nowPlaying };
|
|
102
|
+
byId.set(one.id, station);
|
|
103
|
+
stations.push(station);
|
|
104
|
+
}
|
|
105
|
+
if (!label) return;
|
|
106
|
+
holders.add(label.holder);
|
|
107
|
+
for (const genre of label.genres) {
|
|
108
|
+
const slot = genres.get(genre.genre) ?? { genre: genre.genre, stations: [], artists: [] };
|
|
109
|
+
const station = byId.get(genre.station);
|
|
110
|
+
if (station) slot.stations.push(station);
|
|
111
|
+
for (const artist of genre.artists) slot.artists.push({ ...artist, server: id, follow: artistFollowId(artist.name) });
|
|
112
|
+
genres.set(genre.genre, slot);
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
return {
|
|
116
|
+
holders: [...holders],
|
|
117
|
+
genres: [...genres.values()].sort((a, b) => a.genre.localeCompare(b.genre)),
|
|
118
|
+
stations: stations.sort((a, b) => a.name.localeCompare(b.name)),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const FILE = /^\/api\/v1\/music\/file\/([a-f0-9]{10})\/([a-f0-9]{10}\/(?:[a-f0-9]{8}\/(?:\d{1,3}\.txt|cover\.jpg)|artist\.md|members\/[a-z0-9-]{1,40}\.(?:md|jpg)))$/;
|
|
124
|
+
|
|
125
|
+
const slugOf = (text: string, max: number): string => text.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, max);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* live.streaming's /radio/artist/<slug> and /radio/album/<slug> addresses, on
|
|
129
|
+
* nixamp.com: the /music page they name (radio-slug.ts's slugs), or "" when
|
|
130
|
+
* the catalogue has no such artist or album.
|
|
131
|
+
*/
|
|
132
|
+
export async function musicPageFor(hub: MusicHub, path: string): Promise<string> {
|
|
133
|
+
const match = /^\/radio\/(artist|album)\/([a-z0-9-]{1,100})\/?$/.exec(path);
|
|
134
|
+
if (!match) return "";
|
|
135
|
+
const catalogue = await hub.catalogue();
|
|
136
|
+
const artists = catalogue.genres.flatMap((one) => one.artists);
|
|
137
|
+
if (match[1] === "artist") {
|
|
138
|
+
const artist = artists.find((one) => one.follow === `artist:${match[2]}`);
|
|
139
|
+
return artist ? `/music/artist/${artist.server}/${artist.key}` : "";
|
|
140
|
+
}
|
|
141
|
+
for (const artist of artists) {
|
|
142
|
+
const album = artist.albums.find((one) => slugOf(`${artist.follow.slice(7)} ${one.title}`, 90) === match[2]);
|
|
143
|
+
if (album) return `/music/album/${artist.server}/${artist.key}/${album.key}`;
|
|
144
|
+
}
|
|
145
|
+
return "";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function isMusicPath(path: string): boolean {
|
|
149
|
+
return path === "/music" || path.startsWith("/music/") || path === "/api/v1/music" || FILE.test(path) || path === "/api/v1/music/released";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface MusicRoutesContext {
|
|
153
|
+
hub: MusicHub;
|
|
154
|
+
json: (response: ServerResponse, status: number, body: unknown) => void;
|
|
155
|
+
readBody: (request: IncomingMessage) => Promise<string>;
|
|
156
|
+
/** The page shell (web/music.html), or null when the web build is absent. */
|
|
157
|
+
page: () => string | null;
|
|
158
|
+
/** A server says something of its label landed; null when nobody may say so. */
|
|
159
|
+
released?: (request: IncomingMessage, body: Record<string, unknown>) => Promise<{ status: number; body: unknown }>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export async function handleMusicRoutes(request: IncomingMessage, response: ServerResponse, path: string, ctx: MusicRoutesContext): Promise<boolean> {
|
|
163
|
+
if (!isMusicPath(path)) return false;
|
|
164
|
+
const method = request.method ?? "GET";
|
|
165
|
+
if (path === "/api/v1/music/released") {
|
|
166
|
+
if (method !== "POST" || !ctx.released) { ctx.json(response, 405, { error: "not like that" }); return true; }
|
|
167
|
+
let body: Record<string, unknown> = {};
|
|
168
|
+
try { body = JSON.parse(await ctx.readBody(request)) as Record<string, unknown>; } catch { ctx.json(response, 400, { error: "the body is not JSON" }); return true; }
|
|
169
|
+
const answer = await ctx.released(request, body);
|
|
170
|
+
ctx.json(response, answer.status, answer.body);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
if (method !== "GET" && method !== "HEAD") { ctx.json(response, 405, { error: "not like that" }); return true; }
|
|
174
|
+
if (path === "/api/v1/music") {
|
|
175
|
+
ctx.json(response, 200, await ctx.hub.catalogue());
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
const file = FILE.exec(path);
|
|
179
|
+
if (file) {
|
|
180
|
+
const base = ctx.hub.resolve(file[1]!);
|
|
181
|
+
if (!base) { ctx.json(response, 404, { error: "no such server" }); return true; }
|
|
182
|
+
try {
|
|
183
|
+
const upstream = await fetch(`${base}/api/v1/label/${file[2]}`, { signal: AbortSignal.timeout(15_000) });
|
|
184
|
+
if (!upstream.ok || !upstream.body) { ctx.json(response, upstream.status === 404 ? 404 : 502, { error: "not there" }); return true; }
|
|
185
|
+
response.writeHead(200, {
|
|
186
|
+
"content-type": upstream.headers.get("content-type") ?? "application/octet-stream",
|
|
187
|
+
"cache-control": "public, max-age=3600",
|
|
188
|
+
...(upstream.headers.get("content-length") ? { "content-length": upstream.headers.get("content-length")! } : {}),
|
|
189
|
+
});
|
|
190
|
+
if (method === "HEAD") { response.end(); return true; }
|
|
191
|
+
const reader = upstream.body.getReader();
|
|
192
|
+
for (;;) {
|
|
193
|
+
const { done, value } = await reader.read();
|
|
194
|
+
if (done) break;
|
|
195
|
+
if (!response.write(value)) await new Promise((resolve) => response.once("drain", resolve));
|
|
196
|
+
}
|
|
197
|
+
response.end();
|
|
198
|
+
} catch {
|
|
199
|
+
if (!response.headersSent) ctx.json(response, 502, { error: "the server holding it did not answer" });
|
|
200
|
+
else response.destroy();
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
// /music and everything under it is the app; it reads /api/v1/music.
|
|
205
|
+
const page = ctx.page();
|
|
206
|
+
if (!page) { ctx.json(response, 404, { error: "the music app is not built here" }); return true; }
|
|
207
|
+
response.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-cache" });
|
|
208
|
+
response.end(method === "HEAD" ? undefined : page);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
package/src/music-store.ts
CHANGED
|
@@ -153,6 +153,8 @@ export interface MusicStoreOptions {
|
|
|
153
153
|
secret: string;
|
|
154
154
|
/** The servers whose catalogues may be sold here (the directory and the guide's peers). */
|
|
155
155
|
servers: () => string[];
|
|
156
|
+
/** The https origin behind an opaque server id, when nixamp.com keeps a hub. */
|
|
157
|
+
resolveServer?: (id: string) => string;
|
|
156
158
|
fetcher?: typeof fetch;
|
|
157
159
|
now?: () => number;
|
|
158
160
|
log?: (line: string) => void;
|
|
@@ -190,7 +192,9 @@ export class MusicStore {
|
|
|
190
192
|
|
|
191
193
|
/** What is for sale at this address, with its name and price; refused when there is no such thing. */
|
|
192
194
|
async describe(input: Record<string, unknown>): Promise<Scope & { title: string; artistName: string; amountCents: number; songs: number }> {
|
|
193
|
-
|
|
195
|
+
// An opaque server id (music-hub.ts), or an https origin.
|
|
196
|
+
const asked = String(input["server"] ?? "");
|
|
197
|
+
const server = /^[a-f0-9]{10}$/.test(asked) ? (this.options.resolveServer?.(asked) ?? "") : serverBase(asked);
|
|
194
198
|
// A server in the directory or the guide's peers, or one named under nixamp.com (whose names
|
|
195
199
|
// and certificates nixamp.com issues): the directory empties on every restart of nixamp.com.
|
|
196
200
|
const named = server ? new URL(server).hostname.endsWith(".nixamp.com") : false;
|
|
@@ -276,7 +280,7 @@ export class MusicStore {
|
|
|
276
280
|
await this.mail(purchase.email, `Your music: ${purchase.title}`, [
|
|
277
281
|
`Thank you. "${purchase.title}" by ${purchase.artistName} is yours: MP3s with the cover art and the lyrics, in one zip.`,
|
|
278
282
|
`Download it, now or any time: ${this.link(purchase.id, purchase.token)}`,
|
|
279
|
-
`Sign in to nixamp.com with ${purchase.email} and everything you have bought is under My music on ${this.options.site}/
|
|
283
|
+
`Sign in to nixamp.com with ${purchase.email} and everything you have bought is under My music on ${this.options.site}/music/me, to play or download again.`,
|
|
280
284
|
]);
|
|
281
285
|
return purchase;
|
|
282
286
|
}
|
package/src/server.ts
CHANGED
|
@@ -83,6 +83,7 @@ import { handleAiRoutes, isPublicSharePath } from "./ai-routes.ts";
|
|
|
83
83
|
import { AiLabel } from "./ai-label.ts";
|
|
84
84
|
import { buyLink, handleLabelRoutes, isPublicLabelPath } from "./label-routes.ts";
|
|
85
85
|
import { GrantVerifier, MusicStore, PRICES } from "./music-store.ts";
|
|
86
|
+
import { handleMusicRoutes, isMusicPath, MusicHub, musicPageFor, serverId } from "./music-hub.ts";
|
|
86
87
|
import { handleStoreRoutes, isStorePath } from "./store-routes.ts";
|
|
87
88
|
import { AiRadio } from "./ai-radio.ts";
|
|
88
89
|
import { ListenerShares } from "./listener-shares.ts";
|
|
@@ -1961,6 +1962,8 @@ export interface HandlerOptions {
|
|
|
1961
1962
|
coinpayWebhookSecret?: string;
|
|
1962
1963
|
/** The AI label's songs for sale, nixamp.com only (music-store.ts). */
|
|
1963
1964
|
musicStore?: MusicStore;
|
|
1965
|
+
/** nixamp.com/music: every server's label in one app (music-hub.ts). */
|
|
1966
|
+
music?: { hub: MusicHub; released: (request: IncomingMessage, body: Record<string, unknown>) => Promise<{ status: number; body: unknown }> };
|
|
1964
1967
|
sharedTranslations?: SharedTranslations;
|
|
1965
1968
|
/** Translation: texts in another language, by a model here. The same optional library. */
|
|
1966
1969
|
translator?: Translator;
|
|
@@ -2142,7 +2145,7 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
2142
2145
|
query.set("t", station!.listenToken);
|
|
2143
2146
|
request.url = `/api/v1/stations/${station!.id}/${sub[2]}?${query.toString()}`;
|
|
2144
2147
|
const here = options.stations.publicBase?.() ?? "";
|
|
2145
|
-
rewriteResponse(response, radioRewriter(station!, sub[1]!, /^https:\/\//.test(here) ? `${storeSite}/buy?server=${
|
|
2148
|
+
rewriteResponse(response, radioRewriter(station!, sub[1]!, /^https:\/\//.test(here) ? `${storeSite}/buy?server=${serverId(here)}&` : ""));
|
|
2146
2149
|
return handle(request, response);
|
|
2147
2150
|
}
|
|
2148
2151
|
}
|
|
@@ -2853,6 +2856,9 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
2853
2856
|
!(isPublicLabelPath(path) && Boolean(options.stations?.label)) &&
|
|
2854
2857
|
// The music store: its pages, checkout, receipts and grants (nixamp.com).
|
|
2855
2858
|
!(isStorePath(path) && Boolean(options.musicStore)) &&
|
|
2859
|
+
// nixamp.com/music: the app and its catalogue, for anybody.
|
|
2860
|
+
!(isMusicPath(path) && Boolean(options.music)) &&
|
|
2861
|
+
!(/^\/radio\/(artist|album)\//.test(path) && Boolean(options.music)) &&
|
|
2856
2862
|
// What is on, as MCP, for anybody.
|
|
2857
2863
|
path !== "/mcp/public" &&
|
|
2858
2864
|
// Supporting a copyright holder is for anybody listening.
|
|
@@ -3175,6 +3181,16 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
3175
3181
|
// /radio: public, listed stations under readable names, and the artists and
|
|
3176
3182
|
// albums they play (radio-pages.ts). A station's own paths under its name
|
|
3177
3183
|
// were answered at the top of this handler.
|
|
3184
|
+
// On nixamp.com, live.streaming's artist and album addresses open the same page of the music app.
|
|
3185
|
+
if (options.music && /^\/radio\/(artist|album)\//.test(path) && (request.method === "GET" || request.method === "HEAD")) {
|
|
3186
|
+
const target = await musicPageFor(options.music.hub, path).catch(() => "");
|
|
3187
|
+
if (target) {
|
|
3188
|
+
response.writeHead(302, { location: target });
|
|
3189
|
+
response.end();
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3178
3194
|
if (options.stations && isRadioPath(path) && (request.method === "GET" || request.method === "HEAD")) {
|
|
3179
3195
|
const stations = options.stations;
|
|
3180
3196
|
const named = radioStations(stations.store.list());
|
|
@@ -3378,6 +3394,18 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
3378
3394
|
return;
|
|
3379
3395
|
}
|
|
3380
3396
|
|
|
3397
|
+
if (options.music && isMusicPath(path)) {
|
|
3398
|
+
const music = options.music;
|
|
3399
|
+
const shell = web ? join(web, "music.html") : "";
|
|
3400
|
+
if (await handleMusicRoutes(request, response, path, {
|
|
3401
|
+
hub: music.hub,
|
|
3402
|
+
json,
|
|
3403
|
+
readBody,
|
|
3404
|
+
page: () => { try { return shell ? readFileSync(shell, "utf8") : null; } catch { return null; } },
|
|
3405
|
+
released: music.released,
|
|
3406
|
+
})) return;
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3381
3409
|
if (options.musicStore && options.support && isStorePath(path)) {
|
|
3382
3410
|
const support = options.support;
|
|
3383
3411
|
const accounts = options.accounts;
|
|
@@ -7647,6 +7675,18 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
7647
7675
|
root: process.env["NIXAMP_LABEL_ROOT"] || (labelHome ? join(labelHome.root, "ai") : join(stateDir(), "ai-label")),
|
|
7648
7676
|
owner: options.owner || "",
|
|
7649
7677
|
mayStart: mayStartStation,
|
|
7678
|
+
// A release is told to nixamp.com as this server's owner; nixamp.com tells the artist's followers.
|
|
7679
|
+
announce: (release) => {
|
|
7680
|
+
const session = readSession();
|
|
7681
|
+
const here = stations.publicBase?.() ?? "";
|
|
7682
|
+
if (!session?.token || !/^https:\/\//.test(here)) return;
|
|
7683
|
+
void fetch(`${session.site.replace(/\/+$/, "")}/api/v1/music/released`, {
|
|
7684
|
+
method: "POST",
|
|
7685
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${session.token}` },
|
|
7686
|
+
body: JSON.stringify({ ...release, server: here }),
|
|
7687
|
+
signal: AbortSignal.timeout(15_000),
|
|
7688
|
+
}).then((answer) => console.log(` ai label: nixamp.com was told of "${release.title}" (${answer.status})`)).catch(() => undefined);
|
|
7689
|
+
},
|
|
7650
7690
|
log: (line) => console.log(line),
|
|
7651
7691
|
});
|
|
7652
7692
|
aiRadio.startSchedule();
|
|
@@ -7889,18 +7929,50 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
7889
7929
|
supportMonthly?.startSchedule();
|
|
7890
7930
|
// The AI label's songs for sale: purchases kept here, the music zipped by the server that holds it.
|
|
7891
7931
|
const jwtSecret = process.env["NIXAMP_JWT_SECRET"] ?? "";
|
|
7932
|
+
// The servers whose music nixamp.com sells and plays: the directory and the guide's peers.
|
|
7933
|
+
const musicServers = (): string[] => {
|
|
7934
|
+
const listed = directory ? directory.list().map((one) => peerBase(one.url)).filter(Boolean) : [];
|
|
7935
|
+
return [...new Set([...guidePeers(), ...listed])];
|
|
7936
|
+
};
|
|
7937
|
+
// nixamp.com/music: every server's label in one catalogue (music-hub.ts).
|
|
7938
|
+
const musicHub = options.directory ? new MusicHub({ peers: musicServers }) : undefined;
|
|
7892
7939
|
const musicStore = supportPayments && supportPayments.enabled && pool && jwtSecret ? new MusicStore({
|
|
7893
7940
|
db: pool as unknown as import("./support.ts").Db,
|
|
7894
7941
|
support: supportPayments,
|
|
7895
7942
|
mail: process.env["RESEND_API_KEY"] ? { apiKey: process.env["RESEND_API_KEY"], from: process.env["NIXAMP_MAIL_FROM"] ?? "nixamp <notifications@nixamp.com>" } : null,
|
|
7896
7943
|
site: nixampSite,
|
|
7897
7944
|
secret: sha("sha256").update(`music-grant:${jwtSecret}`).digest("hex"),
|
|
7898
|
-
servers:
|
|
7899
|
-
|
|
7900
|
-
return [...new Set([...guidePeers(), ...listed])];
|
|
7901
|
-
},
|
|
7945
|
+
servers: musicServers,
|
|
7946
|
+
...(musicHub ? { resolveServer: (id: string) => musicHub.resolve(id) } : {}),
|
|
7902
7947
|
log: (line) => console.log(line),
|
|
7903
7948
|
}) : undefined;
|
|
7949
|
+
/**
|
|
7950
|
+
* A server says an album (or song) of its label landed: its artist's
|
|
7951
|
+
* followers are told. Only the account that owns a listed server may say
|
|
7952
|
+
* so, only for an artist that server's catalogue has, once per release.
|
|
7953
|
+
*/
|
|
7954
|
+
const announced = new Set<string>();
|
|
7955
|
+
const musicReleased = async (request: IncomingMessage, body: Record<string, unknown>): Promise<{ status: number; body: unknown }> => {
|
|
7956
|
+
const me = accounts ? await accounts.whoIs(tokenFrom(request.headers)).catch(() => null) : null;
|
|
7957
|
+
if (!me) return { status: 401, body: { error: "sign in as the server's owner" } };
|
|
7958
|
+
const base = peerBase(String(body["server"] ?? ""));
|
|
7959
|
+
const owns = directory?.list().some((one) => one.ownerId === me.id && peerBase(one.url) === base) ?? false;
|
|
7960
|
+
if (!base || !owns || !musicHub) return { status: 403, body: { error: "that server is not yours, or not listed" } };
|
|
7961
|
+
const catalogue = await musicHub.catalogue();
|
|
7962
|
+
const id = serverId(base);
|
|
7963
|
+
const artist = catalogue.genres.flatMap((one) => one.artists).find((one) => one.server === id && one.key === body["artist"]);
|
|
7964
|
+
const what = String(body["title"] ?? "").replace(/[\r\n]/g, " ").slice(0, 120);
|
|
7965
|
+
if (!artist || !what) return { status: 404, body: { error: "no such artist on that server" } };
|
|
7966
|
+
const key = `${id}:${artist.key}:${what}`;
|
|
7967
|
+
if (announced.has(key)) return { status: 200, body: { told: false, why: "already" } };
|
|
7968
|
+
announced.add(key);
|
|
7969
|
+
tellAudienceOf(artist.follow, {
|
|
7970
|
+
title: `New from ${artist.name}`,
|
|
7971
|
+
body: body["kind"] === "song" ? `"${what}" is out. Listen free on nixamp.` : `The album "${what}" is out. Listen free on nixamp.`,
|
|
7972
|
+
url: `${nixampSite}/music/artist/${id}/${artist.key}`,
|
|
7973
|
+
});
|
|
7974
|
+
return { status: 202, body: { told: true, follow: artist.follow } };
|
|
7975
|
+
};
|
|
7904
7976
|
if (translationPasses) void translationPasses.access().catch(() => console.error("nixamp: translation checkout could not warm; it will retry on demand"));
|
|
7905
7977
|
const liveVoice = accounts && process.env["NIXAMP_DUBBING"] !== "off" ? new LiveVoice({
|
|
7906
7978
|
...(pool ? { db: pool } : {}),
|
|
@@ -8050,8 +8122,14 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
8050
8122
|
body: `${what} Listen at ${DEFAULT_DIRECTORY}/directory, or call ${CALL_IN_NUMBER} and key ${listing.code}.`.trim(),
|
|
8051
8123
|
url: listing.url,
|
|
8052
8124
|
};
|
|
8125
|
+
tellAudienceOf(listing.ownerId, note);
|
|
8126
|
+
};
|
|
8127
|
+
|
|
8128
|
+
/** Everyone following `followed` (an account, or `artist:<slug>`), by every way they asked to be told. */
|
|
8129
|
+
const tellAudienceOf = (followed: string, note: Notification): void => {
|
|
8130
|
+
if (follows === undefined) return;
|
|
8053
8131
|
void follows
|
|
8054
|
-
.audience(
|
|
8132
|
+
.audience(followed)
|
|
8055
8133
|
.then((audience) =>
|
|
8056
8134
|
notifyAll(audience, note, {
|
|
8057
8135
|
...(process.env["RESEND_API_KEY"]
|
|
@@ -8456,6 +8534,7 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
8456
8534
|
...(supportPayments ? { support: supportPayments } : {}),
|
|
8457
8535
|
...(supportMonthly ? { supportSubscriptions: supportMonthly } : {}),
|
|
8458
8536
|
...(musicStore ? { musicStore } : {}),
|
|
8537
|
+
...(musicHub ? { music: { hub: musicHub, released: musicReleased } } : {}),
|
|
8459
8538
|
...(process.env["COINPAY_WEBHOOK_SECRET"] ? { coinpayWebhookSecret: process.env["COINPAY_WEBHOOK_SECRET"] } : {}),
|
|
8460
8539
|
...(sharedTranslations ? { sharedTranslations } : {}),
|
|
8461
8540
|
...(translator ? { translator } : {}),
|
package/src/store-routes.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
14
14
|
import { PRICES, type MusicStore } from "./music-store.ts";
|
|
15
|
+
import { serverId } from "./music-hub.ts";
|
|
15
16
|
import { SupportError } from "./support.ts";
|
|
16
17
|
|
|
17
18
|
const PURCHASE = /^\/purchases\/([0-9a-f-]{36})$/;
|
|
@@ -119,7 +120,7 @@ export async function handleStoreRoutes(request: IncomingMessage, response: Serv
|
|
|
119
120
|
}
|
|
120
121
|
const me = await ctx.account().catch(() => null);
|
|
121
122
|
const what = item.kind === "song" ? "One song" : item.kind === "album" ? `The album, ${item.songs} songs` : `Everything by ${escape(item.artistName)}, ${item.songs} songs so far`;
|
|
122
|
-
const cover = item.kind === "artist" ? "" : `<img src="${escape(
|
|
123
|
+
const cover = item.kind === "artist" ? "" : `<img src="${escape(`/api/v1/music/file/${serverId(item.server)}/${item.artist}/${item.album}/cover.jpg`)}" alt="" width="160" height="160" style="border-radius:10px;float:right;margin:0 0 8px 12px;max-width:40%;height:auto">`;
|
|
123
124
|
html(response, 200, page(`Download ${item.title}`, `<div class="card">${cover}
|
|
124
125
|
<h1>${escape(item.title)}</h1><p class="by">${escape(item.artistName)}</p>
|
|
125
126
|
<div class="price">${price(item.amountCents)}</div>
|
|
@@ -132,8 +133,8 @@ export async function handleStoreRoutes(request: IncomingMessage, response: Serv
|
|
|
132
133
|
<button id="pay" type="submit">Pay ${price(item.amountCents)} with crypto</button>
|
|
133
134
|
</form>
|
|
134
135
|
<p id="status" role="status" aria-live="polite"></p>
|
|
135
|
-
<small>Payments go through <a href="https://coinpayportal.com">CoinPay</a> to nixamp.com. For small amounts pick a coin with low fees (USDC on Polygon or Solana, SOL, LTC). Listening on the live stations is always free.${me ? "" : ` <a href="/
|
|
136
|
-
</div>`, JSON.stringify({ server: item.server, kind: item.kind, artist: item.artist, album: item.album, n: item.n })), method);
|
|
136
|
+
<small>Payments go through <a href="https://coinpayportal.com">CoinPay</a> to nixamp.com. For small amounts pick a coin with low fees (USDC on Polygon or Solana, SOL, LTC). Listening on the live stations is always free.${me ? "" : ` <a href="/?redirect=${encodeURIComponent("/music/me")}#account-panel">Sign in</a> with the same email to keep everything under My music.`}</small>
|
|
137
|
+
</div>`, JSON.stringify({ server: serverId(item.server), kind: item.kind, artist: item.artist, album: item.album, n: item.n })), method);
|
|
137
138
|
return true;
|
|
138
139
|
}
|
|
139
140
|
const receipt = PURCHASE.exec(path);
|
|
@@ -146,7 +147,7 @@ export async function handleStoreRoutes(request: IncomingMessage, response: Serv
|
|
|
146
147
|
const body = purchase.status === "paid"
|
|
147
148
|
? `<div class="card"><h1>${escape(purchase.title)}</h1><p class="by">${escape(purchase.artistName)} · paid ${price(purchase.amountCents)}</p>
|
|
148
149
|
<a class="go" href="${escape(store.zipUrl(purchase))}" download>Download the zip</a>
|
|
149
|
-
<small>MP3s with the cover art and lyrics, plus each song's .lyrics.txt, cover.jpg and album.json. Keep this page's address (it is in your email too) to download again. Signed in to nixamp.com as ${escape(purchase.email)}, everything you bought is under <a href="/
|
|
150
|
+
<small>MP3s with the cover art and lyrics, plus each song's .lyrics.txt, cover.jpg and album.json. Keep this page's address (it is in your email too) to download again. Signed in to nixamp.com as ${escape(purchase.email)}, everything you bought is under <a href="/music/me">My music</a>, to play or download.</small></div>`
|
|
150
151
|
: `<div class="card"><h1>${escape(purchase.title)}</h1><p class="by">${escape(purchase.artistName)} · ${price(purchase.amountCents)} in ${escape(purchase.coin)}</p>
|
|
151
152
|
<p>Waiting for your payment. Once CoinPay confirms it, your download is here and in your email (${escape(purchase.email)}). This page checks again when you reload it.</p>
|
|
152
153
|
<a class="go" href="https://coinpayportal.com/pay/${escape(purchase.paymentId)}">Open the payment</a></div>`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./main-
|
|
1
|
+
import{t as e}from"./main-BMYkP1N_.js";var t={...e,"No parties live right now.":`لا توجد جلسات مباشرة الآن.`,"Could not refresh parties.":`تعذر تحديث الجلسات.`,"Pick a server in the directory, or paste its link here.":`اختر خادمًا من الدليل أو الصق رابطه هنا.`,"Interface language":`لغة الواجهة`,Language:`اللغة`,"Translation language":`لغة الترجمة`,"Original (auto-detect)":`الأصل (اكتشاف تلقائي)`,Play:`تشغيل`,Pause:`إيقاف مؤقت`,Stop:`إيقاف`,Next:`التالي`,Previous:`السابق`,Select:`اختيار`,"Next/Prev":`التالي/السابق`,Quit:`خروج`,"Now Playing":`قيد التشغيل`,"Spectrum Analyser":`محلل الطيف`,Playlist:`قائمة التشغيل`,Files:`الملفات`,"Open files":`فتح ملفات`,"Open folder":`فتح مجلد`,"Add to library":`إضافة إلى المكتبة`,"Replace playlist":`استبدال قائمة التشغيل`,Filter:`تصفية`,Search:`بحث`,"Nothing loaded.":`لم يُحمّل أي محتوى.`,"Empty.":`فارغ.`,"Loading…":`جارٍ التحميل…`,"Connecting…":`جارٍ الاتصال…`,Connected:`متصل`,"Not connected":`غير متصل`,"No source":`لا يوجد مصدر`,Playing:`يعمل`,Stopped:`متوقف`,Volume:`مستوى الصوت`,Seek:`موضع التشغيل`,"Full screen":`ملء الشاشة`,Download:`تنزيل`,Share:`مشاركة`,Copy:`نسخ`,"Copy link":`نسخ الرابط`,Copied:`تم النسخ`,Save:`حفظ`,Cancel:`إلغاء`,Close:`إغلاق`,Remove:`إزالة`,Delete:`حذف`,Edit:`تعديل`,Add:`إضافة`,Send:`إرسال`,Retry:`إعادة المحاولة`,Back:`رجوع`,"Next page":`الصفحة التالية`,"Previous page":`الصفحة السابقة`,"Show more":`عرض المزيد`,Panels:`اللوحات`,"Reset layout":`إعادة ضبط التخطيط`,Show:`إظهار`,Hide:`إخفاء`,Collapse:`طي`,Expand:`توسيع`,"Move up":`نقل لأعلى`,"Move down":`نقل لأسفل`,Install:`تثبيت`,"TV mode":`وضع التلفاز`,On:`مفعّل`,Off:`معطّل`,Account:`الحساب`,"Sign in":`تسجيل الدخول`,"Sign out":`تسجيل الخروج`,"Create account":`إنشاء حساب`,Email:`البريد الإلكتروني`,Password:`كلمة المرور`,"Forgot password?":`نسيت كلمة المرور؟`,"Welcome back":`مرحبًا بعودتك`,Profile:`الملف الشخصي`,Handle:`اسم المستخدم`,"Your servers":`خوادمك`,Server:`الخادم`,Connect:`اتصال`,Disconnect:`قطع الاتصال`,Directory:`الدليل`,Favourites:`المفضلة`,Follow:`متابعة`,Unfollow:`إلغاء المتابعة`,Notifications:`الإشعارات`,"Phone number":`رقم الهاتف`,"Save number":`حفظ الرقم`,Transcript:`النص المفرغ`,Captions:`الترجمة النصية`,"Translate audio":`ترجمة الصوت`,"Audio language":`لغة الصوت`,"Audio options":`خيارات الصوت`,"Keep background sound":`الاحتفاظ بأصوات الخلفية`,"Background level":`مستوى صوت الخلفية`,"Speaker voices":`أصوات المتحدثين`,"Any voice":`أي صوت`,"Male voice":`صوت رجالي`,"Female voice":`صوت نسائي`,"Original audio.":`الصوت الأصلي.`,"Buy translated audio":`شراء الصوت المترجم`,"Audio credit":`رصيد الصوت`,"Buy pass":`شراء تصريح`,Pass:`تصريح`,"Pay with":`الدفع باستخدام`,"Check payment":`التحقق من الدفع`,"Open checkout":`الانتقال للدفع`,"Free sessions":`جلسات مجانية`,"Usage rates and expiry":`الأسعار ومدة الصلاحية`,Catalogs:`الكتالوجات`,"Add catalog":`إضافة كتالوج`,"Catalog name":`اسم الكتالوج`,Link:`الرابط`,"Play link":`تشغيل الرابط`,"Go live":`بدء بث مباشر`,Publish:`نشر`,Listen:`استماع`,"Live now":`مباشر الآن`,Upcoming:`قريبًا`,Parties:`حفلات المشاهدة`,"Join party":`الانضمام للحفلة`,"Invite code":`رمز الدعوة`,Invite:`دعوة`,Chat:`الدردشة`,"Chat message":`رسالة دردشة`,People:`الأشخاص`,Speaker:`متحدث`,Speakers:`المتحدثون`,Listener:`مستمع`,Moderator:`مشرف`,"Raise hand":`رفع اليد`,"Hand raises":`الأيدي المرفوعة`,Questions:`الأسئلة`,Resources:`الموارد`,Replay:`إعادة العرض`,Schedule:`الجدول`,Event:`الفعالية`,Host:`المضيف`,About:`حول`,Stage:`المنصة`,Title:`العنوان`,Description:`الوصف`,Topic:`الموضوع`,Public:`عام`,"Anyone with the link":`أي شخص لديه الرابط`,"Invited people":`الأشخاص المدعوون`,"Who can join":`من يمكنه الانضمام`,"Date and time":`التاريخ والوقت`,"Expected length":`المدة المتوقعة`,Repeat:`تكرار`,"Does not repeat":`لا يتكرر`,"Every day":`كل يوم`,"Every week":`كل أسبوع`,Homepage:`الموقع الإلكتروني`,"Host name":`اسم المضيف`,"Profile photo URL":`رابط صورة الملف الشخصي`,"Broadcast link":`رابط البث`,"Edit event":`تعديل الفعالية`,"Save changes":`حفظ التغييرات`,"Create live":`إنشاء بث مباشر`,"Schedule class":`جدولة درس`,"Start class":`بدء الدرس`,"End event":`إنهاء الفعالية`,"End session":`إنهاء الجلسة`,"Session ended":`انتهت الجلسة`,"Event ended":`انتهت الفعالية`,Cancelled:`ملغاة`,"Replay available":`إعادة العرض متاحة`,Join:`انضمام`,"Create invite":`إنشاء دعوة`,"Invite as":`الدعوة بصفة`,"Watch now":`شاهد الآن`,"Start a room":`إنشاء غرفة`,"Recent replays":`إعادات العرض الأخيرة`,"Your account":`حسابك`,"Write with AI":`الكتابة بالذكاء الاصطناعي`,"Suggested title":`العنوان المقترح`,"Suggested description":`الوصف المقترح`,"Suggested topic":`الموضوع المقترح`,"Use these details":`استخدام هذه التفاصيل`,"Learn something live.":`تعلّم شيئًا مباشرة.`,"Screen share":`مشاركة الشاشة`,"Upload and broadcast":`رفع وبث`,Help:`مساعدة`,"Reload Player":`إعادة تحميل المشغل`,"Copy Bundled CLI Path":`نسخ مسار أداة سطر الأوامر المضمنة`,"Developer tools":`أدوات المطور`,Undo:`تراجع`,Redo:`إعادة`,Cut:`قص`,Paste:`لصق`,"Select all":`تحديد الكل`,Status:`الحالة`,"Activity log":`سجل النشاط`,Admin:`الإدارة`,"Playback controls":`عناصر التحكم بالتشغيل`,"Tracks and folders":`المقاطع والمجلدات`,"Original-language captions.":`ترجمة نصية باللغة الأصلية.`,"Skip to playback controls":`الانتقال إلى عناصر التحكم بالتشغيل`,"Skip to playlist":`الانتقال إلى قائمة التشغيل`,"Skip to transcript and translated audio":`الانتقال إلى النص المفرغ والصوت المترجم`};export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=function(e){return`/`+e},t={},n=function(n,r,i){let a=Promise.resolve();if(r&&r.length>0){let n=document.getElementsByTagName(`link`),o=document.querySelector(`meta[property=csp-nonce]`),s=o?.nonce||o?.getAttribute(`nonce`);function c(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function l(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}a=c(r.map(r=>{if(r=e(r,i),r=l(r),r in t)return;t[r]=!0;let a=r.endsWith(`.css`);for(let e=n.length-1;e>=0;e--){let t=n[e];if(t.href===r&&(!a||t.rel===`stylesheet`))return}let o=document.createElement(`link`);if(o.rel=a?`stylesheet`:`modulepreload`,a||(o.as=`script`),o.crossOrigin=``,o.href=r,s&&o.setAttribute(`nonce`,s),document.head.appendChild(o),a)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}))}function o(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return a.then(e=>{for(let t of e||[])t.status===`rejected`&&o(t.reason);return n().catch(o)})};function r(e,t){if(!e||e.length===0||!Number.isFinite(t)||t<=0)return[];let n=new Set,r=e.filter(e=>!!e&&typeof e.title==`string`).map(e=>({start:Math.floor(e.start),title:e.title.trim()})).filter(e=>Number.isFinite(e.start)&&e.start>=0).filter(e=>e.start<t).filter(e=>e.title!==``).sort((e,t)=>e.start-t.start).filter(e=>!n.has(e.start)&&(n.add(e.start),!0));return r.map((e,n)=>({...e,end:r[n+1]?.start??t,position:e.start/t}))}function i(e,t){if(!Number.isFinite(t))return null;let n=null;for(let r of e)if(r.start<=t)n=r;else break;return n}var a=`profullstack.player.prefs`,o=`profullstack.player.positions`,s=60,c={volume:1,muted:!1,rate:1};function l(e){if(e!==void 0)return e;try{return typeof window>`u`?null:window.localStorage}catch{return null}}function u(e,t){if(!e)return null;try{let n=e.getItem(t);return n===null?null:JSON.parse(n)}catch{return null}}function d(e,t,n){if(e)try{e.setItem(t,JSON.stringify(n))}catch{}}function f(e,t,n,r){return typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function p(e){let t=u(l(e),a);return t?{volume:f(t.volume,0,1,c.volume),muted:typeof t.muted==`boolean`?t.muted:c.muted,rate:f(t.rate,.25,4,c.rate)}:{...c}}function m(e,t){d(l(t),a,e)}function h(e){let t=u(e,o);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t)){if(!r||typeof r!=`object`)continue;let t=r;typeof t.t==`number`&&Number.isFinite(t.t)&&(n[e]={t:t.t,d:typeof t.d==`number`&&Number.isFinite(t.d)?t.d:0,at:typeof t.at==`number`&&Number.isFinite(t.at)?t.at:0})}return n}function g(e,t){return h(l(t))[e]??null}function ee(e,t,n,r=Date.now){let i=l(n);if(!i)return;let a=h(i);a[e]={t:t.t,d:t.d,at:r()};let c=Object.entries(a).sort(([,e],[,t])=>t.at-e.at).slice(0,s);d(i,o,Object.fromEntries(c))}function _(e,t){let n=l(t);if(!n)return;let r=h(n);if(!(e in r))return;let i=Object.entries(r).filter(([t])=>t!==e);d(n,o,Object.fromEntries(i))}var v=15,y=20;function b(e,t){return!e||!Number.isFinite(t)||t<=0||Number.isFinite(e.d)&&e.d>0&&Math.abs(e.d-t)>1?!1:e.t>=v&&e.t<=t-y}function x(e){if(!Number.isFinite(e)||e<0)return`--:--`;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${String(n)}:${a(r)}:${a(i)}`:`${String(r)}:${a(i)}`}function S(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();if(t===``)return null;if(t.includes(`:`)){let e=t.split(`:`);if(e.length>3)return null;let n=0;for(let t of e){if(!/^\d+$/.test(t))return null;n=n*60+Number(t)}return n}if(/^\d+s?$/.test(t))return Number(t.replace(`s`,``));let n=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(t);if(!n||n[1]===void 0&&n[2]===void 0&&n[3]===void 0)return null;let r=Number(n[1]??0),i=Number(n[2]??0),a=Number(n[3]??0);return r*3600+i*60+a}function C(e){return!Number.isFinite(e)||e<=0?`0`:String(Math.floor(e))}var w=[[/\bAFT[A-Z0-9]+\b/i,`firetv`],[/\bKF[A-Z]+\b/,`silk`],[/\bSilk\b/i,`silk`],[/\bAndroid TV\b/i,`androidtv`],[/\bGoogleTV\b/i,`googletv`],[/\bTizen\b/i,`tizen`],[/\bWeb0S\b/i,`webos`],[/\bRoku\b/i,`roku`],[/AppleTV/i,`appletv`],[/\bCrKey\b/i,`chromecast`],[/\bSMART-TV\b/i,`smarttv`],[/\bSmartTV\b/i,`smarttv`]];function T(e){if(!e)return null;for(let[t,n]of w)if(t.test(e))return n;return null}function te(e){return T(e)!==null}function ne(e){return e?{hideAfterMs:6e3,seekStep:10,alwaysShowFocus:!0}:{hideAfterMs:2800,seekStep:5,alwaysShowFocus:!1}}var E=[[/\.m3u8$/i,`hls`],[/\.(ts|mts|m2ts|mpegts)$/i,`mpegts`],[/\.(mp3|m4a|aac|oga|ogg|opus|wav|flac)$/i,`audio`],[/\.(mp4|m4v|webm|mov|ogv)$/i,`mp4`]],D=[[/mpegurl/i,`hls`],[/mp2t|mpeg-?ts/i,`mpegts`],[/^audio\//i,`audio`],[/^video\//i,`mp4`]];function O(e){if(e.kind)return e.kind;if(e.mimeType){for(let[t,n]of D)if(t.test(e.mimeType))return n}let t=k(e.src);for(let[e,n]of E)if(e.test(t))return n;return`unknown`}function k(e){try{return new URL(e,`https://placeholder.invalid`).pathname}catch{return e.split(/[?#]/)[0]??e}}function re(e=globalThis,t=null){let n=e.MediaSource!==void 0,r=!1;try{let e=t??(typeof document>`u`?null:document.createElement(`video`));r=e?e.canPlayType(`application/vnd.apple.mpegurl`)!==``||e.canPlayType(`application/x-mpegURL`)!==``:!1}catch{r=!1}return{mediaSource:n,nativeHls:r}}function ie(e,t){let n=O(e);switch(n){case`hls`:return t.mediaSource?{engine:`hls`,kind:n}:t.nativeHls?{engine:`native`,kind:n}:{engine:`native`,kind:n,unplayable:`This browser cannot play HLS streams.`};case`mpegts`:return t.mediaSource?{engine:`mpegts`,kind:n}:{engine:`mpegts`,kind:n,unplayable:`This browser cannot play transport streams.`};default:return{engine:`native`,kind:n}}}function ae(e){return e===`audio`}async function oe(e,t){let r=t.capabilities??re(),i=ie({src:t.src,...t.kind?{kind:t.kind}:{},...t.mimeType?{mimeType:t.mimeType}:{}},r),a=()=>void 0,o={media:e,src:t.src,isTv:t.isTv??!1,live:t.live??i.kind===`mpegts`,onError:t.onError??a,onNotice:t.onNotice??a,...t.headers?{headers:t.headers}:{},...t.onReady?{onReady:t.onReady}:{}};if(i.unplayable)return t.onError?.(i.unplayable),{destroy:a,engine:i.engine,kind:i.kind,levels:()=>[],unplayable:i.unplayable};let s,c=t.engines?.[i.engine];if(c)s=await c(o);else if(i.engine===`hls`){let{createHlsEngine:e}=await n(async()=>{let{createHlsEngine:e}=await import(`./hls-OR5FY6YP-B-70I17r.js`);return{createHlsEngine:e}},[]);s=await e(o)}else if(i.engine===`mpegts`){let{createMpegtsEngine:e}=await n(async()=>{let{createMpegtsEngine:e}=await import(`./mpegts-7CN75AI2-D-bdbDNw.js`);return{createMpegtsEngine:e}},[]);s=await e(o,{withCredentials:t.withCredentials??!1,unplayableAdvice:t.unplayableAdvice??``})}else{let{createNativeEngine:e}=await n(async()=>{let{createNativeEngine:e}=await import(`./native-C7JTKWJH-BUyIoj0P.js`);return{createNativeEngine:e}},[]);s=await e(o)}return{destroy:()=>{s.destroy()},engine:i.engine,kind:i.kind,levels:s.levels,...s.setLevel?{setLevel:s.setLevel}:{},...s.currentLevel?{currentLevel:s.currentLevel}:{}}}var se=300,A=120,ce=.4;function j(e,t,n,r){return n<=0||e===t?(r(t),Promise.resolve()):new Promise(i=>{let a=Date.now(),o=n*1e3,s=()=>{let n=Math.min(1,(Date.now()-a)/o);r(e+(t-e)*n),n<1?setTimeout(s,16):i()};s()})}var M=e=>Math.min(1,Math.max(0,e));function N(e){return e.volume>0?e.volume:1}function le(e){return e&&e.tagName===`VIDEO`?e:null}function P(e){return e?typeof document<`u`&&document.pictureInPictureElement===e||e.webkitPresentationMode===`picture-in-picture`:!1}async function ue(e){let t=e,n=e.requestPictureInPicture;if(typeof n==`function`){await n.call(e);return}if(typeof t.webkitSetPresentationMode==`function`){t.webkitSetPresentationMode(`picture-in-picture`);return}throw Error(`picture-in-picture is not available here`)}var F=/\.(mp3|m4a|aac|ogg|oga|opus|wav|flac)(\?|#|$)/i;function de(e){let t=typeof e==`string`?{url:e}:e;return{url:t.url,kind:t.kind??(F.test(t.url)?`audio`:`video`)}}function fe(e,t,n,r=()=>Date.now()){let i=Math.max(5,n.everySeconds??se)*1e3,a=Math.max(5,n.maxSeconds??A)*1e3,o=Math.max(0,n.fadeSeconds??ce),s=n.revealStage!==!1;function c(){if(!s||typeof window>`u`)return;let t=e.getBoundingClientRect();if(Math.min(t.bottom,window.innerHeight)-Math.max(t.top,0)>=t.height*.6)return;let n=!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;e.scrollIntoView({block:`center`,behavior:n?`smooth`:`auto`})}async function l(e){if(e)try{await ue(e)}catch(e){n.onError?.(e)}}let u=0,d=null,f=0,p=!1,m=!1,h=!n.preroll,g=document.createElement(`div`);g.className=`pux-ad`,g.hidden=!0,Object.assign(g.style,{position:`absolute`,inset:`0`,zIndex:`3`,display:`grid`,placeItems:`center`,background:`#000`});let ee=getComputedStyle(e).position;(!ee||ee===`static`)&&(e.style.position=`relative`);let _=document.createElement(`video`);_.className=`pux-ad__video`,_.playsInline=!0,_.preload=`auto`,Object.assign(_.style,{width:`100%`,height:`100%`,objectFit:`contain`,background:`#000`});let v=document.createElement(`audio`);v.className=`pux-ad__audio`,v.preload=`auto`;let y=_;for(let e of[_,v])e.muted=t.muted,e.volume=N(t);let b=document.createElement(`span`);b.className=`pux-ad__badge`,b.textContent=`Ad`,Object.assign(b.style,{position:`absolute`,top:`0.75rem`,left:`0.75rem`,padding:`0.15rem 0.5rem`,borderRadius:`0.25rem`,background:`rgb(0 0 0 / 0.65)`,color:`#fff`,font:`600 0.75rem/1.4 system-ui, sans-serif`,letterSpacing:`0.04em`,textTransform:`uppercase`});let x=document.createElement(`button`);x.type=`button`,x.className=`pux-ad__skip`,x.hidden=!0,Object.assign(x.style,{position:`absolute`,right:`1rem`,bottom:`1rem`,padding:`0.5rem 0.9rem`,border:`1px solid rgb(255 255 255 / 0.4)`,borderRadius:`0.3rem`,background:`rgb(0 0 0 / 0.6)`,color:`#fff`,font:`500 0.85rem/1 system-ui, sans-serif`,cursor:`pointer`}),g.append(_,v,b,x),e.append(g);function S(){if(m||p)return;let e=r();if(t.paused){d=null;return}d!==null&&(u+=e-d),d=e,u>=i&&C()}async function C(){if(p||m)return;p=!0,u=0,d=null;let r=null;try{r=await n.next()}catch(e){n.onError?.(e)}if(!r||m){p=!1;return}let i=de(r),s=i.url;y=i.kind===`audio`?v:_;let h=f++,ee=!t.paused,b=i.kind!==`audio`&&P(t),S=N(t);await j(S,0,o,e=>{t.volume=M(e)}),t.pause(),y.src=s,y.currentTime=0,y.muted=t.muted,y.volume=0,g.style.opacity=`0`,c(),g.hidden=!1,g.classList.toggle(`pux-ad--audio`,i.kind===`audio`);let C=i.kind===`audio`;g.style.background=C?`rgb(0 0 0 / 0.35)`:`#000`,_.style.display=C?`none`:``,e.classList.add(`pux-player--ad`),n.onBreakStart?.({url:s,index:h});let w=!1,T=e=>{p&&(w=e,j(1,0,o,e=>{g.style.opacity=String(e),y.volume=M(S*e)}).then(async()=>{b&&P(y)&&await l(le(t)),te(),n.onBreakEnd?.({url:s,index:h,skipped:w}),!m&&(t.volume=0,ee&&t.play().catch(()=>{}),j(0,S,o,e=>{t.volume=M(e)}))}))};function te(){clearTimeout(O),clearInterval(re),y.removeEventListener(`ended`,ne),y.removeEventListener(`error`,E),x.removeEventListener(`click`,D),y.pause(),y.removeAttribute(`src`),y.load(),g.hidden=!0,g.classList.remove(`pux-ad--audio`),x.hidden=!0,e.classList.remove(`pux-player--ad`),p=!1}let ne=()=>T(!1),E=()=>{n.onError?.(Error(`advert failed to play: ${s}`)),T(!1)},D=()=>T(!0);y.addEventListener(`ended`,ne),y.addEventListener(`error`,E),x.addEventListener(`click`,D);let O=setTimeout(()=>T(!1),a),k=n.skipAfter,re=0;if(typeof k==`number`&&k>=0){let e=k;x.hidden=!1;let t=()=>{let t=Math.ceil(e-y.currentTime);t>0?(x.disabled=!0,x.textContent=`Skip in ${t}`):(x.disabled=!1,x.textContent=`Skip ad`)};t(),re=setInterval(t,250)}try{await y.play(),b&&await l(y),await j(0,1,o,e=>{g.style.opacity=String(e),y.volume=M(S*e)})}catch(e){n.onError?.(e),t.volume=M(S),T(!1)}}let w=()=>S(),T=()=>{d=r(),h||(h=!0,C())},te=()=>{S(),d=null},ne=()=>{for(let e of[_,v])e.muted=t.muted,e.volume=N(t)};return t.addEventListener(`timeupdate`,w),t.addEventListener(`play`,T),t.addEventListener(`pause`,te),t.addEventListener(`volumechange`,ne),{play(){return C()},destroy(){m=!0,P(y)&&l(le(t)),t.removeEventListener(`timeupdate`,w),t.removeEventListener(`play`,T),t.removeEventListener(`pause`,te),t.removeEventListener(`volumechange`,ne),_.pause(),v.pause(),g.remove()},get playing(){return p}}}var pe=[1,1.25,1.5,1.75,2,.75],me=5e3,I=10,L={play:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>`,pause:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 5h4v14H6zM14 5h4v14h-4z"/></svg>`,replay:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5V1L7 6l5 5V7a6 6 0 1 1-6 6H4a8 8 0 1 0 8-8z"/></svg>`,back10:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5V1L7 6l5 5V7a6 6 0 1 1-6 6H4a8 8 0 1 0 8-8z"/><text x="12" y="17" font-size="8" text-anchor="middle" fill="currentColor">10</text></svg>`,fwd10:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5V1l5 5-5 5V7a6 6 0 1 0 6 6h2a8 8 0 1 1-8-8z"/><text x="12" y="17" font-size="8" text-anchor="middle" fill="currentColor">10</text></svg>`,volume:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4z"/></svg>`,muted:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M15 9l6 6m0-6l-6 6" stroke="currentColor" stroke-width="2" fill="none"/></svg>`,pip:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 5h18v14H3z" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 12h7v5h-7z"/></svg>`,link:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 16a4 4 0 0 1 0-5.7l2-2a4 4 0 0 1 5.7 5.7l-1 1-1.4-1.4 1-1a2 2 0 0 0-2.9-2.9l-2 2A2 2 0 0 0 9.4 14.6L8 16z"/><path d="M16 8a4 4 0 0 1 0 5.7l-2 2A4 4 0 0 1 8.3 10l1-1 1.4 1.4-1 1a2 2 0 0 0 2.9 2.9l2-2A2 2 0 0 0 14.6 9.4L16 8z"/></svg>`,enterFullscreen:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9V4h5v2H6v3H4zm11-5h5v5h-2V6h-3V4zM4 15h2v3h3v2H4v-5zm14 0h2v5h-5v-2h3v-3z"/></svg>`,exitFullscreen:`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 4v3H6v2H4V4h5zm6 0h5v5h-2V7h-3V4zM4 15h2v3h3v2H4v-5zm14 3v-3h2v5h-5v-2h3z"/></svg>`};function R(e,t,n={}){let r=document.createElement(e);r.className=t;for(let[e,t]of Object.entries(n))r.setAttribute(e,t);return r}function z(e,t,n,r){let i=R(`button`,e,{type:`button`,"aria-label":t,title:t,"data-control":r});return i.innerHTML=n,i}function he(e){let t=e.error,n=t?.message??``;if(/URL safety check/i.test(n))return`This was blocked before it could load. That is a configuration problem on our side, not on yours — please report it.`;switch(t?.code){case 1:return`Playback was stopped before it started.`;case 2:return`The connection dropped while loading. Check your network and try again.`;case 3:return`This could not be decoded by your browser.`;case 4:return`This is missing, or in a format your browser cannot play.`;default:return`This could not be played.`}}function ge(e,t){let{src:n,mediaId:a,startAt:o=null,shareUrl:s=null,storage:l,now:u=Date.now,userAgent:d=typeof navigator>`u`?``:navigator.userAgent}=t,f=te(d),h=ne(f),v=t.capabilities??re(),y=ie({src:n,...t.kind?{kind:t.kind}:{},...t.mimeType?{mimeType:t.mimeType}:{}},v),S=t.audio??(typeof HTMLAudioElement<`u`&&t.media instanceof HTMLAudioElement||ae(y.kind)),C=t.live??y.kind===`mpegts`,w=t.media??document.createElement(S?`audio`:`video`);t.media||e.append(w),!S&&t.poster&&w instanceof HTMLVideoElement&&(w.poster=t.poster),w instanceof HTMLVideoElement&&(w.playsInline=!0),w.controls=!1,e.classList.add(`pux-player`),f&&e.classList.add(`pux-player--tv`),S&&e.classList.add(`pux-player--audio`),e.hasAttribute(`tabindex`)||e.setAttribute(`tabindex`,`0`);let T=z(`pux-player__overlay`,`Play`,L.play,`overlay`),E=R(`div`,`pux-player__spinner`,{"aria-hidden":`true`}),D=R(`div`,`pux-player__notice`,{role:`status`,"aria-live":`polite`});D.hidden=!0;let O=R(`span`,`pux-player__notice-text`),k=R(`button`,`pux-player__notice-action`,{type:`button`});k.hidden=!0,D.append(O,k);let se=R(`div`,`pux-player__bar`),A=R(`div`,`pux-player__scrub`,{role:`slider`,tabindex:`0`,"aria-label":`Seek`,"aria-valuemin":`0`,"aria-valuenow":`0`}),ce=R(`div`,`pux-player__track`),j=R(`div`,`pux-player__buffered`),M=R(`div`,`pux-player__played`),N=R(`div`,`pux-player__marks`,{"aria-hidden":`true`}),le=R(`div`,`pux-player__handle`,{"aria-hidden":`true`}),P=R(`div`,`pux-player__tooltip`,{"aria-hidden":`true`});ce.append(j,M,N,le),A.append(ce,P);let ue=R(`div`,`pux-player__row`),F=z(`pux-player__btn`,`Play`,L.play,`play`),de=z(`pux-player__btn`,`Back ${String(I)} seconds`,L.back10,`back`),ge=z(`pux-player__btn`,`Forward ${String(I)} seconds`,L.fwd10,`forward`),_e=R(`div`,`pux-player__volume`),B=z(`pux-player__btn`,`Mute`,L.volume,`mute`),V=R(`input`,`pux-player__volume-input`,{type:`range`,min:`0`,max:`1`,step:`0.05`,"aria-label":`Volume`,"data-control":`volume`});_e.append(B,V);let ve=R(`div`,`pux-player__live`,{"data-control":`live`});ve.textContent=`LIVE`;let ye=R(`div`,`pux-player__time`),be=R(`div`,`pux-player__chapter`),xe=R(`div`,`pux-player__spacer`),H=R(`button`,`pux-player__btn pux-player__btn--text`,{type:`button`,"aria-label":`Playback speed`,title:`Playback speed`,"data-control":`rate`}),U=R(`button`,`pux-player__btn pux-player__btn--text`,{type:`button`,"aria-label":`Quality`,title:`Quality`,"data-control":`quality`});U.hidden=!0;let Se=z(`pux-player__btn`,`Copy link at this time`,L.link,`share`),W=z(`pux-player__btn`,`Picture in picture`,L.pip,`pip`),G=z(`pux-player__btn`,`Fullscreen`,L.enterFullscreen,`fullscreen`);ue.append(F,de,ge,_e,ve,ye,be,xe,H,U,Se,W,G),se.append(A,ue),e.append(T,E,D,se),f&&(V.hidden=!0,W.hidden=!0),S&&(G.hidden=!0,W.hidden=!0,T.hidden=!0),s||(Se.hidden=!0),(typeof document>`u`||!document.pictureInPictureEnabled)&&(W.hidden=!0);let Ce=[],we=t.chapters??[],Te=[],K=null,q=null,Ee=0,De=!1,Oe=!1,J=null,ke=[];function Y(e,t,n,r){e.addEventListener(t,n,r),Te.push(()=>e.removeEventListener(t,n,r))}function X(e,t){O.textContent=e,D.hidden=!1,q&&clearTimeout(q),t?(k.hidden=!1,k.textContent=t.label,k.onclick=()=>{t.run(),Ae()}):(k.hidden=!0,k.onclick=null),q=setTimeout(Ae,t?9e3:4e3)}function Ae(){D.hidden=!0,k.onclick=null}function je(){e.classList.toggle(`pux-player--live`,C),A.hidden=C,de.hidden=C,ge.hidden=C,H.hidden=C,Se.hidden=C||!s,ve.hidden=!C,ye.hidden=C,be.hidden=C}function Me(){N.replaceChildren();for(let e of Ce){let t=R(`button`,`pux-player__mark`,{type:`button`,"aria-label":`${e.title}, ${x(e.start)}`,title:e.title});t.style.left=`${String(e.position*100)}%`,t.addEventListener(`click`,t=>{t.stopPropagation(),w.currentTime=e.start}),N.append(t)}}function Ne(){Ce=C?[]:r(we,w.duration),Me(),Z()}function Z(){if(C)return;let e=w.duration,t=w.currentTime,n=Number.isFinite(e)&&e>0,r=n?Math.min(1,Math.max(0,t/e)):0;if(M.style.width=`${String(r*100)}%`,le.style.left=`${String(r*100)}%`,w.buffered.length>0&&n){let n=0;for(let e=0;e<w.buffered.length;e+=1)if(w.buffered.start(e)<=t&&w.buffered.end(e)>=t){n=w.buffered.end(e);break}j.style.width=`${String(Math.min(1,n/e)*100)}%`}ye.textContent=`${x(t)} / ${x(e)}`,A.setAttribute(`aria-valuenow`,String(Math.floor(t))),n&&A.setAttribute(`aria-valuemax`,String(Math.floor(e))),A.setAttribute(`aria-valuetext`,n?`${x(t)} of ${x(e)}`:x(t));let a=i(Ce,t);be.textContent=a?a.title:``}function Pe(){let t=!w.paused&&!w.ended,n=w.ended,r=n?L.replay:t?L.pause:L.play,i=n?`Play again`:t?`Pause`:`Play`;F.innerHTML=r,F.setAttribute(`aria-label`,i),F.title=i,T.innerHTML=r,T.setAttribute(`aria-label`,i),e.classList.toggle(`pux-player--playing`,t),e.classList.toggle(`pux-player--ended`,n),t||Q(!1)}function Fe(){let e=w.muted||w.volume===0;B.innerHTML=e?L.muted:L.volume,B.setAttribute(`aria-label`,e?`Unmute`:`Mute`),B.setAttribute(`aria-pressed`,e?`true`:`false`),V.value=String(e?0:w.volume)}function Ie(){H.textContent=`${String(w.playbackRate)}\xD7`,H.setAttribute(`aria-label`,`Playback speed, ${String(w.playbackRate)} times`)}function Le(){if(U.hidden=ke.length<2||!J?.setLevel,U.hidden)return;let e=J?.currentLevel?.()??-1,t=ke.find(t=>t.index===e);U.textContent=e===-1?`Auto`:t?.label??`Auto`}function Q(t=!0){e.classList.add(`pux-player--controls`),K&&clearTimeout(K),t&&(K=setTimeout(()=>{w.paused||e.classList.remove(`pux-player--controls`)},h.hideAfterMs))}function Re(){Ye?.playing||(w.paused||w.ended?w.play().catch(()=>void 0):w.pause())}function $(e){if(C)return;let t=Number.isFinite(w.duration)?w.duration:1/0;w.currentTime=Math.min(t,Math.max(0,w.currentTime+e)),Z(),Q()}function ze(e){C||!Number.isFinite(w.duration)||w.duration<=0||(w.currentTime=Math.min(1,Math.max(0,e))*w.duration,Z())}function Be(e){let t=ce.getBoundingClientRect();return t.width===0?0:(e-t.left)/t.width}function Ve(e){let t=pe[(pe.indexOf(w.playbackRate)+e+pe.length)%pe.length]??1;w.playbackRate=t}function He(){if(!J?.setLevel)return;let e=[-1,...ke.map(e=>e.index)],t=J.currentLevel?.()??-1,n=e[(e.indexOf(t)+1)%e.length]??-1;J.setLevel(n),Le(),Q()}async function Ue(){try{if(document.fullscreenElement){await document.exitFullscreen();return}await e.requestFullscreen()}catch{w.webkitEnterFullscreen?.()}}async function We(){try{document.pictureInPictureElement?await document.exitPictureInPicture():w instanceof HTMLVideoElement&&await w.requestPictureInPicture()}catch{X(`Picture in picture is not available here.`)}}async function Ge(){if(!s)return;let e=Math.floor(w.currentTime),t=s(e);try{await navigator.clipboard.writeText(t),X(`Link copied, starting at ${x(e)}.`)}catch{X(t)}}Y(w,`loadedmetadata`,()=>{if(Ne(),Z(),C)return;let e=typeof o==`number`&&o>0?o:null;if(e!==null&&Number.isFinite(w.duration)&&e<w.duration){w.currentTime=e;return}if(!a)return;let t=g(a,l);b(t,w.duration)&&t&&(w.currentTime=t.t,X(`Resumed at ${x(t.t)}.`,{label:`Start over`,run:()=>{w.currentTime=0,_(a,l)}}))});function Ke(){!C&&a&&Number.isFinite(w.duration)&&w.duration>0&&!w.ended&&ee(a,{t:w.currentTime,d:w.duration},l,u)}Y(w,`timeupdate`,()=>{De||Z(),!(u()-Ee<me)&&(Ee=u(),Ke())}),Y(w,`progress`,Z),Y(w,`seeked`,Z),Y(w,`seeking`,Z),Y(w,`durationchange`,Ne),Y(w,`play`,Pe),Y(w,`pause`,()=>{Pe(),Ke()}),Y(w,`ended`,()=>{Pe(),a&&_(a,l)}),Y(w,`volumechange`,()=>{Fe(),m({volume:w.volume,muted:w.muted,rate:w.playbackRate},l)}),Y(w,`ratechange`,()=>{Ie(),m({volume:w.volume,muted:w.muted,rate:w.playbackRate},l)}),Y(w,`waiting`,()=>e.classList.add(`pux-player--buffering`)),Y(w,`playing`,()=>e.classList.remove(`pux-player--buffering`)),Y(w,`canplay`,()=>e.classList.remove(`pux-player--buffering`)),Y(w,`error`,()=>{e.classList.remove(`pux-player--buffering`),e.classList.add(`pux-player--failed`),X(he(w))}),Y(T,`click`,Re),Y(F,`click`,Re),Y(de,`click`,()=>{$(-I)}),Y(ge,`click`,()=>{$(I)}),Y(B,`click`,()=>{w.muted=!w.muted}),Y(V,`input`,()=>{w.volume=Number(V.value),w.muted=Number(V.value)===0}),Y(H,`click`,()=>{Ve(1)}),Y(U,`click`,He),Y(Se,`click`,()=>void Ge()),Y(W,`click`,()=>void We()),Y(G,`click`,()=>void Ue()),Y(document,`fullscreenchange`,()=>{let t=document.fullscreenElement===e;e.classList.toggle(`pux-player--fullscreen`,t),G.innerHTML=t?L.exitFullscreen:L.enterFullscreen,G.setAttribute(`aria-label`,t?`Exit fullscreen`:`Fullscreen`)}),Y(A,`pointerdown`,e=>{let t=e;De=!0,A.setPointerCapture(t.pointerId),ze(Be(t.clientX))}),Y(A,`pointermove`,e=>{let t=Be(e.clientX);Number.isFinite(w.duration)&&w.duration>0&&(P.textContent=x(Math.max(0,Math.min(1,t))*w.duration),P.style.left=`${String(Math.max(0,Math.min(1,t))*100)}%`),De&&ze(t)});let qe=e=>{if(!De)return;De=!1;let t=e;A.hasPointerCapture(t.pointerId)&&A.releasePointerCapture(t.pointerId)};Y(A,`pointerup`,qe),Y(A,`pointercancel`,qe),Y(e,`pointermove`,()=>{Q()}),Y(e,`pointerleave`,()=>{w.paused||e.classList.remove(`pux-player--controls`)}),Y(e,`focusin`,()=>{Q()}),Y(e,`keydown`,e=>{let t=e.key,n=e.target,r=n?ue.contains(n):!1;if(!(r&&[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(t)))switch(t){case` `:case`k`:case`Enter`:if(t===`Enter`&&n?.closest(`button`))return;e.preventDefault(),Re();break;case`ArrowLeft`:e.preventDefault(),$(-h.seekStep);break;case`ArrowRight`:e.preventDefault(),$(h.seekStep);break;case`j`:$(-I);break;case`l`:$(I);break;case`ArrowUp`:e.preventDefault(),w.volume=Math.min(1,w.volume+.1),w.muted=!1,Q();break;case`ArrowDown`:e.preventDefault(),w.volume=Math.max(0,w.volume-.1),Q();break;case`m`:w.muted=!w.muted,Q();break;case`f`:G.hidden||Ue();break;case`p`:W.hidden||We();break;case`Home`:e.preventDefault(),C||(w.currentTime=0);break;case`End`:e.preventDefault(),!C&&Number.isFinite(w.duration)&&(w.currentTime=w.duration);break;case`<`:case`,`:C||(Ve(-1),Q());break;case`>`:case`.`:C||(Ve(1),Q());break;default:/^[0-9]$/.test(t)&&!r&&!C&&(e.preventDefault(),ze(Number(t)/10))}}),Y(window,`pagehide`,Ke);let Je=p(l);w.volume=Je.volume,w.muted=t.autoplay?!0:Je.muted,w.playbackRate=Je.rate===0?c.rate:Je.rate,je(),Pe(),Fe(),Ie(),Z(),Ne(),Q(!1),y.unplayable&&(e.classList.add(`pux-player--failed`),X(y.unplayable));let Ye=t.ads?fe(e,w,t.ads,u):null,Xe=Ze();async function Ze(){if(!y.unplayable)try{let r=await oe(w,{src:n,...t.kind?{kind:t.kind}:{},...t.mimeType?{mimeType:t.mimeType}:{},live:C,isTv:f,capabilities:v,withCredentials:t.withCredentials??!1,...t.headers?{headers:t.headers}:{},unplayableAdvice:t.unplayableAdvice??``,...t.engines?{engines:t.engines}:{},onError:t=>{e.classList.add(`pux-player--failed`),X(t)},onNotice:e=>{e===null?Ae():X(e)},onReady:e=>{Oe||(e.live!==C&&(C=e.live,je(),Ne()),ke=e.levels,Le())}});if(J=r,Oe){r.destroy(),J=null;return}Le(),t.autoplay&&w.play().catch(()=>void 0)}catch{e.classList.add(`pux-player--failed`),X(`The player could not be loaded. Please reload the page.`)}}return{media:w,destroy(){if(!Oe){Oe=!0,Ke(),Ye?.destroy(),K&&clearTimeout(K),q&&clearTimeout(q);for(let e of Te)e();Xe.then(()=>{J?.destroy(),J=null}),T.remove(),E.remove(),D.remove(),se.remove(),t.media||w.remove(),e.classList.remove(`pux-player`,`pux-player--tv`,`pux-player--audio`,`pux-player--live`,`pux-player--controls`,`pux-player--playing`,`pux-player--ended`,`pux-player--buffering`,`pux-player--failed`,`pux-player--fullscreen`)}},setChapters(e){we=e,Ne()}}}export{x as a,n as c,O as i,oe as n,C as o,ge as r,S as s,fe as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./main-
|
|
1
|
+
import{t as e}from"./main-BMYkP1N_.js";var t={...e,"No parties live right now.":`Právě neprobíhají žádné párty.`,"Could not refresh parties.":`Párty se nepodařilo aktualizovat.`,"Pick a server in the directory, or paste its link here.":`Vyberte server v seznamu nebo sem vložte jeho odkaz.`,"Interface language":`Jazyk rozhraní`,Language:`Jazyk`,"Translation language":`Jazyk překladu`,"Original (auto-detect)":`Původní (automatické rozpoznání)`,Play:`Přehrát`,Pause:`Pozastavit`,Stop:`Zastavit`,Next:`Další`,Previous:`Předchozí`,Select:`Vybrat`,"Next/Prev":`Další/Předchozí`,Quit:`Ukončit`,"Now Playing":`Právě hraje`,"Spectrum Analyser":`Spektrální analyzátor`,Playlist:`Seznam skladeb`,Files:`Soubory`,"Open files":`Otevřít soubory`,"Open folder":`Otevřít složku`,"Add to library":`Přidat do knihovny`,"Replace playlist":`Nahradit seznam`,Filter:`Filtrovat`,Search:`Hledat`,"Nothing loaded.":`Nic není načteno.`,"Empty.":`Prázdné.`,"Loading…":`Načítání…`,"Connecting…":`Připojování…`,Connected:`Připojeno`,"Not connected":`Nepřipojeno`,"No source":`Žádný zdroj`,Playing:`Přehrávání`,Stopped:`Zastaveno`,Volume:`Hlasitost`,Seek:`Pozice přehrávání`,"Full screen":`Celá obrazovka`,Download:`Stáhnout`,Share:`Sdílet`,Copy:`Kopírovat`,"Copy link":`Kopírovat odkaz`,Copied:`Zkopírováno`,Save:`Uložit`,Cancel:`Zrušit`,Close:`Zavřít`,Remove:`Odebrat`,Delete:`Smazat`,Edit:`Upravit`,Add:`Přidat`,Send:`Odeslat`,Retry:`Zkusit znovu`,Back:`Zpět`,"Next page":`Další stránka`,"Previous page":`Předchozí stránka`,"Show more":`Zobrazit více`,Panels:`Panely`,"Reset layout":`Obnovit rozložení`,Show:`Zobrazit`,Hide:`Skrýt`,Collapse:`Sbalit`,Expand:`Rozbalit`,"Move up":`Nahoru`,"Move down":`Dolů`,Install:`Nainstalovat`,"TV mode":`Režim TV`,On:`Zapnuto`,Off:`Vypnuto`,Account:`Účet`,"Sign in":`Přihlásit se`,"Sign out":`Odhlásit se`,"Create account":`Vytvořit účet`,Email:`E-mail`,Password:`Heslo`,"Forgot password?":`Zapomenuté heslo?`,"Welcome back":`Vítejte zpět`,Profile:`Profil`,Handle:`Uživatelské jméno`,"Your servers":`Vaše servery`,Server:`Server`,Connect:`Připojit`,Disconnect:`Odpojit`,Directory:`Adresář`,Favourites:`Oblíbené`,Follow:`Sledovat`,Unfollow:`Přestat sledovat`,Notifications:`Oznámení`,"Phone number":`Telefonní číslo`,"Save number":`Uložit číslo`,Transcript:`Přepis`,Captions:`Titulky`,"Translate audio":`Překládat zvuk`,"Audio language":`Jazyk zvuku`,"Audio options":`Možnosti zvuku`,"Keep background sound":`Zachovat zvuk na pozadí`,"Background level":`Hlasitost pozadí`,"Speaker voices":`Hlasy mluvčích`,"Any voice":`Libovolný hlas`,"Male voice":`Mužský hlas`,"Female voice":`Ženský hlas`,"Original audio.":`Původní zvuk.`,"Buy translated audio":`Koupit překlad zvuku`,"Audio credit":`Zvukový kredit`,"Buy pass":`Koupit přístup`,Pass:`Přístup`,"Pay with":`Zaplatit pomocí`,"Check payment":`Ověřit platbu`,"Open checkout":`Přejít k platbě`,"Free sessions":`Bezplatné relace`,"Usage rates and expiry":`Ceny a platnost`,Catalogs:`Katalogy`,"Add catalog":`Přidat katalog`,"Catalog name":`Název katalogu`,Link:`Odkaz`,"Play link":`Přehrát odkaz`,"Go live":`Vysílat živě`,Publish:`Zveřejnit`,Listen:`Poslouchat`,"Live now":`Právě živě`,Upcoming:`Připravované`,Parties:`Společná sledování`,"Join party":`Připojit se ke sledování`,"Invite code":`Kód pozvánky`,Invite:`Pozvat`,Chat:`Chat`,"Chat message":`Zpráva chatu`,People:`Lidé`,Speaker:`Mluvčí`,Speakers:`Mluvčí`,Listener:`Posluchač`,Moderator:`Moderátor`,"Raise hand":`Zvednout ruku`,"Hand raises":`Zvednuté ruce`,Questions:`Otázky`,Resources:`Materiály`,Replay:`Záznam`,Schedule:`Rozvrh`,Event:`Událost`,Host:`Pořadatel`,About:`O události`,Stage:`Pódium`,Title:`Název`,Description:`Popis`,Topic:`Téma`,Public:`Veřejné`,"Anyone with the link":`Kdokoli s odkazem`,"Invited people":`Pozvané osoby`,"Who can join":`Kdo se může připojit`,"Date and time":`Datum a čas`,"Expected length":`Očekávaná délka`,Repeat:`Opakovat`,"Does not repeat":`Neopakuje se`,"Every day":`Každý den`,"Every week":`Každý týden`,Homepage:`Webové stránky`,"Host name":`Jméno pořadatele`,"Profile photo URL":`URL profilové fotky`,"Broadcast link":`Odkaz na vysílání`,"Edit event":`Upravit událost`,"Save changes":`Uložit změny`,"Create live":`Vytvořit vysílání`,"Schedule class":`Naplánovat lekci`,"Start class":`Zahájit lekci`,"End event":`Ukončit událost`,"End session":`Ukončit relaci`,"Session ended":`Relace ukončena`,"Event ended":`Událost ukončena`,Cancelled:`Zrušeno`,"Replay available":`Záznam je k dispozici`,Join:`Připojit se`,"Create invite":`Vytvořit pozvánku`,"Invite as":`Pozvat jako`,"Watch now":`Sledovat nyní`,"Start a room":`Vytvořit místnost`,"Recent replays":`Nedávné záznamy`,"Your account":`Váš účet`,"Write with AI":`Psát pomocí AI`,"Suggested title":`Navrhovaný název`,"Suggested description":`Navrhovaný popis`,"Suggested topic":`Navrhované téma`,"Use these details":`Použít tyto údaje`,"Learn something live.":`Učte se naživo.`,"Screen share":`Sdílet obrazovku`,"Upload and broadcast":`Nahrát a vysílat`,Help:`Nápověda`,"Reload Player":`Znovu načíst přehrávač`,"Copy Bundled CLI Path":`Kopírovat cestu k přibalenému CLI`,"Developer tools":`Vývojářské nástroje`,Undo:`Zpět`,Redo:`Znovu`,Cut:`Vyjmout`,Paste:`Vložit`,"Select all":`Vybrat vše`,Status:`Stav`,"Activity log":`Protokol aktivit`,Admin:`Správa`,"Playback controls":`Ovládání přehrávání`,"Tracks and folders":`Skladby a složky`,"Original-language captions.":`Titulky v původním jazyce.`,"Skip to playback controls":`Přejít k ovládání přehrávání`,"Skip to playlist":`Přejít k seznamu skladeb`,"Skip to transcript and translated audio":`Přejít k přepisu a přeloženému zvuku`};export{t as default};
|