Added locale (english only at the moment) and modifed the EJS so I think

every string is customisable (via the /locales/selected locale)
This commit is contained in:
2025-08-09 16:57:31 +01:00
parent 8418318d80
commit 6fc1f85e18
17 changed files with 187 additions and 80 deletions

View File

@@ -6,10 +6,16 @@
<body>
<form action="/submit_edit_user" method="POST">
<input name="userID" type="hidden" value="<%= userID %>">
<input placeholder="<%= user.prettyname %>'s password" type="password" required id="password" name="password"><br/>
<input placeholder="Pretty Name" name="prettyname" value="<%= user.prettyname %>"><br/>
<textarea placeholder="Description" name="description"><%= user.description %></textarea><br/>
<label><%- config.string.delete_account_confirmation %>: </label><input type="checkbox" name="agreement"><br/>
<label><%= locale.password %>:</label><br/>
<input type="password" required id="password" name="password"><br/><br/>
<label><%= locale.prettyname %>:</label><br/>
<input name="prettyname" value="<%= user.prettyname %>"><br/><br/>
<label><%= locale.description %>:</label><br/>
<textarea name="description"><%= user.description %></textarea><br/><br/>
<label><%- locale.delete_account_confirmation %>: </label><input type="checkbox" name="agreement"><br/>
<input type="submit" value="Submit"><br/>
</form>
</body>

View File

@@ -7,13 +7,21 @@
<form action="/submit_edit_post" method="POST" onsubmit="sha512password()">
<input name="userID" type="hidden" value="<%= post['userID'] %>">
<input name="postID" type="hidden" value="<%= post_id %>">
<input placeholder="<%= user['prettyname'] %>'s password" type="password" required id="password" name="password"><br/>
<input placeholder="title" value=" <%=post['title'] %>" required name="title"><br/>
<textarea placeholder="content" required name="content"><%= post['content'] %></textarea><br/>
<input placeholder="tags (comma seperated)" value="<%= post['tags'] %>" name="tags"><br/>
<label><%= locale.password %>:</label><br/>
<input type="password" required id="password" name="password"><br/><br/>
<label><%= locale.title %>:</label><br/>
<input value="<%=post['title'] %>" required name="title"><br/><br/>
<label><%= locale.post_content %>:</label><br/>
<textarea required name="content"><%= post['content'] %></textarea><br/><br/>
<label><%= locale.tags %>:</label><br/>
<input value="<%= post['tags'] %>" name="tags"><br/><br/>
<label>Delete forever (no undo): </label><input name="delete" type="checkbox"><br/>
<input type="submit" value="Submit"><br/>
<small>* Markdown supported</small>
</form>
</body>
</html>

View File

@@ -5,12 +5,21 @@
</head>
<body>
<form action="/submit_post" method="POST">
<input placeholder="username" required name="username"><br/>
<input placeholder="password" type="password" required id="password" name="password"><br/>
<input placeholder="title" required name="title"><br/>
<textarea placeholder="post content*" required name="content"></textarea><br/>
<input placeholder="Tags (comma seperated)" name="tags"><br/>
<label><%= locale.username %>:</label><br/>
<input required name="username"><br/><br/>
<label><%= locale.password %>:</label><br/>
<input type="password" required id="password" name="password"><br/><br/>
<label><%= locale.title %>:</label><br/>
<input required name="title"><br/><br/>
<label><%= locale.post_content %>:</label><br/>
<textarea required name="content"></textarea><br/><br/>
<label><%= locale.tags %>:</label><br/>
<input name="tags"><br/><br/>
<input type="submit" value="Submit"><br/>
<small>* Markdown supported</small>
</body>
</form></html>

View File

@@ -5,11 +5,19 @@
</head>
<body>
<form action="/submit_signup" method="POST">
<input placeholder="username" required name="username"><br/>
<input placeholder="prettyname" required name="prettyname"><br/>
<input placeholder="password" type="password" required id="password" name="password"><br/>
<textarea placeholder="description (social links, what you do etc), supports markdown" id="description" name="description"></textarea><br/>
<label><%- config.string.signup_agreement %>: </label><input type="checkbox" name="agreement" required><br/>
<label><%= locale.username %></label><br/>
<input required name="username"><br/><br/>
<label><%= locale.prettyname %></label><br/>
<input required name="prettyname"><br/><br/>
<label><%= locale.password %></label><br/>
<input type="password" required id="password" name="password"><br/><br/>
<label><%= locale.description %></label><br/>
<textarea id="description" name="description"></textarea><br/><br/>
<label><%- locale.signup_agreement %>: </label><input type="checkbox" name="agreement" required><br/>
<input type="submit" value="Submit"><br/>
</form>
</body>

View File

@@ -1 +1,5 @@
<a href="/">Home Page</a><br/>
<a href="/"><%= locale.home_page %></a>
<a href="/index/pages"><%= locale.site_index %></a>
<a href="<%= config.new_post_url %>"><%= locale.new_post %></a>
<br/>
<%- config.seperator %>

View File

@@ -1,4 +1,4 @@
<h1>
Post's tagged "<%- tag %>":
<%= locale.posts_tagged %>: "<%- tag %>"
</h1>
<%- config.seperator %>

View File

