RangerMauve / dat-archive-web

DatArchive implementation for browsers that uses dat-gateway
MIT License
30 stars 4 forks source link

#createFileActivityStream #createNetworkActivityStream throw "fs.watch is not a function" error #9

Closed saimonmoore closed 5 years ago

saimonmoore commented 5 years ago

When I attempt to listen for network or file events via:

#createFileActivityStream or #createNetworkActivityStream I get the following error:

Screenshot 2019-06-29 at 22 36 14

from here:

Screenshot 2019-06-29 at 22 35 27

From the code:

Screenshot 2019-06-29 at 22 34 39

it looks like it decides wether to look up the the data from the disk, locally in the browser or remotely depending on wether the key is present in the archive but in this case it's not.

Screenshot 2019-06-29 at 22 35 01

The exception breaks the app but it appears the event listeners were added as I'm seeing some network events:

Screenshot 2019-06-29 at 22 36 14 Screenshot 2019-06-30 at 10 13 43

But as you can see from this trace, the key attribute is returned by the getInfo function but it doesn't appear to be in the dat archive object (or it's somehow added later...):

Screenshot 2019-06-29 at 22 47 23

You can reproduce this with this branch (see last commit):

https://gitlab.com/saimonmoore/dlynx/tree/createNetworkActivityStreamIssue

saimonmoore commented 5 years ago

cc @RangerMauve

RangerMauve commented 5 years ago

Looking into this today

RangerMauve commented 5 years ago

Try using DatArchive.load() or DatArchive.create() to initialize your archive instead.

saimonmoore commented 5 years ago

I’m currently using DatArchive.create if no dat exists locally and otherwise I use the constructor. I believe I tried DatArchive.load but if I recall it hadn’t been implemented maybe?

On Mon, 1 Jul 2019 at 17:17, RangerMauve notifications@github.com wrote:

Try using DatArchive.load() or DatArchive.create() to initialize your archive instead.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RangerMauve/dat-archive-web/issues/9?email_source=notifications&email_token=AAAAD3VHKJWP2LAUPAS6O5TP5IN2DA5CNFSM4H4LGR22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY6OTPY#issuecomment-507308479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD3T4YT5WN73IZM52PTDP5IN2DANCNFSM4H4LGR2Q .

RangerMauve commented 5 years ago

Oh weird! .load should have been present. :P That's a pretty big bug. I'll quickly update that.

saimonmoore commented 5 years ago

The other thing I was wondering was why the api change wrt to beaker for these 2 functions ?

At some point I’d like to be able to try and get this running on beaker as well :)

But I got quite far already this weekend...really just need to setup a friends system (I’ll need the events for this), add search and filtering and then perhaps a proxy server from which I can proxy from mobile.

On Mon, 1 Jul 2019 at 18:25, Saimon Moore saimonmoore@gmail.com wrote:

I’m currently using DatArchive.create if no dat exists locally and otherwise I use the constructor. I believe I tried DatArchive.load but if I recall it hadn’t been implemented maybe?

On Mon, 1 Jul 2019 at 17:17, RangerMauve notifications@github.com wrote:

Try using DatArchive.load() or DatArchive.create() to initialize your archive instead.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RangerMauve/dat-archive-web/issues/9?email_source=notifications&email_token=AAAAD3VHKJWP2LAUPAS6O5TP5IN2DA5CNFSM4H4LGR22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY6OTPY#issuecomment-507308479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD3T4YT5WN73IZM52PTDP5IN2DANCNFSM4H4LGR2Q .

saimonmoore commented 5 years ago

Awesome :)

On Mon, 1 Jul 2019 at 18:29, RangerMauve notifications@github.com wrote:

Oh weird! .load should have been present. :P That's a pretty big bug. I'll quickly update that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RangerMauve/dat-archive-web/issues/9?email_source=notifications&email_token=AAAAD3WKU2QH5GE3KJXTICDP5IWFZA5CNFSM4H4LGR22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY6VL2Y#issuecomment-507336171, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD3WDIQ5PJXC3GRXRT5TP5IWFZANCNFSM4H4LGR2Q .

RangerMauve commented 5 years ago

