Replaces the plugin template with a working plugin that lets several users share one viewing account while keeping their individual watched lists accurate. Three pieces: - Auto-creating groups. Logging in as "alice+bob" with any named member's own password provisions the shared account and signs you in. Verified against 10.11.5: AuthenticateUser offers unmatched usernames to every enabled provider and re-queries afterwards, which is the hook this relies on. Gated on a real member password so knowing two usernames is not enough to create an account. - Multi-password authentication. IRequiresResolvedUser hands us the resolved shared account; each member's live stored hash is checked via ICryptoProvider.Verify. Deliberately avoids re-entering UserManager.AuthenticateUser, which would trip every member's failed-attempt counter whenever a different member's password matched. - One-way played-state sync. Shared account to members only, filtered to PlaybackFinished/TogglePlayed/Import so playback progress ticks are ignored. No loop guard needed: member writes carry a non-shared id. Membership is stored as user IDs rather than re-parsed from the username, so shared accounts can be renamed freely. The +/name collision resolves itself because Jellyfin only consults the plugin when no local user matches the typed name. Targets Jellyfin 10.11.x / net9.0. Adds Gitea CI (test, build, release), a builder image, and 34 tests covering the auth and sync rules.
90 lines
2.9 KiB
YAML
90 lines
2.9 KiB
YAML
name: '🏗️ Build Plugin'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: linux/amd64
|
|
container:
|
|
image: gitea.tourolle.paris/dtourolle/watchedtogether-builder:latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: build-${{ github.run_id }}
|
|
|
|
- name: Cache NuGet packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.nuget/packages
|
|
key: nuget-${{ hashFiles('**/Jellyfin.Plugin.WatchedTogether.csproj', '**/Jellyfin.Plugin.WatchedTogether.Tests.csproj') }}
|
|
restore-keys: nuget-
|
|
|
|
- name: Restore dependencies
|
|
working-directory: build-${{ github.run_id }}
|
|
run: dotnet restore Jellyfin.Plugin.WatchedTogether.sln
|
|
|
|
- name: Compute build version
|
|
id: version
|
|
run: |
|
|
# Date-based version so a side-loaded build is identifiable in Jellyfin.
|
|
DATE=$(date -u +"%Y%m%d")
|
|
VERSION="1.0.${DATE}.${{ github.run_number }}"
|
|
if [ -n "${{ github.event.pull_request.number }}" ]; then
|
|
LABEL="pr${{ github.event.pull_request.number }}"
|
|
else
|
|
LABEL="master"
|
|
fi
|
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
|
echo "label=${LABEL}" >> $GITHUB_OUTPUT
|
|
echo "Build version: ${VERSION} (${LABEL})"
|
|
|
|
- name: Set build version
|
|
working-directory: build-${{ github.run_id }}
|
|
run: |
|
|
sed -i "s/^version:.*/version: \"${{ steps.version.outputs.version }}\"/" build.yaml
|
|
|
|
- name: Build solution
|
|
working-directory: build-${{ github.run_id }}
|
|
run: dotnet build Jellyfin.Plugin.WatchedTogether.sln --configuration Release --no-restore --no-self-contained /m:1
|
|
|
|
- name: Run tests
|
|
working-directory: build-${{ github.run_id }}
|
|
run: dotnet test Jellyfin.Plugin.WatchedTogether.sln --no-build --configuration Release --verbosity normal
|
|
|
|
- name: Build Jellyfin Plugin
|
|
id: jprm
|
|
working-directory: build-${{ github.run_id }}
|
|
run: |
|
|
mkdir -p artifacts
|
|
jprm --verbosity=debug plugin build .
|
|
ARTIFACT=$(find . -name "*.zip" -type f -print -quit | sed 's|^\./||')
|
|
LATEST="artifacts/watchedtogether_latest.zip"
|
|
cp "${ARTIFACT}" "${LATEST}"
|
|
echo "artifact=${LATEST}" >> $GITHUB_OUTPUT
|
|
echo "Found artifact: ${ARTIFACT} -> ${LATEST}"
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: watchedtogether-${{ steps.version.outputs.label }}-${{ steps.version.outputs.version }}
|
|
path: build-${{ github.run_id }}/${{ steps.jprm.outputs.artifact }}
|
|
retention-days: 30
|
|
if-no-files-found: error
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
run: rm -rf build-${{ github.run_id }}
|