chriz2600 / DreamcastHDMI

Dreamcast HDMI
MIT License
154 stars 21 forks source link

Web console incompatibilities between browsers #16

Closed mafredri closed 3 years ago

mafredri commented 3 years ago

Hi, I followed the instructions for migrating to LittleFS, however, when issuing the ls command, all I see is: (See edit below.)

Firmware version: v4.7-rlx

DCDigital> ls
Error listing files.

This was the case before running migratefs, but I attempted it anyway. It would seem migratefs was successful but I still get Error listing files..

DCDigital> migratefs
FS migration already done.
DCDigital> ls
Error listing files.

PS. Possibly related, issuing reset from the web console only seems to reset the web console itself, the Dreamcast and DCDigital seem unaffected by the command. It has been this way since the very beginning. For this reason I've manually powered on/off the console between steps to verify that the issue isn't working memory.


Edit: I gave myself a clue whilst typing up this issue, seems this is actually a browser incompatibility issue.

Did a quick test on the browser I have installed:

Command Brave Firefox Safari
ls Ok Fail Fail
reset Ok Ok Fail

There are no javascript errors in the console, but one hint is that there is no outgoing ajax request on either Firefox or Safari (for ls anyway). It also makes no difference if I'm visiting the hostname or the IP of the DCDigital.

For reset, there is actually an outgoing request on Safari, but it fails (An error occurred trying to load the resource.).

Some further investigation reveals that Safari does not forward authentication headers when issuing the reset command:

curl 'http://dcdigital.***.fi/reset/all' \
-X 'GET' \
-H 'Accept: */*' \
-H 'Referer: http://dcdigital.***.fi/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Safari/605.1.15' \
-H 'X-Requested-With: XMLHttpRequest'
chriz2600 commented 3 years ago

Sorry for the late reply, I think I missed the notification. I will look into this and fix it :)

chriz2600 commented 3 years ago

Fixed and confirmed working with the following browser versions on macos:

v4.8 will be released soon.

mafredri commented 3 years ago

That was quick, thanks! I'll be sure to give it a go when it's out. By the way, I noticed from the commit that there were no changes to the reset code path, did that work without issue for you in Safari? For me it has never reset the DCDigital but if it works for you I'll try to dig in if it's some browser setting in my case that prevents it.

chriz2600 commented 3 years ago

did that work without issue for you in Safari

Yes, worked for me without any issues. Are you using Safari on Big Sur? (this is what I used)

mafredri commented 3 years ago

Hmm, still on Catalina, but it's been broken (for me) since Mojave, IIRC (installed my unit around 9.9.2019). I'll try it out in a Big Sur VM.

mafredri commented 3 years ago

Well, I didn't even need to install Big Sur in a VM, I tested on Catalina and now both ls and reset seems to work 👍🏻.

It's still a bit odd though because reset doesn't always work on the first try. When it doesn't work, it just resets the graphical web console (like clear in a terminal, Dreamcast unaffected), but the second time I type reset it seems properly reset the DCDigital and waits for it to come back online. Since you didn't touch that code path (if I understood correctly), it's a bit weird that it works now since I'm 99% sure it has never worked in Safari for me before.. oh well ¯\_(ツ)_/¯.

chriz2600 commented 3 years ago

Fixed in v4.8