summaryrefslogtreecommitdiff
path: root/testdata/http_server
AgeCommit message (Collapse)Author
2023-12-22all: implement HTTP API to stop local or play executionShulhan
The HTTP API for stopping execution have the following signature, DELETE /awwan/api/execute?id=<string> If the ID is exist, the execution will be cancelled and return HTTP status 200 with the following body, Content-Type: application/json { "code": 200, } Otherwise it will return HTTP status 404 with error message. References: https://todo.sr.ht/~shulhan/awwan/9
2023-12-21all: changes default date-time prefix on testShulhan
Using "-" as dummy date-time prefix make the test output quite hard to read, especially since we use the same prefix "===" and "---" with Go test output.
2023-12-20testdata/http_server: fix missing .ssh directory on executeShulhan
The execute directory is used as base directory of awwan during testing APIExecute.
2023-12-04all: write the output as is when sending with server-sent eventsShulhan
Previously, if the command output is "line1\n\nline2\n", the web output it as line1 line2 it should be line1 line2 This fix the empty line not displayed in wui output.
2023-12-01all: move wrapping BEGIN and END outside of sessionShulhan
2023-12-01all: remove script name in the log prefixShulhan
Since each execution now logged in the file with ".log" extension, there is no need to prefix it with script name again, because its redundant.
2023-12-01all: handle reconnecting when streaming executionShulhan
In "/awwan/api/execute/tail" SSE endpoint, in order for client to be able to reconnect and start streaming from the last know output, we need to send the ID for each message that we send. The ID is the index of Output in slice. If client does not send Last-Event-ID, we send all Output from beginning, otherwise, we send only message start from index in Last-Event-ID.
2023-12-01all: implement HTTP API to fetch execution output by IDShulhan
The new API is "GET /awwan/api/execute/tail" that implement Server-sent events, not a normal GET request. Its accept the query parameter "id" with value is the execution ID from "/awwan/api/execute". Once called with valid ID, it will streaming the command output to client. By using this new API, the WUI can receive the output of command immediately without waiting for all commands to be completed. Implements: https://todo.sr.ht/~shulhan/awwan/5 Signed-off-by: Shulhan <ms@kilabit.info>
2023-12-01all: refactoring HTTP endpoint for ExecuteShulhan
Previously, the Execute endpoint wait for command execution to finish. In case the command takes longer than proxy or server write timeout, it will return with an timeout error to client. In this changes, we generate an execution ID for each request and return it immediately. The next commit will implement HTTP endpoint to fetch the latest status and/or output by execution ID. References: https://todo.sr.ht/~shulhan/awwan/5
2023-11-20all: do not changes the Script path in the response of HTTP ExecuteShulhan
Previously, the ExecRequest from HTTP Execute endpoint changes the Script value to the absolute script path in the system. This changes fix this issue to minimize inconsistency between request and response.
2023-11-19all: return 403 Forbidden when requesting awwan.key and awwan.passShulhan
When user run "awwan serve", using web-user interface, any request to fetch the content of "awwan.key" and "awwan.pass" should not allowed for security reason, in case user want to serve awwan with others.
2023-11-16all: always load SSH config when running PlayShulhan
In case awwan run with "serve" and we modify the ".ssh/config", the changes does not detected by awwan because we only read ".ssh/config" once we Awwan instance created. This changes fix this issue by always loading SSH config everytime the Play method executed so the user CLI and WUI has the same experiences.
2023-11-16all: implement HTTP API to decrypt fileShulhan
Similar to the CLI, the HTTP API accept the path of vault file and return the path to decrypted file.
2023-11-15all: implement HTTP API to encrypt fileShulhan
Similar to the CLI, the HTTP API accept the path of file and return the path to encrypted file.