Sydication updates

This commit is contained in:
deadvey
2026-03-06 21:26:00 +00:00
parent 9f5fd261c3
commit 30cec0f7f0

View File

@@ -37,18 +37,18 @@ router.get("/user/:username", (req, res) => {
let user = data.getdata('users', 'id', userID)[0]
if (userID != -1) {
res.render("pages/user",
{
config,
locale,
posts: data.getdata('posts'),
user,
userID: userID,
comments: data.getdata('comments'),
fromUnixTime,
format,
getUnixTime,
func,
})
{
config,
locale,
posts: data.getdata('posts'),
user,
userID: userID,
comments: data.getdata('comments'),
fromUnixTime,
format,
getUnixTime,
func,
})
}
else if (userID == -1) {
res.render("partials/message",
@@ -63,33 +63,29 @@ router.get("/user/:username", (req, res) => {
router.get("/post/:post_index", (req, res) => {
const postID = parseInt(req.params.post_index)
let post = data.getdata('posts','id', postID)[0]
if (post == 1) { // data.getdata returns error code 1 if nothing is available
if (post.length == 0) { // data.getdata returns error code 1 if nothing is available
res.render("partials/message", {
message: locale.post_doesnt_exist,
config,
})
}
else if (typeof post["deleted"] == "undefined" || post["deleted"] == false) {
else {
if (config.enable_hitcount) {
data.increment_hitcount(postID)
}
res.render("pages/post",
{
config,
locale,
post,
postID,
user: data.getdata('users','id', post.userID),
comments: data.getdata('comments','id', postID)["comments"],
fromUnixTime,
format,
getUnixTime,
func,
})
}
else {
console.log("Error loading page")
res.redirect(301,"/")
{
config,
locale,
post,
postID,
user: data.getdata('users','id', post.userID),
comments: data.getdata('comments','id', postID)["comments"],
fromUnixTime,
format,
getUnixTime,
func,
})
}
}); // /post/:post_index