...
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));
|
||||
_tags.reverse().forEach(tag => {
|
||||
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.style = "color: inherit !important";
|
||||
a.innerText = tag.tag;
|
||||
|
@ -46,7 +46,8 @@ router.post(/^\/login(\/)?$/, async (req, res) => {
|
||||
session: lib.md5(session),
|
||||
browser: req.headers["user-agent"],
|
||||
created_at: stamp,
|
||||
last_used: stamp
|
||||
last_used: stamp,
|
||||
last_action: "/login"
|
||||
});
|
||||
|
||||
return res.writeHead(301, {
|
||||
@ -87,8 +88,15 @@ router.get(/^\/login\/test$/, async (req, res) => {
|
||||
});
|
||||
|
||||
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({
|
||||
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")
|
||||
.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({
|
||||
body: tpl.render("views/admin_sessions", {
|
||||
sessions: rows
|
||||
sessions: rows,
|
||||
totals: totals[0]
|
||||
}, req)
|
||||
});
|
||||
});
|
||||
|
||||
router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
||||
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) {
|
||||
const tag = req.url.qs.tag;
|
||||
|
||||
@ -121,7 +144,8 @@ router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
||||
|
||||
res.reply({
|
||||
body: tpl.render("views/admin_search", {
|
||||
result: ret
|
||||
result: ret,
|
||||
totals: totals[0]
|
||||
}, req)
|
||||
});
|
||||
});
|
||||
|
@ -172,7 +172,7 @@ router.post(/^\/api\/v2\/admin\/tags\/delete$/, auth, async (req, res) => {
|
||||
q = q.andWhere("prefix", `${req.session.user}@webinterface`);
|
||||
const reply = !!(await q);
|
||||
|
||||
await cleanTags();
|
||||
//await cleanTags();
|
||||
|
||||
return res.reply({ body: JSON.stringify({
|
||||
success: reply,
|
||||
|
@ -13,7 +13,12 @@ const allowedMimes = [ "audio", "image", "video", "%" ];
|
||||
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 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 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) {
|
||||
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
|
||||
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.meddlware) {
|
||||
const tmp = r.meddlware(req, req);
|
||||
const tmp = r.meddlware(req, res);
|
||||
if(tmp.redirect)
|
||||
return res.redirect(tmp.redirect);
|
||||
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">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>
|
||||
<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>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>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>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>
|
||||
{{include main/footer}}
|
||||
|
@ -7,6 +7,7 @@
|
||||
<td>browser</td>
|
||||
<td>created_at</td>
|
||||
<td>last_used</td>
|
||||
<td>last_action</td>
|
||||
</tr>
|
||||
{{each sessions as session}}
|
||||
<tr>
|
||||
@ -16,6 +17,7 @@
|
||||
<td>{{=session.browser}}</td>
|
||||
<td>{{=new Date(session.created_at * 1e3).toLocaleString("de-DE")}}</td>
|
||||
<td>{{=new Date(session.last_used * 1e3).toLocaleString("de-DE")}}</td>
|
||||
<td>{{=session.last_action}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
|
@ -64,7 +64,7 @@
|
||||
{{if typeof item.tags !== "undefined"}}
|
||||
{{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">
|
||||
{{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>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
@ -25,6 +25,11 @@
|
||||
<span class="nav-link-identifier">blah</span>
|
||||
</a>
|
||||
</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>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse show" id="navbarSupportedContent">
|
||||
|
Loading…
Reference in New Issue
Block a user