A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: remove offline orchestrator

+11 -70
-1
deno.jsonc
··· 156 156 "./components/orchestrator/cover-groups/element.js": "./src/components/orchestrator/cover-groups/element.js", 157 157 "./components/orchestrator/favourites/element.js": "./src/components/orchestrator/favourites/element.js", 158 158 "./components/orchestrator/media-session/element.js": "./src/components/orchestrator/media-session/element.js", 159 - "./components/orchestrator/offline/element.js": "./src/components/orchestrator/offline/element.js", 160 159 "./components/orchestrator/output/element.js": "./src/components/orchestrator/output/element.js", 161 160 "./components/orchestrator/path-collections/element.js": "./src/components/orchestrator/path-collections/element.js", 162 161 "./components/orchestrator/process-tracks/element.js": "./src/components/orchestrator/process-tracks/element.js",
-1
src/_data/elements.js
··· 56 56 { url: "components/orchestrator/cover-groups/element.js", title: "Cover Groups", desc: "Groups tracks by cover art to form collections." }, 57 57 { url: "components/orchestrator/favourites/element.js", title: "Favourites", desc: "Mark tracks as favourites. Automatically creates an unordered 'Favourites' playlist." }, 58 58 { url: "components/orchestrator/media-session/element.js", title: "Media Session", desc: "Keeps the browser/os media session in sync with queue and audio state. Adds handlers for previous, next, seek to, etc." }, 59 - { url: "components/orchestrator/offline/element.js", title: "Offline", desc: "Registers a service worker that makes the page available offline. Resources (except audio & video) are cached as they load and served from cache when offline." }, 60 59 { url: "components/orchestrator/output/element.js", title: "Output", desc: "A default output configuration. Contains all the outputs provided here along with the relevant transformers." }, 61 60 { url: "components/orchestrator/path-collections/element.js", title: "Path Collections", desc: "Wraps an output element to generate ephemeral playlists based on the first path segment of each track's URI. Ephemeral items are excluded from storage." }, 62 61 { url: "components/orchestrator/process-tracks/element.js", title: "Process Inputs Into Tracks", desc: "Whenever the cached tracks are initially loaded through the passed output element it will list tracks by using the passed input element. Afterwards it loops over all tracks and checks if metadata needs to be fetched. If anything has changed, it'll pass the results to the output element." },
+1 -3
src/_includes/layouts/diffuse.vto
··· 59 59 } 60 60 </script> 61 61 62 - <!-- Make every touched URL available offline --> 63 - <do-offline></do-offline> 64 - <script src="components/orchestrator/offline/element.js" type="module"></script> 62 + <script src="default-layout.js" type="module"></script> 65 63 66 64 <!-- Scripts --> 67 65 {{ for url of scripts }}
-2
src/components/index.js
··· 26 26 import * as _OrchestratorCoverGroups from "./orchestrator/cover-groups/element.js" 27 27 import * as _OrchestratorFavourites from "./orchestrator/favourites/element.js" 28 28 import * as _OrchestratorMediaSession from "./orchestrator/media-session/element.js" 29 - import * as _OrchestratorOffline from "./orchestrator/offline/element.js" 30 29 import * as _OrchestratorOutput from "./orchestrator/output/element.js" 31 30 import * as _OrchestratorPathCollections from "./orchestrator/path-collections/element.js" 32 31 import * as _OrchestratorProcessTracks from "./orchestrator/process-tracks/element.js" ··· 93 92 coverGroups: _OrchestratorCoverGroups, 94 93 favourites: _OrchestratorFavourites, 95 94 mediaSession: _OrchestratorMediaSession, 96 - offline: _OrchestratorOffline, 97 95 output: _OrchestratorOutput, 98 96 pathCollections: _OrchestratorPathCollections, 99 97 processTracks: _OrchestratorProcessTracks,
-63
src/components/orchestrator/offline/element.js
··· 1 - import { defineElement, DiffuseElement } from "~/common/element.js"; 2 - 3 - //////////////////////////////////////////// 4 - // ELEMENT 5 - //////////////////////////////////////////// 6 - 7 - /** 8 - * Registers a service worker that makes the page available offline. 9 - * 10 - * All resources, except audio & video, fetched by the page are cached as they load. 11 - * While online, requests always go to the network (the cache is bypassed), 12 - * and successful responses are stored for later. While offline, the cache 13 - * is used as a fallback. 14 - * 15 - * Attributes: 16 - * cache-name Name of the cache to use (default: "diffuse-offline") 17 - * scope Service worker scope (default: "./") 18 - * src URL of the service worker script (default: built-in service-worker.js) 19 - * Must be served from a path within the requested scope, or the server 20 - * must include a `Service-Worker-Allowed: /` response header. 21 - */ 22 - class OfflineOrchestrator extends DiffuseElement { 23 - static NAME = "diffuse/orchestrator/offline"; 24 - 25 - // LIFECYCLE 26 - 27 - /** @override */ 28 - async connectedCallback() { 29 - super.connectedCallback(); 30 - 31 - if (!("serviceWorker" in navigator)) return; 32 - 33 - const cacheName = this.getAttribute("cache-name") ?? "diffuse-offline"; 34 - const scope = this.getAttribute("scope") ?? "./"; 35 - const src = this.getAttribute("src"); 36 - 37 - const swUrl = new URL( 38 - src ?? import.meta.resolve("../../../service-worker.js"), 39 - ); 40 - 41 - swUrl.searchParams.set("cache-name", cacheName); 42 - 43 - try { 44 - await navigator.serviceWorker.register(swUrl.href, { 45 - type: "module", 46 - scope, 47 - }); 48 - } catch (error) { 49 - console.warn("[do-offline] Failed to register service worker:", error); 50 - } 51 - } 52 - } 53 - 54 - export default OfflineOrchestrator; 55 - 56 - //////////////////////////////////////////// 57 - // REGISTER 58 - //////////////////////////////////////////// 59 - 60 - export const CLASS = OfflineOrchestrator; 61 - export const NAME = "do-offline"; 62 - 63 - defineElement(NAME, OfflineOrchestrator);
+10
src/default-layout.js
··· 1 + if ("serviceWorker" in navigator) { 2 + const swUrl = new URL(import.meta.resolve("./service-worker.js")); 3 + swUrl.searchParams.set("cache-name", "diffuse-offline"); 4 + 5 + navigator.serviceWorker 6 + .register(swUrl.href, { type: "module", scope: "./" }) 7 + .catch((error) => { 8 + console.warn("[do-offline] Failed to register service worker:", error); 9 + }); 10 + }