pickle rick
This commit is contained in:
@@ -319,7 +319,7 @@ export default (router, tpl) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get(/\/admin\/user\/(?<userId>\d+)\/ips(\/)?$/, lib.auth, async (req, res) => {
|
router.get(/^\/admin\/user\/(?<userId>\d+)\/ips(\/)?$/, lib.auth, async (req, res) => {
|
||||||
const userId = +req.params.userId;
|
const userId = +req.params.userId;
|
||||||
const user = await db`select "user", login from "user" where id = ${userId} limit 1`;
|
const user = await db`select "user", login from "user" where id = ${userId} limit 1`;
|
||||||
if (user.length === 0) return res.reply({ code: 404, body: 'User not found' });
|
if (user.length === 0) return res.reply({ code: 404, body: 'User not found' });
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import cfg from "../config.mjs";
|
|||||||
import { createI18n } from "../i18n.mjs";
|
import { createI18n } from "../i18n.mjs";
|
||||||
|
|
||||||
export default (router, tpl) => {
|
export default (router, tpl) => {
|
||||||
router.get(/\/ajax\/item\/(?<itemid>[a-zA-Z0-9_-]{11}|\d+)/, async (req, res) => {
|
router.get(/^\/ajax\/item\/(?<itemid>[a-zA-Z0-9_-]{11}|\d+)/, async (req, res) => {
|
||||||
const tAjaxStart = Date.now();
|
const tAjaxStart = Date.now();
|
||||||
let query = {};
|
let query = {};
|
||||||
if (typeof req.url === 'string') {
|
if (typeof req.url === 'string') {
|
||||||
@@ -195,7 +195,7 @@ export default (router, tpl) => {
|
|||||||
|
|
||||||
|
|
||||||
// Infinite scroll endpoint for index thumbnails
|
// Infinite scroll endpoint for index thumbnails
|
||||||
router.get(/\/ajax\/items/, async (req, res) => {
|
router.get(/^\/ajax\/items/, async (req, res) => {
|
||||||
let query = {};
|
let query = {};
|
||||||
if (typeof req.url === 'string') {
|
if (typeof req.url === 'string') {
|
||||||
const parsedUrl = url.parse(req.url, true);
|
const parsedUrl = url.parse(req.url, true);
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ export default (router, tpl) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// DELETE /api/chat/:id — admin: delete a single message
|
// DELETE /api/chat/:id — admin: delete a single message
|
||||||
router.delete(/\/api\/chat\/(?<id>\d+)/, async (req, res) => {
|
router.delete(/^\/api\/chat\/(?<id>\d+)/, async (req, res) => {
|
||||||
if (!cfg.websrv.enable_global_chat) {
|
if (!cfg.websrv.enable_global_chat) {
|
||||||
return res.reply({ code: 404, body: JSON.stringify({ success: false }) });
|
return res.reply({ code: 404, body: JSON.stringify({ success: false }) });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ export default (router, tpl) => {
|
|||||||
|
|
||||||
// Specific route for direct item links: /user/:user/:itemid
|
// Specific route for direct item links: /user/:user/:itemid
|
||||||
// This avoids ambiguity with the profile route
|
// This avoids ambiguity with the profile route
|
||||||
router.get(/\/user\/(?<user>[^/]+)\/(?<itemid>[a-zA-Z0-9_-]+)$/, handleGenericRoute);
|
router.get(/^\/user\/(?<user>[^/]+)\/(?<itemid>[a-zA-Z0-9_-]+)$/, handleGenericRoute);
|
||||||
|
|
||||||
// Generic router for everything else (Index, Tags, standard User Grids)
|
// Generic router for everything else (Index, Tags, standard User Grids)
|
||||||
// We exclude static paths (/s/, /b/, /t/, /ca/, /a/, system routes) to prevent the greedy regex from intercepting them.
|
// We exclude static paths (/s/, /b/, /t/, /ca/, /a/, system routes) to prevent the greedy regex from intercepting them.
|
||||||
|
|||||||
Reference in New Issue
Block a user