mirror of
https://github.com/0x1d/rcond.git
synced 2025-12-14 18:25:21 +01:00
feat: implement file upload
This commit is contained in:
19
README.md
19
README.md
@@ -4,6 +4,7 @@
|
||||
|
||||
A distributed management daemon designed to remotely configure system components, including:
|
||||
- Network connections: Manage network connections through NetworkManager's D-Bus interface
|
||||
- Files: Manage files on the system
|
||||
- System hostname: Update the system's hostname
|
||||
- Authorized SSH keys: Manage the user's authorized_keys file to add, remove, or modify authorized SSH keys
|
||||
- System state: Restart and shutdown the system
|
||||
@@ -143,6 +144,7 @@ All endpoints except `/health` require authentication via an API token passed in
|
||||
| POST | `/hostname` | Set the hostname |
|
||||
| POST | `/users/{user}/keys` | Add an authorized SSH key |
|
||||
| DELETE | `/users/{user}/keys/{fingerprint}` | Remove an authorized SSH key |
|
||||
| POST | `/system/file` | Upload a file to the system |
|
||||
| POST | `/system/restart` | Restart the system |
|
||||
| POST | `/system/shutdown` | Shutdown the system |
|
||||
| GET | `/cluster/members` | Get the cluster members |
|
||||
@@ -150,6 +152,7 @@ All endpoints except `/health` require authentication via an API token passed in
|
||||
| POST | `/cluster/leave` | Leave the cluster |
|
||||
| POST | `/cluster/event` | Send a cluster event |
|
||||
|
||||
|
||||
### Response Codes
|
||||
|
||||
- 200: Success
|
||||
@@ -229,4 +232,20 @@ curl -X POST "http://rpi-test:8080/cluster/event" \
|
||||
-d '{
|
||||
"name": "restart"
|
||||
}'
|
||||
```
|
||||
|
||||
### Upload a file
|
||||
|
||||
This example will store Base64 encoded content to the target path.
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8080/system/file' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'X-API-Token: 1234567890' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"path": "/tmp/somefile",
|
||||
"content": "Zm9vCg=="
|
||||
}'
|
||||
```
|
||||
Reference in New Issue
Block a user