KudoAI/duckduckgpt

Some issues

quoid opened this issue · 1 comments

quoid commented

@adamlui I figured since this is private it might be ok to leave feedback here, rather than email.

  1. The problem with calling an XHR from the user script is that is called from the context of the web page is there are cross origin request restrictions, which you are probably already aware of. The reason the GM methods work with user script managers is because those requests are made from the context of a background page which have cross origin access.

If you convert the user script to it's own extension, you won't have these issues if you ensure the requests originate from the background page. However, I wanted to point this out because regardless of the issues you currently see, CORS issues will pop up eventually even if you don't see them right now.

  1. Using localStorage isn't a great approach for sort of the same reason mentioned above. The data will be saved in the context of the page and users often clear their storage regularly, whether purposeful or not. Again, GM methods might use a similar method, but the localStorage they are saving to, is in the context of the background page, which is much harder to clear and usually take a fair deal of user initiative. In short, it is a more reliable storage mechanism than a page's localStorage.

If you convert the user script into extension, again, this won't be an issue and you will have a bunch of storage option.

Apologies if you are already aware of these restrictions, but wanted to make sure you don't dump more time into something that is bound to cause issue.

Thanks for the insight, I guess I wanted to convert the userscript so I could centrally host the .js and update one file for all ported versions, but will stick to the tried and true GM methods!