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.

at v4 64 lines 1.6 kB view raw
1import { defineElement, DiffuseElement } from "~/common/element.js"; 2import { SCHEME } from "./constants.js"; 3import { bucketsFromTracks, buildURI } from "./common.js"; 4 5/** 6 * @import {InputActions, InputSchemeProvider} from "~/components/input/types.d.ts" 7 * @import {ProxiedActions} from "~/common/worker.d.ts" 8 * @import {Track} from "~/definitions/types.d.ts" 9 * @import {Demo} from "./types.d.ts" 10 */ 11 12//////////////////////////////////////////// 13// ELEMENT 14//////////////////////////////////////////// 15 16/** 17 * @implements {ProxiedActions<InputActions>} 18 * @implements {InputSchemeProvider} 19 */ 20class S3Input extends DiffuseElement { 21 static NAME = "diffuse/input/s3"; 22 static WORKER_URL = "components/input/s3/worker.js"; 23 24 SCHEME = SCHEME; 25 26 constructor() { 27 super(); 28 29 /** @type {ProxiedActions<InputActions & { demo: () => Demo }>} */ 30 this.proxy = this.workerProxy(); 31 32 this.artwork = this.proxy.artwork; 33 this.consult = this.proxy.consult; 34 this.detach = this.proxy.detach; 35 this.groupConsult = this.proxy.groupConsult; 36 this.list = this.proxy.list; 37 this.resolve = this.proxy.resolve; 38 39 this.demo = this.proxy.demo; 40 } 41 42 // 🛠️ 43 44 /** @param {Track[]} tracks */ 45 sources(tracks) { 46 return Object.values(bucketsFromTracks(tracks)).map((server) => { 47 return { 48 label: `${server.bucketName} (${server.host})`, 49 uri: buildURI(server), 50 }; 51 }); 52 } 53} 54 55export default S3Input; 56 57//////////////////////////////////////////// 58// REGISTER 59//////////////////////////////////////////// 60 61export const CLASS = S3Input; 62export const NAME = "di-s3"; 63 64defineElement(NAME, CLASS);