
I want to be able to share this without giving away my data. The page takes a query parameter map=<ID>, which says which data file to load. If you load the page without a map ID, it makes up a random 8-digit hex string and uses that. The no-selection view shows a link to the map.
18 lines
No EOL
321 B
Python
Executable file
18 lines
No EOL
321 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import cgi
|
|
import cgitb
|
|
from pathlib import Path
|
|
cgitb.enable()
|
|
|
|
form = cgi.FieldStorage()
|
|
|
|
print('Content-Type: text/plain\n')
|
|
|
|
content = form.getfirst('content')
|
|
map_id = form.getfirst('map_id')
|
|
|
|
with open(Path('..') / 'data' / f'markers-{map_id}.json', 'w') as f:
|
|
f.write(content)
|
|
|
|
print(content) |