@@ -4,11 +4,17 @@
<h2>
<%- config.site_description %>
</h2>
<a href="/rss">RSS Feed</a><br/>
<a href="/atom">ATOM Feed</a><br/>
<a href="<%= config.new_post_url %>">New post</a><br/>
<a href="<%= config.signup_url %>">Sign Up</a><br/>
<% if (config.rss == true) { %>
<a href="/rss"><%= locale.rss_feed %></a><br/>
<% } %>
<% if (config.atom == true) { %>
<a href="/atom"><%= locale.atom_feed %></a><br/>
<% } %>
<a href="<%= config.new_post_url %>"><%= locale.new_post %></a><br/>
<% if (config.allow_signup == true) { %>
<a href="<%= config.signup_url %>"><%= locale.sign_up %></a><br/>
<% } %>
<% if (config.enable_hitcount == true) { %>
Hitcount: <%= hitcount %>
<%= locale.hitcount %>: <%= hitcount %>
<% } %>
<%- config.seperator %>

View File

@@ -1,8 +1,8 @@
<h1>
<%= user.prettyname %>'s posts
<%= user.prettyname %>
</h1>
<p><%- converter.makeHtml(user.description) %></p>
<a href="<%= config.edit_account_base_url %>/<%= userID %>">edit account</a><br/>
<a href="/user/<%= user.username %>/rss">RSS</a><br/>
<a href="/user/<%= user.username %>/atom">ATOM</a>
<a href="<%= config.edit_account_base_url %>/<%= userID %>"><%= locale.edit_account %></a><br/>
<a href="/user/<%= user.username %>/rss"><%= locale.rss_feed %></a><br/>
<a href="/user/<%= user.username %>/atom"><%= locale.atom_feed %></a>
<%- config.seperator %>

View File

@@ -10,11 +10,13 @@
</div>
<div id="posts">
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<% posts[index].tags.forEach((current_tag, tag_index) => { %>
<% if (current_tag == tag) { %>
<%- include('../posts/tag', {post: posts[index], postID: index}); %>
<% } %>
<% }) %>
<% if ( posts[index].deleted != true) { %>
<% posts[index].tags.forEach((current_tag, tag_index) => { %>
<% if (current_tag == tag) { %>
<%- include('../posts/tag', {post: posts[index], postID: index}); %>
<% } %>
<% }) %>
<% } %>
<% } %>
</div>
<footer>

View File

@@ -9,6 +9,7 @@
<%- include('../headers/timeline'); %>
</div>
<form method="POST" action="/submit_nothing" style="display:none">
<!-- Form is used to help mitigate spam as it is the first form on the front page -->
<input type="hidden" name="post_index" value="0">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>

View File

@@ -1,2 +1,2 @@
Site is ran by deadvey<br/>
<%- config.string.attribution %>
<%- locale.attribution %>

View File

@@ -3,21 +3,21 @@
</h1>
<%- converter.makeHtml(post.content) %><br/>
<i>
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
<%= locale.written_by %> <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
</i>
<%- func.hyperlink_tags(post.tags) %><br/>
<a href="<%= config.edit_post_base_url %>/<%= postID %>">Edit</a><br/>
<i>Published: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
<i>Last Modified: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
<a href="<%= config.edit_post_base_url %>/<%= postID %>"><%= locale.edit_post %></a><br/>
<i><%= locale.published %>: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
<i><%= locale.last_modified %>: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
<%- config.seperator %>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= postID %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
<label><%= locale.comment %>:</label><br/><textarea name="content"></textarea><br/>
<button type="submit"><%= locale.submit %></button>
</form>
<% comments.forEach((comment, postID) => { %>

View File

@@ -2,15 +2,16 @@
<%= post.title %>
</h3>
<%- converter.makeHtml(post.content) %><br/>
<a href="/post/<%- postID %>">Permalink</a><br/>
<a href="/post/<%- postID %>"><%= locale.permalink %></a><br/>
<%- func.hyperlink_tags(post.tags) %>
<br/>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= postID %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
<label><%= locale.comment %>:</label><br/><textarea name="content"></textarea><br/>
<button type="submit"><%= locale.submit %></button>
</form>
<% comments[postID].forEach((comment) => { %>

View File

@@ -2,17 +2,18 @@
<%= post.title %>
</h3>
<%- converter.makeHtml(post.content) %><br/>
<a href="/post/<%- index %>">Permalink</a><br/>
<a href="/post/<%- index %>"><%= locale.permalink %></a><br/>
<i>
By <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
<%= locale.written_by %> <a href="/user/<%= user.username %>"><%= user.username %></a><br/>
</i>
<br/>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= index %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
<label><%= locale.comment %>:</label><br/><textarea name="content"></textarea><br/>
<button type="submit"><%= locale.submit %></button>
</form>
<% comments[index].forEach((comment, index) => { %>

View File

@@ -2,14 +2,15 @@
<%= post.title %>
</h3>
<%- converter.makeHtml(post.content) %><br/>
<a href="/post/<%- index %>">Permalink</a><br/>
<a href="/post/<%- index %>"><%= locale.permalink %></a><br/>
<br/>
<!-- Comment form -->
<form method="POST" action="/submit_comment">
<input type="hidden" name="post_index" value="<%= index %>">
<input placeholder="username" name="name"><br/>
<textarea placeholder="comment" name="content"></textarea><br/>
<button type="submit">Submit</button>
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
<label><%= locale.comment %>:</label><br/><textarea name="content"></textarea><br/>
<button type="submit"><%= locale.submit %></button>
</form>
<% comments[index].forEach((comment, index) => { %>