taravancil / paste-dat

A tool for sharing files with Dat in the Beaker browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use feature detection instead of user agent sniffing.

peacememories opened this issue · comments

Right now paste-dat checks if it should support saving by looking for the string "BeakerBrowser" in the user agent string. I propose instead checking if "DatArchive" exists in the window context. I know that right now the DatArchive API is only supported by Beaker Browser, but I believe it is better not to user user agents to infer anything, ever.

An example which is forked from the original page can be found here: https://parsedat-peacememories.hashbase.io/
Only the check is changed, not the resulting message, and it's done in the "binary" js.