Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Fork wiki #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

WIP: Fork wiki #8

wants to merge 6 commits into from

Conversation

chrisekelley
Copy link
Contributor

@chrisekelley chrisekelley commented Apr 30, 2018

fork dat feature is implemented; however, when you access the forked dat in the bunsen-ui iframe, you get the following error:

random-access-idb@latest.js:998 Uncaught (in promise) DOMException: 
Failed to execute 'open' on 'IDBFactory': 
access to the Indexed Database API is denied in this context.
    at e.exports (http://nfu06wdcj8tkmvwhbfb9vcp0npked2d2dvanv1dqwgb325qmhwx0.localhost:3000/assets/random-access-idb@latest.js:998:35)
    at PersistantManager.getStorage (http://nfu06wdcj8tkmvwhbfb9vcp0npked2d2dvanv1dqwgb325qmhwx0.localhost:3000/assets/dat-archive-idb-polyfill.js:11:16)
    at DatArchive._loadPromise.getURLData.then (http://nfu06wdcj8tkmvwhbfb9vcp0npked2d2dvanv1dqwgb325qmhwx0.localhost:3000/assets/dat-archive-web.js:53:43)

@chrisekelley chrisekelley self-assigned this Apr 30, 2018
@chrisekelley
Copy link
Contributor Author

Here is the source for the forked wiki: https://github.com/chrisekelley/dat-wysiwywiki-app

@chrisekelley
Copy link
Contributor Author

chrisekelley commented Apr 30, 2018

Thinking about this issue - maybe it makes sense for the wiki to fork itself? I am assuming this is a sandbox issue. Pondering:

  • Does an iframe-in-another-iframe not have any indexdb access?
  • Or is the issue that a dat is trying to manipulate its own structure?
  • Maybe whenever the wiki needs to be updated. it must fork itself and make changes to its fork.

@chrisekelley
Copy link
Contributor Author

Note the change to the release script - it first assumes that you have already copied the .dat file to the root of your repo so that it doesn't get clobbered each time you build.

@@ -0,0 +1,24 @@
// Setup storage to indexdb
const DefaultManager = DatArchive.DefaultManager

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to add code here to double check that DatArchive.DefaultManager exists before trying to set the manager. (for when the code is loaded in beaker)

@RangerMauve
Copy link

Oh dang, it seems IndexedDB just doesn't work in iframes. :(

Luckily, I've basically finished my work on dat-polyfill which stores data in the parent frame's indexedb and as such de-duplicates all dats between origins. (Also provides support for DatArchive.selectArchive through hooks in the parent)

Check out the demo code

@RangerMauve
Copy link

Did you add all the sandbox parameters to the iframe that's contianing bunsen-ui?

@chrisekelley
Copy link
Contributor Author

@RangerMauve thanks for the tip - Still working on this - the past week I created a vanilla js version of the shell - Angular was a bit overkill for what we need here.

bunsenbrowser/bunsen#55

@RangerMauve
Copy link

Nice! Always a good feeling to delete a bunch of code. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants