wagon/back/fed.cgi

22 lines
485 B
Plaintext
Raw Normal View History

2022-09-14 14:44:00 -06:00
#!/bin/bash
# FILE: wagon:back/fed.cgi
2022-09-14 14:44:00 -06:00
# DESCRIPTION: Recieves incoming federated requests
source /etc/wagon/config
2022-09-14 14:44:00 -06:00
case "${REQUEST_METHOD}" in
# Add
'POST') /usr/lib/wagon/fed/peer/add "${HTTP_X_REAL_IP}" "${QUERY_STRING}";;
2022-09-14 14:44:00 -06:00
# Delete
'DELETE') /usr/lib/wagon/fed/peer/del "${HTTP_X_REAL_IP}" "${QUERY_STRING}";;
2022-09-14 14:44:00 -06:00
# Needed for CORS preflight
'OPTIONS') /usr/lib/wagon/http_res 200;;
2022-09-14 14:44:00 -06:00
# Bad request
*) printf 'Invalid HTTP verb' | /usr/lib/wagon/http_res 405;;
2022-11-27 16:00:43 -07:00
2022-09-14 14:44:00 -06:00
esac