wagon/back/dashboard.cgi

25 lines
597 B
Plaintext
Raw Normal View History

2022-09-06 20:57:41 -06:00
#!/bin/bash
# FILE: wagon:back/dashboard.cgi
2022-09-06 20:57:41 -06:00
# DESCRIPTION: Recieves incoming dashboard API requests
source /etc/wagon/config
2022-09-06 20:57:41 -06:00
case "${REQUEST_METHOD}" in
2022-09-14 14:44:00 -06:00
# List peers
'GET') /usr/lib/wagon/dashboard/peer/list "${HTTP_X_REAL_IP}";;
2022-09-06 20:57:41 -06:00
# Add peer
'POST') /usr/lib/wagon/dashboard/peer/add "${HTTP_X_REAL_IP}" "${QUERY_STRING}";;
2022-09-06 20:57:41 -06:00
# Delete peer
'DELETE') /usr/lib/wagon/dashboard/peer/del "${HTTP_X_REAL_IP}" "${QUERY_STRING}";;
2022-09-06 20:57:41 -06:00
2022-09-13 11:33:13 -06:00
# Needed for CORS preflight
'OPTIONS') /usr/lib/wagon/http_res 200;;
2022-09-13 11:33:13 -06:00
2022-09-06 20:57:41 -06:00
# Bad request
*) printf 'Invalid HTTP verb' | /usr/lib/wagon/http_res 405;;
2022-11-08 21:05:34 -07:00
2022-09-14 14:44:00 -06:00
esac