nixamp 0.58.0 → 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.
Files changed (69) hide show
  1. package/dist/ai-label.d.ts +6 -0
  2. package/dist/ai-label.js +1 -0
  3. package/dist/channels.d.ts +20 -0
  4. package/dist/channels.js +38 -0
  5. package/dist/follow-page.js +1 -1
  6. package/dist/label-routes.js +3 -1
  7. package/dist/music-hub.d.ts +97 -0
  8. package/dist/music-hub.js +215 -0
  9. package/dist/music-store.d.ts +2 -0
  10. package/dist/music-store.js +4 -2
  11. package/dist/radio-pages.js +1 -1
  12. package/dist/server.d.ts +9 -0
  13. package/dist/server.js +92 -6
  14. package/dist/station-routes.d.ts +9 -1
  15. package/dist/station-routes.js +63 -3
  16. package/dist/store-routes.js +5 -4
  17. package/package.json +1 -1
  18. package/src/ai-label.ts +3 -0
  19. package/src/channels.ts +43 -0
  20. package/src/follow-page.ts +1 -1
  21. package/src/label-routes.ts +3 -1
  22. package/src/music-hub.ts +210 -0
  23. package/src/music-store.ts +6 -2
  24. package/src/radio-pages.ts +1 -1
  25. package/src/server.ts +85 -6
  26. package/src/station-routes.ts +69 -4
  27. package/src/store-routes.ts +5 -4
  28. package/web/dist/assets/{ar-C8G_vLmh.js → ar-BGz59p0i.js} +1 -1
  29. package/web/dist/assets/chunk-Q2XQMA4B-BaoaSqsD.js +1 -0
  30. package/web/dist/assets/{cs-7bYMjFS2.js → cs-DKsmGQfn.js} +1 -1
  31. package/web/dist/assets/{da-DHY5Csp_.js → da-VBBFYTgq.js} +1 -1
  32. package/web/dist/assets/{de-YNBoxnLa.js → de-DocjfCJV.js} +1 -1
  33. package/web/dist/assets/{es-9F9kBzzh.js → es-ScAWdKuT.js} +1 -1
  34. package/web/dist/assets/{fi-BqpzsfBb.js → fi-BCjOujwG.js} +1 -1
  35. package/web/dist/assets/{fr-BKQXRwFk.js → fr-EO9zGot_.js} +1 -1
  36. package/web/dist/assets/{hi-CGNIGyR-.js → hi-DOv37S1y.js} +1 -1
  37. package/web/dist/assets/{hls-OR5FY6YP-CxI-FwpW.js → hls-OR5FY6YP-B-70I17r.js} +1 -1
  38. package/web/dist/assets/{hu-anYPYX8d.js → hu-BMxwsXKm.js} +1 -1
  39. package/web/dist/assets/{id-BW3GasRn.js → id-DDfdVuoK.js} +1 -1
  40. package/web/dist/assets/{it-C7w2DZ3R.js → it-BbbFjt9-.js} +1 -1
  41. package/web/dist/assets/{main-YkIgU0VD.js → main-BMYkP1N_.js} +2 -2
  42. package/web/dist/assets/modulepreload-polyfill-P2Xu9kJm.js +1 -0
  43. package/web/dist/assets/{mpegts-7CN75AI2-D-6xFZI-.js → mpegts-7CN75AI2-D-bdbDNw.js} +1 -1
  44. package/web/dist/assets/{mpegts-D2ZKeEby.js → mpegts-C_-pZIIG.js} +1 -1
  45. package/web/dist/assets/music-CmI2KJ1Y.js +1 -0
  46. package/web/dist/assets/music-jouma3VD.css +1 -0
  47. package/web/dist/assets/{nl-BNrkTQI2.js → nl-CO-MkYd-.js} +1 -1
  48. package/web/dist/assets/radio-DmVc3wpH.js +1 -0
  49. package/web/dist/assets/{ru-CnKOo1uk.js → ru-C48YQfIR.js} +1 -1
  50. package/web/dist/assets/{station-CSnjPeod.css → station-6b_smJHe.css} +1 -1
  51. package/web/dist/assets/station-DtY1LOm5.js +3 -0
  52. package/web/dist/assets/{sv-BsknKdtx.js → sv--HR26-tY.js} +1 -1
  53. package/web/dist/assets/{uk-u_igTh6D.js → uk-p55LkwrK.js} +1 -1
  54. package/web/dist/assets/{vi-DH0ApTua.js → vi-DPS8isVc.js} +1 -1
  55. package/web/dist/assets/vod-BzQvQVLd.js +1 -0
  56. package/web/dist/assets/watch-B9LW8D1C.js +1 -0
  57. package/web/dist/assets/{zh-Bcnk2nIV.js → zh-Dw9Ji9b2.js} +1 -1
  58. package/web/dist/index.html +4 -3
  59. package/web/dist/music.html +43 -0
  60. package/web/dist/radio.html +3 -2
  61. package/web/dist/station.html +4 -3
  62. package/web/dist/sw.js +32 -29
  63. package/web/dist/vod.html +4 -3
  64. package/web/dist/watch.html +4 -3
  65. package/web/dist/assets/chunk-Q2XQMA4B-PTuZPMen.js +0 -1
  66. package/web/dist/assets/radio-DV3h4YZS.js +0 -1
  67. package/web/dist/assets/station-M7G4NiE3.js +0 -3
  68. package/web/dist/assets/vod-Br9Ooz6-.js +0 -1
  69. package/web/dist/assets/watch-Brz-RgjN.js +0 -1
