nixamp 0.7.16 → 0.7.18

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/publish.d.ts CHANGED
@@ -12,7 +12,14 @@ export interface PublishTarget {
12
12
  * gets a 401 in JSON, which is a caller hearing nothing.
13
13
  */
14
14
  audio?: string;
15
- tracks: number;
15
+ /**
16
+ * How many tracks there are, asked at every heartbeat rather than once.
17
+ *
18
+ * Taken as a number, it was read before the library had finished loading --
19
+ * the port opens first now -- so a server with five thousand tracks
20
+ * advertised nought of them for as long as it stayed up.
21
+ */
22
+ tracks: () => number;
16
23
  nowPlaying: () => string;
17
24
  /**
18
25
  * The account this stream belongs to, from `nixamp login`.
package/dist/publish.js CHANGED
@@ -58,7 +58,7 @@ export class Publisher {
58
58
  name: this.target.name,
59
59
  url: this.target.url,
60
60
  ...(this.target.audio ? { audio: this.target.audio } : {}),
61
- tracks: this.target.tracks,
61
+ tracks: this.target.tracks(),
62
62
  nowPlaying: this.target.nowPlaying(),
63
63
  }),
64
64
  });
package/dist/server.js CHANGED
@@ -2937,9 +2937,9 @@ export async function serve(argv, version = "0.1.0") {
2937
2937
  name: options.name || hostname(),
2938
2938
  url: listen,
2939
2939
  audio,
2940
- // Asked of the engine rather than a variable, because the library is
2941
- // now read after the port opens and may still be arriving.
2942
- tracks: engine.snapshot(false).trackCount,
2940
+ // Asked at every heartbeat rather than once, because the library is
2941
+ // read after the port opens and is still arriving when this is made.
2942
+ tracks: () => engine.snapshot(false).trackCount,
2943
2943
  // From `nixamp login`. The directory will not list a stream it cannot
2944
2944
  // attribute to somebody, because a listing is now a phone code that
2945
2945
  // costs money to answer.
@@ -2966,7 +2966,18 @@ export async function serve(argv, version = "0.1.0") {
2966
2966
  }
2967
2967
  if (options.publish !== "no" && publishable_) {
2968
2968
  const listen = shareLink(publishable_.url, listenKey, false);
2969
- const wanted = options.publish === "yes"
2969
+ // Listed unless told otherwise.
2970
+ //
2971
+ // It used to ask, and a daemon has nobody to ask -- so a server started in
2972
+ // the background was never listed, which meant nobody could find it, which
2973
+ // meant it could not be paid for either. A stream that nobody can find is
2974
+ // not a stream. What is published is the listening link, never the one
2975
+ // that drives, and `--no-publish` is there for a server that should not be
2976
+ // public at all.
2977
+ //
2978
+ // Still asked when a person is at the terminal to answer, because that is
2979
+ // somebody who can say no.
2980
+ const wanted = options.publish === "yes" || !process.stdin.isTTY
2970
2981
  ? true
2971
2982
  : await confirm(`\n List this stream at ${DEFAULT_DIRECTORY}/directory so anyone can find it?\n It publishes ${listen} — listen only, not the controls.`);
2972
2983
  if (wanted) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nixamp",
3
- "version": "0.7.16",
3
+ "version": "0.7.18",
4
4
  "description": "It really whips the terminal's ass. A Winamp-shaped audio player for your terminal.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/publish.ts CHANGED
@@ -21,7 +21,14 @@ export interface PublishTarget {
21
21
  * gets a 401 in JSON, which is a caller hearing nothing.
22
22
  */
23
23
  audio?: string;
24
- tracks: number;
24
+ /**
25
+ * How many tracks there are, asked at every heartbeat rather than once.
26
+ *
27
+ * Taken as a number, it was read before the library had finished loading --
28
+ * the port opens first now -- so a server with five thousand tracks
29
+ * advertised nought of them for as long as it stayed up.
30
+ */
31
+ tracks: () => number;
25
32
  nowPlaying: () => string;
26
33
  /**
27
34
  * The account this stream belongs to, from `nixamp login`.
@@ -92,7 +99,7 @@ export class Publisher {
92
99
  name: this.target.name,
93
100
  url: this.target.url,
94
101
  ...(this.target.audio ? { audio: this.target.audio } : {}),
95
- tracks: this.target.tracks,
102
+ tracks: this.target.tracks(),
96
103
  nowPlaying: this.target.nowPlaying(),
97
104
  }),
98
105
  });
package/src/server.ts CHANGED
@@ -3394,9 +3394,9 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
3394
3394
  name: options.name || hostname(),
3395
3395
  url: listen,
3396
3396
  audio,
3397
- // Asked of the engine rather than a variable, because the library is
3398
- // now read after the port opens and may still be arriving.
3399
- tracks: engine.snapshot(false).trackCount,
3397
+ // Asked at every heartbeat rather than once, because the library is
3398
+ // read after the port opens and is still arriving when this is made.
3399
+ tracks: () => engine.snapshot(false).trackCount,
3400
3400
  // From `nixamp login`. The directory will not list a stream it cannot
3401
3401
  // attribute to somebody, because a listing is now a phone code that
3402
3402
  // costs money to answer.
@@ -3423,7 +3423,18 @@ export async function serve(argv: string[], version = "0.1.0"): Promise<void> {
3423
3423
 
3424
3424
  if (options.publish !== "no" && publishable_) {
3425
3425
  const listen = shareLink(publishable_.url, listenKey, false);
3426
- const wanted = options.publish === "yes"
3426
+ // Listed unless told otherwise.
3427
+ //
3428
+ // It used to ask, and a daemon has nobody to ask -- so a server started in
3429
+ // the background was never listed, which meant nobody could find it, which
3430
+ // meant it could not be paid for either. A stream that nobody can find is
3431
+ // not a stream. What is published is the listening link, never the one
3432
+ // that drives, and `--no-publish` is there for a server that should not be
3433
+ // public at all.
3434
+ //
3435
+ // Still asked when a person is at the terminal to answer, because that is
3436
+ // somebody who can say no.
3437
+ const wanted = options.publish === "yes" || !process.stdin.isTTY
3427
3438
  ? true
3428
3439
  : await confirm(`\n List this stream at ${DEFAULT_DIRECTORY}/directory so anyone can find it?\n It publishes ${listen} — listen only, not the controls.`);
3429
3440
 
package/web/dist/sw.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* nixamp service worker — generated, do not edit */
2
- const CACHE = "nixamp-1788962400373";
2
+ const CACHE = "nixamp-1788963208633";
3
3
  const PRECACHE = [
4
4
  "/",
5
5
  "/apple-touch-icon.png",