arj03 / ssb-browser-core

ssb-server in a browser
Other
50 stars 8 forks source link

Vanilla #59

Closed arj03 closed 2 years ago

arj03 commented 2 years ago

TODO:

KyleMaas commented 2 years ago

When trying to build ssb-browser-demo with this, I get the following error:

(Path redacted)/ssb-browser-core/node_modules/@minireq/browser/build/bundle.esm.js:1
import { defaultSerializers, defaults, makeQueryString } from '@minireq/common';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
KyleMaas commented 2 years ago

Apparently I can get past that error by removing the "module" lines from:

node_modules/@minireq/common/package.json
node_modules/@minireq/node/package.json
node_modules/@minireq/browser/package.json

However, then I run into this line which needs to be ported to the new singleton changes:

https://github.com/arj03/ssb-browser-demo/blob/584a6bfa3e11f85821d7d2dc2cf7444416b3e553/ssb-singleton-setup.js#L78

EDIT: More complete path info in case it wasn't obvious.

arj03 commented 2 years ago

@KyleMaas this is WIP :) Was I was doing here is trying to get SSB browser core as close as possible to a normal ssb-server. This requires some more rework. I'm using this for a private group app I'm working on (not ready yet).

KyleMaas commented 2 years ago

No problem. I'm just excited about the idea of everything being closer to stock (well, probably more like changes upstreamed, but still) and think it might fix some of the problems with ssb-browser-demo not making it through a full sync if it can be made to work.

KyleMaas commented 2 years ago

This works now:

https://github.com/arj03/ssb-browser-demo/pull/325

Initial sync is really, really slow now.

arj03 commented 2 years ago

Yep, this is why we need partial replication using meta feeds. I have a few local changes to this branch I was working on yesterday. It needs some more fine tuning, but it makes SSB browser a lot closer to normal sbot. So in that regard it does require quite a few changes, but they are mostly search/replace.

KyleMaas commented 2 years ago

Yeah. I figure by getting ssb-browser-demo working, we have another way to test it with a decent UI.

KyleMaas commented 2 years ago

What should these calls be replaced with?

EDIT: Adding the reasons they're used in ssb-browser-demo.

KyleMaas commented 2 years ago

This needs to be updated to SSB.helpers.getPeer()

https://github.com/arj03/ssb-browser-core/blob/eddd4317995828382e4fa95903c7a44913269369/simple-blobs.js#L175

arj03 commented 2 years ago

The feedreplication functions are removed. getGraph can be replaced wiith getGraphForFeed in helpers I think.

KyleMaas commented 2 years ago

And with that last change to blobs, blobs now work in ssb-browser-demo again. Nice to have a nice easy way to test it. :)

Profile and Public are updated to use getGraphForFeed, although that ended up being a little bit of a pain for Public since getGraph was synchronous whereas getGraphForFeed is async. Code's a little weird, but it works.

Re: feedReplication being removed: that's why I'm wondering what those calls could be replaced with. I'd think we'd still want to be able to show sync status to the user. What new functionality replaces those?

KyleMaas commented 2 years ago

Finally have a bit of time to work on ssb-browser-demo but don't really want to do much until vanilla's merged since nearly everything I could do would cause conflicts. Any more progress on your end or is there anything I can do to help?

arj03 commented 2 years ago

Yesterday I found that this branch does not work when you start from scratch. It's a bit of a icky issue related to the singleton. I'm working on a solution. As for browser demo, I'd really like other clients to support meta feeds for initial sync to be decent speed and that is still quite a way into the future. Next year realisticly.

KyleMaas commented 2 years ago

Dagnabbit...I guess I'll work on something else, then. Thanks!

arj03 commented 2 years ago

Latest change should fix initialization with an empty database. I would be grateful if you have a look @KyleMaas. It works for me locally.

KyleMaas commented 2 years ago

Maybe I'm not patient enough with the sync, but I'm not seeing much difference. Without the feedReplication stuff, there's no progress indication in the UI anymore, so I don't really know if it's done.

KyleMaas commented 2 years ago

Getting these after leaving it for a while:

WebSocket connection to 'wss://between-two-worlds.dk:8989/' failed: 
module.exports @ bundle-ui.js:115870
client @ bundle-ui.js:90618
client @ bundle-ui.js:90135
client @ bundle-ui.js:90216
connect @ bundle-ui.js:121078
hooked @ bundle-ui.js:66615
(anonymous) @ bundle-ui.js:95349
(anonymous) @ bundle-ui.js:95348
connect @ bundle-ui.js:125154
CONN.connect @ bundle-ui.js:126051
hooked @ bundle-ui.js:66615
(anonymous) @ bundle-ui.js:125784
maintainConnections @ bundle-ui.js:125784
updateHubNow @ bundle-ui.js:125813
updateNow @ bundle-ui.js:125836
(anonymous) @ bundle-ui.js:125846

bundle-ui.js:63084 Error: stackless error
    at module.exports (bundle-ui.js:63084)
    at abort (bundle-ui.js:120535)
    at Object.cb (bundle-ui.js:120542)
    at drain (bundle-ui.js:114924)
    at bundle-ui.js:114941
    at bundle-ui.js:114898
    at bundle-ui.js:115604
    at read (bundle-ui.js:116083)
    at bundle-ui.js:115596
    at bundle-ui.js:114896
KyleMaas commented 2 years ago

It does seem to have finished syncing - latest message shown in Public is now <10 minutes ago.

arj03 commented 2 years ago

I don't expect browser-demo to use this v13, but I'll release a project tomorrow that uses this. It's a major version bump so one can always keep using the existing version.