This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from ltworf/feedback
Fix feedback (for now, at least)
- Loading branch information
Showing
6 changed files
with
70 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env python3 | ||
# Relational | ||
# Copyright (C) 2023 Salvo "LtWorf" Tomaselli | ||
# | ||
# Relation is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# author Salvo "LtWorf" Tomaselli <[email protected]> | ||
# | ||
# Used to receive feedback from relational | ||
|
||
from os import environ | ||
from syslog import * | ||
|
||
HEADERHTTP='HTTP/1.0 200 Ok\r\nContent-Type: text/html; charset=UTF-8\r\nConnection: close\r\n\r\n' | ||
NOTFOUND='HTTP/1.0 404 Not found\r\nContent-Type: text/html; charset=UTF-8\r\nConnection: close\r\n\r\n<html><body><p>Not found</p></body></html>' | ||
|
||
def main(): | ||
if 'HTTP_X_SURVEY' not in environ: | ||
syslog(LOG_ERR, "Got invalid survey") | ||
print(NOTFOUND) | ||
return | ||
syslog(LOG_INFO, "Got valid survey") | ||
import datetime | ||
with open('/srv/www/survey.txt', 'at') as f: | ||
print(datetime.datetime.now(), file=f) | ||
for k, v in environ.items(): | ||
if k.startswith('HTTP_X_SURVEY'): | ||
print(f'{k} = {v}', file=f) | ||
print(file=f) | ||
print(HEADERHTTP) | ||
|
||
if __name__ == '__main__': | ||
openlog('feedback') | ||
try: | ||
main() | ||
except Exception as e: | ||
syslog(LOG_ERR, repr(e)) | ||
from sys import exit | ||
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters