From b5f53267fde9d634ad16a2a50dc76f53dd21c5d5 Mon Sep 17 00:00:00 2001 From: Parminder Klair Date: Fri, 27 Nov 2026 15:02:02 +0000 Subject: [PATCH 1/2] feat(plugins): a directory for music-source plugins Adds plugins/, one JSON file per music-source plugin, published in catalog.json for the /plugins directory every station serves (perminder-klair/subwave#2413). Seeded with the Music folder example. build-catalog.mjs validates each entry: the filename is the manifest name and not a built-in's, the repo is https, the apiVersion is set, and the conformance counts are present with no failed check. The add-plugin form takes the pasted manifest and the conformance kit's --json report; plugin-submission.yml derives the entry from them, turns away a report for another plugin or one with a failed check, and opens a PR with a reviewer checklist, since listing a plugin is a review of its code. report-plugin.yml is the takedown form. --- .github/ISSUE_TEMPLATE/add-plugin.yml | 116 +++++++++ .github/ISSUE_TEMPLATE/config.yml | 3 + .github/ISSUE_TEMPLATE/report-plugin.yml | 67 +++++ .github/workflows/build-catalog.yml | 1 + .github/workflows/plugin-submission.yml | 303 +++++++++++++++++++++++ .github/workflows/validate-catalog.yml | 1 + CONTRIBUTING.md | 8 + README.md | 12 +- package.json | 2 +- plugins/README.md | 93 +++++++ plugins/folder.json | 12 + scripts/build-catalog.mjs | 87 ++++++- 12 files changed, 695 insertions(+), 10 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/add-plugin.yml create mode 100644 .github/ISSUE_TEMPLATE/report-plugin.yml create mode 100644 .github/workflows/plugin-submission.yml create mode 100644 plugins/README.md create mode 100644 plugins/folder.json diff --git a/.github/ISSUE_TEMPLATE/add-plugin.yml b/.github/ISSUE_TEMPLATE/add-plugin.yml new file mode 100644 index 0000000..d2cb2eb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/add-plugin.yml @@ -0,0 +1,116 @@ +name: πŸ”Œ Submit a music-source plugin +description: List a music-source plugin you wrote on the /plugins directory, so stations on another server can find it. Fill this in and a pull request is opened for you; a maintainer reviews the code before it is listed. +title: "Add plugin: " +labels: ["plugin-submission"] +body: + - type: markdown + attributes: + value: | + Thanks for writing a plugin! Paste two things from your plugin below: its + `subwave-source.json`, and the conformance kit's JSON report. A bot turns this into a + one-file pull request, and the plugin's name, label and API version are taken from + the manifest, so they can't drift from the code. + + **A plugin is code that runs inside every station that installs it**, so a listing + is a review of that code, not only of this form. Expect questions on the PR. + + Run the kit from a SUB/WAVE checkout against a real server or library: + + ```bash + npm --prefix router install + npm --prefix router run conformance -- /path/to/your-plugin --config key=value --json + ``` + + It has to pass: a report with a failed check can't be listed. + - type: input + id: repo + attributes: + label: Source repository + description: Where the plugin's code lives, public and https. Point at the exact folder if it's part of a bigger repo. + placeholder: https://github.com/yourhandle/subwave-emby + validations: + required: true + - type: input + id: connects + attributes: + label: Connects to + description: What it plays from, in a few words. Shown as "Plugs into …" on the card. + placeholder: Emby + validations: + required: true + - type: textarea + id: manifest + attributes: + label: Manifest + description: Paste your plugin's `subwave-source.json`, whole. + render: json + validations: + required: true + - type: textarea + id: conformance + attributes: + label: Conformance report + description: Paste the output of the conformance kit run with `--json`, whole. + render: json + validations: + required: true + - type: input + id: version + attributes: + label: SUB/WAVE version + description: The SUB/WAVE version you ran the kit with (`subwave status`, or the admin footer), like 1.35.0. + placeholder: 1.35.0 + validations: + required: false + - type: dropdown + id: hostfiles + attributes: + label: Reads files on the host + description: Does the plugin read files from the operator's machine, so they have to mount a folder into the router? + options: + - "No" + - "Yes" + validations: + required: true + - type: textarea + id: description + attributes: + label: Description + description: One or two sentences about what it does and anything an operator should know. Max 280 characters. + placeholder: Plays an Emby library, with playlists and favourites. Needs an Emby API key. + validations: + required: false + - type: input + id: author + attributes: + label: Author + description: Your name or @handle. A leading @ links to your GitHub profile. + placeholder: "@yourhandle" + validations: + required: false + - type: markdown + attributes: + value: | + ### Listing terms + + By listing a plugin you agree: + + - You wrote it, or have the right to share it, and its source stays public at the link above. + - It talks only to the server or files it says it connects to. No telemetry, no + downloading and running further code, no reaching for the station's credentials. + - It's built and maintained by you, not by SUB/WAVE. A listing means a maintainer read + this version of the code; it isn't an audit, and it doesn't cover later versions. + - The listing may be removed on a valid complaint or at the maintainer's discretion. + + This isn't legal advice. + - type: checkboxes + id: confirm + attributes: + label: Before you submit + options: + - label: The conformance report above is from this version of the plugin, run against a real server or library. + required: true + - label: I understand a pull request will be opened from this issue and a maintainer will read the plugin's code before merging it. + required: true + - label: I agree to the listing terms above. + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index db3a2b8..02bbd4b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -8,3 +8,6 @@ contact_links: - name: 🧰 Add your app by hand (advanced) url: https://github.com/getsubwave/community/blob/main/apps/README.md about: Prefer to open the pull request yourself? Here's the one-file format. Most people should use the "Submit an app" form instead β€” it needs no fork. + - name: πŸ”Œ Add your plugin by hand (advanced) + url: https://github.com/getsubwave/community/blob/main/plugins/README.md + about: Prefer to open the pull request yourself? Here's the one-file format. Most people should use the "Submit a music-source plugin" form instead β€” it needs no fork. diff --git a/.github/ISSUE_TEMPLATE/report-plugin.yml b/.github/ISSUE_TEMPLATE/report-plugin.yml new file mode 100644 index 0000000..030be1b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/report-plugin.yml @@ -0,0 +1,67 @@ +name: 🚩 Report a plugin / takedown request +description: Report a listed music-source plugin for malicious or misleading code, a rights complaint, or because it's broken or gone. Used to request removal from the /plugins directory. +title: "Report plugin: " +labels: ["plugin-report"] +body: + - type: markdown + attributes: + value: | + Use this to flag a plugin listed on the **/plugins** directory. + + Plugins are written and maintained by their authors, not by SUB/WAVE. A listing means + a maintainer read the code when it was submitted; it isn't an audit. **If you think a + plugin is doing something harmful, remove it from your station's `router/plugins/` + folder first**, then report it here. + - type: input + id: plugin + attributes: + label: Plugin + description: Its name as it appears on the directory. + placeholder: Emby + validations: + required: true + - type: input + id: repo + attributes: + label: Source link + description: The source link shown on the listing. + placeholder: https://github.com/yourhandle/subwave-emby + validations: + required: true + - type: dropdown + id: reason + attributes: + label: Reason for the report + options: + - Malicious code, telemetry, or reaching beyond what it says it connects to + - Copyright, trademark, or other rights complaint + - Misleading listing (doesn't connect to what it says, conformance doesn't hold) + - Plugin is broken, abandoned, or the source link is dead + - Other + validations: + required: true + - type: textarea + id: details + attributes: + label: Details + description: > + What's the problem? Be specific: what you observed, and where in the code. For a + rights complaint, identify the work(s) and the rights you hold or represent. + placeholder: e.g. index.mjs posts the plugin's config, including the API key, to a third-party host on every rescan. + validations: + required: true + - type: input + id: contact + attributes: + label: Contact (optional) + description: An email or handle we can reach you at if we need to follow up. Leave blank to stay anonymous. + placeholder: you@example.com + validations: + required: false + - type: checkboxes + id: confirm + attributes: + label: Before you submit + options: + - label: The information in this report is accurate to the best of my knowledge and I'm acting in good faith. + required: true diff --git a/.github/workflows/build-catalog.yml b/.github/workflows/build-catalog.yml index eb6f089..9cdb383 100644 --- a/.github/workflows/build-catalog.yml +++ b/.github/workflows/build-catalog.yml @@ -16,6 +16,7 @@ on: - 'shows/**' - 'stations/**' - 'apps/**' + - 'plugins/**' - 'scripts/build-catalog.mjs' workflow_dispatch: {} diff --git a/.github/workflows/plugin-submission.yml b/.github/workflows/plugin-submission.yml new file mode 100644 index 0000000..dd4af59 --- /dev/null +++ b/.github/workflows/plugin-submission.yml @@ -0,0 +1,303 @@ +name: Plugin submission β†’ PR + +# Turns a "πŸ”Œ Submit a music-source plugin" issue (see +# .github/ISSUE_TEMPLATE/add-plugin.yml) into a one-file pull request against +# main. Unlike the other catalogs, merging is a review of the plugin's CODE, so +# the PR carries a reviewer checklist and the generated entry only records what +# the submission proved. +# +# The entry is derived, not typed: name, label and apiVersion come from the +# pasted manifest, and the conformance counts from the pasted `--json` report, +# whose plugin must be the manifest's and whose `ok` must be true. +# +# Security: the issue body is UNTRUSTED user input. It is parsed and written to +# a file entirely inside actions/github-script via the REST API (Buffer/base64, +# createOrUpdateFileContents) and NEVER interpolated into a shell `run:` step. +# The only file this workflow can write is plugins/.json, where +# must match the router's plugin-name rule. The pasted JSON is parsed, never +# evaluated, and nothing from the plugin's repository is fetched or run. +# +# Mirrors the plugin checks in scripts/build-catalog.mjs (the authority, which +# fails CI) so a submitter gets a clear comment on their own issue. Keep the two +# in lockstep. + +# NOTE: the `plugin-submission` label MUST exist as a repo label, otherwise +# GitHub silently drops it from the issue template and the `if:` guard below +# never matches. `labeled` starts a submission (the template applies the label +# at creation) and is how a maintainer re-triggers one; `edited` refreshes it. +on: + issues: + types: [edited, labeled] + +permissions: + contents: write + pull-requests: write + issues: write + +concurrency: + group: plugin-submission-${{ github.event.issue.number }} + cancel-in-progress: false + +jobs: + build-pr: + name: Build plugin PR from issue + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.build.outputs.branch }} + built: ${{ steps.build.outputs.built }} + if: contains(join(github.event.issue.labels.*.name, ','), 'plugin-submission') && (github.event.action != 'labeled' || github.event.label.name == 'plugin-submission') + steps: + - uses: actions/github-script@v7 + id: build + with: + script: | + const issue = context.payload.issue; + const { owner, repo } = context.repo; + const BASE = 'main'; + const DIR = 'plugins'; + + // Mirrors scripts/build-catalog.mjs β€” keep in lockstep. + const PLUGIN_NAME_RE = /^[a-z][a-z0-9-]{1,31}$/; + const BUILTIN_SOURCES = ['navidrome', 'jellyfin', 'plex', 'mock']; + const SEMVER_RE = /^\d+\.\d+\.\d+$/; + const OUTCOMES = ['pass', 'warn', 'fail', 'skip']; + + // --- 1. Parse the issue-form body into a { heading: value } map --- + // Each field renders as "###