Compare commits

...

12 Commits

Author SHA1 Message Date
deadvey
ad4efffed5 Database reading changes should work, gotta implement same for writing and finish up testing then merge back into master 2026-03-07 17:56:53 +00:00
deadvey
30cec0f7f0 Sydication updates 2026-03-06 21:26:00 +00:00
deadvey
9f5fd261c3 Changing how data is requested in DEV branch 2026-03-05 13:53:10 +00:00
deadvey
3fab094545 Made some small changes 2026-03-03 20:39:40 +00:00
Nullifier
9be261d415 Japanese locale typo fixed 2026-01-18 09:41:50 +00:00
Nullifier
9398919711 Japanese Locale - By Nullifier 2026-01-17 21:49:42 +00:00
545a848479 Stupid spelling error 2026-01-17 14:52:30 +00:00
54ffac931d Added english Australian, apparently there's no differences with GB and
AU
2026-01-17 12:11:04 +00:00
18b842e48c Merge pull request 'add(locale): sv-SE' (#3) from pickzelle/blogger-nodejs:master into master
Reviewed-on: #3
2026-01-16 23:23:52 +01:00
Pickzelle
c7bc64e59e add(locale): sv-SE 2026-01-16 23:19:02 +01:00
9383bd8058 Template .jsonc for locales 2026-01-16 21:25:47 +00:00
d554fce402 Added translated_by key to the locales 2026-01-16 21:15:11 +00:00
23 changed files with 300 additions and 249 deletions

View File

@@ -10,7 +10,7 @@
"delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
"signup_agreement": "I agree to not post illegal or hateful content",
"comment": "Comment",
"submit": "Sumbit",
"submit": "Submit",
"site_ran_by": "Site is ran by",
"signups_unavailable": "Sorry, this server does not allow signups",
@@ -39,5 +39,6 @@
"home_page": "Home Page",
"site_index": "Site Index",
"reply": "reply",
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>"
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>",
"translated_by": "DeaDvey"
}

View File

@@ -10,7 +10,7 @@
"delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
"signup_agreement": "I agree to not post illegal or hateful content",
"comment": "Comment",
"submit": "Sumbit",
"submit": "Submit",
"site_ran_by": "Site is ran by",
"signups_unavailable": "Sorry, this server does not allow signups",
@@ -39,5 +39,6 @@
"home_page": "Home Page",
"site_index": "Site Index",
"reply": "reply",
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>"
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>",
"translated_by": "DeaDvey"
}

View File

@@ -10,7 +10,7 @@
"delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
"signup_agreement": "I agree to not post illegal or hateful content",
"comment": "Comment",
"submit": "Sumbit",
"submit": "Submit",
"site_ran_by": "Site is ran by",
"signups_unavailable": "Sorry, this server does not allow signups",
@@ -39,5 +39,6 @@
"home_page": "Home Page",
"site_index": "Site Index",
"reply": "reply",
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>"
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>",
"translated_by": "DeaDvey"
}

View File

@@ -38,5 +38,6 @@
"home_page": "Página Principal",
"site_index": "Índice del Sitio",
"reply": "Responder",
"attribution": "Empujado por blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Código Fuente</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>licencia (WTFPL)</a>"
"attribution": "Empujado por blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Código Fuente</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>licencia (WTFPL)</a>",
"translated_by": "Javalsai"
}

44
locales/ja_JP.json Normal file
View File

