admin the second lol
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 18s

This commit is contained in:
Flummi 2024-06-24 08:41:46 +02:00
parent c79cca18cf
commit 058fe94fd1
6 changed files with 12 additions and 10 deletions

View File

@ -131,7 +131,7 @@ CREATE TABLE public."user" (
login character varying(255) NOT NULL, login character varying(255) NOT NULL,
"user" character varying(255) NOT NULL, "user" character varying(255) NOT NULL,
password character varying(167) NOT NULL, password character varying(167) NOT NULL,
level integer NOT NULL admin boolean NOT NULL
); );
ALTER TABLE public."user" OWNER TO f0ck; ALTER TABLE public."user" OWNER TO f0ck;

View File

@ -14,7 +14,7 @@ export default (router, tpl) => {
const user = decodeURIComponent(req.params.user); const user = decodeURIComponent(req.params.user);
const query = await db` const query = await db`
select "user".user, "user".created_at, user_options.* select "user".user, "user".admin, "user".created_at, user_options.*
from user_options from user_options
left join "user" on "user".id = user_options.user_id left join "user" on "user".id = user_options.user_id
where "user".user ilike ${user} where "user".user ilike ${user}
@ -35,13 +35,15 @@ export default (router, tpl) => {
user: user, user: user,
mode: req.session.mode, mode: req.session.mode,
fav: false, fav: false,
session: !!req.session session: !!req.session,
limit: 99999999
}); });
const favs = await f0cklib.getf0cks({ const favs = await f0cklib.getf0cks({
user: user, user: user,
mode: req.session.mode, mode: req.session.mode,
fav: true, fav: true,
session: !!req.session session: !!req.session,
limit: 99999999
}); });
const count = { const count = {

View File

@ -8,13 +8,13 @@ export default (router, tpl) => {
try { try {
const list = await db` const list = await db`
select select
"user".user, "user".user, "user".admin,
coalesce("user_options".avatar, ${await lib.getDefaultAvatar()}) as avatar, coalesce("user_options".avatar, ${await lib.getDefaultAvatar()}) as avatar,
count(distinct(tag_id, item_id)) as count count(distinct(tag_id, item_id)) as count
from "tags_assign" from "tags_assign"
left join "user" on "user".id = "tags_assign".user_id left join "user" on "user".id = "tags_assign".user_id
left join "user_options" on "user_options".user_id = "user".id left join "user_options" on "user_options".user_id = "user".id
group by "user".user, "user_options".avatar group by "user".user, "user_options".avatar, "user".admin
order by count desc order by count desc
`; `;
const stats = await lib.countf0cks(); const stats = await lib.countf0cks();

View File

@ -11,8 +11,8 @@
@for(let i = 0; i < list.length; i++) @for(let i = 0; i < list.length; i++)
<tr> <tr>
<td>{{ i + 1 }}</td> <td>{{ i + 1 }}</td>
<td><a href="/{{ list[i].avatar }}"><img class="avatar" src="/t/{{ list[i].avatar }}.webp" /></a></td> <td><a href="/{{ list[i].avatar }}"><img class="avatar" src="/t/{{ list[i].avatar }}.webp"></a></td>
<td><a href="/user/{!! list[i].user !!}">{!! list[i].user !!}</a></td> <td>@if(list[i].admin)&#11088;&nbsp;@endif<a href="/user/{!! list[i].user !!}">{!! list[i].user !!}</a></td>
<td>{{ list[i].count }}</td> <td>{{ list[i].count }}</td>
</tr> </tr>
@endfor @endfor

View File

@ -5,7 +5,7 @@
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link user" href="#" content="{{ session.user }}" data-toggle="dropdown"> <a class="nav-link user" href="#" content="{{ session.user }}" data-toggle="dropdown">
<img src="@if(session.avatar)/t/{{ session.avatar }}.webp@else/s/img/ava/default.png@endif" class="avatar" /><span>{{ session.user }}</span> <img src="@if(session.avatar)/t/{{ session.avatar }}.webp@else/s/img/ava/default.png@endif" class="avatar"><span>@if(session.admin)&#11088;&nbsp;@endif{{ session.user }}</span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="/user/{{ session.user.toLowerCase() }}">my profile</a></li> <li><a href="/user/{{ session.user.toLowerCase() }}">my profile</a></li>

View File

@ -8,7 +8,7 @@
@endif @endif
<div class="layersoffear"> <div class="layersoffear">
<div class="profile_head_username"> <div class="profile_head_username">
<span>{{ user.user }}</span> <span>@if(user.admin)&#11088;&nbsp;@endif{{ user.user }}</span>
</div> </div>
<div class="profile_head_user_stats"> <div class="profile_head_user_stats">
ID: {{ user.user_id }} Joined: {{ user.created_at }} ID: {{ user.user_id }} Joined: {{ user.created_at }}