dielduarte / graphql-devtools

WIP a frameworkless Graphql dev tool focused in a good DX and simplicity - written in TS and state machines just for fun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webRequest domain filter

dielduarte opened this issue · comments

currently, the webRequest API sends events ignoring the active domain that the tab was opened

hey @StanleySathler! I did some tests here and all we should do is to pass the URL or the array of URLs to the listeners, something like that:

    chrome.webRequest.onBeforeRequest.addListener(
      callback,
      { urls: [url] } <- here we can add the URL or array of URLs to watch
    );

we can't just get the location since API URL's are used to be different than the app domain, the solution I thought was to add a little settings field so the users can add the desired APIs URLs they want to watch and we save it to the localStorage, how about this idea below?

user clicks on the Settings icon:

Screen Shot 2020-04-02 at 12 58 15 AM

users can now close clicking in the close icon or outside the modal.
Screen Shot 2020-04-02 at 12 58 22 AM

users starting writing: the close icon turns into the save icon and then when clicking in the save icon we save the values to the localStorage and start the listeners.

Screen Shot 2020-04-02 at 1 08 20 AM

then next time the user opens the dev tools we just start the listeners reading the values from localStorage.

I'm gonna work to implement it tomorrow, let me know what do you think!

fun fact: URLs can be added like: *.mydomain.com or api.*