Created
February 27, 2017 02:47
-
-
Save neuthral/27d6df4b87950885a68f544623eae8ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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