@doitian/dsh-music 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -33,7 +33,7 @@ export const inject = ['tools', 'webServer'];
33
33
 
34
34
  const HERE = path.dirname(fileURLToPath(import.meta.url));
35
35
 
36
- /** Read a shipped asset once at module load; both are small. */
36
+ /** Read a shipped asset once at module load; they are small. */
37
37
  function readAsset(...segments) {
38
38
  return fs.readFileSync(path.join(HERE, ...segments), 'utf8');
39
39
  }
@@ -44,9 +44,12 @@ function readAsset(...segments) {
44
44
  * Deliberately module-scoped rather than read inside {@link apply}: a plugin
45
45
  * remount re-runs `apply`, and reading here instead would let a remounted
46
46
  * plugin serve a page from a *newer* working tree than the code it is running
47
- * beside. The page and the module must describe the same contract.
47
+ * beside. The page and the module must describe the same contract, and so must
48
+ * the playback core: the page runs it, and the engine trusts it on the strength
49
+ * of that contract.
48
50
  */
49
51
  const PANEL_HTML = readAsset('panel.html');
52
+ const PLAYBACK_JS = readAsset('playback.js');
50
53
  const QRCODE_JS = readAsset('vendor', 'qrcode.js');
51
54
 
52
55
  /**
@@ -279,6 +282,7 @@ export function apply(ctx, config = {}) {
279
282
  likes,
280
283
  scrobbler,
281
284
  panelHtml: PANEL_HTML,
285
+ playbackJs: PLAYBACK_JS,
282
286
  qrcodeJs: QRCODE_JS,
283
287
  config,
284
288
  listRoutes: () => dj.listRoutes(),
@@ -752,6 +756,7 @@ export function apply(ctx, config = {}) {
752
756
  } catch {
753
757
  // The route table is already gone when the webserver unloads first.
754
758
  }
759
+ router.dispose();
755
760
  store.close();
756
761
  logger.debug('[music] unloaded');
757
762
  });