fraction / oasis

Free, open-source, peer-to-peer social application that helps you follow friends and discover new ones on Secure Scuttlebutt (SSB).
http://oasis-demo.fraction.io
GNU Affero General Public License v3.0
286 stars 42 forks source link

Image search crashes when using Patchwork's ssb server #432

Open cinnamon-bun opened 4 years ago

cinnamon-bun commented 4 years ago

What's the problem you want solved?

http://localhost:3000/imageSearch?query=totoro

TypeError: Cannot read property 'search' of undefined
    at /usr/local/lib/node_modules/@fraction/oasis/src/models.js:179:18
    at new Promise (<anonymous>)
    at Object.search (/usr/local/lib/node_modules/@fraction/oasis/src/models.js:178:14)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /usr/local/lib/node_modules/@fraction/oasis/src/index.js:316:27
    at async middleware (/usr/local/lib/node_modules/@fraction/oasis/src/index.js:806:7)
    at async /usr/local/lib/node_modules/@fraction/oasis/src/index.js:784:5
    at async /usr/local/lib/node_modules/@fraction/oasis/src/index.js:779:5
    at async /usr/local/lib/node_modules/@fraction/oasis/src/http.js:113:5
    at async /usr/local/lib/node_modules/@fraction/oasis/node_modules/koa-mount/index.js:52:26

It works when Oasis is run by itself (using its own ssb server).

Is there a solution you'd like to recommend?

If we want to run at the same time as Patchwork does that mean we can't rely on our own plugins being present?

christianbundy commented 4 years ago

Oh, yeah that's not good at all. I think we should probably revert the image search until we have a SSB-SQLite flumeview that can provide that for us. What do you think @Powersource?

sbillig commented 4 years ago

:(

Is it possible to add a plugin on the fly? Or could ssb-meme be added to patchwork without much drama? It'd be a shame for oasis to be held back by patchwork.

Or, gasp, what if we just abandoned compatibility?

sbillig commented 4 years ago

Or, perhaps we could just do some plugin-detection at startup and disable features when required plugins are missing?

christianbundy commented 4 years ago

My evil plan: use this experiment with data from createLogStream() and uninstall all the Secret-Stack plugins that are making indexing slow and causing huge pain points for developers working on this project. I have a branch here that's even compatible with the Go back-end, but it doesn't use SQLite so it's slow as hell (and doesn't have any persistence).

christianbundy commented 4 years ago

In other words: I'd like to continue supporting Patchwork, but I'd like to support it in the "yeah it supports createLogStream()" sense rather than "yeah we share a bunch of Secret-Stack plugins and it'll limit us forever" sense.

Powersource commented 4 years ago

revert the image search until we have a SSB-SQLite flumeview that can provide that for us

To my ears (correct me if I'm wrong) an "SSB-SQLite flumeview" sounds super far away, and I'm not too attached to the compatibility, so I'd say keep the image search (biased tho).

Powersource commented 4 years ago

Another option is to only render the Image Search sidebar button if we detect that the plugin is installed (which should be pretty easy right?)

christianbundy commented 4 years ago

To my ears (correct me if I'm wrong) an "SSB-SQLite flumeview" sounds super far away

It's something I'm actively working on (like, I saw your notification and paused my work on it -- my other window is vim open hacking on it) and I don't think it's far away at all. I'm working on a fork of Cinnamon's prototype here: https://github.com/christianbundy/ssb-sqlite-index-experiment/

Powersource commented 4 years ago

Coool! Looking forward to it :D

I'd vote for hiding the image search from patchwork users until we have that, feels like the best compromise to me