@@ -0,0 +1,44 @@
{
"quotes": "“”‘’",
"password": "パスワード",
"username": "ユーザー名",
"prettyname": "きれいな名前",
"description": "説明 (例えばSNSのリンクや何を書くなど)、 マークダウンをスポートする",
"title": "題名",
"post_content": "投稿の内容、マークダウンをスポートする",
"tags": "タグ (カンマで区切られています)",
"delete_account_confirmation": "アカウントを削除する - (アカウントと投稿の全部をいつまでも削除するに賛成します。)",
"signup_agreement": "違法なコンテントと憎らしいコンテントをポストしないに賛成します。",
"comment": "コメント",
"submit": "提出する",
"site_ran_by": "アドミン:",
"signups_unavailable": "申し訳ございませんでもこのサーバーはサインアップ",
"user_exists": "申し訳ございませんでもこのユーザー名をつかえります。別のユーザー名を入ります。",
"user_doesnt_exist": "申し訳ございませんでもこのアカウントがいません。",
"comment_doesnt_exist": "このコメントがない、これから投稿を削除したかもしれない",
"post_doesnt_exist": "この投稿がないか又は削除しました。",
"incorrect_password": "パスワードが違う",
"rss_disabled": "申し訳ございませんでもRSSが使用不可能なります。",
"atom_disabled": "申し訳ございませんでもATOMが使用不可能なります。",
"AI_consent": "書面による同意がないとこのホームページの内容はコピーするか又はスクレイピングするか又はAIモデルか大規模言語モデルLLM)を仕込むことが禁断します。",
"rss_feed": "RSSのフィード",
"atom_feed": "ATOMのフィード",
"no_tags": "タグがない",
"new_post": "新しい投稿",
"edit_post": "投稿をエディットする",
"sign_up": "サインアップ",
"edit_account": "アカウントをエディットする",
"permalink": "恒久リンク",
"written_by": "作家は",
"published": "発行の日付",
"last_modified": "全変更",
"hitcount": "ヒット数",
"posts_tagged": "投稿をタグするの数",
"home_page": "ホーム",
"site_index": "ホームページの索引",
"reply": "返事",
"attribution": "blogger-nodejsで作成されています: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>ソースコード</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>ライセンス (WTFPL)</a>",
"translated_by": "Nullifier"
}

44
locales/sv-SE.json Normal file
View File

@@ -0,0 +1,44 @@
{
"quotes": "“”‘’",
"password": "Lösenord",
"username": "Användarnamn",
"prettyname": "Vackert namn",
"description": "Beskrivning (sociala länkar, vad du skriver om m.m.), stöder markdown",
"title": "Titel",
"post_content": "Inläggsinnehåll, stöder markdown",
"tags": "Taggar (komma separerade)",
"delete_account_confirmation": "Radera mitt konto - (Jag förstår och accepterar att mitt konto och alla mina inlägg kommer att raderas permanent omedelbart)",
"signup_agreement": "Jag samtycker till att inte publicera olagligt eller hatiskt innehåll",
"comment": "Kommentera",
"submit": "Skicka",
"site_ran_by": "Webbplatsen drivs av",
"signups_unavailable": "Tyvärr, denna server tillåter inte registreringar",
"user_exists": "Tyvärr, den här användaren finns redan. Försök med ett annat användarnamn",
"user_doesnt_exist": "Tyvärr, den här användaren finns inte",
"comment_doesnt_exist": "Denna kommentar finns inte, vilket kan bero på att inlägget den var kopplad till har raderats",
"post_doesnt_exist": "Det här inlägget finns inte eller har raderats",
"incorrect_password": "Felaktigt Lösenord",
"rss_disabled": "Tyvärr, RSS är inaktiverat",
"atom_disabled": "Tyvärr, ATOM är inaktiverat",
"AI_consent": "Innehållet på denna webbplats får inte kopieras, skrapas eller användas för att träna AI-modeller eller stora språkmodeller (LLM) utan skriftligt samtycke.",
"rss_feed": "RSS-flöde",
"atom_feed": "ATOM-flöde",
"no_tags": "Inga taggar",
"new_post": "Nytt inlägg",
"edit_post": "Redigera inlägg",
"sign_up": "Registrera",
"edit_account": "Redigera konto",
"permalink": "Permalänk",
"written_by": "Skriven av",
"published": "Publicerad",
"last_modified": "Senast ändrad",
"hitcount": "Besökare",
"posts_tagged": "Taggade inlägg",
"home_page": "Startsida",
"site_index": "Webbplatsindex",
"reply": "Svara",
"attribution": "Drivs av blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Källkod</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>licens (WTFPL)</a>",
"translated_by": "pickzelle"
}

