showes mime on index

This commit is contained in:
Flummi 2016-08-18 23:12:59 +02:00
parent 33b82336db
commit e179fa481d
2 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@
<div style="display: inline-block;"> <div style="display: inline-block;">
<div class="centeredthumbs"> <div class="centeredthumbs">
{% for item in items %} {% for item in items %}
<div class="mrhankyisteinneger"><a href="./{{ item }}"><img src="./t/{{ item }}.png" /></a></div> <div class="mrhankyisteinneger"><a href="./{{ item.id }}" title="{{ item.mime }}"><img src="./t/{{ item.id }}.png" /></a></div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

View File

@ -267,9 +267,9 @@ http.createServer((req, res) => {
if(filePath == "./index.html") { // mainpage if(filePath == "./index.html") { // mainpage
var tpl = swig.compile(templates.index); var tpl = swig.compile(templates.index);
var data = { items: [] }; var data = { items: [] };
sql.query("select * from `f0ck`.`items` order by `id` desc", (err, rows, fields) => { sql.query("select `id`,`mime` from `f0ck`.`items` order by `id` desc", (err, rows, fields) => {
rows.forEach((e,i,a) => { rows.forEach((e,i,a) => {
data.items.push( e.id ); data.items.push({ "id": e.id, "mime": e.mime });
}); });
res.writeHead(200, { 'Content-Type': 'text/html' }); res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(tpl(data), 'utf-8'); res.end(tpl(data), 'utf-8');