diff --git a/t0pic.py b/t0pic.py index 5f7ee54..6885460 100644 --- a/t0pic.py +++ b/t0pic.py @@ -18,10 +18,10 @@ MAX_ALLOWED_SIZE = 16 * 1024 * 1024 # 16 MB def help(): form = ( - '
'.format(URL, POST) + f'' + '@@ -64,23 +64,23 @@ SEE ALSO""" def paste(): - return """ - window.addEventListener('paste', e => { + return f""" + window.addEventListener('paste', e => {{ const file = e.clipboardData.items[0].getAsFile(); const url = URL.createObjectURL(file); const image = new Image(); image.src = url; const form = new FormData(); - form.append('pic', file); - fetch('/', { + form.append('{POST}', file); + fetch('/', {{ method: 'POST', body: form - }) + }}) .then(r => r.text()) .then(u => window.location = u) .catch(e => alert(e.message)); - }); + }}); """ def new_id():