61
locales/template.jsonc Normal file
View File

@@ -0,0 +1,61 @@
{
"quotes": "“”‘’", // Single and Double quotes, according to https://github.com/markdown-it/markdown-it format
// Placeholders in form inputs!
"password": "Password",
"username": "Username",
"prettyname": "Prettyname",
"description": "Description (social links, what you write about etc), supports markdown", // Should explain what can be entered into the user description/bio
"title": "Title", // Post title
"post_content": "Post Content, supports markdown",
"tags": "Tags (comma seperated)", // An input field that allows you to enter a comma seperated list of tags like: 'sus,test,haha'
"delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)", // Should make it clear that all user data and posts will be deleted
"signup_agreement": "I agree to not post illegal or hateful content", // Should make it clear that you cannot post illegal or hateful content
"comment": "Comment",
"submit": "Sumbit",
"site_ran_by": "Site is ran by", // eg 'Site is ran by Bob', it shows up in the footer of each page
// Error messages, should just apologise and make it clear the error
"signups_unavailable": "Sorry, this server does not allow signups",
"user_exists": "Sorry, this user already exists, try a different username",
"user_doesnt_exist": "Sorry, this user does not exist",
"comment_doesnt_exist": "This comment doesn't exist, this could be because the post it was attached to was deleted",
"post_doesnt_exist": "This post doesn't exist or was deleted",
"incorrect_password": "Incorrect Password",
"rss_disabled": "Sorry, RSS is disabled",
"atom_disabled": "Sorry, ATOM is disabled",
// Disclaimer, not legally binding
"AI_consent": "The content on this website may not be copied, scraped, or used to train AI models or large language models (LLMs) without prior written consent.",
// Hyperlinks to pages and plain text that shows up on the website
"rss_feed": "RSS Feed",
"atom_feed": "ATOM Feed",
"no_tags": "No Tags",
"new_post": "New Post",
"edit_post": "Edit Post",
"sign_up": "Sign Up",
"edit_account": "Edit Account",
"permalink": "Permalink",
"written_by": "Written by", // A post is written/authored by x person
"published": "Published", // Published on this date
"last_modified": "Last Modified", // Last modified on this date
"hitcount": "Hitcount", // The number of views/hits/visits to a page, eg: 'hitcount: 53'
"posts_tagged": "Posts Tagged",
"home_page": "Home Page", // The main or default page, ie index.html
"site_index": "Site Index", // Or 'site map'
"reply": "reply", // Reply to a comment
// Attribution for the source code, don't change the URLs obviously, just the text within them.
"attribution": "Powered by blogger-nodejs: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>",
// Comma seperated list of people who contributed to this translation
"translated_by": "DeaDvey"
// TODO
// indexes locales
// Password again
// site_admin?
// Should colons be part of the translations?
}

View File

@@ -10,7 +10,7 @@
"express": "^5.2.1",
"express-router": "^0.0.1",
"markdown-it": "^14.1.0",
"mysql": "^2.18.1",
"mssql": "^12.2.0",
"package.json": "^2.0.1"
}
}

View File