DatArchive.load not being there was an oversight, but the other two are on purpose since they've been deprecated in Beaker.

You're expected to be using archive.watch() now, I think. https://beakerbrowser.com/docs/apis/dat#watch

ping @pfrazee

saimonmoore commented 5 years ago

Aah I’ll check for #watch tonight

On Mon, 1 Jul 2019 at 18:31, RangerMauve notifications@github.com wrote:

DatArchive.load not being there was an oversight, but the other two are on purpose since they've been deprecated in Beaker.

You're expected to be using archive.watch() now, I think. https://beakerbrowser.com/docs/apis/dat#watch

ping @pfrazee https://github.com/pfrazee

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RangerMauve/dat-archive-web/issues/9?email_source=notifications&email_token=AAAAD3SKK6CPH6EOQI54EWTP5IWOLA5CNFSM4H4LGR22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY6VSOI#issuecomment-507337017, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD3XFMWDDHOSF6BUSK4TP5IWOLANCNFSM4H4LGR2Q .

saimonmoore commented 5 years ago

Thanks a lot :)

On Mon, 1 Jul 2019 at 18:34, Saimon Moore saimonmoore@gmail.com wrote:

Aah I’ll check for #watch tonight

On Mon, 1 Jul 2019 at 18:31, RangerMauve notifications@github.com wrote:

DatArchive.load not being there was an oversight, but the other two are on purpose since they've been deprecated in Beaker.

You're expected to be using archive.watch() now, I think. https://beakerbrowser.com/docs/apis/dat#watch

ping @pfrazee https://github.com/pfrazee

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RangerMauve/dat-archive-web/issues/9?email_source=notifications&email_token=AAAAD3SKK6CPH6EOQI54EWTP5IWOLA5CNFSM4H4LGR22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY6VSOI#issuecomment-507337017, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD3XFMWDDHOSF6BUSK4TP5IWOLANCNFSM4H4LGR2Q .

RangerMauve commented 5 years ago

Just pushed out 2.0.2 which has DatArchive.load() :)

saimonmoore commented 5 years ago

Geez that was quick :) Thanks a lot

Will try later on tonight

On Mon, 1 Jul 2019 at 18:35, RangerMauve notifications@github.com wrote:

Just pushed out 2.0.2 which has DatArchive.load() :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RangerMauve/dat-archive-web/issues/9?email_source=notifications&email_token=AAAAD3RP2TCJ72UAG3NRYR3P5IW3NA5CNFSM4H4LGR22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY6V4BA#issuecomment-507338244, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD3Q4DVRCY7RKDKKTORTP5IW3NANCNFSM4H4LGR2Q .

saimonmoore commented 5 years ago

@RangerMauve DatArchive.load seemed to do the trick however I noticed that there isn't any archive.watch currently implemented.

RangerMauve commented 5 years ago

Shoot. I could have sworn I had done something already. 😅

I'm a little busy with the SDK at the moment, but it should be possible to port over the work paul did here into dat-archive-web if you're for taking a shot at it. 😁

saimonmoore commented 5 years ago

Yep. Will try. Thanks for the hint.

On Tue, 2 Jul 2019 at 23:22, RangerMauve notifications@github.com wrote:

Shoot. I could have sworn I had done something already. 😅

I'm a little busy with the SDK at the moment, but it should be possible to port over the work paul did here https://github.com/beakerbrowser/dat-node/blob/master/lib/dat-archive.js#L203 into dat-archive-web if you're for taking a shot at it. 😁

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RangerMauve/dat-archive-web/issues/9?email_source=notifications&email_token=AAAAD3WUF7Z22H5MJH4HG5TP5PBHRA5CNFSM4H4LGR22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZCSVUI#issuecomment-507849425, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD3XCEA25HV3QYNKUFNTP5PBHRANCNFSM4H4LGR2Q .

saimonmoore commented 5 years ago

I've got something together but not sure it's working as I see no events 😅 so digging into it...

saimonmoore commented 5 years ago

Here: https://github.com/RangerMauve/dat-archive-web/pull/10

RangerMauve commented 5 years ago

Awesome, thank you so much for the fix! :D