diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/api.js | 2 | ||||
-rw-r--r-- | public/js/home.js | 11 |
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) |