ready for publish!
This commit is contained in:
parent
0ceacf6390
commit
e8ba08b030
4 changed files with 36 additions and 14 deletions
|
@ -37,7 +37,7 @@ class LBRY
|
|||
$freePublicClaims = array_filter($claims['claims'], function($claim) {
|
||||
$metadata = json_decode($claim['value'], true);
|
||||
return
|
||||
//TODO: Expand these checks
|
||||
//TODO: Expand these checks AND verify it is an image claim!
|
||||
($metadata['license'] == "Public Domain" || stripos($metadata['license'], 'Creative Commons') !== false) &&
|
||||
!isset($metadata['fee']);
|
||||
});
|
||||
|
|
|
@ -4,10 +4,6 @@ if (!defined('ROOT_PAGE')) { die('not allowed'); }
|
|||
|
||||
$claim = LBRY::findTopPublicFreeClaim($name);
|
||||
|
||||
//echo '<pre>';
|
||||
//print_r($claim);
|
||||
//die('over');
|
||||
|
||||
if ($claim)
|
||||
{
|
||||
$getResult = LBRY::api('get', ['name' => $name, 'claim_id' => $claim['claim_id']]);
|
||||
|
@ -15,6 +11,8 @@ if ($claim)
|
|||
if (isset($getResult['completed']) && $getResult['completed'] && isset($getResult['download_path']))
|
||||
{
|
||||
$path = $getResult['download_path'];
|
||||
//TODO, verify it is an image
|
||||
//TODO: serve the correct content type!
|
||||
header('Content-type: image/jpeg');
|
||||
header('Content-length: ' . filesize($path));
|
||||
readfile($getResult['download_path']);
|
||||
|
|
27
index.php
27
index.php
|
@ -1,24 +1,33 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
define('ROOT_PAGE', 1);
|
||||
|
||||
require_once './LBRY.class.php';
|
||||
|
||||
$name = ltrim(urldecode($_SERVER['REQUEST_URI']), '/');
|
||||
|
||||
if ($name)
|
||||
if ($name == 'publish')
|
||||
{
|
||||
include './publish.php';
|
||||
exit(0);
|
||||
}
|
||||
elseif ($name)
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
include './image.php';
|
||||
exit(0);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<h1>spee.ch</h1>
|
||||
<p>OMG we are live, it is actually happening. It is still happening.</p>
|
||||
<p>In just a few hours, this site will morph from this utterly bare 6 lines of HTML into a decentralized, censorship-resistant, truly free image sharing site powered by <a href="https://lbry.io">LBRY</a>.
|
||||
<p>You can watch it happen in real time, starting at 6pm EST tonight (March 29th):</p>
|
||||
<p>spee.ch is a single-serving site that reads (and will soon publish) images to and from the LBRY blockchain.</p>
|
||||
<p>You can watch live right now as it is being built!</p>
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/C9LCapt_OYw" frameborder="0" allowfullscreen></iframe>
|
||||
<p><a href="https://github.com/lbryio/spee.ch">GitHub repo</a></p>
|
||||
<p>Here are some sample images:</p>
|
||||
<ul>
|
||||
<?php foreach(['thailand', 'doitlive', 'coconuts', 'cow-air-balloon'] as $name): ?>
|
||||
<li><a href="/<?php echo $name ?>">spee.ch/<?php echo $name ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<p>Publishing coming in just a few minutes!</p>
|
||||
|
|
15
publish.php
Normal file
15
publish.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
if (isset($_POST['file']))
|
||||
{
|
||||
print_r($_POST['file']);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<h1>Publish</h1>
|
||||
<form method="POST" action="/publish" enctype="multipart/form-data">
|
||||
<div>
|
||||
<input type="file" name="file" />
|
||||
</div>
|
||||
<input type="submit" name="key" value="Go" />
|
||||
</form>
|
Loading…
Reference in a new issue