Files
huso/README.md
2022-07-01 18:43:30 +02:00

296 lines
8.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# huso
Hanami's universeller Serien Organizer
**Backend code**
## API
### General
| Method | Route | Response |
| - | - | - |
| GET | / | Startseite als HTML |
| GET | /api/log | Log als plaintext |
### Auth
| Method | Route | Description | Response | Parameter | Header | POST-Body |
| - | - | - | - | - | - | - |
| GET | /api/auth/{user} | Test für Authentifizierung | (status code) | {user} = MAL username | X-HUSO-AUTH | |
| POST | /api/register | Registrieren | RegisterData JSON | | | RegisterData JSON |
| DELETE | /api/register | User löschen | RegisterData JSON | | | RegisterData JSON |
_RegisterData_
```json
{
"username": "TESTUSERNAME",
"malId": 42069,
"secret": "1ef539ed34435873fc964c2c20da84f8793ae3731a154cffb41039f2f061cabe97dea18cfffa51c58f3f564f8e7f0cd0a98d7ba3dddb7301c0e7549626ea43af",
"sauce": "31f3637d8d05ddca7deee89453e3b68a9b74860facd8d5a6768e5ca842571595c8d31e43ce0e996f893578d0bd2b61f3f3820ec03fbb30407e31a2603c887b1"
}
```
_sauce_
```
SHA512(綾波レイ + malId + username)
```
_secret_
```
SHA512(SAUCE + PASSWORD)
```
_X-HUSO-AUTH_ -> _secret_ des users
### Anime
| Method | Route | Description | Response | Parameter | Header | POST-Body |
| - | - | - | - | - | - | - |
| GET | /api/season | Aktuelle Season holen | []Anime JSON | | | |
| GET | /api/nextseason | Nächste Season holen | []Anime JSON | | | |
| GET | /api/nextnextseason | Übernächste Season holen | []Anime JSON | | | |
| GET | /api/lastseason | Letzte Season holen | []Anime JSON | | | |
| GET | /api/anime/{id} | Einzelnen Anime holen | Anime JSON | {id} = MAL Anime id | | |
| GET | /api/animesearch | Anime auf MAL suchen | []Anime JSON | Query parameter {q} = Suchtext | | |
_[]Anime_
```json
[
{
"anime": 50265,
"title": "Spy x Family",
"titleEn": "",
"titleJp": "SPY×FAMILY",
"imageMedium": "https://cdn.myanimelist.net/images/anime/1441/122795.jpg",
"imageLarge": "https://cdn.myanimelist.net/images/anime/1441/122795l.jpg",
"imageThumb": "https://cdn.myanimelist.net/images/anime/1441/122795t.jpg",
"url": "https://myanimelist.net/anime/50265",
"type": "TV",
"status": "Currently Airing",
"episodes": 12,
"synopsis": "ANYA~ [Written by MAL Rewrite]",
"genres": [
{
"id": 1,
"name": "Action"
},
{
"id": 4,
"name": "Comedy"
}
],
"startDate": "2022-04-09T00:00:00Z",
"endDate": "0001-01-01T00:00:00Z",
"year": 2022,
"season": "spring",
"score": 9.07,
"scoredBy": 191073,
"rank": 5,
"popularity": 239,
"members": 661291,
"source": "Manga",
"weekday": "Saturdays",
"studios": [
{
"id": 858,
"name": "Wit Studio"
},
{
"id": 1835,
"name": "CloverWorks"
}
],
"trailerUrl": "https://www.youtube.com/watch?v=ofXigq9aIpo",
"trailerEmbedUrl": "https://www.youtube.com/embed/ofXigq9aIpo?enablejsapi=1&wmode=opaque&autoplay=1"
},
{
"anime": 43608,
"title": "Kaguya-sama wa Kokurasetai: Ultra Romantic",
"titleEn": "Kaguya-sama: Love is War - Ultra Romantic",
"titleJp": "かぐや様は告らせたい-ウルトラロマンティック-",
"imageMedium": "https://cdn.myanimelist.net/images/anime/1160/122627.jpg",
"imageLarge": "https://cdn.myanimelist.net/images/anime/1160/122627l.jpg",
"imageThumb": "https://cdn.myanimelist.net/images/anime/1160/122627t.jpg",
"url": "https://myanimelist.net/anime/43608",
"type": "TV",
"status": "Currently Airing",
"episodes": 12,
"synopsis": "Tsun [Written by MAL Rewrite]",
"genres": [
{
"id": 4,
"name": "Comedy"
},
{
"id": 41,
"name": "Suspense"
}
],
"startDate": "2022-04-09T00:00:00Z",
"endDate": "0001-01-01T00:00:00Z",
"year": 2022,
"season": "spring",
"score": 8.99,
"scoredBy": 74937,
"rank": 13,
"popularity": 396,
"members": 454326,
"source": "Manga",
"weekday": "Saturdays",
"studios": [
{
"id": 56,
"name": "A-1 Pictures"
}
],
"trailerUrl": "https://www.youtube.com/watch?v=vFN5K-iAyV0",
"trailerEmbedUrl": "https://www.youtube.com/embed/vFN5K-iAyV0?enablejsapi=1&wmode=opaque&autoplay=1"
}
]
```
### User
| Method | Route | Description | Response | Parameter | Header | POST-Body |
| - | - | - | - | - | - | - |
| GET | /api/user/{user?} | MAL user suchen oder alle registrierten user holen | []User JSON | {user?} = optional: MAL username | | |
_[]User_
```json
[
{
"id": 42069,
"username": "TESTUSERNAME",
"url": "https://myanimelist.net/profile/TESTUSERNAME",
"imageUrl": "https://cdn.myanimelist.net/images/userimages/42069.jpg?t=1652707800",
"lastOnline": "2022-01-01T06:26:42Z",
"gender": "",
"birthday": "0001-01-01T00:00:00Z",
"location": "TEST",
"joined": "2010-01-01T00:00:00Z"
}
]
```
### Watch
| Method | Route | Description | Response | Parameter | Header | POST-Body |
| - | - | - | - | - | - | - |
| GET | /api/watch/{user?} | Watches von user oder allen | []AnimeUser JSON | {user?} = optional: MAL username | | |
| GET | /api/watchext/{user?} | Erweiterte Watches von user oder allen | []AnimeUserExtended JSON | {user?} = optional: MAL username | | |
| POST | /api/watch/{user} | Neuen watch schicken | []AnimeUser JSON | {user} = MAL username | X-HUSO-AUTH | []AnimeUser JSON |
| DELETE | /api/watch/{user} | Watch löschen | []AnimeUser JSON | {user} = MAL username | X-HUSO-AUTH | []AnimeUser JSON |
**Verwendung des JSON von GET und POST/DELETE unterscheiden sich. Bei POST/DELETE muss nur der zu verändernde Anime angegeben werden und sonst nichts.**
_[]AnimeUser_ (GET)
```json
[
{
"anime": 50265,
"users": [
{
"username": "TESTUSERNAME",
"malId": 42069,
"progress": 6,
"updated": "2022-05-15T20:44:35Z"
}
]
},
{
"anime": 40356,
"users": [
{
"username": "TESTUSERNAME",
"malId": 42069,
"progress": 3,
"updated": "2022-04-25T18:11:27Z"
}
]
}
]
```
_[]AnimeUserExtended_ (GET)
```json
[
{
"anime": 50265,
"users": [
{
"username": "TESTUSERNAME",
"malId": 42069,
"progress": 6,
"updated": "2022-05-15T20:44:35Z"
}
],
"data": { --SEE ANIME GET (Anime object)-- },
"appointments": { --SEE APPOINTMENT GET (Appointment list)-- }
},
{
"anime": 40356,
"users": [
{
"username": "TESTUSERNAME",
"malId": 42069,
"progress": 3,
"updated": "2022-04-25T18:11:27Z"
}
],
"data": { --SEE ANIME GET (Anime object)-- },
"appointments": { --SEE APPOINTMENT GET (Appointment list)-- }
}
]
```
_[]AnimeUser_ (POST/DELETE)
```json
[
{
"anime": 40356,
"users": []
}
]
```
### Chat
| Method | Route | Description | Response | Parameter | Header | POST-Body |
| - | - | - | - | - | - | - |
| GET | /api/chat/{id} | Chat für Anime holen | Plaintext chat | {id} = MAL Anime id | | |
| POST | /api/chat/{id}/{user} | Chat für Anime senden | Plaintext chat mit neuer Nachricht | {id} = MAL Anime id; {user} = MAL username | X-HUSO-AUTH | Neue Nachricht in plaintext |
### Appointment
| Method | Route | Description | Response | Parameter | Header | POST-Body |
| - | - | - | - | - | - | - |
| GET | /api/appointment | Appointments holen | []Appointment | | | |
| POST | /api/appointment/{user} | Appointment schicken | []Appointment JSON | {user} = MAL username | X-HUSO-AUTH | []Appointment JSON |
| DELETE | /api/appointment/{user} | Von Appointments austragen | []Appointment JSON | {user} = MAL username | X-HUSO-AUTH | []Appointment JSON |
**Verwendung des JSON von GET und POST/DELETE unterscheiden sich. Bei POST/DELETE muss nur das Datum und der zu verändernde Anime angegeben werden und sonst nichts.**
_[]Appointment_ (GET)
```json
[
{
"anime": 40356,
"date": "2022-05-30T20:51:51Z",
"users": [
"TESTUSERNAME",
"TESTUSERNAME2"
]
},
{
"anime": 50265,
"date": "2022-05-31T20:51:51Z",
"users": [
"TESTUSERNAME"
]
}
]
```
_[]Appointment_ (POST/DELETE)
```json
[
{
"anime": 50265,
"date": "2022-05-31T22:51:51Z",
"users": []
}
]
```