From c51e8f98f3ab4b6ac3f8443ae77df5717357d6b2 Mon Sep 17 00:00:00 2001 From: Flummi Date: Wed, 17 Aug 2016 21:13:55 +0200 Subject: [PATCH 1/4] elseif ftw --- s/item.tpl.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/s/item.tpl.html b/s/item.tpl.html index d6b9fd9..34dcfc5 100644 --- a/s/item.tpl.html +++ b/s/item.tpl.html @@ -11,9 +11,9 @@
{% if item == "video" %} - {% else if item == "audio" %} + {% elseif item == "audio" %} - {% else if item == "image" %} + {% elseif item == "image" %} {% else %}

404 - Not f0cked

From 74acf538d1bc9a595ac50961ad5c94e3d99361fe Mon Sep 17 00:00:00 2001 From: jkhsjdhjs Date: Wed, 17 Aug 2016 21:16:56 +0200 Subject: [PATCH 2/4] fixes next and prev --- src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 94f1bdd..9a761be 100644 --- a/src/main.js +++ b/src/main.js @@ -261,9 +261,9 @@ 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; } res.writeHead(200, { 'Content-Type': 'text/html' }); res.end(tpl(data), 'utf-8'); From c109c4a180294fcc0fd819862ea8ee7f5a738d7b Mon Sep 17 00:00:00 2001 From: Flummi Date: Wed, 17 Aug 2016 22:21:56 +0200 Subject: [PATCH 3/4] modified: .gitignore new file: cfg.json --- .gitignore | 4 ++-- cfg.json | 0 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 cfg.json diff --git a/.gitignore b/.gitignore index de0d08a..0efb279 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules/ -cfg/config.cfg -b/ \ No newline at end of file +cfg.cfg +b/ diff --git a/cfg.json b/cfg.json new file mode 100644 index 0000000..e69de29 From ede0e97cf7e825197e17d2ff597d38dd9678355a Mon Sep 17 00:00:00 2001 From: jkhsjdhjs Date: Wed, 17 Aug 2016 22:58:52 +0200 Subject: [PATCH 4/4] adds first and last to control section --- s/item.tpl.html | 2 +- src/main.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/s/item.tpl.html b/s/item.tpl.html index 34dcfc5..b8e4032 100644 --- a/s/item.tpl.html +++ b/s/item.tpl.html @@ -19,7 +19,7 @@

404 - Not f0cked

{% endif %}
-
{% if next != null %} | {% endif %} random {% if prev != null %} | {% endif %}

+
{% if last != null %}<- newest{% endif %}{% if next != null %} | {% endif %} random {% if prev != null %} | {% endif %}{% if first != null %}oldest ->{% endif %}

src: {{ src }}
dest: {{ dest }}
diff --git a/src/main.js b/src/main.js index 9a761be..3dc6d07 100644 --- a/src/main.js +++ b/src/main.js @@ -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]; @@ -264,6 +266,10 @@ http.createServer((req, res) => { data.next = rows[1][0].id; if(rows[2].length) 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');