Skip to content

Instantly share code, notes, and snippets.

@neuthral
Created February 27, 2017 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neuthral/27d6df4b87950885a68f544623eae8ae to your computer and use it in GitHub Desktop.
Save neuthral/27d6df4b87950885a68f544623eae8ae to your computer and use it in GitHub Desktop.
board:{ // index for all threads
posts: [
{0: "hash"},
{1: "hash"},
{2: "hash"},
]
}
post:{
name: $timestamp,
title: "title",
text: "text",
imageHash: "hash",
replies: [
{0: "hash"},
{1: "hash"},
]
}
// all posted replies are hashed and added to parent 'replies' array.
// replies are loaded asynchronously so not to populate whole tree at once
// reddit style for showing replies
// post
// -reply
// -reply
// -reply ect.
// -reply
// -reply
$imageHash = $ipfs->add(getImageData());
$post = [
'name' => time(),
'title' => $request->input('title'),
'text' => $request->input('text'),
'imageHash' => $imageHash,
'replies' => []
];
$hash = $ipfs->add(json_encode($post));
$parentPost = json_decode($ipfs->cat($request->input('postHash'));
$parentPost['replies'] = $hash;
function getImageData() {
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment