AllYourBot / hostedgpt

An open version of ChatGPT you can host anywhere or run locally.
MIT License
354 stars 191 forks source link

Catch navigator.clipboard is undefined and display nicer error message #387

Open krschacht opened 4 months ago

krschacht commented 4 months ago

A firefox user complained that the clipboard buttons don’t work (you can click the icon beneath the cha t message but nothing gets copied to the clipboard). I did a quick check and saw an error for navigator.clipboard in the JS console.

We should check if Firefox has a different API for copying things to the clipboard, or if not, we should (a) catch the exception if this fires and show an JS alert dialog to user explaining the browser doesn’t seem to support copying and/or (b) use one of the browser interrogation techniques to pre-discover that navigator.clipboard is supported or not and actively disable that feature. Disabling the feature would mean: hiding it from beneath messages, hiding it from the top of code blocks within messages, and hiding it from the keyboard shortcut menu (which you open by using the ? shortcut)