diff --git a/package-lock.json b/package-lock.json
index 3257ce6..e7c4673 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,7 @@
"dependencies": {
"cuffeo": "^1.0.7-3",
"flumm-fetch": "^1.0.1",
- "flummpress": "^2.0.4",
+ "flummpress": "^2.0.5",
"postgres": "^3.0.1"
}
},
@@ -40,14 +40,14 @@
}
},
"node_modules/flummpress": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/flummpress/-/flummpress-2.0.4.tgz",
- "integrity": "sha512-AuEf/VnfC9hWqw+/0aH+Y+c8UgZ6CX/wVN8RR8V9btvYhIzLTJzVlyC0oTg5yrqLMUGaL9y8YRBjg2hKbFm94A=="
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/flummpress/-/flummpress-2.0.5.tgz",
+ "integrity": "sha512-C/8Im6OvoZw67q9DvYIXKjKr28zHYLJdH4DucQ6zpVbN1eWPySmxkJTURbkq3uEwABXLngXLifS6mjxAC++umQ=="
},
"node_modules/postgres": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/postgres/-/postgres-3.0.2.tgz",
- "integrity": "sha512-sHkEGAnPVqRclh5oIr9S9e/VNX0/MUb2PgS9bl/0wnI8WrHhzMmxqq/fAkMZKUUrC3Lfa4qaNh1dyDPH4Q8V0w==",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/postgres/-/postgres-3.1.0.tgz",
+ "integrity": "sha512-yQbJtA7z6SsQuFiF01rmHlkG2gU5IEv9D/Pn2fu8Tz6x3/suNWZs4fIPd59rkL+dfVfhDqYQ7DU3YnUqzEDB5Q==",
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/porsager"
@@ -77,14 +77,14 @@
}
},
"flummpress": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/flummpress/-/flummpress-2.0.4.tgz",
- "integrity": "sha512-AuEf/VnfC9hWqw+/0aH+Y+c8UgZ6CX/wVN8RR8V9btvYhIzLTJzVlyC0oTg5yrqLMUGaL9y8YRBjg2hKbFm94A=="
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/flummpress/-/flummpress-2.0.5.tgz",
+ "integrity": "sha512-C/8Im6OvoZw67q9DvYIXKjKr28zHYLJdH4DucQ6zpVbN1eWPySmxkJTURbkq3uEwABXLngXLifS6mjxAC++umQ=="
},
"postgres": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/postgres/-/postgres-3.0.2.tgz",
- "integrity": "sha512-sHkEGAnPVqRclh5oIr9S9e/VNX0/MUb2PgS9bl/0wnI8WrHhzMmxqq/fAkMZKUUrC3Lfa4qaNh1dyDPH4Q8V0w=="
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/postgres/-/postgres-3.1.0.tgz",
+ "integrity": "sha512-yQbJtA7z6SsQuFiF01rmHlkG2gU5IEv9D/Pn2fu8Tz6x3/suNWZs4fIPd59rkL+dfVfhDqYQ7DU3YnUqzEDB5Q=="
}
}
}
diff --git a/package.json b/package.json
index b34ac91..154b2ed 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"dependencies": {
"cuffeo": "^1.0.7-3",
"flumm-fetch": "^1.0.1",
- "flummpress": "^2.0.4",
+ "flummpress": "^2.0.5",
"postgres": "^3.0.1"
}
}
diff --git a/public/s/css/f0ck.css b/public/s/css/f0ck.css
index 1b4007e..6d47944 100644
--- a/public/s/css/f0ck.css
+++ b/public/s/css/f0ck.css
@@ -40,6 +40,10 @@ html[theme='f0ck'] {
--scroller-bg: #424242;
}
+html[theme="f0ck"] .admin-search button {
+ color: var(--black)!important;
+}
+
html[theme='p1nk'] {
--accent: #ff00d0;
--bg: #171717;
@@ -146,6 +150,23 @@ html[theme='amoled'] {
--scroller-bg: #424242;
}
+html[theme="amoled"] .admin-search button {
+ color: var(--black)!important;
+}
+
+html[theme="amoled"] table.table tbody tr:nth-of-type(2n+1) a {
+ color: var(--white) !important;
+ text-decoration: underline;
+}
+
+html[theme="amoled"] table.table tbody tr:nth-of-type(2n+1) {
+ color: var(--white) !important;
+}
+
+html[theme="amoled"] table.table a {
+ text-decoration: underline;
+}
+
html[theme="paper"] {
--accent: #000;
--bg: #fff;
@@ -265,6 +286,28 @@ html[theme="paper"] span#favs {
border: 1px solid var(--white);
}
+html[theme="paper"] .admin-search button {
+ color: var(--white)!important;
+ opacity: 0.9;
+}
+
+html[theme="paper"] table.table tbody tr:nth-of-type(2n+1) a {
+ color: var(--white) !important;
+ text-decoration: underline;
+}
+
+html[theme="paper"] table.table tbody tr:nth-of-type(2n+1) {
+ color: var(--white) !important;
+}
+
+html[theme="paper"] table.table a {
+ text-decoration: underline;
+}
+
+html[theme="paper"] a {
+ color: var(--black);
+}
+
html[theme="atmos"] {
--accent: #1fb2b0;
--bg: #161618;
@@ -438,7 +481,7 @@ html, body {
}
a {
- color: var(--accent) !important;
+ color: var(--accent) /* !important */;
cursor: pointer;
text-decoration: none;
}
@@ -616,7 +659,7 @@ span.f0ck {
border-radius: 3px;
background-image: linear-gradient(to bottom,var(--nav-link-background-linear-gradient));
box-shadow: var(--nav-link-box-shadow);
- color: transparent;
+ /* color: transparent; */
}
.navbar-expand-lg .navbar-nav .nav-link, .pagination > a, .pagination > span {
@@ -710,6 +753,7 @@ span.f0ck {
span.placeholder {
border-left: 1px solid var(--accent);
margin-left: 7px;
+ user-select: none;
}
.navbar .nav-item .dropdown-menu {
@@ -1705,3 +1749,36 @@ a[data-mime^="audio"] {
margin: 10px;
align-self: center;
}
+
+/* Admin search css early test */
+.admin-search {
+ margin-top: 15px;
+ display: flex;
+ justify-content: center;
+}
+
+.admin-search button {
+ background: var(--accent);
+ border: none;
+ color: var(--white);
+ padding: 15px;
+}
+
+.admin-search button:hover {
+ transition: .2s all;
+ opacity: 0.7;
+ cursor: pointer;
+}
+
+.admin-search input {
+ padding: 15px;
+ border: 1px solid var(--accent);
+}
+
+table img {
+ border: 1px solid;
+}
+
+.results {
+ padding: 5px;
+}
diff --git a/public/s/js/admin.js b/public/s/js/admin.js
index 18afad3..37a8db4 100644
--- a/public/s/js/admin.js
+++ b/public/s/js/admin.js
@@ -249,7 +249,7 @@ const flash = ({ type, msg }) => {
const a = document.createElement('a');
a.href = `/user/${f.user}/favs`;
a.setAttribute('tooltip', f.user);
- a.setAttribute('flow', 'down');
+ a.setAttribute('flow', 'up');
const img = document.createElement('img');
img.src = `/t/${f.avatar}.webp`;
diff --git a/src/inc/routeinc/f0cklib.mjs b/src/inc/routeinc/f0cklib.mjs
index 39306c9..c7270a1 100644
--- a/src/inc/routeinc/f0cklib.mjs
+++ b/src/inc/routeinc/f0cklib.mjs
@@ -227,6 +227,7 @@ export default {
? db`group by st.tag, st.item_id, "items".id`
: db`group by "items".id, "favorites".user_id, "favorites".item_id, "user".id`
}
+ order by "items".id desc
`;
}
else {
diff --git a/src/inc/routes/admin.mjs b/src/inc/routes/admin.mjs
index e2ff4aa..139504b 100644
--- a/src/inc/routes/admin.mjs
+++ b/src/inc/routes/admin.mjs
@@ -1,7 +1,6 @@
import db from "../sql.mjs";
import lib from "../lib.mjs";
import { exec } from "child_process";
-import search from "../routeinc/search.mjs";
const auth = async (req, res, next) => {
if(!req.session) {
@@ -120,43 +119,6 @@ export default (router, tpl) => {
}, req)
});
});
-
- router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
- let ret;
- if(Object.keys(req.url.qs).length > 0) {
- let tag = req.url.qs.tag;
- let rows;
-
- if(tag.startsWith('src:')) {
- tag = tag.substring(4);
- ret = await db`
- select *
- from "items"
- where src ilike ${'%' + tag + '%'}
- limit 500
- `;
- }
- else {
- rows = await db`
- select "items".id, "items".username, "tags".tag
- from "tags"
- left join "tags_assign" on "tags_assign".tag_id = "tags".id
- left join "items" on "items".id = "tags_assign".item_id
- where "tags".tag ilike ${'%' + tag + '%'}
- limit 500
- `;
- ret = search(rows, tag);
- }
- }
-
- res.reply({
- body: tpl.render("admin/search", {
- result: ret,
- totals: await lib.countf0cks(),
- session: req.session
- }, req)
- });
- });
router.get(/^\/admin\/log(\/)?$/, auth, async (req, res) => {
exec("journalctl -qeu f0ck --no-pager", (err, stdout) => {
diff --git a/src/inc/routes/search.mjs b/src/inc/routes/search.mjs
new file mode 100644
index 0000000..28f52fd
--- /dev/null
+++ b/src/inc/routes/search.mjs
@@ -0,0 +1,44 @@
+import db from "../sql.mjs";
+import lib from "../lib.mjs";
+import search from "../routeinc/search.mjs";
+
+export default (router, tpl) => {
+ router.get(/^\/search(\/)?$/, lib.auth, async (req, res) => {
+ let ret;
+ let tag = req.url.qs?.tag;
+ if(Object.keys(req.url.qs).length > 0) {
+ let rows;
+
+ if(tag.startsWith('src:')) {
+ tag = tag.substring(4);
+ ret = await db`
+ select *
+ from "items"
+ where src ilike ${'%' + tag + '%'}
+ limit 500
+ `;
+ }
+ else {
+ rows = await db`
+ select "items".id, "items".username, "items".mime, "tags".tag
+ from "tags"
+ left join "tags_assign" on "tags_assign".tag_id = "tags".id
+ left join "items" on "items".id = "tags_assign".item_id
+ where "tags".tag ilike ${'%' + tag + '%'}
+ limit 500
+ `;
+ ret = search(rows, tag);
+ }
+ }
+
+ res.reply({
+ body: tpl.render("search", {
+ result: ret,
+ totals: await lib.countf0cks(),
+ searchstring: tag,
+ session: req.session,
+ tmp: null
+ }, req)
+ });
+ });
+};
diff --git a/views/admin/search.html b/views/admin/search.html
deleted file mode 100644
index 4545972..0000000
--- a/views/admin/search.html
+++ /dev/null
@@ -1,27 +0,0 @@
-@include(snippets/header_admin)
-
-
-@if(result)
-{{ result.length }} f0cks given
-
-
- Thumbnail |
- ID |
- Tag |
- Username |
- Score |
-
-@each(result as line)
-
- |
- {{ line.id }} |
- {{ line.tag }} |
- {{ line.username }} |
- {{ line.score }} |
-
-@endeach
-
-@endif
-@include(snippets/footer)
\ No newline at end of file
diff --git a/views/item.html b/views/item.html
index 0174bd4..8d0dd6f 100644
--- a/views/item.html
+++ b/views/item.html
@@ -79,7 +79,7 @@
@if(item.favorites.length && session)
@each(item.favorites as fav)
-
+
@endeach
@endif
diff --git a/views/ranking.html b/views/ranking.html
index d400dd7..a8af8cb 100644
--- a/views/ranking.html
+++ b/views/ranking.html
@@ -10,8 +10,8 @@
@for(let i = 0; i < list.length; i++)
{{ i + 1 }} |
- |
- {!! list[i].user !!} |
+ |
+ {!! list[i].user !!} |
{{ list[i].count }} |
@endfor
diff --git a/views/search.html b/views/search.html
new file mode 100644
index 0000000..f3e3297
--- /dev/null
+++ b/views/search.html
@@ -0,0 +1,31 @@
+@include(snippets/header)
+f0ckgle
+
+
+ @if(result)
+
{{ result.length }} f0cks given:
+
+ @endif
+
+@include(snippets/footer)
\ No newline at end of file
diff --git a/views/snippets/navbar.html b/views/snippets/navbar.html
index da67e28..cea349d 100644
--- a/views/snippets/navbar.html
+++ b/views/snippets/navbar.html
@@ -12,6 +12,7 @@
my f0cks
my favs
settings
+ search
About
Ranking
logout
diff --git a/views/snippets/navbar_admin.html b/views/snippets/navbar_admin.html
index 01d0649..62b140b 100644
--- a/views/snippets/navbar_admin.html
+++ b/views/snippets/navbar_admin.html
@@ -15,11 +15,6 @@
sessions
-
-
- search (wip)
-
-
Log