Changed how comments are stored and how data is retrieved

This commit is contained in:
2025-11-27 11:34:12 +00:00
parent ef8711b0e1
commit 7d38752f34
14 changed files with 130 additions and 128 deletions

View File

@@ -20,7 +20,7 @@
<% }; %>
Comments:<br/>
<% for (let postID = 0; postID < comments.length; postID++) { %>
<% for (let comment_index = 0; comment_index < comments[postID].length; comment_index++) { %>
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].length; comment_index++) { %>
<a href="/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
<% }; %>
<% }; %>

View File

@@ -5,7 +5,7 @@
</head>
<body>
<% for (let postID = 0; postID < comments.length; postID++) { %>
<% for (let comment_index = 0; comment_index < comments[postID].length; comment_index++) { %>
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].length; comment_index++) { %>
<a href="/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
<% }; %>
<% }; %>

View File

@@ -1,37 +0,0 @@
<!DOCTYPE html>
<html lang='<%- config.locale %>'>
<head>
<%- include('../partials/head'); %>
</head>
<body>
<div id='header'>
<%- include('../headers/site_wide'); %>
</div>
<div id='advanced-search'>
<form method="GET" action="/search">
<label>Search Term:</label>
<input type='text' placeholder='🔍' name='q' value='<%- search_term %>'><br/>
<label>Search for:</label><br/>
<label>Post:</label>
<input type="checkbox" name="type" value="post" <% if (search_type.includes('post')) {%>checked<% } %>><br/>
<label>User:</label>
<input type="checkbox" name="type" value="user" <% if (search_type.includes('user')) {%>checked<% } %>><br/>
<input type="submit" value="Submit">
</form>
</div>
<%- config.seperator %>
<div id='results'>
<% search_results.posts.forEach((result, index) => { %>
<a href="/post/<%- result.id %>"><%- result.title %></a><br/>
<% }); %>
<% search_results.users.forEach((result, index) => { %>
<a href="/user/<%- result.username %>"><%- result.prettyname %></a><br/>
<% }); %>
</div>
</body>
</html>

View File

@@ -15,7 +15,7 @@
</div>
<div id="post-details">
<span id="post-author">
<i><%= locale.written_by %> <a href="/user/<%= user.username %>"><%= user.username %></a></i>
<i><%= locale.written_by %> <a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
</span>
-
<span id="post-pubdate">

View File

@@ -15,7 +15,7 @@
</div>
<div id="post-details">
<span id="post-author">
<i><a href="/user/<%= user.username %>"><%= user.username %></a></i>
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
</span>
-
<span id="post-pubdate">

View File

@@ -15,7 +15,7 @@
</div>
<div id="post-details">
<span id="post-author">
<i><a href="/user/<%= user.username %>"><%= user.username %></a></i>
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
</span>
-
<span id="post-pubdate">

View File

@@ -15,7 +15,7 @@
</div>
<div id="post-details">
<span id="post-author">
<i><a href="/user/<%= user.username %>"><%= user.username %></a></i>
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
</span>
-
<span id="post-pubdate">