@@ -0,0 +1,31 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Install TinyGo
|
||||||
|
run: |
|
||||||
|
wget https://github.com/tinygo-org/tinygo/releases/download/v0.40.1/tinygo_0.40.1_amd64.deb
|
||||||
|
sudo dpkg -i tinygo_0.40.1_amd64.deb
|
||||||
|
sudo apt install -y binaryen
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: make test
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
@@ -1,54 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version-file: go.mod
|
|
||||||
|
|
||||||
- name: Install TinyGo
|
|
||||||
run: |
|
|
||||||
wget https://github.com/tinygo-org/tinygo/releases/download/v0.40.1/tinygo_0.40.1_amd64.deb
|
|
||||||
sudo dpkg -i tinygo_0.40.1_amd64.deb
|
|
||||||
sudo apt install -y binaryen
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: make test
|
|
||||||
|
|
||||||
- name: Append PR info to version
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: |
|
|
||||||
PR_NUM=${{ github.event.pull_request.number }}
|
|
||||||
SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7)
|
|
||||||
SUFFIX="PR${PR_NUM}-${SHA}"
|
|
||||||
jq --arg suffix "$SUFFIX" '.version = .version + "-" + $suffix' manifest.json > manifest.tmp && mv manifest.tmp manifest.json
|
|
||||||
|
|
||||||
- name: Append git SHA to version
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: |
|
|
||||||
SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
|
||||||
jq --arg sha "$SHA" '.version = .version + "-" + $sha' manifest.json > manifest.tmp && mv manifest.tmp manifest.json
|
|
||||||
|
|
||||||
- name: Build and package plugin
|
|
||||||
run: make package
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: discord-rich-presence
|
|
||||||
path: discord-rich-presence.ndp
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
name: Create Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: "Release version (e.g., 1.2.3, without the 'v' prefix)"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
beta:
|
|
||||||
description: "Beta number (1, 2, 3...). Leave empty for stable release"
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
create-release:
|
|
||||||
name: Create Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Validate version format
|
|
||||||
env:
|
|
||||||
VERSION: ${{ inputs.version }}
|
|
||||||
run: |
|
|
||||||
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
||||||
echo "::error::Invalid version format '$VERSION'. Use X.X.X (e.g., 1.2.3)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Compute full version
|
|
||||||
run: |
|
|
||||||
VERSION="${{ inputs.version }}"
|
|
||||||
BETA="${{ inputs.beta }}"
|
|
||||||
if [[ -n "$BETA" && "$BETA" != "0" ]]; then
|
|
||||||
VERSION="${VERSION}-beta-${BETA}"
|
|
||||||
fi
|
|
||||||
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
|
|
||||||
- name: Check tag does not already exist
|
|
||||||
run: |
|
|
||||||
if git ls-remote --tags origin "refs/tags/v${VERSION}" | grep -q .; then
|
|
||||||
echo "::error::Tag v${VERSION} already exists"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version-file: go.mod
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: go test -race ./...
|
|
||||||
|
|
||||||
- name: Update manifest.json version
|
|
||||||
run: |
|
|
||||||
jq --arg v "$VERSION" '.version = $v' manifest.json > manifest.tmp && mv manifest.tmp manifest.json
|
|
||||||
|
|
||||||
- name: Commit, tag, and push
|
|
||||||
run: |
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add manifest.json
|
|
||||||
git commit --allow-empty -m "Release v${VERSION}"
|
|
||||||
git tag "v${VERSION}"
|
|
||||||
git push origin main "v${VERSION}"
|
|
||||||
|
|
||||||
- name: Install TinyGo
|
|
||||||
run: |
|
|
||||||
wget https://github.com/tinygo-org/tinygo/releases/download/v0.40.1/tinygo_0.40.1_amd64.deb
|
|
||||||
sudo dpkg -i tinygo_0.40.1_amd64.deb
|
|
||||||
sudo apt install -y binaryen
|
|
||||||
|
|
||||||
- name: Build and package plugin
|
|
||||||
run: make package
|
|
||||||
|
|
||||||
- name: Create release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: v${{ env.VERSION }}
|
|
||||||
draft: true
|
|
||||||
prerelease: ${{ inputs.beta != '' && inputs.beta != '0' }}
|
|
||||||
files: discord-rich-presence.ndp
|
|
||||||
generate_release_notes: true
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
name: Add download link to PR
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ["Build"]
|
|
||||||
types: [completed]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pr_comment:
|
|
||||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
steps:
|
|
||||||
- name: Get PR number
|
|
||||||
id: pr
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const pulls = await github.rest.pulls.list({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
state: 'open'
|
|
||||||
});
|
|
||||||
const pr = pulls.data.find(p => p.head.sha === '${{ github.event.workflow_run.head_sha }}');
|
|
||||||
if (pr) {
|
|
||||||
core.setOutput('number', pr.number);
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Add download link comment
|
|
||||||
if: steps.pr.outputs.number
|
|
||||||
uses: marocchino/sticky-pull-request-comment@v2
|
|
||||||
with:
|
|
||||||
number: ${{ steps.pr.outputs.number }}
|
|
||||||
message: |
|
|
||||||
Download the plugin for this PR: [discord-rich-presence.zip](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/discord-rich-presence.zip)
|
|
||||||
|
|
||||||
Built from ${{ github.event.workflow_run.head_sha }} on ${{ github.event.workflow_run.updated_at }}
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
*.wasm
|
*.wasm
|
||||||
*.ndp
|
*.ndp
|
||||||
tmp
|
tmp
|
||||||
discord-rich-presence
|
discordrome
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SHELL := /usr/bin/env bash
|
SHELL := /usr/bin/env bash
|
||||||
.PHONY: test build package clean
|
.PHONY: test build package clean
|
||||||
|
|
||||||
PLUGIN_NAME := discord-rich-presence
|
PLUGIN_NAME := discodrome
|
||||||
WASM_FILE := plugin.wasm
|
WASM_FILE := plugin.wasm
|
||||||
TINYGO := $(shell command -v tinygo 2> /dev/null)
|
TINYGO := $(shell command -v tinygo 2> /dev/null)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
# Discord Rich Presence Plugin for Navidrome
|
# Discodrome, a work of Discord Rich Presence Plugin for Navidrome
|
||||||
|
|
||||||
[](https://github.com/navidrome/discord-rich-presence-plugin/actions/workflows/build.yml)
|
|
||||||
[](https://github.com/navidrome/discord-rich-presence-plugin/releases/latest/download/discord-rich-presence.ndp)
|
|
||||||
|
|
||||||
**Attention: This plugin requires Navidrome 0.61.0 or later.**
|
**Attention: This plugin requires Navidrome 0.61.0 or later.**
|
||||||
|
|
||||||
@@ -9,7 +6,7 @@ This plugin integrates Navidrome with Discord Rich Presence, displaying your cur
|
|||||||
The goal is to demonstrate the capabilities of Navidrome's plugin system by implementing a real-time presence feature using Discord's Gateway API.
|
The goal is to demonstrate the capabilities of Navidrome's plugin system by implementing a real-time presence feature using Discord's Gateway API.
|
||||||
It demonstrates how a Navidrome plugin can maintain real-time connections to external services while remaining completely stateless.
|
It demonstrates how a Navidrome plugin can maintain real-time connections to external services while remaining completely stateless.
|
||||||
|
|
||||||
Based on the [Navicord](https://github.com/logixism/navicord) project.
|
Based on the [discord-rich-presence-plugin](https://github.com/navidrome/discord-rich-presence-plugin) project.
|
||||||
|
|
||||||
**⚠️ WARNING: This plugin requires storing Discord user tokens, which may violate Discord's Terms of Service. Use at your own risk.**
|
**⚠️ WARNING: This plugin requires storing Discord user tokens, which may violate Discord's Terms of Service. Use at your own risk.**
|
||||||
|
|
||||||
@@ -26,13 +23,12 @@ Based on the [Navicord](https://github.com/logixism/navicord) project.
|
|||||||
- Optional album art from [Cover Art Archive](https://coverartarchive.org) for MusicBrainz-tagged music
|
- Optional album art from [Cover Art Archive](https://coverartarchive.org) for MusicBrainz-tagged music
|
||||||
- Optional image hosting via [uguu.se](https://uguu.se) for non-public Navidrome instances
|
- Optional image hosting via [uguu.se](https://uguu.se) for non-public Navidrome instances
|
||||||
|
|
||||||
<img alt="Discord Rich Presence showing currently playing track with album art, artist, and playback progress" src="https://raw.githubusercontent.com/navidrome/discord-rich-presence-plugin/master/.github/ss-richpresence.webp">
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Step 1: Download and Install the Plugin
|
### Step 1: Download and Install the Plugin
|
||||||
1. Download the `discord-rich-presence.ndp` file from the [releases page](https://github.com/navidrome/discord-rich-presence-plugin/releases)
|
1. Download the `discodrome.ndp` file from the [releases page](https://git.atri.dad/atridad/discodrome/releases)
|
||||||
2. Copy it to your Navidrome plugins folder. Default location: `<navidrome-data-directory>/plugins/`
|
2. Copy it to your Navidrome plugins folder. Default location: `<navidrome-data-directory>/plugins/`
|
||||||
|
|
||||||
### Step 2: Create a Discord Application
|
### Step 2: Create a Discord Application
|
||||||
@@ -115,7 +111,6 @@ For album artwork to display in Discord, Discord needs to be able to access the
|
|||||||
|
|
||||||
Access the plugin configuration in Navidrome: **Settings > Plugins > Discord Rich Presence**
|
Access the plugin configuration in Navidrome: **Settings > Plugins > Discord Rich Presence**
|
||||||
|
|
||||||
<img alt="Plugin configuration panel showing all available settings" src="https://raw.githubusercontent.com/navidrome/discord-rich-presence-plugin/master/.github/ss-config.webp">
|
|
||||||
|
|
||||||
### Configuration Fields
|
### Configuration Fields
|
||||||
|
|
||||||
@@ -249,7 +244,7 @@ make build
|
|||||||
make package
|
make package
|
||||||
```
|
```
|
||||||
|
|
||||||
The `make package` command creates `discord-rich-presence.ndp` containing the compiled WebAssembly module and manifest.
|
The `make package` command creates `discodrome.ndp` containing the compiled WebAssembly module and manifest.
|
||||||
|
|
||||||
### Manual Build Options
|
### Manual Build Options
|
||||||
|
|
||||||
@@ -257,16 +252,15 @@ The `make package` command creates `discord-rich-presence.ndp` containing the co
|
|||||||
```sh
|
```sh
|
||||||
# Install TinyGo first: https://tinygo.org/getting-started/install/
|
# Install TinyGo first: https://tinygo.org/getting-started/install/
|
||||||
tinygo build -target wasip1 -buildmode=c-shared -o plugin.wasm -scheduler=none .
|
tinygo build -target wasip1 -buildmode=c-shared -o plugin.wasm -scheduler=none .
|
||||||
zip discord-rich-presence.ndp plugin.wasm manifest.json
|
zip discodrome.ndp plugin.wasm manifest.json
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Using Standard Go
|
#### Using Standard Go
|
||||||
```sh
|
```sh
|
||||||
GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o plugin.wasm .
|
GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o plugin.wasm .
|
||||||
zip discord-rich-presence.ndp plugin.wasm manifest.json
|
zip discodrome.ndp plugin.wasm manifest.json
|
||||||
```
|
```
|
||||||
|
|
||||||
### Output
|
### Output
|
||||||
- `plugin.wasm`: The compiled WebAssembly module
|
- `plugin.wasm`: The compiled WebAssembly module
|
||||||
- `discord-rich-presence.ndp`: The complete plugin package ready for installation
|
- `discodrome.ndp`: The complete plugin package ready for installation
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
description = "Discodrome Development Environment";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
self,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
go
|
||||||
|
tinygo
|
||||||
|
gnumake
|
||||||
|
binaryen
|
||||||
|
jq
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
module discord-rich-presence
|
module discodrome
|
||||||
|
|
||||||
go 1.25.0
|
go 1.25.0
|
||||||
|
|
||||||
|
|||||||
+7
-20
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/navidrome/navidrome/refs/heads/master/plugins/manifest-schema.json",
|
"$schema": "https://raw.githubusercontent.com/navidrome/navidrome/refs/heads/master/plugins/manifest-schema.json",
|
||||||
"name": "Discord Rich Presence",
|
"name": "Discodrome",
|
||||||
"author": "Navidrome Team",
|
"author": "Atridad Lahiji",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Discord Rich Presence integration for Navidrome",
|
"description": "Discord Rich Presence integration for Navidrome",
|
||||||
"website": "https://github.com/navidrome/discord-rich-presence-plugin",
|
"website": "https://git.atri.dad.com/atridad/discodrome",
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"users": {
|
"users": {
|
||||||
"reason": "To process scrobbles on behalf of users"
|
"reason": "To process scrobbles on behalf of users"
|
||||||
@@ -20,9 +20,7 @@
|
|||||||
},
|
},
|
||||||
"websocket": {
|
"websocket": {
|
||||||
"reason": "To maintain real-time connection with Discord gateway",
|
"reason": "To maintain real-time connection with Discord gateway",
|
||||||
"requiredHosts": [
|
"requiredHosts": ["gateway.discord.gg"]
|
||||||
"gateway.discord.gg"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"cache": {
|
"cache": {
|
||||||
"reason": "To store connection state and sequence numbers"
|
"reason": "To store connection state and sequence numbers"
|
||||||
@@ -53,12 +51,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "Activity Name Display",
|
"title": "Activity Name Display",
|
||||||
"description": "Choose what to display as the activity name in Discord Rich Presence",
|
"description": "Choose what to display as the activity name in Discord Rich Presence",
|
||||||
"enum": [
|
"enum": ["Default", "Track", "Album", "Artist"],
|
||||||
"Default",
|
|
||||||
"Track",
|
|
||||||
"Album",
|
|
||||||
"Artist"
|
|
||||||
],
|
|
||||||
"default": "Default"
|
"default": "Default"
|
||||||
},
|
},
|
||||||
"caaenabled": {
|
"caaenabled": {
|
||||||
@@ -99,17 +92,11 @@
|
|||||||
"minLength": 1
|
"minLength": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": ["username", "token"]
|
||||||
"username",
|
|
||||||
"token"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": ["clientid", "users"]
|
||||||
"clientid",
|
|
||||||
"users"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"uiSchema": {
|
"uiSchema": {
|
||||||
"type": "VerticalLayout",
|
"type": "VerticalLayout",
|
||||||
|
|||||||
Reference in New Issue
Block a user