From b0d646b7d0d7bf903625a2f4b0f0bbfad5838569 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:04:39 +0200 Subject: [PATCH 01/10] a --- README.md | 17 +--- openapi.yaml | 283 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 286 insertions(+), 14 deletions(-) create mode 100644 openapi.yaml diff --git a/README.md b/README.md index 823ca6f..50d3237 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,8 @@ # hosted there are a bunch of webservers i host for my personal use, mostly for different parts of my website. im writing a pretty barebones documentation for em here, so you can use them if you find them useful :3 -### naming scheme +## naming scheme i use different hrt terms as a naming scheme for my machines. my main pc is called estrogen, my weak main vps is called bica, and the vps i use to host most of my webservers is called mono (as in monotherapy). so every webserver will most likely be under \.mono.exhq.dev -## dc-lookup.mono.exhq.dev -selfhosted [discord lookup api](https://github.com/mesalytic/discord-lookup-api) instance. the documentation can be found in the github -**example usage:** `GET https://dc-lookup.mono.exhq.dev/v1/user/712639419785412668` - - -## backendreview.mono.exhq.dev -review system i use on my website. this instance will most likely not be useful to you, but [you can selfhost the software if you think its useful to you](https://github.com/exhq/review.exhq.dev) -**example usage:** `GET https://backendreview.mono.exhq.dev/getreviews` - -## slcache.mono.exhq.dev -reverse proxied cached api for song.link, since their responses dont have cors set and have a really low ratelimit -i have not written any documentation for this api, but if you think it might be useful to you, you can check out [song.link's api docs](https://linktree.notion.site/API-d0ebe08a5e304a55928405eb682f6741) and [the sourcecode for slcache](https://git.lgbt/exhq/slcache) -**example usage:** `GET http://slcache.mono.exhq.dev/?url=spotify%3Atrack%3A6BJHsLiE47Sk0wQkuppqhr` \ No newline at end of file +## endpoints +see: [wiki](/wiki) diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 0000000..fffae26 --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,283 @@ +openapi: 3.0.0 +info: + title: Personal Web Services API + description: Documentation for various web services hosted under mono.exhq.dev + version: 1.0.0 + +paths: + /v1/user/{userId}: + get: + tags: + - Discord Lookup + summary: Look up Discord user information + description: Retrieves information about a Discord user using their ID + parameters: + - name: userId + in: path + required: true + schema: + type: string + example: "712639419785412668" + responses: + '200': + description: Successful response with user information + content: + application/json: + schema: + $ref: '#/components/schemas/DiscordUser' + servers: + - url: https://dc-lookup.mono.exhq.dev + + /getreviews: + get: + tags: + - Review System + summary: Get reviews + description: Retrieves reviews from the backend review system + responses: + '200': + description: Successful response with reviews + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Review' + servers: + - url: https://backendreview.mono.exhq.dev + + /: + get: + tags: + - Song Link Cache + summary: Get cached song.link data + description: Cached proxy for song.link API responses with CORS support + parameters: + - name: url + in: query + required: true + schema: + type: string + example: "spotify:track:6BJHsLiE47Sk0wQkuppqhr" + description: Encoded song URL or identifier + responses: + '200': + description: Cached song.link response + content: + application/json: + schema: + $ref: '#/components/schemas/SongLinkResponse' + servers: + - url: http://slcache.mono.exhq.dev + +components: + schemas: + DiscordUser: + type: object + properties: + id: + type: string + example: "712639419785412668" + created_at: + type: string + format: date-time + example: "2020-05-20T12:14:37.877Z" + username: + type: string + example: "exhq" + avatar: + $ref: '#/components/schemas/DiscordAvatar' + avatar_decoration: + type: string + nullable: true + example: null + badges: + type: array + items: + type: string + example: ["HOUSE_BALANCE"] + accent_color: + type: string + nullable: true + example: null + global_name: + type: string + example: "ECHO 🐈" + banner: + $ref: '#/components/schemas/DiscordBanner' + raw: + $ref: '#/components/schemas/DiscordRawData' + + DiscordAvatar: + type: object + properties: + id: + type: string + example: "93dd1fc1629fb1ec652c68203af4f3f1" + link: + type: string + example: "https://cdn.discordapp.com/avatars/712639419785412668/93dd1fc1629fb1ec652c68203af4f3f1" + is_animated: + type: boolean + example: false + + DiscordBanner: + type: object + properties: + id: + type: string + nullable: true + example: null + link: + type: string + nullable: true + example: null + is_animated: + type: boolean + example: false + color: + type: string + nullable: true + example: null + + DiscordRawData: + type: object + properties: + id: + type: string + example: "712639419785412668" + username: + type: string + example: "exhq" + avatar: + type: string + example: "93dd1fc1629fb1ec652c68203af4f3f1" + discriminator: + type: string + example: "0" + public_flags: + type: integer + example: 256 + flags: + type: integer + example: 256 + banner: + type: string + nullable: true + example: null + accent_color: + type: string + nullable: true + example: null + global_name: + type: string + example: "ECHO 🐈" + avatar_decoration_data: + type: string + nullable: true + example: null + banner_color: + type: string + nullable: true + example: null + clan: + type: string + nullable: true + example: null + + Review: + type: object + properties: + reviewID: + type: integer + example: 1 + discordID: + type: string + example: "712653921692155965" + reviewText: + type: string + example: "meow" + timestamp: + type: string + example: "1708902649485" + + SongLinkResponse: + type: object + properties: + entityUniqueId: + type: string + example: "SPOTIFY_SONG::6BJHsLiE47Sk0wQkuppqhr" + userCountry: + type: string + example: "US" + pageUrl: + type: string + example: "https://song.link/s/6BJHsLiE47Sk0wQkuppqhr" + entitiesByUniqueId: + type: object + additionalProperties: + $ref: '#/components/schemas/SongEntity' + linksByPlatform: + type: object + additionalProperties: + $ref: '#/components/schemas/PlatformLink' + + SongEntity: + type: object + properties: + id: + type: string + example: "6BJHsLiE47Sk0wQkuppqhr" + type: + type: string + example: "song" + title: + type: string + example: "From the Start" + artistName: + type: string + example: "Good Kid" + thumbnailUrl: + type: string + example: "https://i.scdn.co/image/ab67616d0000b273e67835d0a5d81fa4f268b513" + thumbnailWidth: + type: integer + example: 640 + thumbnailHeight: + type: integer + example: 640 + apiProvider: + type: string + example: "spotify" + platforms: + type: array + items: + type: string + example: ["spotify"] + + PlatformLink: + type: object + properties: + country: + type: string + example: "US" + url: + type: string + example: "https://open.spotify.com/track/6BJHsLiE47Sk0wQkuppqhr" + entityUniqueId: + type: string + example: "SPOTIFY_SONG::6BJHsLiE47Sk0wQkuppqhr" + nativeAppUriMobile: + type: string + example: "spotify:track:6BJHsLiE47Sk0wQkuppqhr" + nativeAppUriDesktop: + type: string + example: "spotify:track:6BJHsLiE47Sk0wQkuppqhr" + +tags: + - name: Discord Lookup + description: Discord user information lookup service + - name: Review System + description: Backend review system for website + - name: Song Link Cache + description: Cached proxy for song.link API -- 2.45.2 From 4abea6ec74009cbdc2943f9cb10fffb3e524a3a0 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:05:22 +0200 Subject: [PATCH 02/10] guh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50d3237..a7fc784 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ there are a bunch of webservers i host for my personal use, mostly for different i use different hrt terms as a naming scheme for my machines. my main pc is called estrogen, my weak main vps is called bica, and the vps i use to host most of my webservers is called mono (as in monotherapy). so every webserver will most likely be under \.mono.exhq.dev ## endpoints -see: [wiki](/wiki) +see: [wiki](wiki) -- 2.45.2 From 37cff9e5d4d4888f511404191037f4ec228408d1 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:05:42 +0200 Subject: [PATCH 03/10] guh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a7fc784..dac0a6a 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ there are a bunch of webservers i host for my personal use, mostly for different i use different hrt terms as a naming scheme for my machines. my main pc is called estrogen, my weak main vps is called bica, and the vps i use to host most of my webservers is called mono (as in monotherapy). so every webserver will most likely be under \.mono.exhq.dev ## endpoints -see: [wiki](wiki) +see: [wiki](./wiki) -- 2.45.2 From 6a6506834c15ea49f62c88a86eef8b6e2c0b914b Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:35:26 +0200 Subject: [PATCH 04/10] test --- .forgejo/workflows/build.yml | 49 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .forgejo/workflows/build.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..1f71154 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,49 @@ +name: Update API Documentation + +on: + push: + paths: + - 'openapi.yaml' # Trigger when openapi.yaml changes + branches: + - main # or your default branch + +jobs: + convert-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Checkout wiki + uses: actions/checkout@v3 + with: + repository: ${{github.repository}}.wiki + path: wiki + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Install Widdershins + run: npm install -g widdershins + + - name: Convert OpenAPI to Markdown + run: | + widdershins openapi.yaml -o wiki/api.md --omitHeader true + + - name: Configure Git + run: | + cd wiki + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Commit and push changes to wiki + run: | + cd wiki + git add api.md + git diff-index --quiet HEAD || git commit -m "Update API documentation" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index dac0a6a..70b42e4 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ there are a bunch of webservers i host for my personal use, mostly for different i use different hrt terms as a naming scheme for my machines. my main pc is called estrogen, my weak main vps is called bica, and the vps i use to host most of my webservers is called mono (as in monotherapy). so every webserver will most likely be under \.mono.exhq.dev ## endpoints -see: [wiki](./wiki) +see wiki -- 2.45.2 From fcf9774c08a26416e6efd1e5bfda66d08e5be597 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:36:23 +0200 Subject: [PATCH 05/10] guh --- .forgejo/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 1f71154..c48c7be 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -1,11 +1,12 @@ name: Update API Documentation on: + workflow_dispatch: push: paths: - - 'openapi.yaml' # Trigger when openapi.yaml changes + - 'openapi.yaml' branches: - - main # or your default branch + - main jobs: convert-and-push: -- 2.45.2 From 2c91b2699d9728319c9df709ee8030ddcbb84da6 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:41:49 +0200 Subject: [PATCH 06/10] mw --- .forgejo/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index c48c7be..847fdc1 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -21,6 +21,7 @@ jobs: with: repository: ${{github.repository}}.wiki path: wiki + ref: main - name: Setup Node.js uses: actions/setup-node@v3 -- 2.45.2 From b8ca6b210eabf1bf4d74e4fad1411a209d32ec20 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:49:39 +0200 Subject: [PATCH 07/10] mfw --- .forgejo/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 847fdc1..27f7411 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -33,7 +33,7 @@ jobs: - name: Convert OpenAPI to Markdown run: | - widdershins openapi.yaml -o wiki/api.md --omitHeader true + widdershins openapi.yaml -o wiki/api.md --omitHeader --summary --expandBody -c - name: Configure Git run: | -- 2.45.2 From 7b7360be0f85035b62e4ba9c918ff757e7e02341 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:52:45 +0200 Subject: [PATCH 08/10] bah --- .forgejo/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 27f7411..e3a9bc0 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -33,7 +33,7 @@ jobs: - name: Convert OpenAPI to Markdown run: | - widdershins openapi.yaml -o wiki/api.md --omitHeader --summary --expandBody -c + widdershins openapi.yaml -o wiki/api.md --omitHeader true --summary true --expandBody true --code false - name: Configure Git run: | -- 2.45.2 From fede3d4b14e845b32f2e8166c6841acd04eefc7a Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:53:42 +0200 Subject: [PATCH 09/10] oop --- .forgejo/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index e3a9bc0..4abd526 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -33,7 +33,7 @@ jobs: - name: Convert OpenAPI to Markdown run: | - widdershins openapi.yaml -o wiki/api.md --omitHeader true --summary true --expandBody true --code false + widdershins openapi.yaml -o wiki/api.md --omitHeader true --summary true --expandBody true --code true - name: Configure Git run: | -- 2.45.2 From da97f4c3e2ff5cac6d9c0d81dd06ffe3d7ea5739 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 26 Oct 2024 22:55:38 +0200 Subject: [PATCH 10/10] oop --- .forgejo/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 4abd526..da6e101 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -38,8 +38,8 @@ jobs: - name: Configure Git run: | cd wiki - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + git config --local user.email "action@noreply.git.lgbt" + git config --local user.name "GitLGBT Action" - name: Commit and push changes to wiki run: | -- 2.45.2