...
This commit is contained in:
parent
f3e357d8a4
commit
5b7dd4293c
|
@ -82,7 +82,7 @@ const flash = ({ type, msg }) => {
|
||||||
[...document.querySelectorAll("#tags > .badge")].forEach(tag => tag.parentElement.removeChild(tag));
|
[...document.querySelectorAll("#tags > .badge")].forEach(tag => tag.parentElement.removeChild(tag));
|
||||||
_tags.reverse().forEach(tag => {
|
_tags.reverse().forEach(tag => {
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.href = `/admin/test?tag=${tag.tag.replace(/\s/g, "%20")}`;
|
a.href = `/admin/test?tag=${tag.tag.replace(/\s/g, "+")}`;
|
||||||
a.target = "_blank";
|
a.target = "_blank";
|
||||||
a.style = "color: inherit !important";
|
a.style = "color: inherit !important";
|
||||||
a.innerText = tag.tag;
|
a.innerText = tag.tag;
|
||||||
|
|
|
@ -46,7 +46,8 @@ router.post(/^\/login(\/)?$/, async (req, res) => {
|
||||||
session: lib.md5(session),
|
session: lib.md5(session),
|
||||||
browser: req.headers["user-agent"],
|
browser: req.headers["user-agent"],
|
||||||
created_at: stamp,
|
created_at: stamp,
|
||||||
last_used: stamp
|
last_used: stamp,
|
||||||
|
last_action: "/login"
|
||||||
});
|
});
|
||||||
|
|
||||||
return res.writeHead(301, {
|
return res.writeHead(301, {
|
||||||
|
@ -87,8 +88,15 @@ router.get(/^\/login\/test$/, async (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get(/^\/admin(\/)?$/, auth, async (req, res) => { // frontpage
|
router.get(/^\/admin(\/)?$/, auth, async (req, res) => { // frontpage
|
||||||
|
const totals = await sql("items")
|
||||||
|
.select(
|
||||||
|
sql.raw("(select count(*) from items) total"),
|
||||||
|
sql.raw("sum(if(ifnull(tags_assign.item_id, 0) = 0, 1, 0)) untagged"),
|
||||||
|
sql.raw("sum(if(ifnull(tags_assign.item_id, 1) = 1, 0, 1)) tagged"))
|
||||||
|
.leftJoin("tags_assign", "tags_assign.item_id", "items.id");
|
||||||
|
|
||||||
res.reply({
|
res.reply({
|
||||||
body: tpl.render("views/admin", {}, req)
|
body: tpl.render("views/admin", { totals: totals[0] }, req)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -98,15 +106,30 @@ router.get(/^\/admin\/sessions(\/)?$/, auth, async (req, res) => {
|
||||||
.select("user_sessions.*", "user.user")
|
.select("user_sessions.*", "user.user")
|
||||||
.orderBy("user.id");
|
.orderBy("user.id");
|
||||||
|
|
||||||
|
const totals = await sql("items")
|
||||||
|
.select(
|
||||||
|
sql.raw("(select count(*) from items) total"),
|
||||||
|
sql.raw("sum(if(ifnull(tags_assign.item_id, 0) = 0, 1, 0)) untagged"),
|
||||||
|
sql.raw("sum(if(ifnull(tags_assign.item_id, 1) = 1, 0, 1)) tagged"))
|
||||||
|
.leftJoin("tags_assign", "tags_assign.item_id", "items.id");
|
||||||
|
|
||||||
res.reply({
|
res.reply({
|
||||||
body: tpl.render("views/admin_sessions", {
|
body: tpl.render("views/admin_sessions", {
|
||||||
sessions: rows
|
sessions: rows,
|
||||||
|
totals: totals[0]
|
||||||
}, req)
|
}, req)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
||||||
let ret;
|
let ret;
|
||||||
|
const totals = await sql("items")
|
||||||
|
.select(
|
||||||
|
sql.raw("(select count(*) from items) total"),
|
||||||
|
sql.raw("sum(if(ifnull(tags_assign.item_id, 0) = 0, 1, 0)) untagged"),
|
||||||
|
sql.raw("sum(if(ifnull(tags_assign.item_id, 1) = 1, 0, 1)) tagged"))
|
||||||
|
.leftJoin("tags_assign", "tags_assign.item_id", "items.id");
|
||||||
|
|
||||||
if(Object.keys(req.url.qs).length > 0) {
|
if(Object.keys(req.url.qs).length > 0) {
|
||||||
const tag = req.url.qs.tag;
|
const tag = req.url.qs.tag;
|
||||||
|
|
||||||
|
@ -121,7 +144,8 @@ router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
||||||
|
|
||||||
res.reply({
|
res.reply({
|
||||||
body: tpl.render("views/admin_search", {
|
body: tpl.render("views/admin_search", {
|
||||||
result: ret
|
result: ret,
|
||||||
|
totals: totals[0]
|
||||||
}, req)
|
}, req)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -172,7 +172,7 @@ router.post(/^\/api\/v2\/admin\/tags\/delete$/, auth, async (req, res) => {
|
||||||
q = q.andWhere("prefix", `${req.session.user}@webinterface`);
|
q = q.andWhere("prefix", `${req.session.user}@webinterface`);
|
||||||
const reply = !!(await q);
|
const reply = !!(await q);
|
||||||
|
|
||||||
await cleanTags();
|
//await cleanTags();
|
||||||
|
|
||||||
return res.reply({ body: JSON.stringify({
|
return res.reply({ body: JSON.stringify({
|
||||||
success: reply,
|
success: reply,
|
||||||
|
|
|
@ -13,7 +13,12 @@ const allowedMimes = [ "audio", "image", "video", "%" ];
|
||||||
router.get(/^\/(audio\/?|image\/?|video\/?)?(p\/\d+)?$/, async (req, res) => {
|
router.get(/^\/(audio\/?|image\/?|video\/?)?(p\/\d+)?$/, async (req, res) => {
|
||||||
const tmpmime = (allowedMimes.filter(n => req.url.split[0].startsWith(n))[0] ? req.url.split[0] : "");
|
const tmpmime = (allowedMimes.filter(n => req.url.split[0].startsWith(n))[0] ? req.url.split[0] : "");
|
||||||
const mime = tmpmime + "%";
|
const mime = tmpmime + "%";
|
||||||
const total = (await sql("items").where("mime", "like", mime).count("* as total"))[0].total;
|
|
||||||
|
const total = (
|
||||||
|
await sql("items")
|
||||||
|
.where("mime", "like", mime)
|
||||||
|
.count("* as total")
|
||||||
|
)[0].total;
|
||||||
|
|
||||||
const pages = +Math.ceil(total / cfg.websrv.eps);
|
const pages = +Math.ceil(total / cfg.websrv.eps);
|
||||||
const page = Math.min(pages, +req.url.split[tmpmime.length > 0 ? 2 : 1] || 1);
|
const page = Math.min(pages, +req.url.split[tmpmime.length > 0 ? 2 : 1] || 1);
|
||||||
|
|
|
@ -65,7 +65,12 @@ import router from "./inc/router.mjs";
|
||||||
|
|
||||||
if(user.length > 0) {
|
if(user.length > 0) {
|
||||||
req.session = user[0];
|
req.session = user[0];
|
||||||
await sql("user_sessions").update("last_used", (Date.now() / 1e3)).where("id", user[0].sess_id);
|
let q = sql("user_sessions")
|
||||||
|
.update("last_used", (Date.now() / 1e3))
|
||||||
|
.where("id", user[0].sess_id);
|
||||||
|
if(!req.url.pathname.match(/^\/(s|b|t|ca)/))
|
||||||
|
q = q.update("last_action", req.url.pathname)
|
||||||
|
await q;
|
||||||
}
|
}
|
||||||
else { // delete session
|
else { // delete session
|
||||||
return res.writeHead(301, {
|
return res.writeHead(301, {
|
||||||
|
@ -85,7 +90,7 @@ import router from "./inc/router.mjs";
|
||||||
|
|
||||||
if(r = router.routes.getRoute(req.url.pathname, req.method)) {
|
if(r = router.routes.getRoute(req.url.pathname, req.method)) {
|
||||||
if(r.meddlware) {
|
if(r.meddlware) {
|
||||||
const tmp = r.meddlware(req, req);
|
const tmp = r.meddlware(req, res);
|
||||||
if(tmp.redirect)
|
if(tmp.redirect)
|
||||||
return res.redirect(tmp.redirect);
|
return res.redirect(tmp.redirect);
|
||||||
if(!tmp.success)
|
if(!tmp.success)
|
||||||
|
|
|
@ -46,8 +46,8 @@
|
||||||
<p style="text-decoration: line-through">Theme plopper (If theme is selected the default f0ck sheme will appear for a small amount of time until the custom stylesheet is applied) - ETA: Christmas™</p>
|
<p style="text-decoration: line-through">Theme plopper (If theme is selected the default f0ck sheme will appear for a small amount of time until the custom stylesheet is applied) - ETA: Christmas™</p>
|
||||||
<p style="text-decoration: line-through">Magical video seeker (If you hold mouseclick for too long on the video timeline and drag to a specific position it will go crazy, don't!) - ETA: Christmas™</p>
|
<p style="text-decoration: line-through">Magical video seeker (If you hold mouseclick for too long on the video timeline and drag to a specific position it will go crazy, don't!) - ETA: Christmas™</p>
|
||||||
<h5>f0ck Privacy?</h5>
|
<h5>f0ck Privacy?</h5>
|
||||||
<p>Cookies: Yes, we set 1 cookie for your prefered stylesheet, for the _cfduid cookie please see <a href="https://blog.cloudflare.com/deprecating-cfduid-cookie/" target="_blank">https://blog.cloudflare.com/deprecating-cfduid-cookie/</a></p>
|
<p>Cookies: Yes, we set 1 cookie for your prefered stylesheet, this is a optional cookie and not required for the site to function, simply cosmetics, you can block this cookie and the site will still work as intended and will default to the default f0ck theme called "f0ck"</p>
|
||||||
<p>Logs: No for Tor - Yes for cloudflare and cloudflare probably sells your soul to the devil, however our webserver doesn't log cloudflare connecting to our webserver, if you want to lurk without being flared by the cloud, see the above tor section my man</p>
|
<p>Logs:No for Tor - Yes for cloudflare and cloudflare probably sells your soul to the devil, however our webserver doesn't log cloudflare connecting to our webserver, if you want to lurk without being flared by the cloud, see the above tor section my man</p>
|
||||||
<p>But let me tell you something about internet "privacy". At first you need to understand what it means to have "privacy", for me as a human the word privacy means that I am by myself, private not observable by others, on the internet this concept does not work, in real life you might lock your door and then no one can enter the normal way to your room and you have some good old fashioned privacy, but on the internet various applications on your computer including extensions for your browser might make connections without you knowing or even giving consent if you knew, most applications send heartbeats, store information, read files on your computer, they might even process the gained data with or without you knowing or consenting to any of it, you probably accepted in good faith the ToS of many services without ever reading them, in the end it's up to you if you give a shit about your privacy, btw a VPN wont help if you still got all the tracking cookies and shit in your browser, they will just add 1+1 and you are identified again. My honest advice for anyone who seeks total privacy without bullshit, disconnect from the internet, remove the internet from your life, it's a bulletproof solution! With that being said, have a good day!</p>
|
<p>But let me tell you something about internet "privacy". At first you need to understand what it means to have "privacy", for me as a human the word privacy means that I am by myself, private not observable by others, on the internet this concept does not work, in real life you might lock your door and then no one can enter the normal way to your room and you have some good old fashioned privacy, but on the internet various applications on your computer including extensions for your browser might make connections without you knowing or even giving consent if you knew, most applications send heartbeats, store information, read files on your computer, they might even process the gained data with or without you knowing or consenting to any of it, you probably accepted in good faith the ToS of many services without ever reading them, in the end it's up to you if you give a shit about your privacy, btw a VPN wont help if you still got all the tracking cookies and shit in your browser, they will just add 1+1 and you are identified again. My honest advice for anyone who seeks total privacy without bullshit, disconnect from the internet, remove the internet from your life, it's a bulletproof solution! With that being said, have a good day!</p>
|
||||||
</div>
|
</div>
|
||||||
{{include main/footer}}
|
{{include main/footer}}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<td>browser</td>
|
<td>browser</td>
|
||||||
<td>created_at</td>
|
<td>created_at</td>
|
||||||
<td>last_used</td>
|
<td>last_used</td>
|
||||||
|
<td>last_action</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{each sessions as session}}
|
{{each sessions as session}}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
<td>{{=session.browser}}</td>
|
<td>{{=session.browser}}</td>
|
||||||
<td>{{=new Date(session.created_at * 1e3).toLocaleString("de-DE")}}</td>
|
<td>{{=new Date(session.created_at * 1e3).toLocaleString("de-DE")}}</td>
|
||||||
<td>{{=new Date(session.last_used * 1e3).toLocaleString("de-DE")}}</td>
|
<td>{{=new Date(session.last_used * 1e3).toLocaleString("de-DE")}}</td>
|
||||||
|
<td>{{=session.last_action}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
{{if typeof item.tags !== "undefined"}}
|
{{if typeof item.tags !== "undefined"}}
|
||||||
{{each item.tags as tag}}
|
{{each item.tags as tag}}
|
||||||
<span {{if session}}title="{{=tag.prefix}}"{{/if}} class="badge {{if tag.tag[0] == "&"}}badge-greentext{{/if}} badge-{{=(tag.tag === "nsfw" ? "danger" : tag.tag === "sfw" ? "success" : "light")}} mr-2">
|
<span {{if session}}title="{{=tag.prefix}}"{{/if}} class="badge {{if tag.tag[0] == "&"}}badge-greentext{{/if}} badge-{{=(tag.tag === "nsfw" ? "danger" : tag.tag === "sfw" ? "success" : "light")}} mr-2">
|
||||||
{{if session}}<a href="/admin/test?tag={{=tag.tag.replace(/\s/g, "%20")}}" target="_blank" style="color: inherit !important;">{{/if}}{{=tag.tag}}{{if session}}</a> <a href="#">×</a>{{/if}}
|
{{if session}}<a href="/admin/test?tag={{=tag.tag.replace(/\s/g, "+")}}" target="_blank" style="color: inherit !important;">{{/if}}{{=tag.tag}}{{if session}}</a> <a href="#">×</a>{{/if}}
|
||||||
</span>
|
</span>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -25,6 +25,11 @@
|
||||||
<span class="nav-link-identifier">blah</span>
|
<span class="nav-link-identifier">blah</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{{if typeof totals !== "undefined"}}
|
||||||
|
<li class="nav-item" style="width: 100%; text-align: center">
|
||||||
|
total: {{=totals.total}} | tagged: {{=totals.tagged}} | untagged: {{=totals.untagged}}
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse navbar-collapse show" id="navbarSupportedContent">
|
<div class="collapse navbar-collapse show" id="navbarSupportedContent">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user