Compare commits
20 commits
8b01664b71
...
2f5d59dd32
Author | SHA1 | Date | |
---|---|---|---|
2f5d59dd32 | |||
a82290cf73 | |||
bc286413ad | |||
ed80a21495 | |||
881ea81488 | |||
653b91cb1e | |||
41c7e0cdc3 | |||
38a5056ff0 | |||
9e855fba36 | |||
0d9bedcaca | |||
16fb45aaf4 | |||
4baa737d95 | |||
f02e6b3168 | |||
a7a7c738ec | |||
d54d3077cb | |||
b6b8c587a1 | |||
de2dea4b18 | |||
53fc1fac5a | |||
906014cf05 | |||
81056ea42e |
32 changed files with 614 additions and 178 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|
||||||
|
sftp.json
|
|
@ -14,5 +14,7 @@ RUN a2enmod rewrite
|
||||||
RUN a2enmod headers
|
RUN a2enmod headers
|
||||||
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
||||||
|
|
||||||
|
RUN mkdir raw
|
||||||
|
|
||||||
COPY www/ .
|
COPY www/ .
|
||||||
RUN chmod -R a+r $(ls -I vendor)
|
RUN chmod -R a+rw $(ls -I vendor)
|
||||||
|
|
|
@ -5,6 +5,12 @@ services:
|
||||||
dockerfile: docker_dev/Dockerfile
|
dockerfile: docker_dev/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- 8081:80
|
- 8081:80
|
||||||
|
environment:
|
||||||
|
MYSQL_USER: root
|
||||||
|
MYSQL_PASSWORD: example
|
||||||
|
MYSQL_DATABASE: dragon_fire
|
||||||
|
MYSQL_HOST: mysql
|
||||||
|
MYSQL_PORT: 3306
|
||||||
develop:
|
develop:
|
||||||
watch:
|
watch:
|
||||||
- path: ./
|
- path: ./
|
||||||
|
@ -17,6 +23,9 @@ services:
|
||||||
ignore:
|
ignore:
|
||||||
- ../.git
|
- ../.git
|
||||||
- mysql_schema.sql
|
- mysql_schema.sql
|
||||||
|
volumes:
|
||||||
|
- website_datavolume:/var/www/html/raw
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
build:
|
build:
|
||||||
dockerfile: MysqlDockerfile
|
dockerfile: MysqlDockerfile
|
||||||
|
@ -32,7 +41,8 @@ services:
|
||||||
watch:
|
watch:
|
||||||
- path: mysql_schema.sql
|
- path: mysql_schema.sql
|
||||||
action: rebuild
|
action: rebuild
|
||||||
# volumes:
|
volumes:
|
||||||
# - sqlvolume:/var/lib/mysql
|
- sqlvolume:/var/lib/mysql
|
||||||
volumes:
|
volumes:
|
||||||
sqlvolume: {}
|
sqlvolume: {}
|
||||||
|
website_datavolume: {}
|
||||||
|
|
|
@ -107,5 +107,15 @@ Sorry for this. Shi is working hard :>
|
||||||
# Nothing here yet!
|
# Nothing here yet!
|
||||||
|
|
||||||
Sorry for this. She GRABS A LOT
|
Sorry for this. She GRABS A LOT
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## And now, for the lorem:
|
||||||
|
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Eleifend mi in nulla posuere sollicitudin aliquam ultrices sagittis orci. Risus commodo viverra maecenas accumsan lacus vel facilisis. Sed viverra tellus in hac habitasse. Nulla malesuada pellentesque elit eget gravida cum. Posuere sollicitudin aliquam ultrices sagittis orci a. Libero nunc consequat interdum varius sit amet. Bibendum arcu vitae elementum curabitur vitae nunc sed velit. Amet mauris commodo quis imperdiet massa tincidunt nunc pulvinar. Sed adipiscing diam donec adipiscing. Laoreet id donec ultrices tincidunt arcu non sodales. Id semper risus in hendrerit gravida rutrum quisque non. Ut venenatis tellus in metus vulputate eu.
|
||||||
|
|
||||||
|
Risus sed vulputate odio ut enim blandit volutpat. Placerat in egestas erat imperdiet. Non curabitur gravida arcu ac tortor dignissim convallis aenean. Neque aliquam vestibulum morbi blandit cursus risus at. Elementum integer enim neque volutpat ac tincidunt vitae semper. Eu ultrices vitae auctor eu augue ut. In mollis nunc sed id semper risus in hendrerit gravida. Lectus arcu bibendum at varius vel pharetra vel turpis nunc. In pellentesque massa placerat duis. Non quam lacus suspendisse faucibus. Vitae aliquet nec ullamcorper sit amet risus nullam. Accumsan lacus vel facilisis volutpat est velit egestas dui.
|
||||||
|
|
||||||
|
Risus feugiat in ante metus dictum at tempor commodo. Duis ut diam quam nulla. Nunc aliquet bibendum enim facilisis gravida neque convallis. Tincidunt augue interdum velit euismod in pellentesque. Praesent semper feugiat nibh sed pulvinar proin gravida hendrerit lectus. Non odio euismod lacinia at quis risus sed vulputate odio. Nunc sed blandit libero volutpat sed cras ornare arcu. Adipiscing enim eu turpis egestas pretium aenean pharetra magna. Ut tristique et egestas quis ipsum suspendisse. Blandit cursus risus at ultrices mi tempus imperdiet nulla malesuada.
|
||||||
'
|
'
|
||||||
);
|
);
|
15
scripts/upload_file.sh
Executable file
15
scripts/upload_file.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
CURL_URL=${DERG_UPLOAD_URL:-https://lucidragons.de/api/admin/upload}
|
||||||
|
CURL_KEY=${DERG_UPLOAD_KEY:-SoftDragonKeys}
|
||||||
|
|
||||||
|
for FILE_PATH in "$@"
|
||||||
|
do
|
||||||
|
if [ -f "${FILE_PATH}" ]; then
|
||||||
|
POST_PATH="/${FILE_PATH#"./"}"
|
||||||
|
|
||||||
|
echo "Uploading ${FILE_PATH} to ${POST_PATH}"
|
||||||
|
|
||||||
|
curl -i -X POST -H "Content-Type: multipart/form-data" \
|
||||||
|
-F "api_key=${CURL_KEY}" -F "post_path=${POST_PATH}" -F "post_data=@${FILE_PATH}" "${CURL_URL}"
|
||||||
|
fi
|
||||||
|
done
|
11
test_entries/about/README.md
Normal file
11
test_entries/about/README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
tags: [what]
|
||||||
|
directory_data:
|
||||||
|
type: text/markdown
|
||||||
|
---
|
||||||
|
|
||||||
|
# The dergens
|
||||||
|
|
||||||
|
The
|
||||||
|
|
||||||
|
yes
|
BIN
test_entries/about/neira/1.png
Normal file
BIN
test_entries/about/neira/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 MiB |
8
test_entries/about/neira/1.png.mddesc
Normal file
8
test_entries/about/neira/1.png.mddesc
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
title: A cuddly image <3
|
||||||
|
author: Shaky // Doggonaut
|
||||||
|
---
|
||||||
|
|
||||||
|
# Cuddly dragons
|
||||||
|
|
||||||
|
A dear picture made by a dear friend. Shaky - we hope you are OK.
|
12
test_entries/about/neira/test_me_readme.md
Normal file
12
test_entries/about/neira/test_me_readme.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
title: A little image test idea
|
||||||
|
---
|
||||||
|
|
||||||
|
# README concept
|
||||||
|
|
||||||
|
This file is just to show the README concept - it's its own file but will be
|
||||||
|
rendered under a directory listing :)
|
||||||
|
|
||||||
|
There's also a test for an image! Let's hope that works:
|
||||||
|
|
||||||
|

