summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-01-22 20:47:39 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-01-22 20:47:39 -0500
commit5fe8ea1b85299564686f3fba331644e1178f363e (patch)
tree5ec235febb3957507a1dcdee8cf71c1d9b69011d /public/js
parentincrease post limit (diff)
downloadxssbook-5fe8ea1b85299564686f3fba331644e1178f363e.tar.gz
xssbook-5fe8ea1b85299564686f3fba331644e1178f363e.tar.bz2
xssbook-5fe8ea1b85299564686f3fba331644e1178f363e.zip
bug fixes
Diffstat (limited to 'public/js')
-rw-r--r--public/js/api.js2
-rw-r--r--public/js/home.js11
2 files changed, 12 insertions, 1 deletions
diff --git a/public/js/api.js b/public/js/api.js
index 371ecf3..05a0906 100644
--- a/public/js/api.js
+++ b/public/js/api.js
@@ -1,4 +1,4 @@
-const endpoint = 'https://xssbook.com/api'
+const endpoint = 'https://xssbook.com'
const request = async (url, body, method) => {
if (method === undefined) method = 'POST'
diff --git a/public/js/home.js b/public/js/home.js
index e0186a8..7697c29 100644
--- a/public/js/home.js
+++ b/public/js/home.js
@@ -7,6 +7,9 @@ function parseDate(date) {
function parseComment(comment) {
const author = data.users[comment.user]
+ if (author === undefined) {
+ author = {}
+ }
const html = `
<div class="comment">
<a class="pfp">
@@ -23,6 +26,9 @@ function parseComment(comment) {
function parsePost(post) {
const author = data.users[post.user]
+ if (author === undefined) {
+ author = {}
+ }
const html = `
<div class="post" postid=${post.id}>
<div class="postheader">
@@ -189,6 +195,11 @@ async function load() {
data.posts.push(... posts)
const batch = []
for (const post of posts) {
+ for(const comment of post.comments) {
+ if (data.users[comment.user] !== undefined) continue
+ if (batch.includes(comment.user)) continue
+ batch.push(comment.user)
+ }
if (data.users[post.user] !== undefined) continue
if (batch.includes(post.user)) continue
batch.push(post.user)