moved stuff around to fix slug system

This commit is contained in:
Jonas_Jones 2024-09-01 16:54:44 +02:00
parent 31a1419cb4
commit 1f96b8fde1
11 changed files with 6 additions and 4 deletions

10
docs/api/_category_.json Normal file
View file

@ -0,0 +1,10 @@
{
"position": 2,
"label": "API",
"collapsible": true,
"collapsed": true,
"link": {
"type": "generated-index",
"description": "Documentation for the Jonas_Jones API"
}
}

58
docs/api/intro.mdx Normal file
View file

@ -0,0 +1,58 @@
---
slug: /api
sidebar_position: 1
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Introduction
The API aims to provide a foundation for the different parts of the [Jonas_Jones Ecosystem](/jj_ecosystem) to interact with each other.
## Composition
The APi features 2 parts, the [front-end](#front-end) and the [back-end](#back-end)
### Front-End
A cloudflare worker available on [Github](https://github.com/JonasunderscoreJones/api-worker/) that routes the traffic to the [back-end](#back-end) and has a route for the API's uptime status:
- GET **/status** - Get API uptime status
:::tip[Response]
<Tabs>
<TabItem value="200" label="200">
```json
API is up and running
{
"status": 200,
"statusText": "Ok"
}
```
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
</TabItem>
</Tabs>
:::
### Back-End
:::info
The Back-End is only available when the `/status` route returns code `200`
In theory this should always be the case but it is not guaranteed. Downtime can occur from time to time.
:::
A Rust back-end available on [Github](https://github.com/JonasunderscoreJones/jonas_jones-api) that handles all the forwarded requests from the [front-end](#front-end). The API is currently in it's first version therefore all routes start with `/v1/`. The routes are referenced on the [v1 Routes](/category/v1-routes) page.

View file

@ -0,0 +1,10 @@
{
"position": 2,
"label": "v1 Routes",
"collapsible": true,
"collapsed": true,
"link": {
"type": "generated-index",
"description": "Documentation for the Jonas_Jones API v1 Routes"
}
}

View file

@ -0,0 +1,167 @@
---
sidebar_position: 1
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Basic
The basic routes of the API
## GET /v1/help
Get a help message.
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
Please refer to the wiki at https://wiki.jonasjones.dev/Api/
```
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::
## GET /v1/ping
Get a ping back from the API
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
pong
```
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::
## GET /v1/version
Get the version of the Rust api back-end
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
["0.0.1+alpha-build01"]
```
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::
## GET /v1/debug/headers
Get the incoming headers of the request
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
{
"Origin": "...",
"Referer": "...",
"User-Agent": "...",
"...": "..."
}
```
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,79 @@
---
sidebar_position: 5
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Minecraft Mod Update Checker
A simple way for a mod to check if it is up to date
## GET /v1/updates/minecraft/mods/
→ /v1/updates/minecraft/mods/*<span style={{ color: "green" }}>package</span>*/*<span style={{ color: "green" }}>modloader</span>*/*<span style={{ color: "green" }}>minecraftversion</span>*/*<span style={{ color: "green" }}>modversion</span>*
| Parameter | Type | Description | Example | Required | Default Value (if optional) |
| ---------------- | ------------------- | --------------------------------------------------- | ------------------------- | -------- | --------------------------- |
| package name | String | Full package name (letter case **RELEVANT**) | "me.jonasjones.mcwebserver" | Yes | - |
| modloader | String | modloader id ("fabricquilt" or "forge") | "fabricquilt | Yes | - |
| minecraftversion | Version Number | The Minecraft Version | "1.14.4" | Yes | - |
| modversion | Version Number | The Mod Version | "0.3.2" | Yes | - |
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
{
"promos": {
"latest": "0.3.2",
"recommended": "0.3.2"
},
"upToDate": true,
"telemetry_enabled": false
}
```
| Parameter | Type | Description |
| ----------------- | -------------- | ----------------------------------------------------------------------------- |
| latest | Version Number | The version number of the latest version for the given Minecraft Version |
| recommended | Version Number | The version number of the recommended version for the given Minecraft Version |
| upToDate | Boolean | Wether the mod is up to date or not |
| telemetry_enabled | Boolean | Wether telemetry is enabled or not |
</TabItem>
<TabItem value="400" label="400">
```json
{
"status": 400,
"statusText": "Bad Request"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,147 @@
---
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Run Scripts
The available run-scripts routes for the pre-setup python scripts for the [K-Comebacks Database](./k-comebacks-database) ([on Github](https://github.com/JonasunderscoreJones/turbo-octo-potato/blob/main/rpopfetch.py)), [Projects Database](./projects-database) ([on Github](https://github.com/JonasunderscoreJones/turbo-octo-potato/blob/main/update_projects.py)) and the [likesongsync2.py script](https://github.com/JonasunderscoreJones/turbo-octo-potato/blob/main/likedsongsync2.py]).
:::note
If the requested script is already running, the request will be ignored.
:::
## GET /v1/run/kcomebacks
Run the [rpopfetch.py Script](https://github.com/JonasunderscoreJones/turbo-octo-potato/blob/main/rpopfetch.py) to update the [K-Comebacks Database](./k-comebacks-database)
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
{
"status": "udating..."
}
```
| Parameter | Type | Description |
| ---------- | ------ | -------------------------------- |
| status | String | The status message of the script |
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::
## GET /v1/run/projects
Run the [update_projects.py Script](https://github.com/JonasunderscoreJones/turbo-octo-potato/blob/main/update_projects.py) to update the [Projects Database](./projects-database)
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
{
"status": "udating..."
}
```
| Parameter | Type | Description |
| ---------- | ------ | -------------------------------- |
| status | String | The status message of the script |
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::
## GET /v1/run/synclikedsongs
Run the [likedsongsync2.py Script](https://github.com/JonasunderscoreJones/turbo-octo-potato/blob/main/likedsongsync2.py) to sync my liked songs from Spotify with [Last.fm](https://fm.jonasjones.dev)
:::tip[**Example** Response]
<Tabs>
<TabItem value="200" label="200">
```json
{
"status": "udating..."
}
```
| Parameter | Type | Description |
| ---------- | ------ | -------------------------------- |
| status | String | The status message of the script |
</TabItem>
<TabItem value="500" label="500">
```json
{
"status": 500,
"statusText": "Internal Server Error"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
<TabItem value="503" label="503">
```json
API is down
{
"status": 503,
"statusText": "Service Unavailable"
}
```
| Parameter | Type | Description |
| ---------- | ------ | ---------------------------- |
| status | Number | The status code of the error |
| statusText | String | The status text of the error |
</TabItem>
</Tabs>
:::