|
BIN
test_entries/test/the/images/1.png
Normal file
BIN
test_entries/test/the/images/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 MiB |
8
test_entries/test/the/images/1.png.mddesc
Normal file
8
test_entries/test/the/images/1.png.mddesc
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
title: A cuddly image <3
|
||||||
|
author: Shaky // Doggonaut
|
||||||
|
---
|
||||||
|
|
||||||
|
# Cuddly dragons
|
||||||
|
|
||||||
|
A dear picture made by a dear friend. Shaky - we hope you are OK.
|
12
test_entries/test/the/images/README.md
Normal file
12
test_entries/test/the/images/README.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
title: A little image test idea
|
||||||
|
---
|
||||||
|
|
||||||
|
# README concept
|
||||||
|
|
||||||
|
This file is just to show the README concept - it's its own file but will be
|
||||||
|
rendered under a directory listing :)
|
||||||
|
|
||||||
|
There's also a test for an image! Let's hope that works:
|
||||||
|
|
||||||
|

|
|
@ -1,6 +1,23 @@
|
||||||
|
|
||||||
|
AddType text/plain .md
|
||||||
|
|
||||||
|
php_value upload_max_filesize 40M
|
||||||
|
php_value post_max_size 42M
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteBase /
|
RewriteBase /
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} !^/?static/.*
|
RewriteCond %{REQUEST_URI} !^/?(static|raw)/.*
|
||||||
RewriteRule (.*) router.php
|
RewriteRule (.*) router.php
|
||||||
|
|
||||||
|
Allow from all
|
||||||
|
|
||||||
|
Options +Indexes
|
||||||
|
|
||||||
|
<filesMatch ".(flv|gif|ico|jpg|jpeg|mp4|mpeg|png|svg|swf|webp)$">
|
||||||
|
Header set Cache-Control "max-age=315360, public"
|
||||||
|
</filesMatch>
|
||||||
|
|
||||||
|
<filesMatch ".(js)$">
|
||||||
|
Header set Cache-Control "max-age=315360, public"
|
||||||
|
</filesMatch>
|
|
@ -1,19 +1,31 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Spatie\YamlFrontMatter\YamlFrontMatter;
|
|
||||||
|
|
||||||
class MySQLAdapter {
|
class MySQLAdapter {
|
||||||
public $raw;
|
public $raw;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->raw = mysqli_connect('mysql', 'root', 'example', 'dragon_fire');
|
$db_params = json_decode(file_get_contents('secrets/db.json'), true);
|
||||||
|
|
||||||
if (!$this->raw)
|
try {
|
||||||
{
|
if(false !== getenv('MYSQL_HOST')) {
|
||||||
echo 'Connection failed<br>';
|
$this->raw = mysqli_connect(getenv('MYSQL_HOST'),
|
||||||
echo 'Error number: ' . mysqli_connect_errno() . '<br>';
|
getenv('MYSQL_USER'), getenv('MYSQL_PASSWORD'),
|
||||||
echo 'Error message: ' . mysqli_connect_error() . '<br>';
|
getenv('MYSQL_DATABASE'),
|
||||||
die();
|
getenv('MYSQL_PORT'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->raw = mysqli_connect($db_params['MYSQL_HOST'],
|
||||||
|
$db_params['MYSQL_USER'], $db_params['MYSQL_PASSWORD'],
|
||||||
|
$db_params['MYSQL_DATABASE'],
|
||||||
|
$db_params['MYSQL_PORT']);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
echo 'Connection failed<br>';
|
||||||
|
echo 'Error number: ' . mysqli_connect_errno() . '<br>';
|
||||||
|
echo 'Error message: ' . mysqli_connect_error() . '<br>';
|
||||||
|
die();
|
||||||
|
|
||||||
|
//throw $th;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,39 +37,69 @@ class MySQLAdapter {
|
||||||
return $stmt->get_result();
|
return $stmt->get_result();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _prepare_post_data($post_data) {
|
function _normalize_post_data($post_data) {
|
||||||
if($post_data == null) {
|
if($post_data == null) {
|
||||||
$post_data = [
|
return [
|
||||||
"found" => false
|
"found" => false
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$post_data["found"] = true;
|
|
||||||
$post_data["post_metadata"] = json_decode($post_data["post_metadata"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $post_data;
|
$post_data["found"] = true;
|
||||||
|
|
||||||
|
$post_data['post_metadata'] = json_decode($post_data["post_metadata"], true) ?? [];
|
||||||
|
$post_data["post_content"] ??= '';
|
||||||
|
|
||||||
|
return $post_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_markdown_post($post_path, $post_data) {
|
function bump_post($post_path, $post_metadata = [], $create_dirs = true) {
|
||||||
$frontmatter_post = YamlFrontMatter::parse($post_data);
|
|
||||||
|
|
||||||
$post_path = chop($post_path, '/');
|
$post_path = chop($post_path, '/');
|
||||||
$path_depth = substr_count($post_path, "/");
|
$path_depth = substr_count($post_path, "/");
|
||||||
|
|
||||||
$post_content = $frontmatter_post->body();
|
if($create_dirs) {
|
||||||
$post_metadata = $frontmatter_post->matter();
|
$this->make_post_directory(dirname($post_path));
|
||||||
|
}
|
||||||
$post_metadata['type'] = 'text/markdown';
|
|
||||||
|
|
||||||
var_dump($post_path, $post_content, $post_metadata);
|
|
||||||
|
|
||||||
$qry = "
|
$qry = "
|
||||||
INSERT INTO posts
|
INSERT INTO posts
|
||||||
(post_path, post_path_depth, post_metadata, post_content)
|
(post_path, post_path_depth, post_metadata, post_content)
|
||||||
VALUES
|
VALUES
|
||||||
( ?, ?, ?, ?) AS new
|
( ?, ?, ?, ?) AS new
|
||||||
ON DUPLICATE KEY UPDATE post_metadata=new.post_metadata, post_content=new.post_content;";
|
ON DUPLICATE KEY UPDATE post_path=new.post_path;";
|
||||||
|
|
||||||
|
$this->_exec($qry, "siss",
|
||||||
|
$post_path,
|
||||||
|
$path_depth,
|
||||||
|
json_encode($post_metadata),
|
||||||
|
'');
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_post_directory($directory) {
|
||||||
|
$json_metadata = ["type" => 'directory'];
|
||||||
|
|
||||||
|
while(strlen($directory) > 1) {
|
||||||
|
try {
|
||||||
|
$this->bump_post($directory, $json_metadata, false);
|
||||||
|
}
|
||||||
|
catch(Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
$directory = dirname($directory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_or_create_post($post_path, $post_metadata, $post_content) {
|
||||||
|
$post_path = chop($post_path, '/');
|
||||||
|
$path_depth = substr_count($post_path, "/");
|
||||||
|
|
||||||
|
$this->make_post_directory(dirname($post_path));
|
||||||
|
|
||||||
|
$qry = "
|
||||||
|
INSERT INTO posts
|
||||||
|
(post_path, post_path_depth, post_metadata, post_content)
|
||||||
|
VALUES
|
||||||
|
( ?, ?, ?, ?) AS new
|
||||||
|
ON DUPLICATE KEY UPDATE post_metadata=new.post_metadata, post_content=new.post_content;";
|
||||||
|
|
||||||
$this->_exec($qry, "siss",
|
$this->_exec($qry, "siss",
|
||||||
$post_path,
|
$post_path,
|
||||||
|
@ -71,7 +113,8 @@ class MySQLAdapter {
|
||||||
|
|
||||||
$post_path = chop($post_path, '/');
|
$post_path = chop($post_path, '/');
|
||||||
|
|
||||||
$post_data = $this->_prepare_post_data($this->_exec($qry, "s", $post_path)->fetch_assoc());
|
$post_data = $this->_exec($qry, "s", $post_path)->fetch_assoc();
|
||||||
|
$post_data = $this->_normalize_post_data($post_data);
|
||||||
|
|
||||||
if($with_subposts) {
|
if($with_subposts) {
|
||||||
$post_data['subposts'] = $this->get_subposts_by_path($post_path);
|
$post_data['subposts'] = $this->get_subposts_by_path($post_path);
|
||||||
|
@ -87,7 +130,7 @@ class MySQLAdapter {
|
||||||
|
|
||||||
$path_depth = substr_count($path, "/");
|
$path_depth = substr_count($path, "/");
|
||||||
|
|
||||||
$qry = "SELECT post_path, post_metadata
|
$qry = "SELECT post_path, post_metadata, post_update_time
|
||||||
FROM posts
|
FROM posts
|
||||||
WHERE (post_path LIKE CONCAT(?,'/%'))
|
WHERE (post_path LIKE CONCAT(?,'/%'))
|
||||||
AND post_path_depth = ?
|
AND post_path_depth = ?
|
||||||
|
@ -97,7 +140,7 @@ class MySQLAdapter {
|
||||||
$post_data = $this->_exec($qry, "si", $path, $path_depth+1)->fetch_all(MYSQLI_ASSOC);
|
$post_data = $this->_exec($qry, "si", $path, $path_depth+1)->fetch_all(MYSQLI_ASSOC);
|
||||||
|
|
||||||
$fn = function($data) {
|
$fn = function($data) {
|
||||||
return $this->_prepare_post_data($data);
|
return $this->_normalize_post_data($data);
|
||||||
};
|
};
|
||||||
|
|
||||||
$post_data = array_map($fn, $post_data);
|
$post_data = array_map($fn, $post_data);
|
||||||
|
|
99
www/post_adapter.php
Normal file
99
www/post_adapter.php
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'mysql_adapter.php';
|
||||||
|
|
||||||
|
use Spatie\YamlFrontMatter\YamlFrontMatter;
|
||||||
|
|
||||||
|
class PostHandler extends MySQLAdapter {
|
||||||
|
public $data_directory;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->data_directory = 'raw';
|
||||||
|
}
|
||||||
|
|
||||||
|
function _normalize_post_data($post_data) {
|
||||||
|
$post_data = parent::_normalize_post_data($post_data);
|
||||||
|
|
||||||
|
$post_data["post_basename"] = basename($post_data["post_path"]);
|
||||||
|
|
||||||
|
$post_meta = $post_data['post_metadata'];
|
||||||
|
|
||||||
|
$post_meta["title"] ??= basename($post_data["post_path"]);
|
||||||
|
|
||||||
|
if(!isset($post_meta['type'])) {
|
||||||
|
$type = null;
|
||||||
|
|
||||||
|
$ext = pathinfo($post_data['post_basename'], PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
$ext_mapping = [
|
||||||
|
'' => 'directory',
|
||||||
|
'md' => 'text/markdown',
|
||||||
|
'png' => 'image',
|
||||||
|
];
|
||||||
|
|
||||||
|
if(isset($ext_mapping[$ext])) {
|
||||||
|
$post_meta['type'] = $ext_mapping[$ext];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$post_data["post_file_dir"] = '/' . $this->data_directory . $post_data["post_path"];
|
||||||
|
|
||||||
|
$post_data['post_metadata'] = $post_meta;
|
||||||
|
|
||||||
|
return $post_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_post_directory($directory) {
|
||||||
|
$data_directory = $this->data_directory . $directory;
|
||||||
|
|
||||||
|
is_dir($data_directory) || mkdir($data_directory, 0777, true);
|
||||||
|
|
||||||
|
parent::make_post_directory($directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_file($post_path, $file_path) {
|
||||||
|
$this->bump_post($post_path);
|
||||||
|
move_uploaded_file($file_path, $this->data_directory . $post_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_markdown_post($post_path, $post_data) {
|
||||||
|
$frontmatter_post = YamlFrontMatter::parse($post_data);
|
||||||
|
$post_path = chop($post_path, '/');
|
||||||
|
|
||||||
|
$post_content = $frontmatter_post->body();
|
||||||
|
$post_metadata = $frontmatter_post->matter();
|
||||||
|
|
||||||
|
if(basename($post_path) == "README.md") {
|
||||||
|
$readme_metadata = [];
|
||||||
|
if(isset($post_metadata['directory_data'])) {
|
||||||
|
$readme_metadata = $post_metadata['directory_data'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->update_or_create_post(dirname($post_path),
|
||||||
|
$readme_metadata, $post_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->update_or_create_post($post_path, $post_metadata, $post_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handle_upload($post_path, $file_path) {
|
||||||
|
$ext = pathinfo($post_path, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
switch($ext) {
|
||||||
|
case "md":
|
||||||
|
$this->save_markdown_post($post_path, file_get_contents($file_path));
|
||||||
|
|
||||||
|
move_uploaded_file($file_path, $this->data_directory . $post_path);
|
||||||
|
break;
|
||||||
|
case "mddesc":
|
||||||
|
$this->save_markdown_post(chop($post_path, '.mddesc'), file_get_contents($file_path));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->save_file($post_path, $file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'vendor/autoload.php';
|
require_once 'vendor/autoload.php';
|
||||||
require_once 'mysql_adapter.php';
|
require_once 'post_adapter.php';
|
||||||
|
|
||||||
// $sql = mysqli_connect('mysql', 'root', 'example', 'dragon_fire');
|
// $sql = mysqli_connect('mysql', 'root', 'example', 'dragon_fire');
|
||||||
|
|
||||||
$adapter = new MySQLAdapter();
|
$adapter = new PostHandler();
|
||||||
|
|
||||||
//if (!$sql)
|
//if (!$sql)
|
||||||
// {
|
// {
|
||||||
|
@ -36,6 +36,32 @@ $SURI = $_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
if($SURI == '/') {
|
if($SURI == '/') {
|
||||||
echo $twig->render('root.html');
|
echo $twig->render('root.html');
|
||||||
|
} elseif(preg_match('/^\/api\/admin/', $SURI)) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$user_api_key = '';
|
||||||
|
if(isset($_GET['api_key'])) {
|
||||||
|
$user_api_key = $_GET['api_key'];
|
||||||
|
}
|
||||||
|
if(isset($_POST['api_key'])) {
|
||||||
|
$user_api_key = $_POST['api_key'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($user_api_key != file_get_contents('secrets/api_admin_key')) {
|
||||||
|
http_response_code(401);
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
"authorized" => false
|
||||||
|
]);
|
||||||
|
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($SURI = '/api/admin/upload') {
|
||||||
|
$adapter->handle_upload($_POST['post_path'], $_FILES['post_data']['tmp_name']);
|
||||||
|
|
||||||
|
echo json_encode(["ok" => true]);
|
||||||
|
}
|
||||||
} elseif(preg_match('/^\/api/', $SURI)) {
|
} elseif(preg_match('/^\/api/', $SURI)) {
|
||||||
if(preg_match('/^\/api\/posts(.*)$/', $SURI, $match)) {
|
if(preg_match('/^\/api\/posts(.*)$/', $SURI, $match)) {
|
||||||
|
|
||||||
|
@ -47,34 +73,38 @@ if($SURI == '/') {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(get_subposts($match[1]));
|
echo json_encode(get_subposts($match[1]));
|
||||||
} elseif($SURI == '/api/upload') {
|
} elseif($SURI == '/api/upload') {
|
||||||
|
|
||||||
if(array_key_exists('post_data', $_FILES)) {
|
|
||||||
$upload_content = file_get_contents($_FILES['post_data']['tmp_name']);
|
|
||||||
$upload_path = $_POST['post_path'];
|
|
||||||
|
|
||||||
$adapter->save_markdown_post($upload_path, $upload_content);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $twig->render('upload.html');
|
echo $twig->render('upload.html');
|
||||||
}
|
}
|
||||||
|
} elseif($_SERVER['HTTP_SEC_FETCH_DEST'] == 'image') {
|
||||||
|
header('Location: /raw' . $SURI);
|
||||||
|
exit(0);
|
||||||
} elseif(true) {
|
} elseif(true) {
|
||||||
$post = $adapter->get_post_by_path($SURI);
|
$post = $adapter->get_post_by_path($SURI);
|
||||||
|
|
||||||
echo $twig->render('about.html', [
|
if($post['post_metadata']['type'] == 'directory') {
|
||||||
"post" => $post,
|
if(preg_match('/^(.*[^\/])((?:#.*)?)$/', $SURI, $match)) {
|
||||||
"subposts" => $post['subposts']
|
header('Location: ' . $match[1] . '/' . $match[2]);
|
||||||
]);
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $twig->render('post_types/directory.html', [
|
||||||
|
"post" => $post,
|
||||||
|
"subposts" => $post['subposts']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
elseif($post['post_metadata']['type'] == 'text/markdown') {
|
||||||
|
echo $twig->render('post_types/markdown.html', [
|
||||||
|
"post" => $post,
|
||||||
|
"subposts" => $post['subposts']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
elseif($post['post_metadata']['type'] == 'image') {
|
||||||
|
echo $twig->render('post_types/image.html', [
|
||||||
|
"post" => $post
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
} elseif(preg_match('/^\/about(.html)?$/', $SURI)) {
|
|
||||||
echo $twig->render('about.html');
|
|
||||||
} elseif(preg_match('/^\/gallery\/([^\?]+)/', $SURI)) {
|
|
||||||
echo $twig->render('/gallery/gallery_entry.html', [
|
|
||||||
'image_url' => '/static/banner/0.png',
|
|
||||||
'image_title' => 'Test!',
|
|
||||||
'image_desc' => 'A soft piece made by a dear friend',
|
|
||||||
'artist_name' => 'Doggonaut',
|
|
||||||
'artist_src_link' => 'https://twitter.com/doggonaut'
|
|
||||||
]);
|
|
||||||
} else {
|
} else {
|
||||||
echo $twig->render('rrror.html',[
|
echo $twig->render('rrror.html',[
|
||||||
"error_code" => '404 Hoard not found!',
|
"error_code" => '404 Hoard not found!',
|
||||||
|
|
2
www/secrets/.gitignore
vendored
Normal file
2
www/secrets/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.json
|
||||||
|
api_admin_key
|
2
www/secrets/.htaccess
Normal file
2
www/secrets/.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
Deny from all
|
|
@ -1,5 +1,7 @@
|
||||||
Allow from all
|
Allow from all
|
||||||
|
|
||||||
|
Options +Indexes
|
||||||
|
|
||||||
<filesMatch ".(flv|gif|ico|jpg|jpeg|mp4|mpeg|png|svg|swf|webp)$">
|
<filesMatch ".(flv|gif|ico|jpg|jpeg|mp4|mpeg|png|svg|swf|webp)$">
|
||||||
Header set Cache-Control "max-age=315360, public"
|
Header set Cache-Control "max-age=315360, public"
|
||||||
</filesMatch>
|
</filesMatch>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -6,35 +7,44 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
color: #B0B0B0;
|
--bg_1: #0e0a2a;
|
||||||
background: #201c2a;
|
--bg_2: #2c2943;
|
||||||
|
--bg_3: #3f4148;
|
||||||
|
|
||||||
|
--highlight_1: #ee9015;
|
||||||
|
--highlight_2: #edd29e;
|
||||||
|
|
||||||
|
--text_1: #FFFFFF;
|
||||||
|
|
||||||
|
color: var(--text_1);
|
||||||
|
background: var(--bg_1);
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding-bottom: 4em;
|
padding-bottom: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
:link {
|
:link {
|
||||||
color: cyan;
|
color: var(--highlight_1);
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
||||||
transition: color 0.2s;
|
transition: color 0.2s;
|
||||||
}
|
}
|
||||||
a:visited {
|
a:visited {
|
||||||
color: cyan;
|
color: var(--highlight_1);
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: lightblue;
|
color: var(--highlight_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#main_header {
|
#main_header {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
padding-bottom: 0.7em;
|
padding-bottom: 0.7rem;
|
||||||
}
|
}
|
||||||
#main_banner_img {
|
#main_banner_img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -51,9 +61,9 @@ a:hover {
|
||||||
#main_banner_img_link {
|
#main_banner_img_link {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 2vw;
|
right: 2vw;
|
||||||
bottom: 0.5em;
|
bottom: 0.5rem;
|
||||||
|
|
||||||
font-size: 0.8em;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav_bar {
|
#nav_bar {
|
||||||
|
@ -62,63 +72,124 @@ a:hover {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
margin-top: 1em;
|
margin-top: 1rem;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
#nav_bar li {
|
#nav_bar li {
|
||||||
padding: 0em 0.3em 0em 0.3em;
|
padding: 0rem 0.3rem 0rem 0.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#big_title {
|
#big_title {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 2.5em;
|
font-size: 2.5rem;
|
||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2rem;
|
||||||
}
|
}
|
||||||
#main_header h2 {
|
#main_header h2 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 2em;
|
font-size: 2rem;
|
||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#title_separator {
|
#title_separator {
|
||||||
height: 1.5px;
|
height: 1.5px;
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
margin-left: 2em;
|
margin-left: 2rem;
|
||||||
margin-right: 2em;
|
margin-right: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main_content_wrapper {
|
#main_content_wrapper {
|
||||||
padding: 3vmin 1em 1em 1em;
|
--content-width: min(100vw, calc(20rem + 40vw));
|
||||||
|
--content-total-margin: calc(calc(100vw - var(--content-width)) / 2);
|
||||||
|
|
||||||
|
--content-padding: max(0px, min(1rem, var(--content-total-margin)));
|
||||||
|
--content-margin: max(0px, calc(var(--content-total-margin) - 1rem));
|
||||||
|
|
||||||
|
padding: 0rem var(--content-padding) 1rem var(--content-padding);
|
||||||
width: auto;
|
width: auto;
|
||||||
margin-left: max(0.75em, min(max(20vmin, 50vw - 30rem), 50vw - 25rem));
|
|
||||||
margin-right: max(0.75em, min(max(20vmin, 50vw - 30rem), 50vw - 25rem));
|
|
||||||
|
margin-left: var(--content-margin);
|
||||||
|
margin-right: var(--content-margin);
|
||||||
|
margin-top: 0px;
|
||||||
|
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
|
||||||
background: #3e355479;
|
background: var(--bg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#post_file_bar {
|
||||||
|
position: sticky;
|
||||||
|
|
||||||
|
top: 0px;
|
||||||
|
|
||||||
|
background: var(--bg_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#post_file_titles {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: left;
|
||||||
|
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#post_file_titles * {
|
||||||
|
padding: 0.5rem;
|
||||||
|
font-style: bold;
|
||||||
|
font-size: 1.3rem;
|
||||||
|
|
||||||
|
background: var(--highlight_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#post_file_path {
|
||||||
|
width: 100%;
|
||||||
|
font-style: italic;
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
|
||||||
|
background: var(--highlight_1);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
#post_file_path a {
|
||||||
|
color: var(--text_1);
|
||||||
|
padding-right: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main_content_wrapper article {
|
#main_content_wrapper article {
|
||||||
background: #3e3554;
|
background: var(--bg_3);
|
||||||
color: #c6c3c3;
|
|
||||||
border-radius: 0.3em;
|
border-radius: 0rem 0rem 0.8rem 0.8rem;
|
||||||
box-shadow: 3px 7px 7px 0px #00000040;
|
box-shadow: 3px 7px 7px 0px #00000040;
|
||||||
|
|
||||||
padding: 0.75em;
|
padding: 0.75rem;
|
||||||
}
|
}
|
||||||
#main_content_wrapper article h1 {
|
#main_content_wrapper article h1 {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding-left: 3vmin;
|
padding-left: 3vmin;
|
||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2rem;
|
||||||
|
|
||||||
border-bottom: solid 1px darkgrey;
|
border-bottom: solid 1px darkgrey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#main_content_wrapper article img {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
|
||||||
|
max-height: 70vh;
|
||||||
|
|
||||||
|
margin: 1vmin;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
#main_footer {
|
#main_footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
height: 2.5em;
|
height: 2.5rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #3a3a3a;
|
background-color: #3a3a3a;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|
43
www/static/directorystyle.css
Normal file
43
www/static/directorystyle.css
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
|
||||||
|
table.directory {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.directory caption {
|
||||||
|
text-align: left;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
|
||||||
|
padding-left: 3vmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.directory td {
|
||||||
|
padding: 0.2rem;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
table.directory th {
|
||||||
|
padding: 0.2rem;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
padding-bottom: 0.05rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.directory tr.entry:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
table.directory tr.entry .entry_title {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.directory .entry_update_time {
|
||||||
|
display: block;
|
||||||
|
width: 12rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 600px) {
|
||||||
|
table.directory .entry_update_time {
|
||||||
|
visibility: hidden;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +1,12 @@
|
||||||
|
|
||||||
|
|
||||||
article {
|
#main_content_wrapper figcaption h1 {
|
||||||
margin-top: 0.8em;
|
|
||||||
margin-left: 10%;
|
|
||||||
margin-right: 10%;
|
|
||||||
}
|
|
||||||
|
|
||||||
figcaption {
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
border-bottom: solid 3px darkgrey;
|
border-bottom: solid 3px darkgrey;
|
||||||
font-size: 2em;
|
font-size: 1.8rem;
|
||||||
|
|
||||||
margin-bottom: 0.3em;
|
margin-bottom: 0.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#gallery_image {
|
#gallery_image {
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
#rrr_header {
|
#rrr_header {
|
||||||
font-size: 2em;
|
font-size: 2rem;
|
||||||
|
|
||||||
border-bottom: 1px solid grey;
|
border-bottom: 1px solid grey;
|
||||||
padding-bottom: 0.2em;
|
padding-bottom: 0.2rem;
|
||||||
margin-bottom: 0.3em;
|
margin-bottom: 0.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#rrr_code {
|
#rrr_code {
|
||||||
font-size: 1.5em;
|
font-size: 1.5rem;
|
||||||
}
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
{% extends "root.html" %}
|
|
||||||
|
|
||||||
{% block second_title %}
|
|
||||||
<h2> {{ post.post_metadata.title }} </h2>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{%block main_content%}
|
|
||||||
<article>
|
|
||||||
{{ post['post_content']|markdown_to_html }}
|
|
||||||
</article>
|
|
||||||
|
|
||||||
{% if subposts|length > 0 %}
|
|
||||||
<article>
|
|
||||||
<h3>Related:</h3>
|
|
||||||
<ul>
|
|
||||||
{% for subpost in subposts %}
|
|
||||||
<li><a href={{subpost.post_path}}>{{ subpost.post_metadata.title }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</article>
|
|
||||||
{%endif%}
|
|
||||||
|
|
||||||
{%endblock%}
|
|
30
www/templates/fragments/filepath_bar.html
Normal file
30
www/templates/fragments/filepath_bar.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<div id="post_file_bar">
|
||||||
|
<menu id="post_file_titles">
|
||||||
|
<li>
|
||||||
|
{{ post.post_metadata.title }}
|
||||||
|
</li>
|
||||||
|
</menu>
|
||||||
|
<menu id="post_file_path">
|
||||||
|
{% set split_post = post.post_path |split('/') %}
|
||||||
|
{% for i in range(0, split_post|length - 1) %}
|
||||||
|
<li>
|
||||||
|
{% if i != 0 %}
|
||||||
|
>
|
||||||
|
{% endif %}
|
||||||
|
{% if i != 0 %}
|
||||||
|
<a href="{{split_post|slice(0,i+1)|join('/')}}">
|
||||||
|
{{ split_post[i] }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/">root</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
<li style="margin-left: auto;">
|
||||||
|
<a href="/raw{{post.post_path}}">raw</a>
|
||||||
|
<a href="/api/posts{{post.post_path}}">api</a>
|
||||||
|
</li>
|
||||||
|
</menu>
|
||||||
|
</div>
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
{% extends "root.html" %}
|
|
||||||
|
|
||||||
{% block second_title %}
|
|
||||||
<h2> Abouts </h2>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{%block main_content%}
|
|
||||||
<article>
|
|
||||||
{{ include('about.md')|markdown_to_html }}
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
{% for subpost in subposts %}
|
|
||||||
<li> {{ subpost.title }} </li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{%endblock%}
|
|
|
@ -1,31 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Lucidragons' Fire</title>
|
|
||||||
<link rel="stylesheet" href="/dergstyle.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1 id="big_title">The dergsite</h1>
|
|
||||||
<div id="title_separator"></div>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a href="/about"> About </a></li>
|
|
||||||
<li><a href="/blog"> Blog </a></li>
|
|
||||||
<li><a href="/projects"> Projects </a></li>
|
|
||||||
<li><a href="/artwork"> Artworks </a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="main_content_wrapper">
|
|
||||||
{% block content %}<h3>Soon there shall be content!</h3>{% endblock %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sidebar-wrapper">
|
|
||||||
{%block sidebar %}
|
|
||||||
<ul>
|
|
||||||
<li> Test 1 </li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
18
www/templates/pathed_content.html
Normal file
18
www/templates/pathed_content.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
|
||||||
|
{% extends "root.html" %}
|
||||||
|
|
||||||
|
{% block second_title %}
|
||||||
|
<h2> {{ post.post_metadata.title }} </h2>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{%block main_content%}
|
||||||
|
|
||||||
|
{{ include('fragments/filepath_bar.html') }}
|
||||||
|
|
||||||
|
<article>
|
||||||
|
{%block content_article %}
|
||||||
|
{%endblock%}
|
||||||
|
</article>
|
||||||
|
|
||||||
|
{%endblock%}
|
43
www/templates/post_types/directory.html
Normal file
43
www/templates/post_types/directory.html
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
|
||||||
|
{% extends "pathed_content.html" %}
|
||||||
|
|
||||||
|
{% block extra_head %}
|
||||||
|
<link rel="stylesheet" href="/static/directorystyle.css">
|
||||||
|
{%endblock%}
|
||||||
|
|
||||||
|
{%block content_article%}
|
||||||
|
{% if subposts|length > 0 %}
|
||||||
|
<table class="directory">
|
||||||
|
<caption>Directory contents:</caption>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th class="entry_update_time">Modified</th>
|
||||||
|
</tr>
|
||||||
|
{% for subpost in subposts %}
|
||||||
|
<tr class="entry">
|
||||||
|
<td>
|
||||||
|
ICN
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href={{subpost.post_path}}>{{subpost.post_basename}}</a>
|
||||||
|
</td>
|
||||||
|
<td class="entry_title">
|
||||||
|
{{ subpost.post_metadata.title }}
|
||||||
|
</td>
|
||||||
|
<td class="entry_update_time">
|
||||||
|
{{ subpost.post_update_time }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{%else%}
|
||||||
|
<h4>This directory appears to be empty...</h4>
|
||||||
|
<span>This shouldn't happen, sorry!</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ post.post_content|markdown_to_html }}
|
||||||
|
|
||||||
|
{%endblock%}
|
19
www/templates/post_types/image.html
Normal file
19
www/templates/post_types/image.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
|
||||||
|
{% extends "pathed_content.html" %}
|
||||||
|
|
||||||
|
{% block extra_head %}
|
||||||
|
<link rel="stylesheet" href="/static/imagestyle.css">
|
||||||
|
{%endblock%}
|
||||||
|
|
||||||
|
{%block content_article%}
|
||||||
|
<figure>
|
||||||
|
<a target="_blank" href="{{post['post_file_dir']}}">
|
||||||
|
<img id="gallery_image" src="{{post['post_file_dir']}}"></img>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<figcaption>
|
||||||
|
{{ post.post_content|markdown_to_html }}
|
||||||
|
</figcaption>
|
||||||
|
</figure>
|
||||||
|
{%endblock%}
|
7
www/templates/post_types/markdown.html
Normal file
7
www/templates/post_types/markdown.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
{% extends "pathed_content.html" %}
|
||||||
|
|
||||||
|
{%block content_article%}
|
||||||
|
{{ post['post_content']|markdown_to_html }}
|
||||||
|
{% endblock %}
|
|
@ -8,8 +8,9 @@
|
||||||
|
|
||||||
{%block main_content%}
|
{%block main_content%}
|
||||||
<article>
|
<article>
|
||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data" action="/api/admin/upload">
|
||||||
<input type="text" id="post_path" name="post_path"/>
|
<input type="text" id="post_path" name="post_path"/>
|
||||||
|
<input type="password" id="api_key" name="api_key"/>
|
||||||
<input type="file" id="post_data" name="post_data"/>
|
<input type="file" id="post_data" name="post_data"/>
|
||||||
|
|
||||||
<button>Submit</button>
|
<button>Submit</button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue