unraid / webgui

Unraid Web UI
146 stars 71 forks source link

fix: replace document write usages #1821

Closed Garbee closed 1 month ago

Garbee commented 1 month ago

This replaces the two uses of document.write with a more modern solution. First we create the content needed in the body. Then wipe the body content out and finally append the desired content to it.

This does NOT fix the 3rd referenced use in the app code. Since it is from the VNC module, we'd be diverging from upstream which would make updating the VNC client more difficult in the future unless we rember to always go patch that again. To fix that, we should work upstream to have a solution in their system. There are also a few more findings of document.write elsewhere in the app code that is tracked. Same situation as this one for all of them, being upstream code that we shouldn't touch.

Fixes: #1175

ljm42 commented 1 month ago

Thanks for this @Garbee. The original error message is kind of hard to read, would you mind changing the error message to: Please enable cookies to use the Unraid webGUI

limetech commented 1 month ago

I'll make that small wording change.

Garbee commented 1 month ago

Thanks for doing that update @limetech. I had caffeine withdrawal (kicking the dependency on it) the past few days so wasn't checking things.