szabodanika / microbin

A secure, configurable file-sharing and URL shortening web app written in Rust.
https://microbin.eu
BSD 3-Clause "New" or "Revised" License
2.65k stars 163 forks source link

Cannot create pasta? #180

Closed ChristopherRabotin closed 1 year ago

ChristopherRabotin commented 1 year ago

Hi there,

I have deployed this repo from https://github.com/ChristopherRabotin/microbin on https://paste.nyxspace.com/ . Until the other day I was running version 1.x and never encountered any issue.

Right now, with the latest version, clicking "Save" does nothing at all. No error in the JS console, no sending of data to a server in the network tab, and nothing in the logs:

Jul 5 06:47:55 PM  2023-07-06T00:47:55 [INFO] - 127.0.0.1 "GET / HTTP/1.1" 200 11047 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0" 0.000085
Jul 5 06:47:55 PM  2023-07-06T00:47:55 [INFO] - 127.0.0.1 "GET /static/water.css HTTP/1.1" 200 26764 "https://paste.nyxspace.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0" 0.000122
Jul 5 06:47:55 PM  2023-07-06T00:47:55 [INFO] - 127.0.0.1 "GET /static/aes.js HTTP/1.1" 200 63732 "https://paste.nyxspace.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0" 0.000159
Jul 5 06:47:55 PM  2023-07-06T00:47:55 [INFO] - 127.0.0.1 "GET /static/logo.png HTTP/1.1" 200 3591 "https://paste.nyxspace.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0" 0.000066
Jul 5 06:47:55 PM  2023-07-06T00:47:55 [INFO] - 127.0.0.1 "GET /static/favicon.ico HTTP/1.1" 200 15406 "https://paste.nyxspace.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0" 0.000081

In my environment on render, I define these env vars but nothing else: image

Any idea what could be happening ?

Thanks

szabodanika commented 1 year ago

Hi there!

Sorry that this is happening and thank you for reporting it! Especially big thanks for letting me try your instance. In the console, on submission I see an error: Uncaught (in promise) TypeError: Cannot read properties of null (reading 'value') at form.onsubmit ((index):149:27)

Which refers to this JS code in the submission function: if (passwordField.value.trim() != "") {

Basically I am trying to check whether your set password is empty or not, but you don't even have a password field because MICROBIN_ENCRYPTION_SERVER_SIDE is not set: https://github.com/szabodanika/microbin/blob/aec6cab27562df6c671ef05b304a92ae90e19c6e/.env#L201

This will be an easy fix, and in the meantime you can enable server-side encryption so that the password field shows up. For now I think also enable client-side encryption, I think if you only have one of the two enabled, it will cause some more unexpected things to happen

ChristopherRabotin commented 1 year ago

Thanks! Just adding MICROBIN_ENCRYPTION_SERVER_SIDE = true fixed the issue.