This commit is contained in:
Robo 2016-08-17 23:05:48 +02:00
commit e3c421994e
4 changed files with 15 additions and 9 deletions

4
.gitignore vendored
View File

@ -1,3 +1,3 @@
node_modules/
cfg/config.cfg
b/
cfg.cfg
b/

0
cfg.json Normal file
View File

View File

@ -11,15 +11,15 @@
<div class="medium">
{% if item == "video" %}
<video src="{{ dest }}" style="max-width: 1024px" autoplay controls loop></video>
{% else if item == "audio" %}
{% elseif item == "audio" %}
<audio controls src="{{ dest }}" type="audio/mp3" autoplay></audio>
{% else if item == "image" %}
{% elseif item == "image" %}
<a href="{{ dest }}" target="_blank"><img src="{{ dest }}" style="max-width: 1024px" /></a>
{% else %}
<h1>404 - Not f0cked</h1>
{% endif %}
</div>
<div class="controls">{% if next != null %}<a id="next" href="/{{ next }}"><<-</a> | {% endif %} <a id="random" href="/random" title="Random">random</a> {% if prev != null %} | <a id="prev" href="/{{ prev }}">->></a>{% endif %}</div><br />
<div class="controls">{% if last != null %}<a id="last" href="/{{ last }}"><- newest</a>{% endif %}{% if next != null %}<a id="next" href="/{{ next }}"><<-</a> | {% endif %} <a id="random" href="/random" title="Random">random</a> {% if prev != null %} | <a id="prev" href="/{{ prev }}">->></a>{% endif %}{% if first != null %}<a id="first" href="/{{ first }}">oldest -></a>{% endif %}</div><br />
<div class="info">
<span class="src">src: <a href="{{ src }}" target="_blank">{{ src }}</a></span><br />
<span class="dest">dest: {{ dest }}</span><br />

View File

@ -219,7 +219,7 @@ http.createServer((req, res) => {
});
}
else if(Number.isInteger(parseInt(url))) { // itempage
sql.query("select * from `f0ck`.`items` where `id` = ? limit 1; select `id` from `f0ck`.`items` where `id` = (select min(`id`) from `f0ck`.`items` where `id` > ?); select `id` from `f0ck`.`items` where `id` = (select max(`id`) from `f0ck`.`items` where `id` < ?)", [url, url, url], (err, rows, fields) => {
sql.query("select * from `f0ck`.`items` where `id` = ? limit 1; select `id` from `f0ck`.`items` where `id` = (select min(`id`) from `f0ck`.`items` where `id` > ?); select `id` from `f0ck`.`items` where `id` = (select max(`id`) from `f0ck`.`items` where `id` < ?); select `id` from `f0ck`.`items` order by `id` asc limit 1; select `id` from `f0ck`.`items` order by `id` desc limit 1", [url, url, url], (err, rows, fields) => {
var tpl = swig.compile(templates.item);
var data = {
id: '',
@ -232,7 +232,9 @@ http.createServer((req, res) => {
userchannel: '',
usernetwork: '',
next: null,
prev: null
prev: null,
first: null,
last: null
};
if(rows[0].length) {
var e = rows[0][0];
@ -261,9 +263,13 @@ http.createServer((req, res) => {
data.usernetwork = e.usernetwork;
if(rows[1].length)
data.next = rows[1].id;
data.next = rows[1][0].id;
if(rows[2].length)
data.prev = rows[2].id;
data.prev = rows[2][0].id;
if(rows[3].length)
data.first = rows[3][0].id;
if(rows[4].length)
data.first = rows[4][0].id;
}
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(tpl(data), 'utf-8');