Also consider wall posts the ones there are from authors with no roots, and no wall specified, comming from patchwork
This commit is contained in:
parent
3ad7ace4ea
commit
3344cb8550
|
@ -1,5 +1,6 @@
|
|||
const { promisify } = require("./utils");
|
||||
const pull = require("pull-stream");
|
||||
const cat = require("pull-cat");
|
||||
|
||||
const latestOwnerValue = (ssbServer) => ({ key, dest }, cb) => {
|
||||
let value = null;
|
||||
|
@ -73,6 +74,8 @@ const mapAuthorName = (ssbServer) => (data, callback) => {
|
|||
const getPosts = (ssbServer, profile) =>
|
||||
new Promise((resolve, reject) => {
|
||||
pull(
|
||||
// @ts-ignore
|
||||
cat([
|
||||
ssbServer.query.read({
|
||||
reverse: true,
|
||||
query: [
|
||||
|
@ -86,6 +89,25 @@ const getPosts = (ssbServer, profile) =>
|
|||
],
|
||||
limit: 100,
|
||||
}),
|
||||
ssbServer.query.read({
|
||||
reverse: true,
|
||||
query: [
|
||||
{
|
||||
$filter: {
|
||||
value: {
|
||||
author: profile.id,
|
||||
content: {
|
||||
type: "post",
|
||||
wall: { $not: true },
|
||||
root: { $not: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
limit: 100,
|
||||
}),
|
||||
]),
|
||||
pull.asyncMap(mapAuthorName(ssbServer)),
|
||||
pull.collect((err, msgs) => {
|
||||
const entries = msgs.map((x) => x.value);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
var pull = require("pull-stream");
|
||||
var cat = require("pull-cat");
|
||||
var toPull = require("stream-to-pull-stream");
|
||||
var ident = require("pull-identify-filetype");
|
||||
var mime = require("mime-types");
|
||||
var URL = require("url");
|
||||
const pull = require("pull-stream");
|
||||
const cat = require("pull-cat");
|
||||
const toPull = require("stream-to-pull-stream");
|
||||
const ident = require("pull-identify-filetype");
|
||||
const mime = require("mime-types");
|
||||
const URL = require("url");
|
||||
|
||||
const serveBlobs = (sbot) => {
|
||||
return (req, res) => {
|
||||
var parsed = URL.parse(req.url, true);
|
||||
var hash = decodeURIComponent(parsed.pathname.replace("/blob/", ""));
|
||||
const parsed = URL.parse(req.url, true);
|
||||
const hash = decodeURIComponent(parsed.pathname.replace("/blob/", ""));
|
||||
|
||||
waitFor(hash, function (_, has) {
|
||||
if (!has) return respond(res, 404, "File not found");
|
||||
|
|
Loading…
Reference in New Issue