-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
Thanks for your interest in contributing. This page covers everything you need to get started.
- Getting Set Up
- Branching
- Code Conventions
- Testing Your Changes
- Opening a Pull Request
- Reporting Bugs
-
Fork the repository on GitHub and clone your fork:
git clone https://github.com/yourusername/MusicPlayer.git cd MusicPlayer -
Set up your config:
cp appsettings.example.json appsettings.json
Then open
appsettings.jsonand set your own API key. -
Verify everything builds before making any changes:
dotnet build
If this doesn't pass cleanly, stop and fix it before continuing.
Always work on a new branch. Never commit directly to main.
git checkout -b feature/your-feature-nameUse a descriptive name that reflects what you're working on:
feature/repeat-modefix/playback-skippingimprovement/upload-progress-bar
Keep branches focused — one feature or fix per branch. If you find an unrelated bug while working, open a separate branch for it.
- Match the style of the surrounding code
- Keep partial class files focused on their area — playback logic in the playback file, playlist logic in the playlist file, and so on
- Don't leave commented-out code in pull requests
The API runs on a background thread. Any code that touches UI controls or NAudio must be marshalled back to the UI thread using this.Invoke(). Follow the pattern already used in the PlayerService bridge in Form1.cs:
svc.Play = () => this.Invoke(ResumePlayback);
svc.SetVolume = (v) => this.Invoke(() =>
{
music_volume.Value = Math.Clamp(v, 0, 100);
if (audioFile != null) audioFile.Volume = v / 100f;
});If you add a new action to PlayerService, follow this same delegate pattern.
- Add new endpoints to the appropriate controller (
PlayerControllerfor playback/queue,RoomControllerfor room management) - Use
context.Items["IsHost"]to check the caller's role and return403for unauthorized actions - Update the API reference table in
README.mdto include your new endpoint - Make sure your endpoint shows up correctly in Swagger before submitting
- Register new middleware in
Program.csbetweenbuilder.Build()andapp.Run() - Order matters —
LoggingMiddlewaremust always come beforeApiKeyMiddlewareso rejected requests still get logged - If your middleware needs to skip certain paths (like Swagger), add them to the path exclusion list at the top of
InvokeAsync
- If you add a new config value, add it to
appsettings.example.jsonwith a placeholder value - Never commit
appsettings.json— it is in.gitignorefor a reason - Never hardcode secrets, IP addresses, or environment-specific values in code
There are no automated tests yet. Before submitting, manually verify the following:
Build
-
dotnet buildpasses with no errors or warnings
Playback
- Songs play, pause, stop, and resume correctly
- Next and previous buttons work
- Songs auto-advance when they finish
- Shuffle mode works and doesn't cause jumping
API
- Any endpoints you added or changed return correct responses in Swagger or Postman
- Host-only endpoints return
403when called with a guest token - Protected endpoints return
401when called with no credentials
Phone remote
- The remote page loads on a phone browser over the local network
- Now playing info updates every second
- Guest join flow works with a valid room code
- Upload flow works and the track appears in the queue and playlist
Push your branch to your fork and open a pull request against main:
git push origin feature/your-feature-nameIn your pull request description, include:
- What the change does
- Why it's needed or useful
- Any tradeoffs or known limitations
- Screenshots or Postman output if relevant
Pull requests that break existing functionality or skip the testing checklist above will be asked to fix those issues before merging.
Open a GitHub issue and include:
- What you expected to happen
- What actually happened
- Steps to reproduce the issue
- Your OS and .NET version:
dotnet --version
The more detail the better — vague reports are hard to act on.