mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-12 23:08:40 +00:00
Implement basic RPC configuration API endpoint (#864)
* Implement basic RPC information endpoint with test data * Implement configuration options for RPC * Rename RpcConfiguration to RpcResponse * Rider insists on modifying dataSources.xml * Implement documentation and fix code quality/gitignore issues * Use SerializableAttribute instead of UsedImplicitlyAttribute * Add warning regarding nullable assets * Prevent precision issues with application ID * Check asset properties for null/whitespace and return null
This commit is contained in:
parent
7939211308
commit
e072201ec7
7 changed files with 123 additions and 20 deletions
38
Documentation/RPC.md
Normal file
38
Documentation/RPC.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# RPC (Rich Presence)
|
||||
|
||||
Lighthouse supports Discord's [Rich Presence](https://discordapp.com/rich-presence) feature, which allows you
|
||||
to display your current activity in Lighthouse to your Discord friends.
|
||||
|
||||
This can be done by utilizing a pre-existing RPC client, such as [this one](https://github.com/LBPUnion/PLRPC),
|
||||
or by creating your own. This page will explain how to utilize the `/api/v1/rpc` endpoint to access the
|
||||
required information.
|
||||
|
||||
## Authentication
|
||||
|
||||
This endpoint does not require any form of authentication and is available to use without restriction, aside
|
||||
from any server admin imposed rate limiting.
|
||||
|
||||
## Endpoints
|
||||
|
||||
### GET `/api/v1/rpc`
|
||||
|
||||
Returns a JSON object containing the following information:
|
||||
|
||||
- `applicationId`: The ID of the Discord application.
|
||||
- `partyIdPrefix`: The prefix to use for the party ID. This is used to prevent collisions between
|
||||
multiple instances of Lighthouse running on the same Discord application.
|
||||
- `usernameType`: Some compatible APIs require usernames instead of user IDs. A return value of `0`
|
||||
indicates that usernames should be used, while a return value of `1` indicates that user
|
||||
IDs should be used.
|
||||
- `assets`: A JSON object containing the following information:
|
||||
- `podAsset`: Asset used when in the Pod.
|
||||
- `moonAsset`: Asset used when creating on the Moon.
|
||||
- `remoteMoonAsset`: Asset used when creating on a remote Moon.
|
||||
- `developerAsset`: Asset used when playing a story mode level.
|
||||
- `developerAdventureAsset`: Asset used when playing an adventure level.
|
||||
- `dlcAsset`: Asset used when playing a DLC level.
|
||||
- `fallbackAsset`: Asset used when client can't determine the slot type.
|
||||
|
||||
> **Warning**
|
||||
> All `assets` properties are nullable and will return `null` if not set in configuration. Be sure to account
|
||||
> for this when using the returned data.
|
Loading…
Add table
Add a link
Reference in a new issue