This commit is contained in:
2026-05-30 12:50:15 +02:00
parent ae2a9b76cb
commit 1a0a5d7679
2 changed files with 6 additions and 6 deletions

View File

@@ -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 @@
</button>
${item.is_external ? (
item.local_id
? `<a class="scroll-btn success" href="/${item.local_id}" target="_blank" title="${_i.already_added || 'Already added'}">
? `<a class="scroll-btn rehost-btn success" href="/${item.local_id}" target="_blank" title="${_i.already_added || 'Already added'}">
<div class="scroll-btn-icon"><i class="fa-solid fa-check"></i></div>
<span class="scroll-btn-label">${_i.view_label || 'View'}</span>
</a>`
@@ -1889,7 +1889,7 @@
// Update button to link to the new site-internal post
setTimeout(() => {
btn.outerHTML = `
<a href="/${data.item_id}" target="_blank" class="scroll-btn success" style="text-decoration:none;">
<a href="/${data.item_id}" target="_blank" class="scroll-btn rehost-btn success" style="text-decoration:none;">
<div class="scroll-btn-icon"><i class="fa-solid fa-arrow-up-right-from-square"></i></div>
<span class="scroll-btn-label">View</span>
</a>

View File

@@ -4,7 +4,7 @@ import lib from "../lib.mjs";
export default (router, tpl) => {
// Serve the scroller page
router.get(/^\/abyss(?:\/(?<id>[0-9]+))?\/?$/, async (req, res) => {
router.get(/^\/abyss(?:\/(?<id>[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: '<html><body>502 Bad Gateway</body></html>' });
@@ -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