@@ -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
+ }
@@ -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
- const server = serverBase(input["server"]);
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}/radio#music, to play or download again.`,
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
  }
@@ -24,7 +24,7 @@ import type { Station } from "./stations.ts";
24
24
  import { albumSlug, artistSlug, stationSlug } from "./radio-slug.ts";
25
25
 
26
26
  /** A station's own paths, as the station link opens them. */
27
- export const RADIO_SUB = /^\/radio\/([a-z0-9-]{1,60})\/(stream|state|listen\.m3u|events|now|art|lyrics)$/;
27
+ export const RADIO_SUB = /^\/radio\/([a-z0-9-]{1,60})\/(stream|state|listen\.m3u|events|now|art|lyrics|clock)$/;
28
28
  export const RADIO_STATION = /^\/radio\/([a-z0-9-]{1,60})\/?$/;
29
29
  export const RADIO_ARTIST = /^\/radio\/artist\/([a-z0-9-]{1,90})\/?$/;
30
30
  export const RADIO_ALBUM = /^\/radio\/album\/([a-z0-9-]{1,100})(\/cover\.jpg)?\/?$/;
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=${encodeURIComponent(here)}&` : ""));
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
- const listed = directory ? directory.list().map((one) => peerBase(one.url)).filter(Boolean) : [];
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(listing.ownerId)
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 } : {}),
@@ -13,7 +13,7 @@
13
13
  * reading English.
14
14
  */
15
15
  import type { IncomingMessage, ServerResponse } from "node:http";
16
- import type { Channels } from "./channels.ts";
16
+ import { chunkStart, type Channels } from "./channels.ts";
17
17
  import type { StationRunner } from "./station-runner.ts";
18
18
  import { alertsFor, type Limits, type StationUsage } from "./station-metering.ts";
19
19
  import { aiFromTags, type TrackFacts } from "./track-facts.ts";
@@ -28,7 +28,7 @@ import {
28
28
  } from "./stations.ts";
29
29
 
30
30
  /** The three things a station's link opens. */
31
- const LISTEN = /^\/api\/v1\/stations\/([a-z0-9]{10})\/(stream|state|listen\.m3u|events|now|art|lyrics)$/;
31
+ const LISTEN = /^\/api\/v1\/stations\/([a-z0-9]{10})\/(stream|state|listen\.m3u|events|now|art|lyrics|clock)$/;
32
32
 
33
33
  /** Whether this path is one a station's own link may open, without the server's key. */
34
34
  export function isStationListenPath(path: string): boolean {
@@ -105,6 +105,47 @@ function links(ctx: StationContext, station: Station, base = ctx.base): { page:
105
105
  };
106
106
  }
107
107
 
108
+ /**
109
+ * A listener's clock: where each run of the bytes one connection was sent
110
+ * sits in its channel's byte count. The page asks with its player's
111
+ * currentTime and is told the song and the second it is hearing, exactly,
112
+ * whatever the player has buffered. Keyed by the stream's ?n=.
113
+ */
114
+ interface ListenerClock { runs: Array<{ local: number; global: number }>; local: number; next: number }
115
+ const clocks = new Map<string, ListenerClock>();
116
+ const MAX_CLOCKS = 5000;
117
+ const MAX_RUNS = 500;
118
+
119
+ /** Records a connection's bytes onto its channel's, through the listener it writes to. */
120
+ export function clockedListener<T extends { write(chunk: Buffer): boolean }>(key: string, out: T): T & { forget(): void } {
121
+ const clock: ListenerClock = { runs: [], local: 0, next: -1 };
122
+ if (clocks.size >= MAX_CLOCKS) clocks.delete(clocks.keys().next().value!);
123
+ clocks.set(key, clock);
124
+ return Object.assign(Object.create(out) as T, {
125
+ write: (chunk: Buffer): boolean => {
126
+ const at = chunkStart(chunk);
127
+ // Silence written in a break's place carries no start: it stands for the break's bytes.
128
+ if (at !== undefined && at !== clock.next) {
129
+ clock.runs.push({ local: clock.local, global: at });
130
+ if (clock.runs.length > MAX_RUNS) clock.runs.shift();
131
+ }
132
+ clock.local += chunk.length;
133
+ clock.next = (at ?? clock.next) + chunk.length;
134
+ return out.write(chunk);
135
+ },
136
+ forget: (): void => { if (clocks.get(key) === clock) clocks.delete(key); },
137
+ });
138
+ }
139
+
140
+ /** Which byte of its channel a connection's player is on, `seconds` into what it was sent; null when unknown. */
141
+ export function heardByte(key: string, seconds: number, kbps: number): number | null {
142
+ const clock = clocks.get(key);
143
+ if (!clock || !(seconds >= 0) || kbps <= 0) return null;
144
+ const local = Math.min(clock.local, (seconds * kbps * 1000) / 8);
145
+ const run = clock.runs.findLast((one) => one.local <= local);
146
+ return run ? run.global + (local - run.local) : null;
147
+ }
148
+
108
149
  /** The file on the air now, as the channel's own encoder last reported it. */
109
150
  function nowPlayingFile(ctx: StationContext, station: Station): string {
110
151
  const info = ctx.channels.info(channelOf(station.id));
@@ -331,6 +372,26 @@ export async function handleStations(
331
372
  ctx.json(response, 200, { lyrics: { title: lyrics.title, artist: lyrics.artist, text: lyrics.text, source: lyrics.source, language: lyrics.language, ...(lyrics.synced ? { synced: lyrics.synced } : {}) } });
332
373
  return true;
333
374
  }
375
+ if (what === "clock") {
376
+ // ?n= the stream's nonce, ?ct= the player's currentTime: the song and second being heard.
377
+ const key = `${station.id}:${url.searchParams.get("n") ?? ""}`;
378
+ const byte = heardByte(key, Number(url.searchParams.get("ct")), station.bitrate);
379
+ const place = byte === null ? null : ctx.channels.placeAt(channelOf(station.id), byte);
380
+ if (!place) {
381
+ ctx.json(response, 404, { error: "no clock for that stream", code: "not_found" });
382
+ return true;
383
+ }
384
+ const track = place.file ? (place.tags ?? ctx.trackFor(place.file)) : null;
385
+ const duration = place.file && ctx.durationOf ? ctx.durationOf(place.file) : 0;
386
+ ctx.json(response, 200, {
387
+ station: station.id,
388
+ break: place.file === "",
389
+ position: Math.round(place.position * 1000) / 1000,
390
+ duration: Math.round(duration * 10) / 10,
391
+ nowPlaying: track && (track.title || track.artist) ? { title: track.title, artist: track.artist, album: track.album } : null,
392
+ });
393
+ return true;
394
+ }
334
395
  if (what === "now") {
335
396
  const file = ctx.runner.observed(station.id) === "live" || ctx.runner.observed(station.id) === "recovering" ? nowPlayingFile(ctx, station) : "";
336
397
  ctx.json(response, 200, { station: station.id, facts: file && ctx.facts ? await ctx.facts(station, file).catch(() => null) : null });
@@ -398,9 +459,12 @@ export async function handleStations(
398
459
  pending: (): number => response.writableLength,
399
460
  }
400
461
  : response;
462
+ const nonce = /^[A-Za-z0-9_-]{1,40}$/.test(url.searchParams.get("n") ?? "") ? url.searchParams.get("n")! : "";
463
+ const clocked = nonce && !station.video ? clockedListener(`${station.id}:${nonce}`, metered) : null;
464
+ const out = clocked ?? metered;
401
465
  const detach = spared
402
- ? ctx.channels.listenWithoutBreaks(channelId, metered, station.bitrate, (out) => quietDuringBreaks(out, station.bitrate, () => true))
403
- : ctx.channels.listen(channelId, metered);
466
+ ? ctx.channels.listenWithoutBreaks(channelId, out, station.bitrate, (quiet) => quietDuringBreaks(quiet, station.bitrate, () => true))
467
+ : ctx.channels.listen(channelId, out);
404
468
  if (detach === null) {
405
469
  response.end();
406
470
  return true;
@@ -414,6 +478,7 @@ export async function handleStations(
414
478
  detach();
415
479
  untrack();
416
480
  left?.();
481
+ clocked?.forget();
417
482
  };
418
483
  request.on("close", leave);
419
484
  response.on("close", leave);
@@ -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(`${item.server}/api/v1/label/${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
+ 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="/radio#music">Sign in</a> with the same email to keep everything under My music.`}</small>
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="/radio#music">My music</a>, to play or download.</small></div>`
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-YkIgU0VD.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};
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};