xdddd
This commit is contained in:
@@ -1,5 +1,19 @@
|
|||||||
|
|
||||||
|
// Normalize percent-encoded characters in the URL bar that are safe to show decoded.
|
||||||
|
// Runs immediately so the address bar is clean before any other JS runs.
|
||||||
|
(function () {
|
||||||
|
try {
|
||||||
|
const p = window.location.pathname;
|
||||||
|
// Decode colon and space; leave %2F (/), %3F (?), %23 (#), %26 (&) encoded.
|
||||||
|
const clean = p.replace(/%3A/gi, ':').replace(/%20/gi, ' ');
|
||||||
|
if (clean !== p) {
|
||||||
|
history.replaceState(null, '', clean + window.location.search + window.location.hash);
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
})();
|
||||||
|
|
||||||
window.requestAnimFrame = (function () {
|
window.requestAnimFrame = (function () {
|
||||||
|
|
||||||
return window.requestAnimationFrame
|
return window.requestAnimationFrame
|
||||||
|| window.webkitRequestAnimationFrame
|
|| window.webkitRequestAnimationFrame
|
||||||
|| window.mozRequestAnimationFrame
|
|| window.mozRequestAnimationFrame
|
||||||
|
|||||||
@@ -99,8 +99,9 @@ export default {
|
|||||||
const user = rawUser ? lib.escapeLike(decodeURI(rawUser)) : null;
|
const user = rawUser ? lib.escapeLike(decodeURI(rawUser)) : null;
|
||||||
|
|
||||||
// --- title: prefix — search items.title instead of the tags table ---
|
// --- title: prefix — search items.title instead of the tags table ---
|
||||||
const isTitleSearch = (rawTag ?? '').startsWith('title:');
|
const _decodedTag = rawTag ? decodeURIComponent(rawTag) : '';
|
||||||
const titleQuery = isTitleSearch ? (rawTag ?? '').substring(6).trim() : null;
|
const isTitleSearch = _decodedTag.startsWith('title:');
|
||||||
|
const titleQuery = isTitleSearch ? _decodedTag.substring(6).trim() : null;
|
||||||
|
|
||||||
const tag = isTitleSearch ? null : lib.parseTag(rawTag ?? null);
|
const tag = isTitleSearch ? null : lib.parseTag(rawTag ?? null);
|
||||||
let hall = rawHall ?? null;
|
let hall = rawHall ?? null;
|
||||||
@@ -147,7 +148,7 @@ export default {
|
|||||||
const strictParams = ((strict || (tag && tag.includes(','))) && tag) ? tag.split(',').map(t => lib.slugify(t)).filter(t => t) : [];
|
const strictParams = ((strict || (tag && tag.includes(','))) && tag) ? tag.split(',').map(t => lib.slugify(t)).filter(t => t) : [];
|
||||||
const isStrict = strictParams.length > 0;
|
const isStrict = strictParams.length > 0;
|
||||||
|
|
||||||
const tmp = { user, tag: isTitleSearch ? rawTag : tag, hall: hallObj || hall, mime, page: actPage, mode: mode, view_mode: fav ? 'favs' : 'uploads', strict: strict, userHall: userHallObj || userHallSlug, userHallOwner };
|
const tmp = { user, tag: isTitleSearch ? _decodedTag : tag, hall: hallObj || hall, mime, page: actPage, mode: mode, view_mode: fav ? 'favs' : 'uploads', strict: strict, userHall: userHallObj || userHallSlug, userHallOwner };
|
||||||
const baseMode = lib.getMode(mode ?? 0);
|
const baseMode = lib.getMode(mode ?? 0);
|
||||||
const modequery = baseMode;
|
const modequery = baseMode;
|
||||||
|
|
||||||
@@ -339,7 +340,12 @@ export default {
|
|||||||
},
|
},
|
||||||
getf0ck: async ({ user: rawUser, tag: rawTag, hall: rawHall, mime: rawMime, itemid: rawItemid, mode, session, strict, exclude, user_id, fav, random, userHall: rawUserHall, userHallOwner: rawUserHallOwner, lang } = {}) => {
|
getf0ck: async ({ user: rawUser, tag: rawTag, hall: rawHall, mime: rawMime, itemid: rawItemid, mode, session, strict, exclude, user_id, fav, random, userHall: rawUserHall, userHallOwner: rawUserHallOwner, lang } = {}) => {
|
||||||
const user = rawUser ? lib.escapeLike(decodeURI(rawUser)) : null;
|
const user = rawUser ? lib.escapeLike(decodeURI(rawUser)) : null;
|
||||||
const tag = lib.parseTag(rawTag ?? null);
|
|
||||||
|
// --- title: prefix — search items.title instead of the tags table ---
|
||||||
|
const _decodedTag = rawTag ? decodeURIComponent(rawTag) : '';
|
||||||
|
const isTitleSearch = _decodedTag.startsWith('title:');
|
||||||
|
const titleQuery = isTitleSearch ? _decodedTag.substring(6).trim() : null;
|
||||||
|
const tag = isTitleSearch ? null : lib.parseTag(rawTag ?? null);
|
||||||
let hall = rawHall ?? null;
|
let hall = rawHall ?? null;
|
||||||
if (hall) {
|
if (hall) {
|
||||||
const hallData = await db`SELECT name, slug, description FROM halls WHERE slug = ${hall} LIMIT 1`;
|
const hallData = await db`SELECT name, slug, description FROM halls WHERE slug = ${hall} LIMIT 1`;
|
||||||
@@ -376,7 +382,7 @@ export default {
|
|||||||
const strictParams = ((strict || (tag && tag.includes(','))) && tag) ? tag.split(',').map(t => lib.slugify(t)).filter(t => t) : [];
|
const strictParams = ((strict || (tag && tag.includes(','))) && tag) ? tag.split(',').map(t => lib.slugify(t)).filter(t => t) : [];
|
||||||
const isStrict = strictParams.length > 0;
|
const isStrict = strictParams.length > 0;
|
||||||
|
|
||||||
const tmp = { user, tag, hall, mime, itemid, strict: strict, userHall: userHallObj || userHallSlug, userHallOwner };
|
const tmp = { user, tag: isTitleSearch ? _decodedTag : tag, hall, mime, itemid, strict: strict, userHall: userHallObj || userHallSlug, userHallOwner };
|
||||||
|
|
||||||
const effMode = Number(mode ?? 0);
|
const effMode = Number(mode ?? 0);
|
||||||
const modequery = lib.getMode(effMode);
|
const modequery = lib.getMode(effMode);
|
||||||
@@ -389,7 +395,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let tagFilter = db``;
|
let tagFilter = db``;
|
||||||
if (tag) {
|
let titleFilter = db``;
|
||||||
|
if (isTitleSearch && titleQuery) {
|
||||||
|
titleFilter = db`and items.title ILIKE ${'%' + titleQuery + '%'} and items.title IS NOT NULL`;
|
||||||
|
} else if (tag) {
|
||||||
const terms = tag.split(',').map(t => t.trim()).filter(Boolean);
|
const terms = tag.split(',').map(t => t.trim()).filter(Boolean);
|
||||||
if (terms.length > 0) {
|
if (terms.length > 0) {
|
||||||
if (isStrict) {
|
if (isStrict) {
|
||||||
@@ -426,6 +435,7 @@ export default {
|
|||||||
${db.unsafe(modequery)}
|
${db.unsafe(modequery)}
|
||||||
and items.active = true
|
and items.active = true
|
||||||
${tagFilter}
|
${tagFilter}
|
||||||
|
${titleFilter}
|
||||||
${hallFilter}
|
${hallFilter}
|
||||||
${userHallFilter}
|
${userHallFilter}
|
||||||
${fav ? db`and "user"."user" ilike ${user}` : db``}
|
${fav ? db`and "user"."user" ilike ${user}` : db``}
|
||||||
@@ -724,8 +734,9 @@ export default {
|
|||||||
const hall = rawHall || null;
|
const hall = rawHall || null;
|
||||||
|
|
||||||
// --- title: prefix — search items.title instead of the tags table ---
|
// --- title: prefix — search items.title instead of the tags table ---
|
||||||
const isTitleSearch = (rawTag ?? '').startsWith('title:');
|
const _decodedTag = rawTag ? decodeURIComponent(rawTag) : '';
|
||||||
const titleQuery = isTitleSearch ? (rawTag ?? '').substring(6).trim() : null;
|
const isTitleSearch = _decodedTag.startsWith('title:');
|
||||||
|
const titleQuery = isTitleSearch ? _decodedTag.substring(6).trim() : null;
|
||||||
const tag = isTitleSearch ? null : lib.parseTag(rawTag ?? null);
|
const tag = isTitleSearch ? null : lib.parseTag(rawTag ?? null);
|
||||||
|
|
||||||
const mime = (rawMime ?? "");
|
const mime = (rawMime ?? "");
|
||||||
|
|||||||
Reference in New Issue
Block a user