diff --git a/public/s/js/scroller.js b/public/s/js/scroller.js
index 633e76a..04bec5b 100644
--- a/public/s/js/scroller.js
+++ b/public/s/js/scroller.js
@@ -235,8 +235,8 @@
return ago(fmt(y === 1 ? i.ta_year : i.ta_years, y, 'year'));
}
function hashId() {
- // Check path first /abyss/1234
- const pathMatch = location.pathname.match(/\/abyss\/(\d+)$/);
+ // Check path first /abyss/1234 or /abyss/gif/1234
+ const pathMatch = location.pathname.match(/\/abyss\/([a-zA-Z0-9_\/-]+)$/);
if (pathMatch) return pathMatch[1];
// Fallback to hash
@@ -1398,7 +1398,7 @@
${item.is_external ? (
item.local_id
- ? `
+ ? `
${_i.view_label || 'View'}
`
@@ -1889,7 +1889,7 @@
// Update button to link to the new site-internal post
setTimeout(() => {
btn.outerHTML = `
-
+
View
diff --git a/src/inc/routes/scroller.mjs b/src/inc/routes/scroller.mjs
index 54ba38d..f6165c8 100644
--- a/src/inc/routes/scroller.mjs
+++ b/src/inc/routes/scroller.mjs
@@ -4,7 +4,7 @@ import lib from "../lib.mjs";
export default (router, tpl) => {
// Serve the scroller page
- router.get(/^\/abyss(?:\/(?[0-9]+))?\/?$/, async (req, res) => {
+ router.get(/^\/abyss(?:\/(?[a-zA-Z0-9_\/-]+))?\/?$/, async (req, res) => {
if (cfg.websrv.abyss_enabled === false) return res.reply({ code: 404, body: tpl.render('error', { message: 'Not found', tmp: null }, req) });
if (cfg.websrv.private_society && !req.session) {
return res.reply({ code: 502, body: '502 Bad Gateway' });
@@ -18,7 +18,7 @@ export default (router, tpl) => {
url: `https://${cfg.main.url.domain}/abyss`
};
- if (id) {
+ if (id && /^\d+$/.test(id.trim())) {
try {
const items = await db`
select i.*, uo.display_name