docs(global): 📝 add documentation Markdown files and LICENSE

Signed-off-by: Andrei Jiroh Eugenio Halili <ajhalili2006@gmail.com>
This commit is contained in:
Andrei Jiroh Halili 2022-03-24 15:45:00 +00:00
parent b8ebf92df3
commit 541777c4e1
5 changed files with 115 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Andrei Jiroh Halili
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

25
README.md Normal file
View File

@ -0,0 +1,25 @@
# Unofficial MCC Discord Rich Presence
| Key | Value |
| --- | --- |
| Maintability/Stability Status | New Project / [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges) |
| Description | Unofficial Discord Rich Presence for MCC viewers/participants, in an REST API.
| License | MIT |
| Maintainer | [Andrei Jiroh](https://ajhalili2006.bio.link) |
| Canonical Repository | <https://gitlab.com/RecapTime/mcc-discord-rpc>
Contains programmatic REST API to update Discord Rich Presence on the fly, especially for MCC viewers who use Discord. It's still not yet ready for production use, but we welcome accepting community contributions
## Requirements
You need [Node.js 16 (or later)](https://nodejs.org) and optionally [Git](https://git-scm.com) if you choose not to [download the source tarball](https://gitlab.com/RecapTime/mcc-discord-rpc/-/archive/main/mcc-discord-rpc-main.zip) (and want to easily update your copy).
## Setup
1. Make sure Yarn is installed, and if not try `corepack enable && yarn` (it's all same for PowerShell and Command Prompt).
2. Navigate to your local copy of the repo (either through `git clone https://gitlab.com/RecapTime/mcc-discord-rpc` or extracted from tarball) and just run `yarn start`. No more `npm install` since we use Yarn Plug 'n Play in combination with offline caches checked in, especially in cases where Windows Defender will think Node.js processes are doing some ransomware-like activity on filesystem level when populating the `node_modules` directory via the regular npm install.
3. Fire up Discord desktop client and enjoy. Optionally hook up your stream board to [do some API calls](./docs/api.md) behind the scenes.
## Documentation
Additional documentation can be found on [the `docs` directory](./docs/README.md), including asset key names and API Docs.

4
docs/README.md Normal file
View File

@ -0,0 +1,4 @@
# Documentation
* [Rich Presence Assets](assets.md)
* [API Docs](api.md)

46
docs/api.md Normal file
View File

@ -0,0 +1,46 @@
# API Docs
The REST API can be accessible at port `60881` unless overriden via the `PORT` variable, listening on all interfaces, so please adjust your firewall settings accordingly.
**:warning: The API docs is a work in progress.** We're currently ironing out the backend code behind the scenes, much like the stability status of the Node.js code in this code.
## Endpoints
**Base URL**: `http://localhost:${PORT:-"60881"}` (for non-Linux users, defaults to `60881` unless `PORT` variable is defined when running `yarn start`)
### `/getState`
**Description**: Gets the current RPC state from `rpcState.json` file.
**Example response**:
```jsonc
// curl http://localhost:60881/getState | jq .
{
"details": "On the Admin Stream",
"state": "https://twitch.tv/TheNoxcrew",
"assets": {
"large_image": "mcc-twitter",
"large_text": "MC Championship",
"small_image": "spectator",
"small_text": "Admin Stream"
},
"buttons": [
{
"label": "Check event stats",
"url": "https://mcc.live"
},
{
"label": "Use this Custom RPC",
"url": "https://gitlab.com/RecapTime/mcc-discord-rpc"
}
],
"timestamps": {
"start": 1647961984753
}
}
```
### `/changeTeams/regular-<participant|viewer>/<teamSlug>`
## Appendix

19
docs/assets.md Normal file
View File

@ -0,0 +1,19 @@
# Available Assets for Rich Presence use
**COPYRIGHT DISCLAIMER**: These assets listed below are used for use in the Rich Presence stuff and doesn't intend to violate the copyright of these assets from Noxcrew.
| Key | URL from Discord's CDN / Preview | Source |
| --- | --- | --- |
| `mcc-twitter` | ![MCC Twitter pfp](https://cdn.discordapp.com/app-assets/952456760948559932/952473393922449418.png) | Twitter |
| `mcc-logo` | Same as `mcc-twitter` curently, might change soon | |
| `spectator` | ![Admin Stream icon](https://cdn.discordapp.com/app-assets/952456760948559932/952579352032329728.png) | Straight from the main stats website, through the magic of DevTools.
| `red-rabbits` | ![Red Rabbits](https://cdn.discordapp.com/app-assets/952456760948559932/952458916078428191.png) | MCC Wiki
| `orange-ocelots` | ![Orange Ocelots](https://cdn.discordapp.com/app-assets/952456760948559932/955451556977868850.png) | MCC Wiki
| `yellow-yaks` | ![Yellow Yaks](https://cdn.discordapp.com/app-assets/952456760948559932/955451556948500560.png) | MCC Wiki
| `` | !
| ``
| ``
| ``
| ``
| ``
| ``