Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reading and setting inputs via the HTTP API #371

Merged
merged 1 commit into from
Sep 1, 2024

Conversation

hanzi
Copy link
Collaborator

@hanzi hanzi commented Aug 30, 2024

Description

This adds the following features to the HTTP API:

  • GET /input for retrieving a list of currently pressed buttons,
  • POST /input for setting the list of currently pressed buttons (only works in manual mode, same as pressing buttons in the GUI),
  • GET /bot_modes for getting a list of all available bot modes,
  • a new Inputs channel for the events stream, that can be used to subscribe to input changes.

I have made use of these new endpoints in the demo page (index.html) and also added form controls for bot mode, emulation speed and video/audio toggle.

Furthermore, the demo page will react to and relay button presses. Though the key mapping is currently hardcoded to the bot's defaults.

image

Checklist

  • Black Linter has been ran, using --line-length 120 argument
  • Wiki has been updated (if relevant)

This adds the following features to the HTTP API:

- `GET /input` for retrieving a list of currently pressed buttons,
- `POST /input` for _setting_ the list of currently pressed buttons (only works in manual mode, same as pressing buttons in the GUI),
- `GET /bot_modes` for getting a list of all available bot modes,
- a new `Inputs` channel for the events stream, that can be used to subscribe to input changes.

I have made use of these new endpoints in the demo page (`index.html`) and also added form controls for bot mode, emulation speed and video/audio toggle.

Furthermore, the demo page will react to and relay button presses. Though the key mapping is currently hardcoded to the bot's defaults.
@hanzi hanzi mentioned this pull request Aug 30, 2024
2 tasks
@40Cakes 40Cakes merged commit 72ba4f0 into 40Cakes:main Sep 1, 2024
1 check passed
@hanzi hanzi deleted the http-api-enhancements branch September 6, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants