Compare commits
12 Commits
dev
...
5a14b125d2
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a14b125d2 | |||
| 1a0b16feb2 | |||
| 9b10188066 | |||
| 27149b1f01 | |||
| a52c57f3ea | |||
| d895bbcb8c | |||
| 3119a76d96 | |||
| b253fac1c4 | |||
| f11b94527d | |||
| 6e7d2109c8 | |||
| dd317883be | |||
| 4955ebe7bd |
@@ -29,20 +29,14 @@ Read the [configuation guide](docs/CONFIG.md) for configuration help (in config.
|
|||||||
* Search functionality
|
* Search functionality
|
||||||
* Page indexes
|
* Page indexes
|
||||||
|
|
||||||
# Bugs:
|
|
||||||
* probably scales like shit
|
|
||||||
* probably insecure as hell
|
|
||||||
|
|
||||||
# Planned features/todo list:
|
# Planned features/todo list:
|
||||||
* federation (looks tricky)
|
* federation
|
||||||
* inline comments and docs
|
|
||||||
* clean up code a bit
|
* clean up code a bit
|
||||||
* /postID and /userID pages
|
* /postID and /userID pages
|
||||||
* Make EJS modification more user friendly (half done)
|
* Make EJS modification more user friendly (half done)
|
||||||
* API for returning posts, users, comments, tags other?...
|
* API for returning posts, users, comments, tags other?...
|
||||||
* Moderation tools including a keyword blacklist
|
* Moderation tools including a keyword blacklist
|
||||||
* Request account function? Not sure how this should be implemented.
|
* Request account function? Not sure how this should be implemented.
|
||||||
* optional SQL
|
|
||||||
* initialisation has prompts for setup process.
|
* initialisation has prompts for setup process.
|
||||||
|
|
||||||
# Docs:
|
# Docs:
|
||||||
|
|||||||
+5
-4
@@ -3,6 +3,7 @@
|
|||||||
"seperator": "<hr/>",
|
"seperator": "<hr/>",
|
||||||
"site_name": "My Blog",
|
"site_name": "My Blog",
|
||||||
"site_url": "https://example.com",
|
"site_url": "https://example.com",
|
||||||
|
"site_path": "/",
|
||||||
"locale": "en-US",
|
"locale": "en-US",
|
||||||
"port": 8080,
|
"port": 8080,
|
||||||
"data_storage": "json",
|
"data_storage": "json",
|
||||||
@@ -13,10 +14,10 @@
|
|||||||
"enable_hitcount": true,
|
"enable_hitcount": true,
|
||||||
"charset": "UTF-8",
|
"charset": "UTF-8",
|
||||||
"root_path": "../webroot/",
|
"root_path": "../webroot/",
|
||||||
"edit_account_base_url": "/edit_account",
|
"edit_account_base_url": "edit_account",
|
||||||
"new_post_url": "/post",
|
"new_post_url": "post",
|
||||||
"signup_url": "/signup",
|
"signup_url": "signup",
|
||||||
"edit_post_base_url": "/edit",
|
"edit_post_base_url": "edit",
|
||||||
"default_commenter_username": "Anon",
|
"default_commenter_username": "Anon",
|
||||||
"rss": true,
|
"rss": true,
|
||||||
"atom": true,
|
"atom": true,
|
||||||
|
|||||||
+7
-6
@@ -14,7 +14,7 @@ export function increment_hitcount(postID = -1) { // -1 Means it will increment
|
|||||||
writedata('hitcount', hitcount);
|
writedata('hitcount', hitcount);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let post = getdata('posts','id', postID);
|
let post = getdata('posts','id', postID)[0];
|
||||||
if (post == 1) // Does not exist
|
if (post == 1) // Does not exist
|
||||||
{
|
{
|
||||||
return 1
|
return 1
|
||||||
@@ -86,18 +86,19 @@ export function getdata(table_name, key=-1, value=-1) {
|
|||||||
{ // id is the index
|
{ // id is the index
|
||||||
if (value < result.length && value >= 0)
|
if (value < result.length && value >= 0)
|
||||||
{
|
{
|
||||||
return result[value]
|
return [result[value]]
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
console.log("No object of this ID exists for the selected table")
|
console.log("No object of this ID exists for the selected table", table_name)
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result[func.find_key_value_pair(result, key, value)]
|
let return_value = func.find_key_value_pair(result, key, value)
|
||||||
return -1 // This index doesn't exist
|
return return_value
|
||||||
}
|
}
|
||||||
return result.slice(- config['data_request_limit'])
|
let return_value = result.slice(- config['data_request_limit'])
|
||||||
|
return return_value
|
||||||
break;
|
break;
|
||||||
case 'hitcount':
|
case 'hitcount':
|
||||||
result = func.require_module('../data/data.json') // This file is actually called data.json
|
result = func.require_module('../data/data.json') // This file is actually called data.json
|
||||||
|
|||||||
+17
-1
@@ -69,7 +69,7 @@ export function render_tags(tags)
|
|||||||
{
|
{
|
||||||
for (let tag_index = 0; tag_index < tags.length; tag_index++)
|
for (let tag_index = 0; tag_index < tags.length; tag_index++)
|
||||||
{ // Loop over each tag
|
{ // Loop over each tag
|
||||||
string += `<a href="/tag/${tags[tag_index].trim()}">#${tags[tag_index].trim()}</a> ` // Adds the tag to the string as a HTML href
|
string += `<a href="${config.site_path}/tag/${tags[tag_index].trim()}">#${tags[tag_index].trim()}</a> ` // Adds the tag to the string as a HTML href
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string
|
return string
|
||||||
@@ -140,6 +140,7 @@ export function render_md(content)
|
|||||||
return md.render(content)
|
return md.render(content)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
export function find_key_value_pair(data_array, key, value) {
|
export function find_key_value_pair(data_array, key, value) {
|
||||||
for (let i = 0; i < data_array.length; i++) {
|
for (let i = 0; i < data_array.length; i++) {
|
||||||
if (data_array[i][key] == value) {
|
if (data_array[i][key] == value) {
|
||||||
@@ -148,3 +149,18 @@ export function find_key_value_pair(data_array, key, value) {
|
|||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 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++) {
|
||||||
|
let element = data_array[i][key]
|
||||||
|
if (element == value
|
||||||
|
|| (Array.isArray(element) && element.includes(value))) {
|
||||||
|
return_list.push(data_array[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return return_list
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
+14
-13
@@ -14,7 +14,7 @@ const crypto = require('crypto')
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
////////////////////// Form actions /////////////////////////
|
////////////////////// Form actions /////////////////////////
|
||||||
router.post("/submit_comment", (req,res) => {
|
router.post(`${config.site_path}/submit_comment`, (req,res) => {
|
||||||
const unix_timestamp = getUnixTime(new Date())
|
const unix_timestamp = getUnixTime(new Date())
|
||||||
const postID = parseInt(req.body.post_index)
|
const postID = parseInt(req.body.post_index)
|
||||||
const content = func.escape_input(req.body.content)
|
const content = func.escape_input(req.body.content)
|
||||||
@@ -38,10 +38,10 @@ router.post("/submit_comment", (req,res) => {
|
|||||||
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`, 'utf-8');
|
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`, 'utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
res.redirect(301,`/post/${req.body.post_index}`)
|
res.redirect(301,`${config.site_path}/post/${req.body.post_index}`)
|
||||||
}); // /submit_comment
|
}); // /submit_comment
|
||||||
|
|
||||||
router.post("/submit_post", (req,res) => {
|
router.post(`${config.site_path}/submit_post`, (req,res) => {
|
||||||
const password = crypto.createHash('sha512').update(req.body.password).digest('hex');
|
const password = crypto.createHash('sha512').update(req.body.password).digest('hex');
|
||||||
const username = func.escape_input(req.body.username)
|
const username = func.escape_input(req.body.username)
|
||||||
const title = func.escape_input(req.body.title)
|
const title = func.escape_input(req.body.title)
|
||||||
@@ -71,7 +71,7 @@ router.post("/submit_post", (req,res) => {
|
|||||||
fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8');
|
fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8');
|
||||||
comments.push({'id': id, 'comments': []})
|
comments.push({'id': id, 'comments': []})
|
||||||
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`)
|
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`)
|
||||||
res.redirect(302, "/");
|
res.redirect(302, `/post/${id}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
@@ -81,7 +81,7 @@ router.post("/submit_post", (req,res) => {
|
|||||||
}
|
}
|
||||||
}); // /submit_post
|
}); // /submit_post
|
||||||
|
|
||||||
router.post("/submit_signup", (req,res) => {
|
router.post(`${config.site_path}/submit_signup`, (req,res) => {
|
||||||
const password = crypto.createHash('sha512').update(req.body.password).digest('hex');
|
const password = crypto.createHash('sha512').update(req.body.password).digest('hex');
|
||||||
const username = func.escape_input(req.body.username)
|
const username = func.escape_input(req.body.username)
|
||||||
const prettyname = func.escape_input(req.body.prettyname)
|
const prettyname = func.escape_input(req.body.prettyname)
|
||||||
@@ -100,7 +100,7 @@ router.post("/submit_signup", (req,res) => {
|
|||||||
"description": description,
|
"description": description,
|
||||||
})
|
})
|
||||||
fs.writeFileSync(`../data/users.json`, `${JSON.stringify(users)}`, 'utf-8');
|
fs.writeFileSync(`../data/users.json`, `${JSON.stringify(users)}`, 'utf-8');
|
||||||
res.redirect(301, `/user/${username}`)
|
res.redirect(301, `${config.site_path}/user/${username}`)
|
||||||
}
|
}
|
||||||
// if the user does exist then
|
// if the user does exist then
|
||||||
else {
|
else {
|
||||||
@@ -118,12 +118,12 @@ router.post("/submit_signup", (req,res) => {
|
|||||||
}
|
}
|
||||||
// If allow_signup is undefined or not a boolean, error
|
// If allow_signup is undefined or not a boolean, error
|
||||||
else {
|
else {
|
||||||
res.redirect(301,"/")
|
res.redirect(301,config.site_path)
|
||||||
console.log("Error, invalid value for allow_signup (bool)")
|
console.log("Error, invalid value for allow_signup (bool)")
|
||||||
}
|
}
|
||||||
}); // /submit_signup
|
}); // /submit_signup
|
||||||
|
|
||||||
router.post("/submit_edit_user", (req,res) => {
|
router.post(`${config.site_path}/submit_edit_user`, (req,res) => {
|
||||||
// Get the form info
|
// Get the form info
|
||||||
const password = crypto.createHash("sha512").update(req.body.password).digest("hex");
|
const password = crypto.createHash("sha512").update(req.body.password).digest("hex");
|
||||||
const userID = func.escape_input(req.body.userID)
|
const userID = func.escape_input(req.body.userID)
|
||||||
@@ -152,7 +152,7 @@ router.post("/submit_edit_user", (req,res) => {
|
|||||||
fs.writeFileSync(`../data/users.json`, `${JSON.stringify(users)}`, 'utf-8');
|
fs.writeFileSync(`../data/users.json`, `${JSON.stringify(users)}`, 'utf-8');
|
||||||
fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8');
|
fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8');
|
||||||
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`, 'utf-8');
|
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`, 'utf-8');
|
||||||
res.redirect(301,`/user/${users[userID]["username"]}`)
|
res.redirect(301,`${config.site_path}/user/${users[userID]["username"]}`)
|
||||||
}
|
}
|
||||||
else { // password does not match
|
else { // password does not match
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
@@ -170,7 +170,7 @@ router.post("/submit_edit_user", (req,res) => {
|
|||||||
}
|
}
|
||||||
}); // /submit_delete_account
|
}); // /submit_delete_account
|
||||||
|
|
||||||
router.post("/submit_edit_post", (req,res) => {
|
router.post(`${config.site_path}/submit_edit_post`, (req,res) => {
|
||||||
const password = crypto.createHash('sha512').update(req.body.password).digest('hex');
|
const password = crypto.createHash('sha512').update(req.body.password).digest('hex');
|
||||||
const postID = req.body.postID
|
const postID = req.body.postID
|
||||||
const userID = req.body.userID
|
const userID = req.body.userID
|
||||||
@@ -194,7 +194,7 @@ router.post("/submit_edit_post", (req,res) => {
|
|||||||
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`, 'utf-8');
|
fs.writeFileSync(`../data/comments.json`, `${JSON.stringify(comments)}`, 'utf-8');
|
||||||
}
|
}
|
||||||
fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8');
|
fs.writeFileSync(`../data/posts.json`, `${JSON.stringify(posts)}`, 'utf-8');
|
||||||
res.redirect(302, "/");
|
res.redirect(302, config.site_path);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
@@ -204,7 +204,7 @@ router.post("/submit_edit_post", (req,res) => {
|
|||||||
}
|
}
|
||||||
}); // /submit_edit
|
}); // /submit_edit
|
||||||
|
|
||||||
router.get('/search', (req, res) => {
|
router.get(`${config.site_path}/search`, (req, res) => {
|
||||||
const search_term = func.escape_input(req.query.q); // 'q' is the parameter name
|
const search_term = func.escape_input(req.query.q); // 'q' is the parameter name
|
||||||
let search_type = req.query.type; // eg 'post', 'user'
|
let search_type = req.query.type; // eg 'post', 'user'
|
||||||
if (typeof search_type == 'string') { // Make the search_term an array
|
if (typeof search_type == 'string') { // Make the search_term an array
|
||||||
@@ -216,7 +216,8 @@ router.get('/search', (req, res) => {
|
|||||||
console.log('searching for: ', search_term);
|
console.log('searching for: ', search_term);
|
||||||
const search_results = data.searchdata(search_term, search_type); // data.searchdata returns an array of search results
|
const search_results = data.searchdata(search_term, search_type); // data.searchdata returns an array of search results
|
||||||
|
|
||||||
res.render('pages/search', {
|
res.render('pages/search',
|
||||||
|
{
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
search_results,
|
search_results,
|
||||||
|
|||||||
+8
-6
@@ -5,13 +5,13 @@ const func = require('../functions')
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
///////////////////// Form pages ////////////////////////////
|
///////////////////// Form pages ////////////////////////////
|
||||||
router.get(config.new_post_url, (req,res) => {
|
router.get(`${config.site_path}/${config.new_post_url}`, (req,res) => {
|
||||||
res.render("forms/new_post", {
|
res.render("forms/new_post", {
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
});
|
});
|
||||||
}); // /post
|
}); // /post
|
||||||
router.get(config.signup_url, (req,res) => {
|
router.get(`${config.site_path}/${config.signup_url}`, (req,res) => {
|
||||||
// if the server does allow signup
|
// if the server does allow signup
|
||||||
if (config.allow_signup == true) {
|
if (config.allow_signup == true) {
|
||||||
// Send the page for signing up to the server
|
// Send the page for signing up to the server
|
||||||
@@ -33,20 +33,22 @@ router.get(config.signup_url, (req,res) => {
|
|||||||
console.log("Error, invalid value for allow_signup (bool)")
|
console.log("Error, invalid value for allow_signup (bool)")
|
||||||
}
|
}
|
||||||
}); // /signup
|
}); // /signup
|
||||||
router.get(`${config.edit_account_base_url}/:user_id`, (req,res) => {
|
router.get(`${config.site_path}/${config.edit_account_base_url}/:user_id`, (req,res) => {
|
||||||
const userID = parseInt(req.params.user_id);
|
const userID = parseInt(req.params.user_id);
|
||||||
res.render("forms/edit_account", {
|
res.render("forms/edit_account",
|
||||||
|
{
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
user: data.getdata('users', 'id', userID),
|
user: data.getdata('users', 'id', userID),
|
||||||
userID
|
userID
|
||||||
});
|
});
|
||||||
}); // /delete_account
|
}); // /delete_account
|
||||||
router.get(`${config.edit_post_base_url}/:post_id`, (req,res) => {
|
router.get(`${config.site_path}/${config.edit_post_base_url}/:post_id`, (req,res) => {
|
||||||
const postID = req.params.post_id
|
const postID = req.params.post_id
|
||||||
const post = data.getdata('posts','id', postID)
|
const post = data.getdata('posts','id', postID)
|
||||||
const user = data.getdata('users', 'id', post.userID)
|
const user = data.getdata('users', 'id', post.userID)
|
||||||
res.render("forms/edit_post", {
|
res.render("forms/edit_post",
|
||||||
|
{
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
post,
|
post,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const func = require('../functions')
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
///////////////////// Page index's ///////////////////////
|
///////////////////// Page index's ///////////////////////
|
||||||
router.get("/index/pages", (req,res) => {
|
router.get(`${config.site_path}/index/pages`, (req,res) => {
|
||||||
res.render("indexes/all_pages", {
|
res.render("indexes/all_pages", {
|
||||||
config,
|
config,
|
||||||
posts: data.getdata('posts'),
|
posts: data.getdata('posts'),
|
||||||
@@ -14,19 +14,19 @@ router.get("/index/pages", (req,res) => {
|
|||||||
comments: data.getdata('comments'),
|
comments: data.getdata('comments'),
|
||||||
});
|
});
|
||||||
}); // /index/pages
|
}); // /index/pages
|
||||||
router.get("/index/posts", (req,res) => {
|
router.get(`${config.site_path}/index/posts`, (req,res) => {
|
||||||
res.render("indexes/posts", {
|
res.render("indexes/posts", {
|
||||||
config,
|
config,
|
||||||
posts: data.getdata('posts'),
|
posts: data.getdata('posts'),
|
||||||
});
|
});
|
||||||
}); // /index/posts
|
}); // /index/posts
|
||||||
router.get("/index/users", (req,res) => {
|
router.get(`${config.site_path}/index/users`, (req,res) => {
|
||||||
res.render("indexes/users", {
|
res.render("indexes/users", {
|
||||||
config,
|
config,
|
||||||
users: data.getdata('users'),
|
users: data.getdata('users'),
|
||||||
});
|
});
|
||||||
}); // /index/users
|
}); // /index/users
|
||||||
router.get("/index/comments", (req,res) => {
|
router.get(`${config.site_path}/index/comments`, (req,res) => {
|
||||||
res.render("indexes/comments", {
|
res.render("indexes/comments", {
|
||||||
config,
|
config,
|
||||||
comments: data.getdata('comments'),
|
comments: data.getdata('comments'),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const router = express.Router();
|
|||||||
///////////////////// Standard Pages //////////////////////
|
///////////////////// Standard Pages //////////////////////
|
||||||
|
|
||||||
// Timeline
|
// Timeline
|
||||||
router.get("/", (req,res) => {
|
router.get(config.site_path, (req,res) => {
|
||||||
// Increment the hitcount
|
// Increment the hitcount
|
||||||
if (config.enable_hitcount) {
|
if (config.enable_hitcount) {
|
||||||
data.increment_hitcount()
|
data.increment_hitcount()
|
||||||
@@ -31,18 +31,19 @@ router.get("/", (req,res) => {
|
|||||||
}); // /
|
}); // /
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
router.get("/user/:username", (req, res) => {
|
router.get(`${config.site_path}/user/:username`, (req, res) => {
|
||||||
const userID = func.get_userID(req.params.username)
|
const userID = func.get_userID(req.params.username)
|
||||||
let user = data.getdata('users', 'id', userID)
|
let posts = data.getdata('posts', 'userID', userID);
|
||||||
|
let user = data.getdata('users', 'id', userID)[0];
|
||||||
if (userID != -1) {
|
if (userID != -1) {
|
||||||
res.render("pages/user",
|
res.render("pages/user",
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
posts: data.getdata('posts'),
|
posts,
|
||||||
user,
|
user,
|
||||||
userID: userID,
|
userID: userID,
|
||||||
comments: data.getdata('comments'),
|
comments: data.getdata('comments', 'postID'),
|
||||||
fromUnixTime,
|
fromUnixTime,
|
||||||
format,
|
format,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
@@ -59,9 +60,9 @@ router.get("/user/:username", (req, res) => {
|
|||||||
}); // /user/:username
|
}); // /user/:username
|
||||||
|
|
||||||
// Posts
|
// Posts
|
||||||
router.get("/post/:post_index", (req, res) => {
|
router.get(`${config.site_path}/post/:post_index`, (req, res) => {
|
||||||
const postID = parseInt(req.params.post_index)
|
const postID = parseInt(req.params.post_index)
|
||||||
let post = data.getdata('posts','id', postID)
|
let post = data.getdata('posts','id', postID)[0]
|
||||||
if (post == 1) { // data.getdata returns error code 1 if nothing is available
|
if (post == 1) { // data.getdata returns error code 1 if nothing is available
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.post_doesnt_exist,
|
message: locale.post_doesnt_exist,
|
||||||
@@ -78,8 +79,8 @@ router.get("/post/:post_index", (req, res) => {
|
|||||||
locale,
|
locale,
|
||||||
post,
|
post,
|
||||||
postID,
|
postID,
|
||||||
user: data.getdata('users','id', post.userID),
|
user: data.getdata('users','id', post.userID)[0],
|
||||||
comments: data.getdata('comments','id', postID)["comments"],
|
comments: data.getdata('comments','id', postID)[0]["comments"],
|
||||||
fromUnixTime,
|
fromUnixTime,
|
||||||
format,
|
format,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
@@ -94,7 +95,7 @@ router.get("/post/:post_index", (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
router.get("/tag/:tag", (req,res) => {
|
router.get(`${config.site_path}/tag/:tag`, (req,res) => {
|
||||||
const tag = req.params.tag
|
const tag = req.params.tag
|
||||||
res.render("pages/tag",
|
res.render("pages/tag",
|
||||||
{
|
{
|
||||||
@@ -113,7 +114,7 @@ router.get("/tag/:tag", (req,res) => {
|
|||||||
|
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
router.get("/comment/:postID-:commentID", (req,res) => {
|
router.get(`${config.site_path}/comment/:postID-:commentID`, (req,res) => {
|
||||||
const commentID = parseInt(req.params.commentID);
|
const commentID = parseInt(req.params.commentID);
|
||||||
const postID = parseInt(req.params.postID);
|
const postID = parseInt(req.params.postID);
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -9,7 +9,7 @@ const router = express.Router();
|
|||||||
|
|
||||||
////////////////////// SYNDICATION ////////////////////////
|
////////////////////// SYNDICATION ////////////////////////
|
||||||
// global RSS protocol gets
|
// global RSS protocol gets
|
||||||
router.get("/rss", (req,res) => {
|
router.get(`${config.site_path}/rss`, (req,res) => {
|
||||||
if (config.rss == false) {
|
if (config.rss == false) {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.rss_disabled,
|
message: locale.rss_disabled,
|
||||||
@@ -18,7 +18,8 @@ router.get("/rss", (req,res) => {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.setHeader('content-type', 'application/rss+xml');
|
res.setHeader('content-type', 'application/rss+xml');
|
||||||
res.render("syndication/global_rss", {
|
res.render("syndication/rss", {
|
||||||
|
users: data.getdata('users'),
|
||||||
config,
|
config,
|
||||||
posts: data.getdata('posts'),
|
posts: data.getdata('posts'),
|
||||||
func,
|
func,
|
||||||
@@ -26,9 +27,10 @@ router.get("/rss", (req,res) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
// user RSS protocol gets
|
// user RSS protocol gets
|
||||||
router.get("/user/:username/rss", (req,res) => {
|
// TODO specific title field and descriptions??
|
||||||
|
router.get(`${config.site_path}/user/:username/rss`, (req,res) => {
|
||||||
const username = req.params.username;
|
const username = req.params.username;
|
||||||
const userID = func.get_userID(username);
|
const user = data.getdata('users','username',username)[0]; // Get the user data
|
||||||
if (config.rss == false) {
|
if (config.rss == false) {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.rss_disabled,
|
message: locale.rss_disabled,
|
||||||
@@ -37,16 +39,16 @@ router.get("/user/:username/rss", (req,res) => {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.setHeader('content-type', 'application/rss+xml');
|
res.setHeader('content-type', 'application/rss+xml');
|
||||||
res.render("syndication/user_rss", {
|
res.render("syndication/rss", {
|
||||||
|
users: [user],
|
||||||
config,
|
config,
|
||||||
posts: data.getdata('posts'),
|
posts: data.getdata('posts','id',user['id']),
|
||||||
func,
|
func,
|
||||||
userID,
|
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// global ATOM protocol gets
|
// global ATOM protocol gets
|
||||||
router.get("/atom", (req,res) => {
|
router.get(`${config.site_path}/atom`, (req,res) => {
|
||||||
if (config.atom == false) {
|
if (config.atom == false) {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.atom_disabled,
|
message: locale.atom_disabled,
|
||||||
@@ -55,7 +57,7 @@ router.get("/atom", (req,res) => {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.setHeader('content-type', 'application/rss+xml');
|
res.setHeader('content-type', 'application/rss+xml');
|
||||||
res.render("syndication/global_atom", {
|
res.render("syndication/atom", {
|
||||||
config,
|
config,
|
||||||
posts: data.getdata('posts'),
|
posts: data.getdata('posts'),
|
||||||
func,
|
func,
|
||||||
@@ -64,9 +66,8 @@ router.get("/atom", (req,res) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
// user ATOM protocol gets
|
// user ATOM protocol gets
|
||||||
router.get("/user/:username/atom", (req,res) => {
|
router.get(`${config.site_path}/user/:username/atom`, (req,res) => {
|
||||||
const username = req.params.username;
|
const username = req.params.username;
|
||||||
const userID = func.get_userID(username);
|
|
||||||
if (config.atom == false) {
|
if (config.atom == false) {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.atom_disabled,
|
message: locale.atom_disabled,
|
||||||
@@ -75,11 +76,10 @@ router.get("/user/:username/atom", (req,res) => {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.setHeader('content-type', 'application/rss+xml');
|
res.setHeader('content-type', 'application/rss+xml');
|
||||||
res.render("syndication/user_atom", {
|
res.render("syndication/atom", {
|
||||||
config,
|
config,
|
||||||
posts: data.getdata('posts'),
|
posts: data.getdata('posts'),
|
||||||
func,
|
func,
|
||||||
userID,
|
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-3
@@ -26,7 +26,7 @@ catch (error) {
|
|||||||
const app = express();
|
const app = express();
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.static(config.root_path));
|
app.use(config.site_path, express.static(config.root_path));
|
||||||
// set the view engine to ejs
|
// set the view engine to ejs
|
||||||
app.set('view engine', 'ejs');
|
app.set('view engine', 'ejs');
|
||||||
app.set('views', '../views')
|
app.set('views', '../views')
|
||||||
@@ -82,8 +82,7 @@ function perform_checks()
|
|||||||
}
|
}
|
||||||
perform_checks()
|
perform_checks()
|
||||||
|
|
||||||
|
|
||||||
app.listen(config.port, () => {
|
app.listen(config.port, () => {
|
||||||
console.log(`Server is running at http://localhost:${config.port} webroot: ${config.root_path}`);
|
console.log(`Server is running at http://localhost:${config.port} webroot: ${config.root_path}`);
|
||||||
console.log("Running in: ", __dirname)
|
console.log("Running in: ", __dirname)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= config.language %>
|
<html lang="<%= config.language %">
|
||||||
<head>
|
<head>
|
||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/submit_edit_user" method="POST">
|
<form action="<%= config.site_path %>/submit_edit_user" method="POST">
|
||||||
<input name="userID" type="hidden" value="<%= userID %>">
|
<input name="userID" type="hidden" value="<%= userID %>">
|
||||||
<label><%= locale.password %>:</label><br/>
|
<label><%= locale.password %>:</label><br/>
|
||||||
<input type="password" required id="password" name="password"><br/><br/>
|
<input type="password" required id="password" name="password"><br/><br/>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/submit_edit_post" method="POST" onsubmit="sha512password()">
|
<form action="<%= config.site_path %>/submit_edit_post" method="POST" onsubmit="sha512password()">
|
||||||
<input name="userID" type="hidden" value="<%= post['userID'] %>">
|
<input name="userID" type="hidden" value="<%= post['userID'] %>">
|
||||||
<input name="postID" type="hidden" value="<%= postID %>">
|
<input name="postID" type="hidden" value="<%= postID %>">
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<%- include('../partials/head.ejs') %>
|
<%- include('../partials/head.ejs') %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/submit_post" method="POST">
|
<form action="<%= config.site_path %>/submit_post" method="POST">
|
||||||
<label><%= locale.username %>:</label><br/>
|
<label><%= locale.username %>:</label><br/>
|
||||||
<input required name="username"><br/><br/>
|
<input required name="username"><br/><br/>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/submit_signup" method="POST">
|
<form action="<%= config.site_path %>/submit_signup" method="POST">
|
||||||
<label><%= locale.username %></label><br/>
|
<label><%= locale.username %></label><br/>
|
||||||
<input required name="username"><br/><br/>
|
<input required name="username"><br/><br/>
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,29 @@
|
|||||||
<a id='home-page-link' href="/"><%= locale.home_page %></a>
|
<a id='home-page-link' href="<%= config.site_path %>/"><%= locale.home_page %></a>
|
||||||
/
|
/
|
||||||
<% if (config.rss == true) { %>
|
<% if (config.rss == true) { %>
|
||||||
<a id='rss-link' href="/rss">
|
<a id='rss-link' href="<%= config.site_path %>/rss">
|
||||||
<img class='icon' src='/icons/rss.png' alt="<%= locale.rss_feed %>" title='<%= locale.rss_feed %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/rss.png' alt="<%= locale.rss_feed %>" title='<%= locale.rss_feed %>'>
|
||||||
</a>
|
</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
||||||
<% if (config.atom == true) { %>
|
<% if (config.atom == true) { %>
|
||||||
<a id='atom-link' href="/atom">
|
<a id='atom-link' href="<%= config.site_path %>/atom">
|
||||||
<img class='icon' src='/icons/atom.png' alt='<%= locale.atom_feed %>' title='<%= locale.atom_feed %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/atom.png' alt='<%= locale.atom_feed %>' title='<%= locale.atom_feed %>'>
|
||||||
</a>
|
</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
/
|
/
|
||||||
<a id='new-post-link' href="<%= config.new_post_url %>"><%= locale.new_post %></a>
|
<a id='new-post-link' href="<%= config.site_path %>/<%= config.new_post_url %>"><%= locale.new_post %></a>
|
||||||
/
|
/
|
||||||
<% if (config.allow_signup == true) { %>
|
<% if (config.allow_signup == true) { %>
|
||||||
<a id='signup-link' href="<%= config.signup_url %>"><%= locale.sign_up %></a>
|
<a id='signup-link' href="<%= config.site_path %>/<%= config.signup_url %>"><%= locale.sign_up %></a>
|
||||||
<% } %>
|
<% } %>
|
||||||
/
|
/
|
||||||
<form id='search-form' method="GET" action="/search" style="display: inline">
|
<form id='search-form' method="GET" action="<%= config.site_path %>/search" style="display: inline">
|
||||||
<input type="text" placeholder="🔍" name="q"><input type="submit" value="Search">
|
<input type="text" placeholder="🔍" name="q"><input type="submit" value="Search">
|
||||||
</form>
|
</form>
|
||||||
<br/>
|
<br/>
|
||||||
<div id='site-name'>
|
<div id='site-name'>
|
||||||
<h1><a id='home-page-link' href="/"><%= config.site_name %></a></h1>
|
<h1><a id='home-page-link' href="<%= config.site_path %>/"><%= config.site_name %></a></h1>
|
||||||
</div>
|
</div>
|
||||||
<div id='site-description'>
|
<div id='site-description'>
|
||||||
<h2><%- config.site_description %></h2>
|
<h2><%- config.site_description %></h2>
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<p><%- func.render_md(user.description) %></p>
|
<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.site_path %>/<%= config.edit_account_base_url %>/<%= userID %>">
|
||||||
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_account %>' title='<%= locale.edit_account %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/edit.png' alt='<%= locale.edit_account %>' title='<%= locale.edit_account %>'>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
|
||||||
<a id='rss-link' href="/user/<%= user.username %>/rss">
|
<a id='rss-link' href="<%= config.site_path %>/user/<%= user.username %>/rss">
|
||||||
<img class='icon' src='/icons/rss.png' alt="<%= locale.rss_feed %>" title='<%= locale.rss_feed %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/rss.png' alt="<%= locale.rss_feed %>" title='<%= locale.rss_feed %>'>
|
||||||
</a>
|
</a>
|
||||||
<a id='atom-link' href="/user/<%= user.username %>/atom">
|
<a id='atom-link' href="<%= config.site_path %>/user/<%= user.username %>/atom">
|
||||||
<img class='icon' src='/icons/atom.png' alt='<%= locale.atom_feed %>' title='<%= locale.atom_feed %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/atom.png' alt='<%= locale.atom_feed %>' title='<%= locale.atom_feed %>'>
|
||||||
</a>
|
</a>
|
||||||
<%- config.seperator %>
|
<%- config.seperator %>
|
||||||
|
|||||||
+13
-11
@@ -4,44 +4,46 @@
|
|||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
Misc:<br/>
|
Misc:<br/>
|
||||||
<a href="/">Home Page</a><br/>
|
<a href="<%= config.site_path %>/">Home Page</a><br/>
|
||||||
<a href="<%= config.new_post_url %>">New Post Form</a><br/>
|
<a href="<%= config.site_path %><%= config.new_post_url %>">New Post Form</a><br/>
|
||||||
<a href="<%= config.signup_url %>">Signup Form</a><br/>
|
<a href="<%= config.site_path %><%= config.signup_url %>">Signup Form</a><br/>
|
||||||
Indexes:<br/>
|
Indexes:<br/>
|
||||||
<a href="/index/posts">Posts Index</a><br/>
|
<a href="<%= config.site_path %>/index/posts">Posts Index</a><br/>
|
||||||
<a href="/index/users">Users Index</a><br/>
|
<a href="<%= config.site_path %>/index/users">Users Index</a><br/>
|
||||||
<a href="/index/comments">Comments Index</a><br/>
|
<a href="<%= config.site_path %>/index/comments">Comments Index</a><br/>
|
||||||
Posts:<br/>
|
Posts:<br/>
|
||||||
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
<% if (posts[postID]["deleted"] != true) { %>
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
<a href="/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
<a href="<%= config.site_path %>/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Comments:<br/>
|
Comments:<br/>
|
||||||
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
||||||
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].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/>
|
<a href="<%= config.site_path %>/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Users:<br/>
|
Users:<br/>
|
||||||
<% for (let userID = 0; userID < users.length; userID++) { %>
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
<% if (users[userID]["deleted"] != true) { %>
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
<a href="/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
<a href="<%= config.site_path %>/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Edit Posts:<br/>
|
Edit Posts:<br/>
|
||||||
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
<% if (posts[postID]["deleted"] != true) { %>
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
<a href="<%= config.edit_post_base_url %>/<%= postID %>">Edit <%= posts[postID]["title"] %></a><br/>
|
<a href="<%= config.site_path %><%= config.edit_post_base_url %>/<%= postID %>">Edit <%= posts[postID]["title"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Edit Users:<br/>
|
Edit Users:<br/>
|
||||||
<% for (let userID = 0; userID < users.length; userID++) { %>
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
<% if (users[userID]["deleted"] != true) { %>
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
<a href="<%= config.edit_account_base_url %>/<%= users[userID]["username"] %>">Edit <%= users[userID]["username"] %></a><br/>
|
<a href="<%= config.site_path %><%= config.edit_account_base_url %>/<%= users[userID]["username"] %>">Edit <%= users[userID]["username"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<!-- TODO add tags -->
|
<!-- TODO add tags -->
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
||||||
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].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/>
|
<a href="<%= config.site_path %>/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
<% if (posts[postID]["deleted"] != true) { %>
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
<a href="/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
<a href="<%= config.site_path %>/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<% for (let userID = 0; userID < users.length; userID++) { %>
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
<% if (users[userID]["deleted"] != true) { %>
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
<a href="/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
<a href="<%= config.site_path %>/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<header id="site-header">
|
<header id="site-header">
|
||||||
<%- include("../headers/site_wide") %>
|
<%- include("../headers/site_wide") %>
|
||||||
</header>
|
</header>
|
||||||
@@ -22,5 +23,6 @@
|
|||||||
<button type="submit"><%= locale.submit %></button>
|
<button type="submit"><%= locale.submit %></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<header id="site-header">
|
<header id="site-header">
|
||||||
<%- include("../headers/site_wide") %>
|
<%- include("../headers/site_wide") %>
|
||||||
</header>
|
</header>
|
||||||
@@ -13,5 +14,6 @@
|
|||||||
<footer id='footer'>
|
<footer id='footer'>
|
||||||
<%- include('../partials/footer'); %>
|
<%- include('../partials/footer'); %>
|
||||||
</footer>
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<div id='site-header'>
|
<div id='site-header'>
|
||||||
<%- include('../headers/site_wide'); %>
|
<%- include('../headers/site_wide'); %>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,5 +34,6 @@
|
|||||||
<a href="/user/<%- result.username %>"><%- result.prettyname %></a><br/>
|
<a href="/user/<%- result.username %>"><%- result.prettyname %></a><br/>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<header id="site-header">
|
<header id="site-header">
|
||||||
<%- include('../headers/site_wide'); %>
|
<%- include('../headers/site_wide'); %>
|
||||||
</header>
|
</header>
|
||||||
@@ -24,5 +25,6 @@
|
|||||||
<footer id='footer'>
|
<footer id='footer'>
|
||||||
<%- include('../partials/footer'); %>
|
<%- include('../partials/footer'); %>
|
||||||
</footer>
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<header id="site-header">
|
<header id="site-header">
|
||||||
<%- include("../headers/site_wide") %>
|
<%- include("../headers/site_wide") %>
|
||||||
</header>
|
</header>
|
||||||
@@ -20,5 +21,6 @@
|
|||||||
<footer id='footer'>
|
<footer id='footer'>
|
||||||
<%- include('../partials/footer'); %>
|
<%- include('../partials/footer'); %>
|
||||||
</footer>
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="main">
|
||||||
<header id="site-header">
|
<header id="site-header">
|
||||||
<%- include("../headers/site_wide") %>
|
<%- include("../headers/site_wide") %>
|
||||||
</header>
|
</header>
|
||||||
@@ -20,5 +21,6 @@
|
|||||||
<footer id='footer'>
|
<footer id='footer'>
|
||||||
<%- include('../partials/footer'); %>
|
<%- include('../partials/footer'); %>
|
||||||
</footer>
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<%= func.unix_time_to_date_format(comment.pubdate) %>
|
<%= func.unix_time_to_date_format(comment.pubdate) %>
|
||||||
</span>
|
</span>
|
||||||
<span id='comment-id' style='display: inline'>
|
<span id='comment-id' style='display: inline'>
|
||||||
<a href='/comment/<%= postID %>-<%= comment.id %>'>No. <%= postID %>-<%= comment.id %></a>:<br/>
|
<a href='<%= config.site_path %>/comment/<%= postID %>-<%= comment.id %>'>No. <%= postID %>-<%= comment.id %></a>:<br/>
|
||||||
</span>
|
</span>
|
||||||
<span id='comment-content'>
|
<span id='comment-content'>
|
||||||
<%- func.render_comment(comment.content) %>
|
<%- func.render_comment(comment.content) %>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<a id='site-index-link' href="/index/pages"><%= locale.site_index %></a><br/>
|
<a id='site-index-link' href="<%= config.site_path %>/index/pages"><%= locale.site_index %></a><br/>
|
||||||
<%= locale.site_ran_by %> <%= config.site_admin %><br/>
|
<%= locale.site_ran_by %> <%= config.site_admin %><br/>
|
||||||
<%- locale.attribution %><br/>
|
<%- locale.attribution %><br/>
|
||||||
<%= locale.AI_consent %> <!-- remove consent for AI scrapers -->
|
<%= locale.AI_consent %> <!-- remove consent for AI scrapers -->
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<meta charset="<%- config.charset %>">
|
<meta charset="<%- config.charset %>">
|
||||||
<title><%= config.site_name %></title>
|
<meta name='robots' content='noindex'>
|
||||||
|
<title><%= config.site_path %></title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/default.css">
|
<link rel="stylesheet" href="<%= config.site_path %>/default.css">
|
||||||
<link rel="stylesheet" href="/custom.css">
|
<link rel="stylesheet" href="<%= config.site_path %>/custom.css">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="post-header">
|
<div id="post-header">
|
||||||
<h2>
|
<h2>
|
||||||
<a href='/post/<%= post['id'] %>'><%= post.title %></a>
|
<a href='<%= config.site_path %>/post/<%= post['id'] %>'><%= post.title %></a>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="post-details">
|
<div id="post-details">
|
||||||
<span id="post-author">
|
<span id="post-author">
|
||||||
<i><%= locale.written_by %> <a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
<i><%= locale.written_by %> <a href="<%= config.site_path %>/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
||||||
</span>
|
</span>
|
||||||
-
|
-
|
||||||
<span id="post-pubdate">
|
<span id="post-pubdate">
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
<i><%= locale.last_modified %>: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
|
<i><%= locale.last_modified %>: <%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
|
||||||
</div>
|
</div>
|
||||||
<div id="post-edit">
|
<div id="post-edit">
|
||||||
<a href="<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
<a href="<%= config.site_path %>/<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
||||||
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
||||||
</a><br/>
|
</a><br/>
|
||||||
</div>
|
</div>
|
||||||
<% if (config.enable_hitcount == true) { %>
|
<% if (config.enable_hitcount == true) { %>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
<div id="post-commentform">
|
<div id="post-commentform">
|
||||||
<!-- Comment form -->
|
<!-- Comment form -->
|
||||||
<form method="POST" action="/submit_comment">
|
<form method="POST" action="<%= config.site_path %>/submit_comment">
|
||||||
<input type="hidden" name="post_index" value="<%= post["id"] %>">
|
<input type="hidden" name="post_index" value="<%= post["id"] %>">
|
||||||
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
|
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
|
||||||
<label><%= locale.comment %>:</label><br/><textarea name="content"></textarea><br/>
|
<label><%= locale.comment %>:</label><br/><textarea name="content"></textarea><br/>
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
<div id="post-header">
|
<div id="post-header">
|
||||||
<h2>
|
<h2>
|
||||||
<a href='/post/<%= post['id'] %>'><%= post.title %></a>
|
<a href='<%= config.site_path %>/post/<%= post['id'] %>'><%= post.title %></a>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="post-details">
|
<div id="post-details">
|
||||||
<span id="post-author">
|
<span id="post-author">
|
||||||
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
<i><a href="<%= config.site_path %>/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
||||||
</span>
|
</span>
|
||||||
-
|
-
|
||||||
<span id="post-pubdate">
|
<span id="post-pubdate">
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<div id="post-edit">
|
<div id="post-edit">
|
||||||
<a href="<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
<a href="<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
||||||
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
||||||
</a><br/>
|
</a><br/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="post-header">
|
<div id="post-header">
|
||||||
<h2>
|
<h2>
|
||||||
<a href='/post/<%= post['id'] %>'><%= post.title %></a>
|
<a href='<%= config.site_path %>/post/<%= post['id'] %>'><%= post.title %></a>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -15,11 +15,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="post-details">
|
<div id="post-details">
|
||||||
<span id="post-author">
|
<span id="post-author">
|
||||||
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
<i><a href="<%= config.site_path %>/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
||||||
</span>
|
</span>
|
||||||
-
|
-
|
||||||
<a if='edit-account-link' href="<%= config.edit_account_base_url %>/<%= user.id %>">
|
<a if='edit-account-link' href="<%= config.site_path %>/<%= config.edit_account_base_url %>/<%= user.id %>">
|
||||||
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_account %>' title='<%= locale.edit_account %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/edit.png' alt='<%= locale.edit_account %>' title='<%= locale.edit_account %>'>
|
||||||
</a>
|
</a>
|
||||||
-
|
-
|
||||||
<span id="post-pubdate">
|
<span id="post-pubdate">
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<br/>
|
<br/>
|
||||||
<div id="post-edit">
|
<div id="post-edit">
|
||||||
<a href="<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
<a href="<%= config.site_path %>/<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
||||||
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
||||||
</a><br/>
|
</a><br/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="post-header">
|
<div id="post-header">
|
||||||
<h2>
|
<h2>
|
||||||
<a href='/post/<%= post['id'] %>'><%= post.title %></a>
|
<a href='<%= config.site_path %>/post/<%= post['id'] %>'><%= post.title %></a>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="post-details">
|
<div id="post-details">
|
||||||
<span id="post-author">
|
<span id="post-author">
|
||||||
<i><a href="/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
<i><a href="<%= config.site_path %>/user/<%= user.username %>"><%= user.prettyname %></a></i>
|
||||||
</span>
|
</span>
|
||||||
-
|
-
|
||||||
<span id="post-pubdate">
|
<span id="post-pubdate">
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<br/>
|
<br/>
|
||||||
<div id="post-edit">
|
<div id="post-edit">
|
||||||
<a href="<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
<a href="<%= config.site_path %>/<%= config.edit_post_base_url %>/<%= post["id"] %>">
|
||||||
<img class='icon' src='/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
<img class='icon' src='<%= config.site_path %>/icons/edit.png' alt='<%= locale.edit_post %>' title='<%= locale.edit_post %>'>
|
||||||
</a><br/>
|
</a><br/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?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>
|
||||||
|
<% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %>
|
||||||
|
<category><![CDATA[<%= posts[postID]['tags'][tag_index] %>]]></category>
|
||||||
|
<% } %>
|
||||||
|
</entry>
|
||||||
|
<% } %>
|
||||||
|
<% } %>
|
||||||
|
</feed>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="<%= config.charset %>" ?>
|
||||||
|
<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>
|
||||||
|
<% for (let tag_index = 0; tag_index < posts[postID]['tags'].length; tag_index++) { %>
|
||||||
|
<category><![CDATA[<%= posts[postID]['tags'][tag_index] %>]]></category>
|
||||||
|
<% } %>
|
||||||
|
</item>
|
||||||
|
<% } %>
|
||||||
|
<% } %>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
Reference in New Issue
Block a user