feat(api-server): remote control api #1909

Merged
Su-Yong merged 26 commits from feature/api-server into master 2024-10-13 10:10:12 +00:00
Su-Yong commented 2024-03-30 17:50:46 +00:00 (Migrated from github.com)

Summary

  • WIP
  • Implement API server
  • hono.js (zero-deps)
  • Validating inputs with ZOD
  • JWT for authorization
  • Swagger (OpenAPI)

Notes

# Summary - WIP - Implement API server - hono.js (zero-deps) - Validating inputs with ZOD - JWT for authorization - Swagger (OpenAPI) # Notes
Owner

Please add versioning 🙏

Please add versioning 🙏
Owner

Huh, I resolved the conflict and Snyk is now mad at me :(

I assume a new vulnerability was found between the previous merge and my merge?

Huh, I resolved the conflict and Snyk is now mad at me :( I assume a new vulnerability was found between the previous merge and my merge?
iryis commented 2024-09-13 15:17:35 +00:00 (Migrated from github.com)

What's blocking this from being merged currently? I'd love to adapt my integrations based on this PR

What's blocking this from being merged currently? I'd love to adapt my integrations based on this PR
Owner

I'll give this a thorough look tomorrow.
As for why it is not merged, I think it is still in progress.

I'll give this a thorough look tomorrow. As for why it is not merged, I think it is still in progress.
Owner

I squashed the commits and resolved the conflict, you can find it here.

(Note that I won't be opening a PR to merge that branch into this one, it is just for testing)

--

I ran into an issue, I couldn't authenticate using the bearer token given to me by the api.
Steps taken:

  1. Send POST to /auth/{id} (id=a) and receive a json response that contains the JWT
  2. Attempt to use any of the APIs endpoints other than /auth/{id} and provide the JWT in the form Authorization: Bearer {JWT}
  3. Receive an Unauthorized response

PS: I had the auth strategy to none.
PS2: I have a huge headache, so I didn't end up giving this a thorough look :(

I squashed the commits and resolved the conflict, you can find it [here](https://github.com/ArjixWasTaken/youtube-music/commit/a6bcf1e4871b00a85c39039705ada4a13fb0563a). (Note that I won't be opening a PR to merge that branch into this one, it is just for testing) -- I ran into an issue, I couldn't authenticate using the bearer token given to me by the api. Steps taken: 1. Send POST to `/auth/{id}` (`id`=`a`) and receive a json response that contains the JWT 2. Attempt to use any of the APIs endpoints other than `/auth/{id}` and provide the JWT in the form `Authorization: Bearer {JWT}` 3. Receive an `Unauthorized` response PS: I had the auth strategy to none. PS2: I have a huge headache, so I didn't end up giving this a thorough look :(
JellyBrick commented 2024-09-17 17:59:53 +00:00 (Migrated from github.com)

TODO: processing CORS with hono/cors

TODO: processing CORS with `hono/cors`
JustMrPhoenix commented 2024-10-07 20:08:53 +00:00 (Migrated from github.com)

Hey, who is responsible for this PR? I'd love to move this along for all the cool integrations to be possible. If there are still changes needed I'm willing to work on them. Please let me know if I should take over this feature @JellyBrick. Kinda painful to see it stuck in limbo for this long 🫠

Hey, who is responsible for this PR? I'd love to move this along for all the cool integrations to be possible. If there are still changes needed I'm willing to work on them. Please let me know if I should take over this feature @JellyBrick. Kinda painful to see it stuck in limbo for this long 🫠
JellyBrick (Migrated from github.com) approved these changes 2024-10-13 10:09:55 +00:00
JellyBrick commented 2024-10-13 12:49:29 +00:00 (Migrated from github.com)

@JustMrPhoenix merged

@JustMrPhoenix merged
SurajBhari commented 2025-01-03 18:35:51 +00:00 (Migrated from github.com)

i am having issue using the api key.
i am on /swagger page and got a access token. upon adding that token to authorize on top of page I should be able to tryout routes.

but it keeps on saying unauthorized

this is the curl request it generates. what is wrong here ?

curl -X 'POST' \
  'http://localhost:26538/api/v1/toggle-play' \
  -H 'accept: */*' \
  -H 'Authorization: Bearer eyJhfGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5NjkiLCJpYXQiOjE3MzU5MjkyNzJ9.5kCWqMddF1bBgwi6QzTVkO4hGYumZ1QLoFH9rEqin_Y' \
  -d ''
  
i am having issue using the api key. i am on /swagger page and got a access token. upon adding that token to authorize on top of page I should be able to tryout routes. but it keeps on saying unauthorized this is the curl request it generates. what is wrong here ? ``` curl -X 'POST' \ 'http://localhost:26538/api/v1/toggle-play' \ -H 'accept: */*' \ -H 'Authorization: Bearer eyJhfGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5NjkiLCJpYXQiOjE3MzU5MjkyNzJ9.5kCWqMddF1bBgwi6QzTVkO4hGYumZ1QLoFH9rEqin_Y' \ -d '' ```
Zerwin commented 2025-03-11 00:14:12 +00:00 (Migrated from github.com)

I had to disable and enable the plugin for it to start working, maybe that'll also fix it for you

I had to disable and enable the plugin for it to start working, maybe that'll also fix it for you
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: YTMD/youtube-music#1909
No description provided.