Bug fix and Document fix
Removed the string object from config.json as it's now all in the locale. and I fixed data.getdata() to return an error code if the index is out of bounds, it now returns a 1. Signed-off-by: deadvey <deadvey@deadvey.com>
This commit is contained in:
@@ -19,9 +19,9 @@ All options show an example configuartion value and the variable type + an expla
|
|||||||
## Basic Customisation
|
## Basic Customisation
|
||||||
| name | example value | variable type | explanation |
|
| name | example value | variable type | explanation |
|
||||||
|-----------------|----------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-----------------|----------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|locale|"en"|String|Your locale, see [/locales](/locales) for a list of all locales (you can open a PR for a new translation too)|
|
|locale|"en-GB"|String|Your locale, see [/locales](/locales) for a list of all locales (you can open a PR for a new translation too)|
|
||||||
|seperator|"\<hr/\>"|String|This is what %S represents in the formatting, this will go inbetween posts and generally to seperate out content on pages.|
|
|seperator|"\<hr/\>"|String|By default, this will go inbetween posts and generally to seperate out content on pages.|
|
||||||
|site_name|"My Blog"|String|This is what %Y represents; it's the name of your instance, a human readable string.|
|
|site_name|"Pete's Blogging Site!"|String|It's the name of your blog site, a human readable string.|
|
||||||
|site_description|"Read my blogs!"|String|This is what %W represents; it's the description of your instance, a human readable string.|
|
|site_description|"Read my blogs!"|String|This is what %W represents; it's the description of your instance, a human readable string.|
|
||||||
|default_commenter_username|"Anon"|String|Default commenter username if no username is inputted in comment submission.|
|
|default_commenter_username|"Anon"|String|Default commenter username if no username is inputted in comment submission.|
|
||||||
|
|
||||||
@@ -36,13 +36,14 @@ Read more at [date-fns](https://date-fns.org/v4.1.0/docs/format)<br/>
|
|||||||
| name | example value | variable type | explanation |
|
| name | example value | variable type | explanation |
|
||||||
|------|---------------|---------------|-------------------------------|
|
|------|---------------|---------------|-------------------------------|
|
||||||
|date_format|"yyyy-MM-dd"|String|The format of date's on the website.|
|
|date_format|"yyyy-MM-dd"|String|The format of date's on the website.|
|
||||||
|time_zone|"+0000"|String|\Your offset from UTC|
|
|time_zone|"+0000"|String|Your offset from UTC|
|
||||||
|
|
||||||
## Advanced Customisation
|
## Advanced Customisation
|
||||||
* /views/* files are EJS files (used for formatting HTML) and can be editted to your liking, you might want to read [the EJS docs](https://ejs.co/#docs) for help.
|
* /views/* files are EJS files (used for formatting HTML) and can be editted to your liking, you might want to read [the EJS docs](https://ejs.co/#docs) for help.
|
||||||
* "css": "body { background: red; }"<br/>
|
* "css": "body { background: red; }"<br/>
|
||||||
String. Custom CSS to be applied to all pages, if you want more complex css, you can edit custom.css.<br/>
|
String. Custom CSS to be applied to all pages, if you want more complex css, you can edit custom.css.<br/>
|
||||||
You can also edit the custom.css file in the webroot, as by default this is linked in the global header.
|
You can also edit the custom.css file in the webroot, as by default this is linked in the global header.
|
||||||
|
* You can create a file called custom.css in the webroot and that will be loaded as a style onto every page.
|
||||||
|
|
||||||
## Custom Strings
|
## Custom Strings
|
||||||
* You can edit all the strings on the site in /locales/<your-locale>.json
|
* You can edit all the strings on the site in /locales/\<your-locale>.json
|
||||||
|
@@ -21,17 +21,5 @@
|
|||||||
"atom": true,
|
"atom": true,
|
||||||
"date_format": "yyyy-MM-dd",
|
"date_format": "yyyy-MM-dd",
|
||||||
"time_zone": "+0000",
|
"time_zone": "+0000",
|
||||||
"string": {
|
|
||||||
"signup_agreement": "I agree to not post illegal or hateful content",
|
|
||||||
"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",
|
|
||||||
"delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
|
|
||||||
"incorrect_password": "Incorrect Password",
|
|
||||||
"rss_disabled": "Sorry, RSS is disabled",
|
|
||||||
"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>"
|
|
||||||
},
|
|
||||||
"css": ""
|
"css": ""
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,12 @@ export function getdata(data, index=-1) {
|
|||||||
if (data == "posts" || data == 'users' || data == 'comments') {
|
if (data == "posts" || data == 'users' || data == 'comments') {
|
||||||
let result = func.require_module(`../data/${data}.json`)
|
let result = func.require_module(`../data/${data}.json`)
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
if (index < result.length-1) {
|
||||||
return result[index]
|
return result[index]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 1 // This index doesn't exist
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@@ -62,8 +62,7 @@ router.get("/user/:username", (req, res) => {
|
|||||||
router.get("/post/:post_index", (req, res) => {
|
router.get("/post/:post_index", (req, res) => {
|
||||||
const postID = req.params.post_index
|
const postID = req.params.post_index
|
||||||
let post = data.getdata('posts', postID)
|
let post = data.getdata('posts', postID)
|
||||||
|
if (post == 1) { // data.getdata returns error code 1 if nothing is available
|
||||||
if (post["deleted"] == true || 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,
|
||||||
config,
|
config,
|
||||||
|
Reference in New Issue
Block a user