nixamp 0.58.1 → 0.59.1
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 +109 -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 +95 -6
- package/src/store-routes.ts +5 -4
- package/web/dist/assets/{ar-CBn9fObz.js → ar-BUzfqyls.js} +1 -1
- package/web/dist/assets/chunk-Q2XQMA4B-BaoaSqsD.js +1 -0
- package/web/dist/assets/{cs-BvEScz92.js → cs-Cg4JJr06.js} +1 -1
- package/web/dist/assets/{da-uKElVtgi.js → da-Dw-Resfu.js} +1 -1
- package/web/dist/assets/{de-DXEoI1GG.js → de-CZ5dYZwQ.js} +1 -1
- package/web/dist/assets/{es-Q-QEZFh2.js → es-D-dOpAe8.js} +1 -1
- package/web/dist/assets/{fi-ClJkdfXs.js → fi-k22PyB0Z.js} +1 -1
- package/web/dist/assets/{fr-DWmNoP1h.js → fr-DYab0grY.js} +1 -1
- package/web/dist/assets/{hi-DGQOrveg.js → hi-BvC83nQm.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-vUE9gd3q.js} +1 -1
- package/web/dist/assets/{id-D18Cz5RW.js → id-CZk93O-W.js} +1 -1
- package/web/dist/assets/{it-WQxuRjlI.js → it-RH7JO2dG.js} +1 -1
- package/web/dist/assets/{main-cry6C8KD.js → main-DtTNC2wE.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-CuG3UJ3J.js} +1 -1
- package/web/dist/assets/radio-DmVc3wpH.js +1 -0
- package/web/dist/assets/{ru-Cx4tgP1k.js → ru-B2Iki93q.js} +1 -1
- package/web/dist/assets/{station-BzLUgyQ0.js → station-DtY1LOm5.js} +1 -1
- package/web/dist/assets/{sv-f0zj1AdU.js → sv-ChF-PxpS.js} +1 -1
- package/web/dist/assets/{uk-DpGYtFFI.js → uk-kLEkvaMX.js} +1 -1
- package/web/dist/assets/{vi-Cxf7VqJQ.js → vi-CjnMlYos.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-Uq6eryT3.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/dist/store-routes.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { PRICES } from "./music-store.js";
|
|
14
|
+
import { serverId } from "./music-hub.js";
|
|
14
15
|
import { SupportError } from "./support.js";
|
|
15
16
|
const PURCHASE = /^\/purchases\/([0-9a-f-]{36})$/;
|
|
16
17
|
const ONE = /^\/api\/v1\/store\/purchases\/([0-9a-f-]{36})$/;
|
|
@@ -100,7 +101,7 @@ export async function handleStoreRoutes(request, response, path, url, ctx) {
|
|
|
100
101
|
}
|
|
101
102
|
const me = await ctx.account().catch(() => null);
|
|
102
103
|
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`;
|
|
103
|
-
const cover = item.kind === "artist" ? "" : `<img src="${escape(
|
|
104
|
+
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">`;
|
|
104
105
|
html(response, 200, page(`Download ${item.title}`, `<div class="card">${cover}
|
|
105
106
|
<h1>${escape(item.title)}</h1><p class="by">${escape(item.artistName)}</p>
|
|
106
107
|
<div class="price">${price(item.amountCents)}</div>
|
|
@@ -113,8 +114,8 @@ export async function handleStoreRoutes(request, response, path, url, ctx) {
|
|
|
113
114
|
<button id="pay" type="submit">Pay ${price(item.amountCents)} with crypto</button>
|
|
114
115
|
</form>
|
|
115
116
|
<p id="status" role="status" aria-live="polite"></p>
|
|
116
|
-
<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="/
|
|
117
|
-
</div>`, JSON.stringify({ server: item.server, kind: item.kind, artist: item.artist, album: item.album, n: item.n })), method);
|
|
117
|
+
<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>
|
|
118
|
+
</div>`, JSON.stringify({ server: serverId(item.server), kind: item.kind, artist: item.artist, album: item.album, n: item.n })), method);
|
|
118
119
|
return true;
|
|
119
120
|
}
|
|
120
121
|
const receipt = PURCHASE.exec(path);
|
|
@@ -127,7 +128,7 @@ export async function handleStoreRoutes(request, response, path, url, ctx) {
|
|
|
127
128
|
const body = purchase.status === "paid"
|
|
128
129
|
? `<div class="card"><h1>${escape(purchase.title)}</h1><p class="by">${escape(purchase.artistName)} · paid ${price(purchase.amountCents)}</p>
|
|
129
130
|
<a class="go" href="${escape(store.zipUrl(purchase))}" download>Download the zip</a>
|
|
130
|
-
<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="/
|
|
131
|
+
<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>`
|
|
131
132
|
: `<div class="card"><h1>${escape(purchase.title)}</h1><p class="by">${escape(purchase.artistName)} · ${price(purchase.amountCents)} in ${escape(purchase.coin)}</p>
|
|
132
133
|
<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>
|
|
133
134
|
<a class="go" href="https://coinpayportal.com/pay/${escape(purchase.paymentId)}">Open the payment</a></div>`;
|
package/package.json
CHANGED
package/src/ai-label.ts
CHANGED
|
@@ -738,6 +738,8 @@ export interface AiLabelDeps {
|
|
|
738
738
|
storyVideo?: (input: { audio: string; images: string[]; seconds: number; artist: string; title: string; out: string }) => Promise<void>;
|
|
739
739
|
/** A scene's picture for this prompt, or null when nothing can draw one; Workers AI by default. */
|
|
740
740
|
image?: (prompt: string) => Promise<Buffer | null>;
|
|
741
|
+
/** Tells the world an album landed (nixamp.com tells the artist's followers); never awaited. */
|
|
742
|
+
announce?: (release: { artist: string; title: string; kind: "album" | "song" }) => void;
|
|
741
743
|
/** The day's pick (artist, genre, new or not); Math.random by default. */
|
|
742
744
|
random?: () => number;
|
|
743
745
|
now?: () => number;
|
|
@@ -1383,6 +1385,7 @@ export class AiLabel {
|
|
|
1383
1385
|
if (album.songs.every((one) => one.file)) {
|
|
1384
1386
|
album.doneAt = this.now();
|
|
1385
1387
|
this.log(`${artist.name} released "${album.title}"`);
|
|
1388
|
+
this.deps.announce?.({ artist: artist.key, title: album.title, kind: "album" });
|
|
1386
1389
|
void this.ensureProfile(artist).catch(() => undefined);
|
|
1387
1390
|
}
|
|
1388
1391
|
this.save();
|
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());
|
|
@@ -3222,11 +3238,20 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
3222
3238
|
], base, nav));
|
|
3223
3239
|
return;
|
|
3224
3240
|
}
|
|
3241
|
+
// Our label's artists and albums live on nixamp.com/music, where Follow,
|
|
3242
|
+
// Buy and the player are; live.streaming is the public mirror and sends
|
|
3243
|
+
// them there. Anybody else's keep their page here.
|
|
3244
|
+
const onSite = (() => { try { return new URL(storeSite).host === requestHost; } catch { return true; } })();
|
|
3245
|
+
const toMusic = (kind: "artist" | "album", slug: string): void => {
|
|
3246
|
+
response.writeHead(302, { location: `${storeSite}/radio/${kind}/${encodeURIComponent(slug)}`, "cache-control": "public, max-age=300" });
|
|
3247
|
+
response.end();
|
|
3248
|
+
};
|
|
3225
3249
|
const artistPath = RADIO_ARTIST.exec(path);
|
|
3226
3250
|
if (artistPath) {
|
|
3227
3251
|
const catalogue = radioCatalogue();
|
|
3228
3252
|
const artist = catalogue.artists.get(artistPath[1]!);
|
|
3229
3253
|
if (!artist) return send(404, renderMissing("artist", base, nav));
|
|
3254
|
+
if (artist.label && !onSite) return toMusic("artist", artistPath[1]!);
|
|
3230
3255
|
return send(200, renderArtist(catalogue, artist, { base, nav, shop, site: storeSite, stationNames }));
|
|
3231
3256
|
}
|
|
3232
3257
|
const albumPath = RADIO_ALBUM.exec(path);
|
|
@@ -3244,6 +3269,7 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
3244
3269
|
return;
|
|
3245
3270
|
}
|
|
3246
3271
|
if (!album) return send(404, renderMissing("album", base, nav));
|
|
3272
|
+
if (album.label && !onSite) return toMusic("album", albumPath[1]!);
|
|
3247
3273
|
return send(200, renderAlbum(catalogue, album, { base, nav, shop, site: storeSite, stationNames }));
|
|
3248
3274
|
}
|
|
3249
3275
|
const stationPath = RADIO_STATION.exec(path);
|
|
@@ -3378,6 +3404,18 @@ export function createHandler(engine: Engine, options: HandlerOptions) {
|
|
|
3378
3404
|
return;
|
|
3379
3405
|
}
|
|
3380
3406
|
|
|
3407
|
+
if (options.music && isMusicPath(path)) {
|
|
3408
|
+
const music = options.music;
|
|
3409
|
+
const shell = web ? join(web, "music.html") : "";
|
|
3410
|
+
if (await handleMusicRoutes(request, response, path, {
|
|
3411
|
+
hub: music.hub,
|
|
3412
|
+
json,
|
|
3413
|
+
readBody,
|
|
3414
|
+
page: () => { try { return shell ? readFileSync(shell, "utf8") : null; } catch { return null; } },
|
|
3415
|
+
released: music.released,
|
|
3416
|
+
})) return;
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3381
3419
|
if (options.musicStore && options.support && isStorePath(path)) {
|
|
3382
3420
|
const support = options.support;
|
|
3383
3421
|
const accounts = options.accounts;
|
|
@@ -7647,6 +7685,18 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
7647
7685
|
root: process.env["NIXAMP_LABEL_ROOT"] || (labelHome ? join(labelHome.root, "ai") : join(stateDir(), "ai-label")),
|
|
7648
7686
|
owner: options.owner || "",
|
|
7649
7687
|
mayStart: mayStartStation,
|
|
7688
|
+
// A release is told to nixamp.com as this server's owner; nixamp.com tells the artist's followers.
|
|
7689
|
+
announce: (release) => {
|
|
7690
|
+
const session = readSession();
|
|
7691
|
+
const here = stations.publicBase?.() ?? "";
|
|
7692
|
+
if (!session?.token || !/^https:\/\//.test(here)) return;
|
|
7693
|
+
void fetch(`${session.site.replace(/\/+$/, "")}/api/v1/music/released`, {
|
|
7694
|
+
method: "POST",
|
|
7695
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${session.token}` },
|
|
7696
|
+
body: JSON.stringify({ ...release, server: here }),
|
|
7697
|
+
signal: AbortSignal.timeout(15_000),
|
|
7698
|
+
}).then((answer) => console.log(` ai label: nixamp.com was told of "${release.title}" (${answer.status})`)).catch(() => undefined);
|
|
7699
|
+
},
|
|
7650
7700
|
log: (line) => console.log(line),
|
|
7651
7701
|
});
|
|
7652
7702
|
aiRadio.startSchedule();
|
|
@@ -7889,18 +7939,50 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
7889
7939
|
supportMonthly?.startSchedule();
|
|
7890
7940
|
// The AI label's songs for sale: purchases kept here, the music zipped by the server that holds it.
|
|
7891
7941
|
const jwtSecret = process.env["NIXAMP_JWT_SECRET"] ?? "";
|
|
7942
|
+
// The servers whose music nixamp.com sells and plays: the directory and the guide's peers.
|
|
7943
|
+
const musicServers = (): string[] => {
|
|
7944
|
+
const listed = directory ? directory.list().map((one) => peerBase(one.url)).filter(Boolean) : [];
|
|
7945
|
+
return [...new Set([...guidePeers(), ...listed])];
|
|
7946
|
+
};
|
|
7947
|
+
// nixamp.com/music: every server's label in one catalogue (music-hub.ts).
|
|
7948
|
+
const musicHub = options.directory ? new MusicHub({ peers: musicServers }) : undefined;
|
|
7892
7949
|
const musicStore = supportPayments && supportPayments.enabled && pool && jwtSecret ? new MusicStore({
|
|
7893
7950
|
db: pool as unknown as import("./support.ts").Db,
|
|
7894
7951
|
support: supportPayments,
|
|
7895
7952
|
mail: process.env["RESEND_API_KEY"] ? { apiKey: process.env["RESEND_API_KEY"], from: process.env["NIXAMP_MAIL_FROM"] ?? "nixamp <notifications@nixamp.com>" } : null,
|
|
7896
7953
|
site: nixampSite,
|
|
7897
7954
|
secret: sha("sha256").update(`music-grant:${jwtSecret}`).digest("hex"),
|
|
7898
|
-
servers:
|
|
7899
|
-
|
|
7900
|
-
return [...new Set([...guidePeers(), ...listed])];
|
|
7901
|
-
},
|
|
7955
|
+
servers: musicServers,
|
|
7956
|
+
...(musicHub ? { resolveServer: (id: string) => musicHub.resolve(id) } : {}),
|
|
7902
7957
|
log: (line) => console.log(line),
|
|
7903
7958
|
}) : undefined;
|
|
7959
|
+
/**
|
|
7960
|
+
* A server says an album (or song) of its label landed: its artist's
|
|
7961
|
+
* followers are told. Only the account that owns a listed server may say
|
|
7962
|
+
* so, only for an artist that server's catalogue has, once per release.
|
|
7963
|
+
*/
|
|
7964
|
+
const announced = new Set<string>();
|
|
7965
|
+
const musicReleased = async (request: IncomingMessage, body: Record<string, unknown>): Promise<{ status: number; body: unknown }> => {
|
|
7966
|
+
const me = accounts ? await accounts.whoIs(tokenFrom(request.headers)).catch(() => null) : null;
|
|
7967
|
+
if (!me) return { status: 401, body: { error: "sign in as the server's owner" } };
|
|
7968
|
+
const base = peerBase(String(body["server"] ?? ""));
|
|
7969
|
+
const owns = directory?.list().some((one) => one.ownerId === me.id && peerBase(one.url) === base) ?? false;
|
|
7970
|
+
if (!base || !owns || !musicHub) return { status: 403, body: { error: "that server is not yours, or not listed" } };
|
|
7971
|
+
const catalogue = await musicHub.catalogue();
|
|
7972
|
+
const id = serverId(base);
|
|
7973
|
+
const artist = catalogue.genres.flatMap((one) => one.artists).find((one) => one.server === id && one.key === body["artist"]);
|
|
7974
|
+
const what = String(body["title"] ?? "").replace(/[\r\n]/g, " ").slice(0, 120);
|
|
7975
|
+
if (!artist || !what) return { status: 404, body: { error: "no such artist on that server" } };
|
|
7976
|
+
const key = `${id}:${artist.key}:${what}`;
|
|
7977
|
+
if (announced.has(key)) return { status: 200, body: { told: false, why: "already" } };
|
|
7978
|
+
announced.add(key);
|
|
7979
|
+
tellAudienceOf(artist.follow, {
|
|
7980
|
+
title: `New from ${artist.name}`,
|
|
7981
|
+
body: body["kind"] === "song" ? `"${what}" is out. Listen free on nixamp.` : `The album "${what}" is out. Listen free on nixamp.`,
|
|
7982
|
+
url: `${nixampSite}/music/artist/${id}/${artist.key}`,
|
|
7983
|
+
});
|
|
7984
|
+
return { status: 202, body: { told: true, follow: artist.follow } };
|
|
7985
|
+
};
|
|
7904
7986
|
if (translationPasses) void translationPasses.access().catch(() => console.error("nixamp: translation checkout could not warm; it will retry on demand"));
|
|
7905
7987
|
const liveVoice = accounts && process.env["NIXAMP_DUBBING"] !== "off" ? new LiveVoice({
|
|
7906
7988
|
...(pool ? { db: pool } : {}),
|
|
@@ -8050,8 +8132,14 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
8050
8132
|
body: `${what} Listen at ${DEFAULT_DIRECTORY}/directory, or call ${CALL_IN_NUMBER} and key ${listing.code}.`.trim(),
|
|
8051
8133
|
url: listing.url,
|
|
8052
8134
|
};
|
|
8135
|
+
tellAudienceOf(listing.ownerId, note);
|
|
8136
|
+
};
|
|
8137
|
+
|
|
8138
|
+
/** Everyone following `followed` (an account, or `artist:<slug>`), by every way they asked to be told. */
|
|
8139
|
+
const tellAudienceOf = (followed: string, note: Notification): void => {
|
|
8140
|
+
if (follows === undefined) return;
|
|
8053
8141
|
void follows
|
|
8054
|
-
.audience(
|
|
8142
|
+
.audience(followed)
|
|
8055
8143
|
.then((audience) =>
|
|
8056
8144
|
notifyAll(audience, note, {
|
|
8057
8145
|
...(process.env["RESEND_API_KEY"]
|
|
@@ -8456,6 +8544,7 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
|
|
|
8456
8544
|
...(supportPayments ? { support: supportPayments } : {}),
|
|
8457
8545
|
...(supportMonthly ? { supportSubscriptions: supportMonthly } : {}),
|
|
8458
8546
|
...(musicStore ? { musicStore } : {}),
|
|
8547
|
+
...(musicHub ? { music: { hub: musicHub, released: musicReleased } } : {}),
|
|
8459
8548
|
...(process.env["COINPAY_WEBHOOK_SECRET"] ? { coinpayWebhookSecret: process.env["COINPAY_WEBHOOK_SECRET"] } : {}),
|
|
8460
8549
|
...(sharedTranslations ? { sharedTranslations } : {}),
|
|
8461
8550
|
...(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-DtTNC2wE.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};
|