stakwork / sphinx-js

Web extension and PWA for Sphinx.chat and 2nd Brain
2 stars 2 forks source link

feat: adds boilerplate vite/svelte/typescript to create a browser extension to resolve #1 #2

Closed dylanbathurst closed 9 months ago

dylanbathurst commented 9 months ago

See the README for a full description of features and getting started guide.

Evanfeenstra commented 9 months ago

Nice start!

dylanbathurst commented 9 months ago

@Evanfeenstra thanks!

Evanfeenstra commented 9 months ago
  1. oh i see it now, thanks
  2. The issue includes: A script should be injected into visited web pages, allowing communication between the service worker and the web page... i did edit the issue like 15 minutes after it was created, maybe u didn't see that in time? It looks like using the Chrome offscreen api is the way to go:

https://stackoverflow.com/questions/68966727/maintaining-a-persitant-connection-in-a-mv3-chrome-extension

https://stackoverflow.com/questions/66618136/persistent-service-worker-in-chrome-extension

  1. We need a way to pass messages back and forth from the web page to the popup, or to the long-running background process
dylanbathurst commented 9 months ago

I see, ok. I'll spend some time getting this implemented tonight.

dylanbathurst commented 9 months ago

I've added the background service worker and am posting messages from the content script. I'm still working on an issue where the messages aren't reaching the background script for some reason. I'll finish it up today.

dylanbathurst commented 9 months ago

@Evanfeenstra mind taking another look at this PR. I added the background script and also add examples of how to pass messages between the content/background/popup(Svelte) scripts.

Evanfeenstra commented 9 months ago

Awesome, thanks @dylanbathurst !