diff options
author | garret <garret@airmail.cc> | 2024-07-02 16:04:46 +0100 |
---|---|---|
committer | garret <garret@airmail.cc> | 2024-07-02 17:34:41 +0100 |
commit | 51c05abc2dcdbcc919dc3ea23125ed91c13dac15 (patch) | |
tree | 2de7e57bf9dd9675bd2f9c446e16a44d169afeff /fetch-status.py | |
parent | 52ce2f247ec3b9db1f14093e092cce9a5a9aa8a9 (diff) | |
download | agora-status-51c05abc2dcdbcc919dc3ea23125ed91c13dac15.tar.gz agora-status-51c05abc2dcdbcc919dc3ea23125ed91c13dac15.tar.bz2 agora-status-51c05abc2dcdbcc919dc3ea23125ed91c13dac15.zip |
sanity check the user id
a
Diffstat (limited to 'fetch-status.py')
-rwxr-xr-x | fetch-status.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fetch-status.py b/fetch-status.py index 684ee9a..1426a99 100755 --- a/fetch-status.py +++ b/fetch-status.py @@ -8,6 +8,19 @@ import os profile_id = os.environ['QUERY_STRING'].strip() +if not profile_id.isdigit(): + print("Status: 400 Bad Request") + print("Content-Type: text/plain") + print() + + current_url = "https://" if os.environ.get("HTTPS") else "http://" + current_url += os.environ.get("HTTP_HOST") + os.environ.get("REQUEST_URI") + + if current_url.endswith("?"+profile_id): + current_url = current_url[:-len(profile_id)-1] + print(f"you have to put your user id as a query, like {current_url}?6498") + quit() + headers = { 'User-Agent': f'agora status fetcher - contact forum user "garret 427738" or https://427738.xyz/hate-mail.html - requested by {os.environ.get("REMOTE_ADDR")}', } |