fdas
This commit is contained in:
@@ -235,8 +235,8 @@
|
|||||||
return ago(fmt(y === 1 ? i.ta_year : i.ta_years, y, 'year'));
|
return ago(fmt(y === 1 ? i.ta_year : i.ta_years, y, 'year'));
|
||||||
}
|
}
|
||||||
function hashId() {
|
function hashId() {
|
||||||
// Check path first /abyss/1234
|
// Check path first /abyss/1234 or /abyss/gif/1234
|
||||||
const pathMatch = location.pathname.match(/\/abyss\/(\d+)$/);
|
const pathMatch = location.pathname.match(/\/abyss\/([a-zA-Z0-9_\/-]+)$/);
|
||||||
if (pathMatch) return pathMatch[1];
|
if (pathMatch) return pathMatch[1];
|
||||||
|
|
||||||
// Fallback to hash
|
// Fallback to hash
|
||||||
@@ -1398,7 +1398,7 @@
|
|||||||
</button>
|
</button>
|
||||||
${item.is_external ? (
|
${item.is_external ? (
|
||||||
item.local_id
|
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>
|
<div class="scroll-btn-icon"><i class="fa-solid fa-check"></i></div>
|
||||||
<span class="scroll-btn-label">${_i.view_label || 'View'}</span>
|
<span class="scroll-btn-label">${_i.view_label || 'View'}</span>
|
||||||
</a>`
|
</a>`
|
||||||
@@ -1889,7 +1889,7 @@
|
|||||||
// Update button to link to the new site-internal post
|
// Update button to link to the new site-internal post
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
btn.outerHTML = `
|
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>
|
<div class="scroll-btn-icon"><i class="fa-solid fa-arrow-up-right-from-square"></i></div>
|
||||||
<span class="scroll-btn-label">View</span>
|
<span class="scroll-btn-label">View</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import lib from "../lib.mjs";
|
|||||||
|
|
||||||
export default (router, tpl) => {
|
export default (router, tpl) => {
|
||||||
// Serve the scroller page
|
// 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.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) {
|
if (cfg.websrv.private_society && !req.session) {
|
||||||
return res.reply({ code: 502, body: '<html><body>502 Bad Gateway</body></html>' });
|
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`
|
url: `https://${cfg.main.url.domain}/abyss`
|
||||||
};
|
};
|
||||||
|
|
||||||
if (id) {
|
if (id && /^\d+$/.test(id.trim())) {
|
||||||
try {
|
try {
|
||||||
const items = await db`
|
const items = await db`
|
||||||
select i.*, uo.display_name
|
select i.*, uo.display_name
|
||||||
|
|||||||
Reference in New Issue
Block a user