gfds
This commit is contained in:
+25
-4
@@ -101,7 +101,7 @@ export default (router, tpl) => {
|
||||
|
||||
if (!data.success) {
|
||||
const { t: tErr } = createI18n(req.session?.language || req.lang || 'en');
|
||||
const modeLabels = { 0: 'SFW', 1: 'NSFW', 2: 'Untagged', 4: 'NSFL' };
|
||||
const modeLabels = { 0: 'SFW', 1: 'NSFW', 2: 'Unrated', 4: 'NSFL' };
|
||||
const errorModeLabel = reqMode !== 3 ? (modeLabels[reqMode] || 'SFW') : null;
|
||||
const errorHtml = tpl.render('error-partial', {
|
||||
message: tErr('error.post_not_visible'),
|
||||
@@ -220,6 +220,27 @@ export default (router, tpl) => {
|
||||
// Detailed timing breakdown
|
||||
console.log(`[AJAX-RANDOM] ${itemid} total=${tAjaxRender - tAjaxStart}ms | getRandom=${tRandom - tAjaxStart}ms | getf0ck=${tAjaxFetch - tRandom}ms | aux=${tAjaxAux - tAjaxFetch}ms | render=${tAjaxRender - tAjaxAux}ms`);
|
||||
|
||||
let itemPage = null;
|
||||
if (query.onara === '1' || req.cookies?.onara === '1' || req.cookies?.f0ck_onara === '1' || cfg.onara) {
|
||||
try {
|
||||
itemPage = await f0cklib.getItemPage({
|
||||
targetItemId: data.item?.id || itemid,
|
||||
targetItemPinned: data.item?.is_pinned,
|
||||
user, tag, hall, userHall, userHallOwner, mime,
|
||||
fav: isFav,
|
||||
mode: reqMode,
|
||||
ratings: ratingsArr && ratingsArr.length > 0 ? ratingsArr : null,
|
||||
strict: isStrict,
|
||||
session: req.session,
|
||||
exclude: req.session ? (req.session.excluded_tags || []) : [],
|
||||
user_id: req.session?.id,
|
||||
is_admin: req.session?.admin,
|
||||
minXdScore: req.url.qs?.min_xd !== undefined ? +req.url.qs.min_xd : (req.session?.min_xd_score || 0),
|
||||
tagger: query.tagger || null
|
||||
});
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
res.reply({
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
@@ -228,7 +249,7 @@ export default (router, tpl) => {
|
||||
title: data.title,
|
||||
id: itemid,
|
||||
slug: data.item?.slug || null,
|
||||
page: null,
|
||||
page: itemPage,
|
||||
is_random: true
|
||||
})
|
||||
});
|
||||
@@ -297,7 +318,7 @@ export default (router, tpl) => {
|
||||
|
||||
if (!data.success) {
|
||||
const reqMode = (query.mode !== undefined ? +query.mode : req.mode) ?? 0;
|
||||
const modeLabels = { 0: 'SFW', 1: 'NSFW', 2: 'Untagged', 4: 'NSFL' };
|
||||
const modeLabels = { 0: 'SFW', 1: 'NSFW', 2: 'Unrated', 4: 'NSFL' };
|
||||
const errorModeLabel = reqMode !== 3 ? (modeLabels[reqMode] || 'SFW') : null;
|
||||
const { t: tErr } = createI18n(req.session?.language || req.lang || 'en');
|
||||
const errorHtml = tpl.render('error-partial', {
|
||||
@@ -443,7 +464,7 @@ export default (router, tpl) => {
|
||||
- Render: ${tAjaxRender - tAjaxAux}ms`);
|
||||
|
||||
let itemPage = null;
|
||||
if (query.onara === '1' || req.cookies?.onara === '1' || cfg.onara || query.get_page === '1') {
|
||||
if (query.onara === '1' || req.cookies?.onara === '1' || req.cookies?.f0ck_onara === '1' || cfg.onara || query.get_page === '1') {
|
||||
try {
|
||||
itemPage = await f0cklib.getItemPage({
|
||||
targetItemId: data.item?.id || itemid,
|
||||
|
||||
Reference in New Issue
Block a user