diff --git a/public/404.html b/public/404.html
index 04ddadc..c89d93d 100644
--- a/public/404.html
+++ b/public/404.html
@@ -5,6 +5,7 @@
+
XSSBook - Not Found
diff --git a/public/admin.html b/public/admin.html
index 8cd2199..cd79337 100644
--- a/public/admin.html
+++ b/public/admin.html
@@ -12,7 +12,7 @@
-
+
${post.content.replace(/\n/g,'
')}
-
- ${Object.keys(post.likes).map(k => post.likes[k]).filter(v => v !== false).length} Likes
+
+ ${post.likes.length} Likes
- Like
+ Like
@@ -95,11 +95,12 @@ async function like(span) {
.getElementsByClassName("liketoggle")
if (current) {
buttons[0].classList.remove("blue")
- buttons[1].classList.remove("blue")
+ buttons[1].classList.remove("bltext")
} else {
buttons[0].classList.add("blue")
- buttons[1].classList.add("blue")
+ buttons[1].classList.add("bltext")
}
+ container.getElementsByClassName("likes")[0].innerHTML = post.likes.length + " Likes"
}
async function comment(event) {
diff --git a/public/js/people.js b/public/js/people.js
index 5c1026b..15fde59 100644
--- a/public/js/people.js
+++ b/public/js/people.js
@@ -1,6 +1,6 @@
function parseUser(user) {
const html = `
-
+
diff --git a/public/js/profile.js b/public/js/profile.js
index 787e2b2..1e14c21 100644
--- a/public/js/profile.js
+++ b/public/js/profile.js
@@ -90,22 +90,26 @@ async function load() {
params[key] = value
}
- data.user = (await loadself()).json;
- data.users[data.user.user_id] = data.user
+ data.self = (await loadself()).json;
+ data.users[data.self.user_id] = data.self
let id;
if (params.id !== undefined && !isNaN(params.id)) {
id = parseInt(params.id);
} else {
- id = data.user.user_id
+ id = data.self.user_id
}
- isself = id === data.user.user_id
+ isself = id === data.self.user_id
const posts = (await loadusersposts(id)).json
data.posts.push(... posts)
const batch = []
+
+ if (!isself) {
+ batch.push(id)
+ }
for (const post of posts) {
for(const comment of post.comments) {
if (data.users[comment[0]] !== undefined) continue
@@ -120,6 +124,7 @@ async function load() {
for (const user of users) {
data.users[user.user_id] = user
}
+ data.user = data.users[id]
render()
}
diff --git a/src/console.rs b/src/console.rs
index c78b3e7..16bf4a3 100644
--- a/src/console.rs
+++ b/src/console.rs
@@ -248,7 +248,7 @@ pub async fn generate() -> Response {
"#