bug fixes
This commit is contained in:
parent
f24c16ce90
commit
5fe8ea1b85
8 changed files with 44 additions and 33 deletions
|
@ -2,9 +2,9 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="css/main.css">
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
<link rel="stylesheet" href="css/404.css">
|
<link rel="stylesheet" href="/css/404.css">
|
||||||
<link rel="stylesheet" href="css/header.css">
|
<link rel="stylesheet" href="/css/header.css">
|
||||||
<title>XSSBook - Not Found</title>
|
<title>XSSBook - Not Found</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="css/header.css">
|
<link rel="stylesheet" href="/css/header.css">
|
||||||
<link rel="stylesheet" href="css/main.css">
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
<link rel="stylesheet" href="css/home.css">
|
<link rel="stylesheet" href="/css/home.css">
|
||||||
<title>XSSBook - Home</title>
|
<title>XSSBook - Home</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="./js/main.js"></script>
|
<script src="/js/main.js"></script>
|
||||||
<script src="./js/header.js"></script>
|
<script src="/js/header.js"></script>
|
||||||
<script src="./js/api.js"></script>
|
<script src="/js/api.js"></script>
|
||||||
<script src="./js/home.js"></script>
|
<script src="/js/home.js"></script>
|
||||||
<script>load()</script>
|
<script>load()</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,4 +1,4 @@
|
||||||
const endpoint = 'https://xssbook.com/api'
|
const endpoint = 'https://xssbook.com'
|
||||||
|
|
||||||
const request = async (url, body, method) => {
|
const request = async (url, body, method) => {
|
||||||
if (method === undefined) method = 'POST'
|
if (method === undefined) method = 'POST'
|
||||||
|
|
|
@ -7,6 +7,9 @@ function parseDate(date) {
|
||||||
|
|
||||||
function parseComment(comment) {
|
function parseComment(comment) {
|
||||||
const author = data.users[comment.user]
|
const author = data.users[comment.user]
|
||||||
|
if (author === undefined) {
|
||||||
|
author = {}
|
||||||
|
}
|
||||||
const html = `
|
const html = `
|
||||||
<div class="comment">
|
<div class="comment">
|
||||||
<a class="pfp">
|
<a class="pfp">
|
||||||
|
@ -23,6 +26,9 @@ function parseComment(comment) {
|
||||||
|
|
||||||
function parsePost(post) {
|
function parsePost(post) {
|
||||||
const author = data.users[post.user]
|
const author = data.users[post.user]
|
||||||
|
if (author === undefined) {
|
||||||
|
author = {}
|
||||||
|
}
|
||||||
const html = `
|
const html = `
|
||||||
<div class="post" postid=${post.id}>
|
<div class="post" postid=${post.id}>
|
||||||
<div class="postheader">
|
<div class="postheader">
|
||||||
|
@ -189,6 +195,11 @@ async function load() {
|
||||||
data.posts.push(... posts)
|
data.posts.push(... posts)
|
||||||
const batch = []
|
const batch = []
|
||||||
for (const post of posts) {
|
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 (data.users[post.user] !== undefined) continue
|
||||||
if (batch.includes(post.user)) continue
|
if (batch.includes(post.user)) continue
|
||||||
batch.push(post.user)
|
batch.push(post.user)
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="css/main.css">
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
<link rel="stylesheet" href="css/login.css">
|
<link rel="stylesheet" href="/css/login.css">
|
||||||
<script src="./js/api.js"></script>
|
<script src="/js/api.js"></script>
|
||||||
<script src="./js/login.js"></script>
|
<script src="/js/login.js"></script>
|
||||||
<title>XSSBook - Login</title>
|
<title>XSSBook - Login</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="css/main.css">
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
<link rel="stylesheet" href="css/people.css">
|
<link rel="stylesheet" href="/css/people.css">
|
||||||
<link rel="stylesheet" href="css/header.css">
|
<link rel="stylesheet" href="/css/header.css">
|
||||||
<title>XSSBook - People</title>
|
<title>XSSBook - People</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="./js/main.js"></script>
|
<script src="/js/main.js"></script>
|
||||||
<script src="./js/header.js"></script>
|
<script src="/js/header.js"></script>
|
||||||
<script src="./js/api.js"></script>
|
<script src="/js/api.js"></script>
|
||||||
<script src="./js/people.js"></script>
|
<script src="/js/people.js"></script>
|
||||||
</body>
|
</body>
|
|
@ -2,16 +2,16 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="css/main.css">
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
<link rel="stylesheet" href="css/header.css">
|
<link rel="stylesheet" href="/css/header.css">
|
||||||
<link rel="stylesheet" href="css/profile.css">
|
<link rel="stylesheet" href="/css/profile.css">
|
||||||
<link rel="stylesheet" href="css/home.css">
|
<link rel="stylesheet" href="/css/home.css">
|
||||||
<title>XSSBook - Profile</title>
|
<title>XSSBook - Profile</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="./js/main.js"></script>
|
<script src="/js/main.js"></script>
|
||||||
<script src="./js/header.js"></script>
|
<script src="/js/header.js"></script>
|
||||||
<script src="./js/api.js"></script>
|
<script src="/js/api.js"></script>
|
||||||
<script src="./js/home.js"></script>
|
<script src="/js/home.js"></script>
|
||||||
<script src="./js/profile.js"></script>
|
<script src="/js/profile.js"></script>
|
||||||
</body>
|
</body>
|
|
@ -59,7 +59,7 @@ router.post('/auth/register', (req, res) => {
|
||||||
if (key === undefined) {
|
if (key === undefined) {
|
||||||
res.status(500).send( {msg: 'Failed to register user'} ); return;
|
res.status(500).send( {msg: 'Failed to register user'} ); return;
|
||||||
}
|
}
|
||||||
res.status(200).cookie('auth', key).send({msg: 'Successfully registered new user'})
|
res.status(200).cookie('auth', key, { maxAge: 365 * 24 * 60 * 60 * 1000, sameSite: 'strict' }).send({msg: 'Successfully registered new user'})
|
||||||
})
|
})
|
||||||
|
|
||||||
router.post('/auth/login', (req, res) => {
|
router.post('/auth/login', (req, res) => {
|
||||||
|
@ -75,7 +75,7 @@ router.post('/auth/login', (req, res) => {
|
||||||
if (key === undefined) {
|
if (key === undefined) {
|
||||||
res.status(400).send( {msg: 'Invalid login combination'} ); return;
|
res.status(400).send( {msg: 'Invalid login combination'} ); return;
|
||||||
}
|
}
|
||||||
res.status(200).cookie('auth', key).send({msg: 'Successfully logged in'})
|
res.status(200).cookie('auth', key, { maxAge: 365 * 24 * 60 * 60 * 1000, sameSite: 'strict' }).send({msg: 'Successfully logged in'})
|
||||||
})
|
})
|
||||||
|
|
||||||
router.post('/auth/self', (req, res) => {
|
router.post('/auth/self', (req, res) => {
|
||||||
|
|
Loading…
Reference in a new issue