@@ -14,7 +14,7 @@ export function increment_hitcount(postID = -1) { // -1 Means it will increment
writedata('hitcount', hitcount);
}
else {
let post = getdata('posts','id', postID);
let post = getdata('posts','id', postID)[0];
if (post == 1) // Does not exist
{
return 1
@@ -86,7 +86,7 @@ export function getdata(table_name, key=-1, value=-1) {
{ // id is the index
if (value < result.length && value >= 0)
{
return result[value]
return [result[value]]
}
else
{
@@ -94,11 +94,10 @@ export function getdata(table_name, key=-1, value=-1) {
return 1
}
}
return result[func.find_key_value_pair(result, key, value)]
return -1 // This index doesn't exist
let return_list = func.find_key_value_pair(result,key,value)
return return_list
}
return result.slice(- config['data_request_limit'])
break;
return result
case 'hitcount':
result = func.require_module('../data/data.json') // This file is actually called data.json
return result["hitcount"]
@@ -109,37 +108,9 @@ export function getdata(table_name, key=-1, value=-1) {
break;
}
break;
// NOT YET WORKING!
case 'mysql':
const mysql = require('mysql');
let con = mysql.createConnection({
host: config.database.host,
user: config.database.user,
password: config.database.password,
database: config.database.database,
});
con.connect(function(err) {
if (err) throw err;
if (data == "posts" || data == 'users' || data == 'comments') {
con.query(`SELECT * FROM ${data}`, function (err, result, fields) {
if (err) throw err;
result = Object.values(JSON.parse(JSON.stringify(result)))
console.log(result)
return result;
});
}
else if (data == 'hitcount') {
con.query(`SELECT paramValue FROM params WHERE paramName = '${data}'`, function (err, result, fields) {
if (err) throw err;
result = Object.values(JSON.parse(JSON.stringify(result)))
console.log(result)
return result;
});
}
});
default:
console.log("Error, invalid database management system")
return 1
}
}

View File

@@ -57,8 +57,10 @@ export function unix_time_to_atom_date(unix_time)
// eg "<a href="/tag/string1">string1</a>, <a href="/tag/string2">string2</a>, <a href="/tag/string3">string3</a>"
// this is so you can have a list of tags that each point to their individual tag page
// returns: string
export function render_tags(tags)
export function render_tags(tags_string)
{
let tags = tags_string.split(',')
tags = tags.filter((item, index) => tags.indexOf(item) === index) // Remove duplicate tags
let string = "" // Initialises the string
if (tags.length == 1 && tags[0] == "")
{
@@ -73,24 +75,6 @@ export function render_tags(tags)
}
return string
}
// The users are stored as a list of objects [ user_object, user_object, user_object ]
// So you cannot easily find the userID (position in list) from the username
// This function returns the username for a given userID by looping over every user
// if the user is present, it returns the index of the user (integer)
// if the user is not present it returns -1
export function get_userID(username)
{
const users = require_module("../data/users.json")
for (let i = 0; i < users.length; i++)
{ // Loop over every user
if (users[i]['username'] == username)
{
return i // If the username matches then return the index of that user
}
}
return -1 // If user is not present, return -1
}
// This escapes some potentially dangerous HTML characters with their HTML entities
// https://www.freeformatter.com/html-entities.html
// accepts a string
@@ -135,14 +119,18 @@ export function render_md(content)
typographer: true,
quotes: locale.quotes,
})
.disable('image');
return md.render(content)
};
// Returns a list of matches
export function find_key_value_pair(data_array, key, value) {
let return_list = []
for (let i = 0; i < data_array.length; i++) {
if (data_array[i][key] == value) {
return i
let element = data_array[i][key]
if (element == value || (key == 'tags' && element.includes(value))) {
return_list.push(data_array[i])
}
}
return -1
return return_list
};

View File

@@ -10,46 +10,45 @@ const router = express.Router();
// Timeline
router.get("/", (req,res) => {
let posts = data.getdata('posts')
// Increment the hitcount
if (config.enable_hitcount) {
data.increment_hitcount()
}
res.render("pages/timeline",
{
config,
locale,
posts: data.getdata("posts"),
users: data.getdata("users"),
comments: data.getdata("comments"),
hitcount: data.getdata("hitcount"),
fromUnixTime,
format,
getUnixTime,
func,
})
res.render("pages/timeline",
{
config,
locale,
posts,
users: data.getdata("users"),
comments: data.getdata("comments"),
hitcount: data.getdata("hitcount"),
fromUnixTime,
format,
getUnixTime,
func,
})
}); // /
// Users
router.get("/user/:username", (req, res) => {
const userID = func.get_userID(req.params.username)
let user = data.getdata('users', 'id', userID)
if (userID != -1) {
let user = data.getdata('users', 'username', req.params.username)
if (user.length > 0) {
res.render("pages/user",
{
config,
locale,
posts: data.getdata('posts'),
user,
userID: userID,
comments: data.getdata('comments'),
fromUnixTime,
format,
getUnixTime,
func,
})
{
config,
locale,
posts: data.getdata('posts','userID',user[0].id),
user: user[0],
comments: data.getdata('comments'),
fromUnixTime,
format,
getUnixTime,
func,
})
}
else if (userID == -1) {
else {
res.render("partials/message",
{
message: locale.user_doesnt_exist,
@@ -61,34 +60,30 @@ router.get("/user/:username", (req, res) => {
// Posts
router.get("/post/:post_index", (req, res) => {
const postID = parseInt(req.params.post_index)
let post = data.getdata('posts','id', postID)
if (post == 1) { // data.getdata returns error code 1 if nothing is available
let post = data.getdata('posts','id', postID)[0]
if (post.length == 0) { // data.getdata returns error code 1 if nothing is available
res.render("partials/message", {
message: locale.post_doesnt_exist,
config,
})
}
else if (typeof post["deleted"] == "undefined" || post["deleted"] == false) {
else {
if (config.enable_hitcount) {
data.increment_hitcount(postID)
}
res.render("pages/post",
{
config,
locale,
post,
postID,
user: data.getdata('users','id', post.userID),
comments: data.getdata('comments','id', postID)["comments"],
fromUnixTime,
format,
getUnixTime,
func,
})
}
else {
console.log("Error loading page")
res.redirect(301,"/")
{
config,
locale,
post,
postID,
user: data.getdata('users','id', post.userID)[0],
comments: data.getdata('comments','id', postID)[0]["comments"],
fromUnixTime,
format,
getUnixTime,
func,
})
}
}); // /post/:post_index
@@ -96,19 +91,23 @@ router.get("/post/:post_index", (req, res) => {
// Tags
router.get("/tag/:tag", (req,res) => {
const tag = req.params.tag
const posts = data.getdata('posts','tags',tag);
console.log(posts)
const users = data.getdata('users')
const comments = data.getdata('comments')
res.render("pages/tag",
{
config,
locale,
tag,
posts: data.getdata('posts'),
users: data.getdata('users'),
comments: data.getdata('comments'),
fromUnixTime,
format,
getUnixTime,
func,
})
{
config,
locale,
tag,
posts,
users,
comments,
fromUnixTime,
format,
getUnixTime,
func,
})
}); // /tag/:tag

View File

@@ -18,9 +18,10 @@ router.get("/rss", (req,res) => {
}
else {
res.setHeader('content-type', 'application/rss+xml');
res.render("syndication/global_rss", {
res.render("syndication/rss", {
config,
posts: data.getdata('posts'),
users: data.getdata('users'),
func,
})
};
@@ -28,7 +29,7 @@ router.get("/rss", (req,res) => {
// user RSS protocol gets
router.get("/user/:username/rss", (req,res) => {
const username = req.params.username;
const userID = func.get_userID(username);
const user = data.getdata('users', 'username', username);
if (config.rss == false) {
res.render("partials/message", {
message: locale.rss_disabled,
@@ -37,11 +38,11 @@ router.get("/user/:username/rss", (req,res) => {
}
else {
res.setHeader('content-type', 'application/rss+xml');
res.render("syndication/user_rss", {
res.render("syndication/rss", {
config,
posts: data.getdata('posts'),
users: user,
func,
userID,
})
};
});
@@ -58,6 +59,7 @@ router.get("/atom", (req,res) => {
res.render("syndication/global_atom", {
config,
posts: data.getdata('posts'),
users: data.getdata('users'),
func,
getUnixTime,
})
@@ -78,6 +80,7 @@ router.get("/user/:username/atom", (req,res) => {
res.render("syndication/user_atom", {
config,
posts: data.getdata('posts'),
users: data.getdata('users'),
func,
userID,
getUnixTime,

View File

@@ -4,7 +4,7 @@
</h1>
</div>
<p><%- func.render_md(user.description) %></p>
<a if='edit-account-link' href="<%= config.edit_account_base_url %>/<%= userID %>">
<a if='edit-account-link' href="<%= config.edit_account_base_url %>/<%= user.id %>">
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_account %>' title='<%= locale.edit_account %>'>
</a>
|

View File

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

View File

@@ -10,27 +10,14 @@
<header id='page-header'>
<%- include('../headers/timeline'); %>
</header>
<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/>
<button type="submit">Submit</button>
</form>
<div id="posts">
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<% if (posts[index]["deleted"] != true) { %>
<%- console.log(posts[index]) %>
<%- include('../posts/timeline', {post: posts[index], postID: index, user: users[posts[index].userID], comments: comments[index]}); %>
<% } %>
<% } %>
</div>
<form method="POST" action="/submit_nothing" style="display:none">
<!-- Form is used to help mitigate spam as it is the last 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/>
<button type="submit">Submit</button>
</form>
<footer id='footer'>
<%- include('../partials/footer'); %>
</footer>

View File

@@ -12,9 +12,7 @@
</header>
<div id="posts">
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<% if (posts[index].userID == userID) { %>
<%- include('../posts/user', {post: posts[index], postID: index, user: user, comments: comments[index]}); %>
<% } %>
<%- include('../posts/user', {post: posts[index], postID: index, user: user, comments: comments[index]}); %>
<% } %>
</div>
<footer id='footer'>

View File

@@ -15,8 +15,12 @@
</div>
<div id="post-details">
<span id="post-author">
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
</span>
-
<a if='edit-account-link' href="<%= config.edit_account_base_url %>/<%= user.id %>">
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_account %>' title='<%= locale.edit_account %>'>
</a>
-
<span id="post-pubdate">
<i><%= func.unix_time_to_date_format(post.pubdate) %></i><br/>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="<%= config.charset %>" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><%= config.site_name %></title>
<link><%= config.site_url %></title>
<description><%= config.site_description %></description>
<updated><%= func.unix_time_to_date_format(getUnixTime(new Date()),"yyyy-MM-dd'T'HH:mm:ss'Z'") %></updated>
<id><%= config.site_url %></id>
<% for (let postID = posts.length-1; postID >= 0; postID--) { %>
<% if (posts[postID]["deleted"] != true) { %>
<entry>
<title><%= posts[postID]["title"] %></title>
<link><%= config.site_url %>/post/<%= postID %></link>
<summary><![CDATA[<%- (posts[postID]["content"]) %>]]></summary>
<guid isPermaLink="true"><%= config.site_url %>/post/<%= postID %></guid>
<pubDate><%- func.unix_time_to_date_format(posts[postID]['pubdate'],"yyyy-MM-dd'T'HH:mm:ss'Z'") %></pubDate>
<% tags = posts[postID]['tags'].split(',') %>
<% for (let tag_index = 0; tag_index < tags.length; tag_index++) { %>
<category><![CDATA[<%= tags[tag_index] %>]]></category>
<% } %>
</entry>
<% } %>
<% } %>
</feed>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="<%= config.charset %>" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><%= config.site_name %></title>
<link><%= config.site_url %></title>
<description><%= config.site_description %></description>
<updated><%= func.unix_time_to_atom_date(getUnixTime(new Date())) %></updated>
<id><%= config.site_url %></id>
<% for (let postID = posts.length-1; postID >= 0; postID--) { %>
<% if (posts[postID]["deleted"] != true) { %>
<entry>
<title><%= posts[postID]["title"] %></title>
<link><%= config.site_url %>/post/<%= postID %></link>
<summary><![CDATA[<%- func.render_md(posts[postID]["content"]) %>]]></summary>
<guid isPermaLink="true"><%= config.site_url %>/post/<%= postID %></guid>
<pubDate><%# func.unix_time_to_atom_date(posts[postID]['pubdate']) %></pubDate>
<% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %>
<category><![CDATA[<%= posts[postID]['tags'][tag_index] %>]]></category>
<% } %>
</entry>
<% } %>
<% } %>
</feed>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="<%= config.charset %>" ?>
<rss version="2.0">
<channel>
<title><%= config.site_name %></title>
<link><%= config.site_url %></title>
<description><%= config.site_description %></description>
<% for (let postID = posts.length-1; postID >= 0; postID--) { %>
<% if (posts[postID]["deleted"] != true) { %>
<item>
<title><%= posts[postID]["title"] %></title>
<link><%= config.site_url %>/post/<%= postID %></link>
<description><![CDATA[<%- func.render_md(posts[postID]["content"]) %>]]></description>
<guid isPermaLink="true"><%= config.site_url %>/post/<%= postID %></guid>
<pubDate><%= func.unix_time_to_rss_date(posts[postID]['pubdate']) %></pubDate>
<% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %>
<category><![CDATA[<%= posts[postID]['tags'][tag_index] %>]]></category>
<% } %>
</item>
<% } %>
<% } %>
</channel>
</rss>

23
views/syndication/rss.ejs Normal file
View File

@@ -0,0 +1,23 @@
<rss version="2.0">
<channel>
<title><%= config.site_name %></title>
<link><%= config.site_url %></link>
<description><%= config.site_description %></description>
<% for (let postID = posts.length-1; postID >= 0; postID--) { %>
<% if (posts[postID]["deleted"] != true) { %>
<item>
<title><%= posts[postID]["title"] %></title>
<link><%= config.site_url %>/post/<%= postID %></link>
<description><![CDATA[<%- (posts[postID]["content"]) %>]]></description>
<guid isPermaLink="true"><%= config.site_url %>/post/<%= postID %></guid>
<pubDate><%= func.unix_time_to_date_format(posts[postID]['pubdate'],'EEE, dd MMM yyyy HH:mm:ss') %></pubDate>
<author><%= users[posts[postID]['userID']]['prettyname'] %></author>
<% tags = posts[postID]['tags'].split(',') %>
<% for (let tag_index = 0; tag_index < tags.length; tag_index++) { %>
<category><![CDATA[<%= tags[tag_index] %>]]></category>
<% } %>
</item>
<% } %>
<% } %>
</channel>
</rss>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="<%= config.charset %>" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><%= config.site_name %></title>
<link><%= config.site_url %></title>
<description><%= config.site_description %></description>
<updated><%= func.unix_time_to_atom_date(getUnixTime(new Date())) %></updated>
<id><%= config.site_url %></id>
<% for (let postID = posts.length-1; postID >= 0; postID--) { %>
<% if (posts[postID]["userID"] == userID) { %>
<% if (posts[postID]["deleted"] != true) { %>
<entry>
<title><%= posts[postID]["title"] %></title>
<link><%= config.site_url %>/post/<%= postID %></link>
<summary><![CDATA[<%- func.render_md(posts[postID]["content"]) %>]]></summary>
<guid isPermaLink="true"><%= config.site_url %>/post/<%= postID %></guid>
<pubDate><%# func.unix_time_to_atom_date(posts[postID]['pubdate']) %></pubDate>
<% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %>
<category><![CDATA[<%= posts[postID]['tags'][tag_index] %>]]></category>
<% } %>
</entry>
<% } %>
<% } %>
<% } %>
</feed>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="<%= config.charset %>" ?>
<rss version="2.0">
<channel>
<title><%= config.site_name %></title>
<link><%= config.site_url %></title>
<description><%= config.site_description %></description>
<% for (let postID = posts.length-1; postID >= 0; postID--) { %>
<% if (posts[postID]["userID"] == userID) { %>
<% if (posts[postID]["deleted"] != true) { %>
<item>
<title><%= posts[postID]["title"] %></title>
<link><%= config.site_url %>/post/<%= postID %></link>
<description><![CDATA[<%- func.render_md(posts[postID]["content"]) %>]]></description>
<guid isPermaLink="true"><%= config.site_url %>/post/<%= postID %></guid>
<pubDate><%= func.unix_time_to_rss_date(posts[postID]['pubdate']) %></pubDate>
<% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %>
<category><![CDATA[<%= posts[postID]['tags'][tag_index] %>]]></category>
<% } %>
</item>
<% } %>
<% } %>
<% } %>
</channel>
</rss>