Created a per-post hitcount as well a writedata() function that can

write to a particular index or to a whole data type
This commit is contained in:
2025-10-02 13:34:55 +01:00
parent 17919e3078
commit 2ada1d970f
5 changed files with 57 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ const router = express.Router();
router.get("/", (req,res) => {
// Increment the hitcount
if (config.enable_hitcount) {
func.increment_hitcount()
data.increment_hitcount()
}
res.render("pages/timeline",
@@ -62,6 +62,9 @@ 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', postID)
if (config.enable_hitcount) {
data.increment_hitcount(postID)
}
if (post == 1) { // data.getdata returns error code 1 if nothing is available
res.render("partials/message", {
message: locale.post_doesnt_exist,