forked from deadvey/blogger-nodejs
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cfb3f6e60 | |||
| 46e7394a6f | |||
| 736edee1b0 | |||
| 63ca617895 | |||
| 9aff454ec2 | |||
| 5a14b125d2 | |||
| 1a0b16feb2 | |||
| 9b10188066 | |||
| 27149b1f01 | |||
| a52c57f3ea | |||
| d895bbcb8c | |||
| 3119a76d96 | |||
| b253fac1c4 | |||
| f11b94527d | |||
| 6e7d2109c8 | |||
| dd317883be | |||
| 4955ebe7bd | |||
| 3fab094545 | |||
| 9be261d415 | |||
| 9398919711 | |||
| 545a848479 | |||
| 54ffac931d | |||
| 18b842e48c | |||
| c7bc64e59e | |||
| 9383bd8058 | |||
| d554fce402 | |||
| d17fcf2dd2 | |||
| a1fa0e3dbc | |||
|
ab1fa5e69a
|
@@ -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,
|
||||||
|
|||||||
@@ -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)",
|
"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",
|
"signup_agreement": "I agree to not post illegal or hateful content",
|
||||||
"comment": "Comment",
|
"comment": "Comment",
|
||||||
"submit": "Sumbit",
|
"submit": "Submit",
|
||||||
|
|
||||||
"site_ran_by": "Site is ran by",
|
"site_ran_by": "Site is ran by",
|
||||||
"signups_unavailable": "Sorry, this server does not allow signups",
|
"signups_unavailable": "Sorry, this server does not allow signups",
|
||||||
@@ -39,5 +39,6 @@
|
|||||||
"home_page": "Home Page",
|
"home_page": "Home Page",
|
||||||
"site_index": "Site Index",
|
"site_index": "Site Index",
|
||||||
"reply": "reply",
|
"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"
|
||||||
}
|
}
|
||||||
+3
-2
@@ -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)",
|
"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",
|
"signup_agreement": "I agree to not post illegal or hateful content",
|
||||||
"comment": "Comment",
|
"comment": "Comment",
|
||||||
"submit": "Sumbit",
|
"submit": "Submit",
|
||||||
|
|
||||||
"site_ran_by": "Site is ran by",
|
"site_ran_by": "Site is ran by",
|
||||||
"signups_unavailable": "Sorry, this server does not allow signups",
|
"signups_unavailable": "Sorry, this server does not allow signups",
|
||||||
@@ -39,5 +39,6 @@
|
|||||||
"home_page": "Home Page",
|
"home_page": "Home Page",
|
||||||
"site_index": "Site Index",
|
"site_index": "Site Index",
|
||||||
"reply": "reply",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -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)",
|
"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",
|
"signup_agreement": "I agree to not post illegal or hateful content",
|
||||||
"comment": "Comment",
|
"comment": "Comment",
|
||||||
"submit": "Sumbit",
|
"submit": "Submit",
|
||||||
|
|
||||||
"site_ran_by": "Site is ran by",
|
"site_ran_by": "Site is ran by",
|
||||||
"signups_unavailable": "Sorry, this server does not allow signups",
|
"signups_unavailable": "Sorry, this server does not allow signups",
|
||||||
@@ -39,5 +39,6 @@
|
|||||||
"home_page": "Home Page",
|
"home_page": "Home Page",
|
||||||
"site_index": "Site Index",
|
"site_index": "Site Index",
|
||||||
"reply": "reply",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"quotes": "«»‹›",
|
||||||
|
"password": "Contraseña",
|
||||||
|
"username": "Nombre de Usuario",
|
||||||
|
"prettyname": "Nombre Bonito",
|
||||||
|
"description": "Descripción (enlaces de redes, sobre que escribes, etc), soporta markdown",
|
||||||
|
"title": "Título",
|
||||||
|
"post_content": "Contenido de la Publicación, soporta markdown",
|
||||||
|
"tags": "Etiquetas (separados por coma)",
|
||||||
|
"delete_account_confirmation": "Eliminar mi cuenta - (Estoy de acuerdo con que todas mis publicaciones serán permanentemente eliminadas al instante)",
|
||||||
|
"signup_agreement": "Acepto no publicar contenido ilegal o de odio",
|
||||||
|
"comment": "Comentar",
|
||||||
|
"submit": "Enviar",
|
||||||
|
|
||||||
|
"site_ran_by": "El sitio es llevado por",
|
||||||
|
"signups_unavailable": "Lo siento, este servidor no permite registrarse",
|
||||||
|
"user_exists": "Lo siento, este usuario ya existe, prueba otro diferente",
|
||||||
|
"user_doesnt_exist": "Lo siento, este usuario no existe",
|
||||||
|
"comment_doesnt_exist": "Este comentario no existe, esto puede ser porque la publicación en la que estaba adjunto se ha eliminado",
|
||||||
|
"post_doesnt_exist": "Esta publicación no existe o se ha aliminado",
|
||||||
|
"incorrect_password": "Contraseña Incorrecta",
|
||||||
|
"rss_disabled": "Lo siento, RSS está desactivado",
|
||||||
|
"atom_disabled": "Lo siento, ATOM está desactivado",
|
||||||
|
"AI_consent": "El contenido de este sitio no debe ser copiado, raspado, o usado para entrenar modelos de IA o de lenguaje (LLMs) sin consentimiento previo.",
|
||||||
|
"rss_feed": "Feed RSS",
|
||||||
|
"atom_feed": "Feed ATOM",
|
||||||
|
"no_tags": "Sin Etiquetas",
|
||||||
|
"new_post": "Nueva Publicación",
|
||||||
|
"edit_post": "Editar Publicación",
|
||||||
|
"sign_up": "Registrarse",
|
||||||
|
"edit_account": "Editar Cuenta",
|
||||||
|
"permalink": "Enlace Permanente",
|
||||||
|
"written_by": "Escrito por",
|
||||||
|
"published": "Publicado",
|
||||||
|
"last_modified": "Última Modificación",
|
||||||
|
"hitcount": "Visitas",
|
||||||
|
"post_tagged": "Publicaciones Etiquetadas",
|
||||||
|
"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>",
|
||||||
|
"translated_by": "Javalsai"
|
||||||
|
}
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
@@ -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?
|
||||||
|
}
|
||||||
+3
-1
@@ -9,8 +9,10 @@
|
|||||||
"ejs": "^3.1.10",
|
"ejs": "^3.1.10",
|
||||||
"express": "^5.2.1",
|
"express": "^5.2.1",
|
||||||
"express-router": "^0.0.1",
|
"express-router": "^0.0.1",
|
||||||
|
"highlight.js": "^11.11.1",
|
||||||
"markdown-it": "^14.1.0",
|
"markdown-it": "^14.1.0",
|
||||||
"mysql": "^2.18.1",
|
"markdown-it-named-code-blocks": "^1.1.0",
|
||||||
|
"mssql": "^12.2.0",
|
||||||
"package.json": "^2.0.1"
|
"package.json": "^2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+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
|
||||||
|
|||||||
+87
-53
@@ -9,15 +9,15 @@ const locale = require(`../locales/${config.locale}.json`)
|
|||||||
// https://stackoverflow.com/a/16060619
|
// https://stackoverflow.com/a/16060619
|
||||||
export function require_module(module)
|
export function require_module(module)
|
||||||
{
|
{
|
||||||
if (config.cache_data == false)
|
if (config.cache_data == false)
|
||||||
{
|
{
|
||||||
delete require.cache[require.resolve(module)];
|
delete require.cache[require.resolve(module)];
|
||||||
return require(module);
|
return require(module);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return require(module);
|
return require(module);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The configuration defines a date format using the date-fns (a datetime library) syntax
|
// The configuration defines a date format using the date-fns (a datetime library) syntax
|
||||||
@@ -27,7 +27,7 @@ export function require_module(module)
|
|||||||
// returns the formatted date (string)
|
// returns the formatted date (string)
|
||||||
export function unix_time_to_date_format(unix_time)
|
export function unix_time_to_date_format(unix_time)
|
||||||
{
|
{
|
||||||
const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date utility library
|
const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date utility library
|
||||||
let date = fromUnixTime(unix_time)
|
let date = fromUnixTime(unix_time)
|
||||||
let formatted_date = format(date, config.date_format)
|
let formatted_date = format(date, config.date_format)
|
||||||
return formatted_date
|
return formatted_date
|
||||||
@@ -39,7 +39,7 @@ export function unix_time_to_date_format(unix_time)
|
|||||||
// returns the formatted date (string)
|
// returns the formatted date (string)
|
||||||
export function unix_time_to_rss_date(unix_time)
|
export function unix_time_to_rss_date(unix_time)
|
||||||
{
|
{
|
||||||
const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date utility library
|
const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date utility library
|
||||||
let date = fromUnixTime(unix_time)
|
let date = fromUnixTime(unix_time)
|
||||||
let formatted_date = format(date, "EEE, dd MMM yyyy HH:mm:ss")
|
let formatted_date = format(date, "EEE, dd MMM yyyy HH:mm:ss")
|
||||||
return `${formatted_date} ${config.time_zone}`
|
return `${formatted_date} ${config.time_zone}`
|
||||||
@@ -47,7 +47,7 @@ export function unix_time_to_rss_date(unix_time)
|
|||||||
// And again with atom's date format
|
// And again with atom's date format
|
||||||
export function unix_time_to_atom_date(unix_time)
|
export function unix_time_to_atom_date(unix_time)
|
||||||
{
|
{
|
||||||
const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date utility library
|
const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date utility library
|
||||||
let date = fromUnixTime(unix_time)
|
let date = fromUnixTime(unix_time)
|
||||||
let formatted_date = format(date, "yyyy-MM-dd'T'HH:mm:ss'Z'")
|
let formatted_date = format(date, "yyyy-MM-dd'T'HH:mm:ss'Z'")
|
||||||
return `${formatted_date}`
|
return `${formatted_date}`
|
||||||
@@ -59,18 +59,19 @@ export function unix_time_to_atom_date(unix_time)
|
|||||||
// returns: string
|
// returns: string
|
||||||
export function render_tags(tags)
|
export function render_tags(tags)
|
||||||
{
|
{
|
||||||
|
tags = tags.filter((item, index) => tags.indexOf(item) === index) // Remove duplicate tags
|
||||||
let string = "" // Initialises the string
|
let string = "" // Initialises the string
|
||||||
if (tags.length == 1 && tags[0] == "")
|
if (tags.length == 1 && tags[0] == "")
|
||||||
{
|
{
|
||||||
string = ''; // If there are no tags, output nothing
|
string = ''; // If there are no tags, output nothing
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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
|
||||||
}
|
}
|
||||||
// The users are stored as a list of objects [ user_object, user_object, user_object ]
|
// The users are stored as a list of objects [ user_object, user_object, user_object ]
|
||||||
@@ -80,11 +81,11 @@ export function render_tags(tags)
|
|||||||
// if the user is not present it returns -1
|
// if the user is not present it returns -1
|
||||||
export function get_userID(username)
|
export function get_userID(username)
|
||||||
{
|
{
|
||||||
const users = require_module("../data/users.json")
|
const users = require_module("../data/users.json")
|
||||||
for (let i = 0; i < users.length; i++)
|
for (let i = 0; i < users.length; i++)
|
||||||
{ // Loop over every user
|
{ // Loop over every user
|
||||||
if (users[i]['username'] == username)
|
if (users[i]['username'] == username)
|
||||||
{
|
{
|
||||||
return i // If the username matches then return the index of that user
|
return i // If the username matches then return the index of that user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,47 +98,65 @@ export function get_userID(username)
|
|||||||
// returns a string with some character replaced by their entities
|
// returns a string with some character replaced by their entities
|
||||||
export function escape_input(input)
|
export function escape_input(input)
|
||||||
{
|
{
|
||||||
let output = input
|
let output = input
|
||||||
.replaceAll("&", "&") // This must be first
|
.replaceAll("&", "&") // This must be first
|
||||||
.replaceAll("<", "<")
|
.replaceAll("<", "<")
|
||||||
.replaceAll(">", ">")
|
.replaceAll(">", ">")
|
||||||
.replaceAll("\\", "\")
|
.replaceAll("\\", "\")
|
||||||
.replaceAll('"', """)
|
.replaceAll('"', """)
|
||||||
.replaceAll("'", "'")
|
.replaceAll("'", "'")
|
||||||
.replaceAll("/", "/")
|
.replaceAll("/", "/")
|
||||||
.replaceAll("%", "%")
|
.replaceAll("%", "%")
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render comment content by replacing the >> int with a url link to that comment
|
// Render comment content by replacing the >> int with a url link to that comment
|
||||||
// Syntax: ">> postID-commentID"
|
// Syntax: ">> postID-commentID"
|
||||||
export function render_comment(comment_content)
|
export function render_comment(comment_content)
|
||||||
{
|
{
|
||||||
return comment_content
|
return comment_content
|
||||||
.replaceAll(/>> ([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>> $1-$2</a>")
|
.replaceAll(/>> ([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>> $1-$2</a>")
|
||||||
.replaceAll(/>>([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>>$1-$2</a>")
|
.replaceAll(/>>([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>>$1-$2</a>")
|
||||||
.replaceAll(/>> ([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>> $1-$2</a>")
|
.replaceAll(/>> ([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>> $1-$2</a>")
|
||||||
.replaceAll(/>>([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>>$1-$2</a>")
|
.replaceAll(/>>([0-9]*)-([0-9]*)/g, "<a href='/comment/$1-$2'>>>$1-$2</a>")
|
||||||
.replaceAll("\n", "<br/>")
|
.replaceAll("\n", "<br/>")
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Renders a string into markdown using markdown-it library
|
// Renders a string into markdown using markdown-it library
|
||||||
export function render_md(content)
|
export function render_md(content)
|
||||||
{
|
{
|
||||||
const markdownit = require("markdown-it")
|
const markdownit = require("markdown-it")
|
||||||
const md = markdownit
|
const hljs = require("highlight.js");
|
||||||
({ // this is just defining some options for markdown-it, should I add this to config.json?
|
const namedCodeBlocks = require("markdown-it-named-code-blocks");
|
||||||
html: false,
|
const md = markdownit
|
||||||
xhtmlOut: false,
|
({ // this is just defining some options for markdown-it, should I add this to config.json?
|
||||||
breaks: true,
|
html: false,
|
||||||
linkify: false,
|
xhtmlOut: false,
|
||||||
typographer: true,
|
breaks: true,
|
||||||
quotes: locale.quotes,
|
linkify: false,
|
||||||
})
|
typographer: true,
|
||||||
return md.render(content)
|
quotes: locale.quotes,
|
||||||
|
highlight: function (content, lang) {
|
||||||
|
if (lang && hljs.getLanguage(lang)) {
|
||||||
|
return (
|
||||||
|
'<pre class="hljs"><code>' +
|
||||||
|
hljs.highlight(content, { language: lang, ignoreIllegals: true }).value +
|
||||||
|
"</code></pre>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
'<pre class="hljs"><code>' + md.utils.escapeHtml(content) + "</code></pre>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.use(namedCodeBlocks)
|
||||||
|
.disable('image');
|
||||||
|
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) {
|
||||||
@@ -146,3 +165,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
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
+170
-169
@@ -14,197 +14,197 @@ 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)
|
||||||
let name = func.escape_input(req.body.name)
|
let name = func.escape_input(req.body.name)
|
||||||
// Give the user the default username if they left that bit blank
|
// Give the user the default username if they left that bit blank
|
||||||
if (name == "" || typeof name == 'undefined') {
|
if (name == "" || typeof name == 'undefined') {
|
||||||
name = config.default_commenter_username
|
name = config.default_commenter_username
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check there is actually content in the comment
|
// Check there is actually content in the comment
|
||||||
if (content != '' && typeof content != 'undefined') {
|
if (content != '' && typeof content != 'undefined') {
|
||||||
let comments = data.getdata('comments')
|
let comments = data.getdata('comments')
|
||||||
|
|
||||||
new_comment = {
|
new_comment = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"content": content,
|
"content": content,
|
||||||
"id": comments[postID]['comments'].length,
|
"id": comments[postID]['comments'].length,
|
||||||
"pubdate": unix_timestamp,
|
"pubdate": unix_timestamp,
|
||||||
};
|
};
|
||||||
comments[postID]['comments'].push(new_comment);
|
comments[postID]['comments'].push(new_comment);
|
||||||
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)
|
||||||
const content = req.body.content
|
const content = req.body.content
|
||||||
const tags = func.escape_input(req.body.tags).split(',').map(str => str.trim());
|
const tags = func.escape_input(req.body.tags).split(',').map(str => str.trim());
|
||||||
const unix_timestamp = getUnixTime(new Date())
|
const unix_timestamp = getUnixTime(new Date())
|
||||||
|
|
||||||
if (func.get_userID(username) == -1) {
|
if (func.get_userID(username) == -1) {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.user_doesnt_exit,
|
message: locale.user_doesnt_exit,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (users[func.get_userID(username)]['hash'] == password) { // Password matches
|
else if (users[func.get_userID(username)]['hash'] == password) { // Password matches
|
||||||
console.log(username, "is submitting a post titled:", title);
|
console.log(username, "is submitting a post titled:", title);
|
||||||
id = posts.length
|
id = posts.length
|
||||||
posts.push({
|
posts.push({
|
||||||
"id": id,
|
"id": id,
|
||||||
"userID": func.get_userID(username),
|
"userID": func.get_userID(username),
|
||||||
"title": title,
|
"title": title,
|
||||||
"content": content,
|
"content": content,
|
||||||
"pubdate": unix_timestamp,
|
"pubdate": unix_timestamp,
|
||||||
"editdate": unix_timestamp,
|
"editdate": unix_timestamp,
|
||||||
"tags": tags,
|
"tags": tags,
|
||||||
})
|
})
|
||||||
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, `${config.sitr_path}/post/${id}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.incorrect_password,
|
message: locale.incorrect_password,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}); // /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)
|
||||||
const description = req.body.description
|
const description = req.body.description
|
||||||
|
|
||||||
// Check that signups are allowed
|
// Check that signups are allowed
|
||||||
if (config.allow_signup == true) {
|
if (config.allow_signup == true) {
|
||||||
// func.get_userID will return -1 if the user does not exist
|
// func.get_userID will return -1 if the user does not exist
|
||||||
// so this checks that the user does not exist
|
// so this checks that the user does not exist
|
||||||
if (func.get_userID(username) == -1) {
|
if (func.get_userID(username) == -1) {
|
||||||
users.push({
|
users.push({
|
||||||
"id": users.length,
|
"id": users.length,
|
||||||
"username": username,
|
"username": username,
|
||||||
"prettyname": prettyname,
|
"prettyname": prettyname,
|
||||||
"hash": password,
|
"hash": password,
|
||||||
"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 {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.user_exists,
|
message: locale.user_exists,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (config.allow_signup == false) {
|
else if (config.allow_signup == false) {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.signups_unavailable,
|
message: locale.signups_unavailable,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 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)
|
||||||
const description = req.body.description
|
const description = req.body.description
|
||||||
const prettyname = func.escape_input(req.body.prettyname)
|
const prettyname = func.escape_input(req.body.prettyname)
|
||||||
const delete_bool = req.body.delete
|
const delete_bool = req.body.delete
|
||||||
|
|
||||||
if (userID >= 0) { // The user exists
|
if (userID >= 0) { // The user exists
|
||||||
if (password == users[userID]['hash']) { // password matches
|
if (password == users[userID]['hash']) { // password matches
|
||||||
console.log(userID, " (userID) is modifying their account")
|
console.log(userID, " (userID) is modifying their account")
|
||||||
users[userID]["prettyname"] = prettyname;
|
users[userID]["prettyname"] = prettyname;
|
||||||
users[userID]["description"] = description;
|
users[userID]["description"] = description;
|
||||||
|
|
||||||
if (delete_bool == true) {
|
if (delete_bool == true) {
|
||||||
// Delete the user
|
// Delete the user
|
||||||
users[userID] = {"id": userID,"deleted": true}
|
users[userID] = {"id": userID,"deleted": true}
|
||||||
// Delete all their posts
|
// Delete all their posts
|
||||||
for (let postid = 0; postid < posts.length; postid++) { // loop over all posts
|
for (let postid = 0; postid < posts.length; postid++) { // loop over all posts
|
||||||
if (posts[postid]['userID'] == userID) { // if userID matches
|
if (posts[postid]['userID'] == userID) { // if userID matches
|
||||||
posts[postid] = {"id": postid, "deleted": true} // delete the post
|
posts[postid] = {"id": postid, "deleted": true} // delete the post
|
||||||
comments[postid] = [] // the comments for this post should also be deleted
|
comments[postid] = [] // the comments for this post should also be deleted
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Write these changes
|
// Write these changes
|
||||||
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", {
|
||||||
message: locale.incorrect_password,
|
message: locale.incorrect_password,
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
message: locale.user_doesnt_exist,
|
message: locale.user_doesnt_exist,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}); // /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
|
||||||
const title = func.escape_input(req.body.title)
|
const title = func.escape_input(req.body.title)
|
||||||
const content = req.body.content
|
const content = req.body.content
|
||||||
const tags = func.escape_input(req.body.tags).split(",").map(str => str.trim());
|
const tags = func.escape_input(req.body.tags).split(",").map(str => str.trim());
|
||||||
const delete_bool = req.body.delete
|
const delete_bool = req.body.delete
|
||||||
const unix_timestamp = getUnixTime(new Date())
|
const unix_timestamp = getUnixTime(new Date())
|
||||||
console.log(users[userID]['prettyname'], "is editting the post titled:", title);
|
console.log(users[userID]['prettyname'], "is editting the post titled:", title);
|
||||||
|
|
||||||
if (users[userID]['hash'] == password) { // password matches
|
if (users[userID]['hash'] == password) { // password matches
|
||||||
let post = posts[postID]
|
let post = posts[postID]
|
||||||
post['title'] = title
|
post['title'] = title
|
||||||
post['content'] = content
|
post['content'] = content
|
||||||
post['tags'] = tags
|
post['tags'] = tags
|
||||||
post['editdate'] = unix_timestamp
|
post['editdate'] = unix_timestamp
|
||||||
if (typeof delete_bool != "undefined") {
|
if (typeof delete_bool != "undefined") {
|
||||||
console.log("Deleting post!")
|
console.log("Deleting post!")
|
||||||
posts[postID] = {"id": post["id"], "deleted": true}
|
posts[postID] = {"id": post["id"], "deleted": true}
|
||||||
comments[postID] = [];
|
comments[postID] = [];
|
||||||
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", {
|
||||||
message: locale.incorrect_password,
|
message: locale.incorrect_password,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}); // /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,
|
||||||
|
|||||||
+54
-45
@@ -5,54 +5,63 @@ const func = require('../functions')
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
///////////////////// Form pages ////////////////////////////
|
///////////////////// Form pages ////////////////////////////
|
||||||
router.get(config.new_post_url, (req,res) => {
|
// new post
|
||||||
res.render("forms/new_post", {
|
router.get(`${config.site_path}/${config.new_post_url}`, (req,res) => {
|
||||||
config,
|
res.render("forms/new_post", {
|
||||||
locale,
|
config,
|
||||||
});
|
locale,
|
||||||
|
});
|
||||||
}); // /post
|
}); // /post
|
||||||
router.get(config.signup_url, (req,res) => {
|
|
||||||
// if the server does allow signup
|
// signup
|
||||||
if (config.allow_signup == true) {
|
router.get(`${config.site_path}/${config.signup_url}`, (req,res) => {
|
||||||
// Send the page for signing up to the server
|
// if the server does allow signup
|
||||||
res.render("forms/signup", {
|
if (config.allow_signup == true) {
|
||||||
config,
|
// Send the page for signing up to the server
|
||||||
locale,
|
res.render("forms/signup", {
|
||||||
});
|
config,
|
||||||
}
|
locale,
|
||||||
// if the server does not allow signup
|
});
|
||||||
else if (config.allow_signup == false) {
|
}
|
||||||
res.render("partials/message", {
|
// if the server does not allow signup
|
||||||
message: locale.signups_unavailable,
|
else if (config.allow_signup == false) {
|
||||||
config,
|
res.render("partials/message", {
|
||||||
})
|
message: locale.signups_unavailable,
|
||||||
}
|
config,
|
||||||
// If allow_signup is undefined or not a boolean, error
|
})
|
||||||
else {
|
}
|
||||||
res.redirect(301,"/")
|
// If allow_signup is undefined or not a boolean, error
|
||||||
console.log("Error, invalid value for allow_signup (bool)")
|
else {
|
||||||
}
|
res.redirect(301,config.site_path)
|
||||||
|
console.log("Error, invalid value for allow_signup (bool)")
|
||||||
|
}
|
||||||
}); // /signup
|
}); // /signup
|
||||||
router.get(`${config.edit_account_base_url}/:user_id`, (req,res) => {
|
|
||||||
const userID = parseInt(req.params.user_id);
|
// edit account
|
||||||
res.render("forms/edit_account", {
|
router.get(`${config.site_path}/${config.edit_account_base_url}/:user_id`, (req,res) => {
|
||||||
config,
|
const userID = parseInt(req.params.user_id);
|
||||||
locale,
|
res.render("forms/edit_account",
|
||||||
user: data.getdata('users', 'id', userID),
|
{
|
||||||
userID
|
config,
|
||||||
});
|
locale,
|
||||||
|
user: data.getdata('users', 'id', userID)[0],
|
||||||
|
userID
|
||||||
|
});
|
||||||
}); // /delete_account
|
}); // /delete_account
|
||||||
router.get(`${config.edit_post_base_url}/:post_id`, (req,res) => {
|
|
||||||
const postID = req.params.post_id
|
// edit post
|
||||||
const post = data.getdata('posts','id', postID)
|
router.get(`${config.site_path}/${config.edit_post_base_url}/:post_id`, (req,res) => {
|
||||||
const user = data.getdata('users', 'id', post.userID)
|
const postID = req.params.post_id
|
||||||
res.render("forms/edit_post", {
|
const post = data.getdata('posts','id', postID)[0]
|
||||||
config,
|
const user = data.getdata('users', 'id', post.userID)[0]
|
||||||
locale,
|
res.render("forms/edit_post",
|
||||||
post,
|
{
|
||||||
postID,
|
config,
|
||||||
user,
|
locale,
|
||||||
});
|
post,
|
||||||
|
postID,
|
||||||
|
user,
|
||||||
|
});
|
||||||
}); // /edit/:post_id
|
}); // /edit/:post_id
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
+22
-22
@@ -6,31 +6,31 @@ 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'),
|
||||||
users: data.getdata('users'),
|
users: data.getdata('users'),
|
||||||
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'),
|
||||||
});
|
});
|
||||||
}); // /index/comments
|
}); // /index/comments
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+119
-118
@@ -9,143 +9,144 @@ 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()
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render("pages/timeline",
|
res.render("pages/timeline",
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
posts: data.getdata("posts"),
|
posts: data.getdata("posts"),
|
||||||
users: data.getdata("users"),
|
users: data.getdata("users"),
|
||||||
comments: data.getdata("comments"),
|
comments: data.getdata("comments"),
|
||||||
hitcount: data.getdata("hitcount"),
|
hitcount: data.getdata("hitcount"),
|
||||||
fromUnixTime,
|
fromUnixTime,
|
||||||
format,
|
format,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
func,
|
func,
|
||||||
})
|
})
|
||||||
}); // /
|
}); // /
|
||||||
|
|
||||||
// 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);
|
||||||
if (userID != -1) {
|
let user = data.getdata('users', 'id', userID)[0];
|
||||||
res.render("pages/user",
|
if (userID != -1) {
|
||||||
{
|
res.render("pages/user",
|
||||||
config,
|
{
|
||||||
locale,
|
config,
|
||||||
posts: data.getdata('posts'),
|
locale,
|
||||||
user,
|
posts,
|
||||||
userID: userID,
|
user,
|
||||||
comments: data.getdata('comments'),
|
userID: userID,
|
||||||
fromUnixTime,
|
comments: data.getdata('comments', 'postID'),
|
||||||
format,
|
fromUnixTime,
|
||||||
getUnixTime,
|
format,
|
||||||
func,
|
getUnixTime,
|
||||||
})
|
func,
|
||||||
}
|
})
|
||||||
else if (userID == -1) {
|
}
|
||||||
res.render("partials/message",
|
else if (userID == -1) {
|
||||||
{
|
res.render("partials/message",
|
||||||
message: locale.user_doesnt_exist,
|
{
|
||||||
config,
|
message: locale.user_doesnt_exist,
|
||||||
})
|
config,
|
||||||
}
|
})
|
||||||
|
}
|
||||||
}); // /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,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (typeof post["deleted"] == "undefined" || post["deleted"] == false) {
|
else if (typeof post["deleted"] == "undefined" || post["deleted"] == false) {
|
||||||
if (config.enable_hitcount) {
|
if (config.enable_hitcount) {
|
||||||
data.increment_hitcount(postID)
|
data.increment_hitcount(postID)
|
||||||
}
|
}
|
||||||
res.render("pages/post",
|
res.render("pages/post",
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
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,
|
||||||
func,
|
func,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Error loading page")
|
console.log("Error loading page")
|
||||||
res.redirect(301,"/")
|
res.redirect(301,config.site_path)
|
||||||
}
|
}
|
||||||
}); // /post/:post_index
|
}); // /post/:post_index
|
||||||
|
|
||||||
|
|
||||||
// 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",
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
tag,
|
tag,
|
||||||
posts: data.getdata('posts'),
|
posts: data.getdata('posts'),
|
||||||
users: data.getdata('users'),
|
users: data.getdata('users'),
|
||||||
comments: data.getdata('comments'),
|
comments: data.getdata('comments'),
|
||||||
fromUnixTime,
|
fromUnixTime,
|
||||||
format,
|
format,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
func,
|
func,
|
||||||
})
|
})
|
||||||
}); // /tag/:tag
|
}); // /tag/:tag
|
||||||
|
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
||||||
let posts_comments = data.getdata('comments', 'id', postID)["comments"]
|
let posts_comments = data.getdata('comments', 'id', postID)[0]["comments"]
|
||||||
let comment = 1
|
let comment = 1
|
||||||
// For loop to find the comment with matching ID
|
// For loop to find the comment with matching ID
|
||||||
posts_comments.forEach((current_comment, index) => {
|
posts_comments.forEach((current_comment, index) => {
|
||||||
if (current_comment.id == commentID) {
|
if (current_comment.id == commentID) {
|
||||||
comment = posts_comments[index]
|
comment = posts_comments[index]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// If comment doesn't exist, show error
|
// If comment doesn't exist, show error
|
||||||
if (comment == 1 || posts_comments == 1) { // Comment of this ID was not found
|
if (comment == 1 || posts_comments == 1) { // Comment of this ID was not found
|
||||||
res.render("partials/message", {
|
res.render("partials/message", {
|
||||||
config,
|
config,
|
||||||
message: locale.comment_doesnt_exist,
|
message: locale.comment_doesnt_exist,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.render("pages/comment",
|
res.render("pages/comment",
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
locale,
|
locale,
|
||||||
comment,
|
comment,
|
||||||
postID,
|
postID,
|
||||||
commentID,
|
commentID,
|
||||||
fromUnixTime,
|
fromUnixTime,
|
||||||
format,
|
format,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
func,
|
func,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
+68
-68
@@ -9,80 +9,80 @@ 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,
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
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", {
|
||||||
config,
|
users: data.getdata('users'),
|
||||||
posts: data.getdata('posts'),
|
config,
|
||||||
func,
|
posts: data.getdata('posts'),
|
||||||
})
|
func,
|
||||||
};
|
})
|
||||||
|
};
|
||||||
});
|
});
|
||||||
// user RSS protocol gets
|
// user RSS protocol gets
|
||||||
router.get("/user/:username/rss", (req,res) => {
|
// TODO specific title field and descriptions??
|
||||||
const username = req.params.username;
|
router.get(`${config.site_path}/user/:username/rss`, (req,res) => {
|
||||||
const userID = func.get_userID(username);
|
const username = req.params.username;
|
||||||
if (config.rss == false) {
|
const user = data.getdata('users','username',username)[0]; // Get the user data
|
||||||
res.render("partials/message", {
|
if (config.rss == false) {
|
||||||
message: locale.rss_disabled,
|
res.render("partials/message", {
|
||||||
config: config,
|
message: locale.rss_disabled,
|
||||||
})
|
config: config,
|
||||||
}
|
})
|
||||||
else {
|
}
|
||||||
res.setHeader('content-type', 'application/rss+xml');
|
else {
|
||||||
res.render("syndication/user_rss", {
|
res.setHeader('content-type', 'application/rss+xml');
|
||||||
config,
|
res.render("syndication/rss", {
|
||||||
posts: data.getdata('posts'),
|
users: [user],
|
||||||
func,
|
config,
|
||||||
userID,
|
posts: data.getdata('posts','id',user['id']),
|
||||||
})
|
func,
|
||||||
};
|
})
|
||||||
|
};
|
||||||
});
|
});
|
||||||
// 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,
|
||||||
config: config,
|
config: config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
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,
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// 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,
|
config: config,
|
||||||
config: config,
|
})
|
||||||
})
|
}
|
||||||
}
|
else {
|
||||||
else {
|
res.setHeader('content-type', 'application/rss+xml');
|
||||||
res.setHeader('content-type', 'application/rss+xml');
|
res.render("syndication/atom", {
|
||||||
res.render("syndication/user_atom", {
|
config,
|
||||||
config,
|
posts: data.getdata('posts'),
|
||||||
posts: data.getdata('posts'),
|
func,
|
||||||
func,
|
getUnixTime,
|
||||||
userID,
|
})
|
||||||
getUnixTime,
|
};
|
||||||
})
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
+42
-40
@@ -15,18 +15,18 @@ config = require('../config.json');
|
|||||||
|
|
||||||
// Import the locale
|
// Import the locale
|
||||||
try {
|
try {
|
||||||
locale = require(`../locales/${config.locale}.json`);
|
locale = require(`../locales/${config.locale}.json`);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log("This locale doesn't exist, if you want to create it then you can create a PR")
|
console.log("This locale doesn't exist, if you want to create it then you can create a PR")
|
||||||
console.log("Locale selected: ", config.locale)
|
console.log("Locale selected: ", config.locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define stuff to do with express (nodejs webserver)
|
// Define stuff to do with express (nodejs webserver)
|
||||||
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')
|
||||||
@@ -46,44 +46,46 @@ app.use('/', form_actions_routes);
|
|||||||
|
|
||||||
function perform_checks()
|
function perform_checks()
|
||||||
{
|
{
|
||||||
console.log("Performing startup checks...")
|
console.log("Performing startup checks...")
|
||||||
exit_flag = false
|
exit_flag = false
|
||||||
required_values = ['site_admin','seperator','site_name','site_url','locale','port','cache_data','allow_signup','site_description','request_data_limit','enable_hitcount','charset','root_path','edit_account_base_url','new_post_url','signup_url','default_commenter_username','rss','atom','date_format','time_zone','css']
|
required_values = ['site_admin','seperator','site_name','site_url','locale','port','cache_data','allow_signup','site_description','request_data_limit','enable_hitcount','charset','root_path','edit_account_base_url','new_post_url','signup_url','default_commenter_username','rss','atom','date_format','time_zone','css']
|
||||||
// Perform some standard checks:
|
// Perform some standard checks:
|
||||||
|
if (config.site_path.slice(-1) == "/") { // cut off a trailing /
|
||||||
|
config.site_path = config.site_path.substring(0,config.site_path.length-1);
|
||||||
|
}
|
||||||
|
|
||||||
// data_storage
|
// data_storage
|
||||||
switch (config.data_storage)
|
switch (config.data_storage)
|
||||||
{
|
{
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'json':
|
case 'json':
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
console.log("[ ERROR ] invalid value in `data_storage`\nPlease modify config.json. Value should be 'mysql' or 'json'.")
|
console.log("[ ERROR ] invalid value in `data_storage`\nPlease modify config.json. Value should be 'mysql' or 'json'.")
|
||||||
exit_flag = true
|
exit_flag = true
|
||||||
}
|
}
|
||||||
// auto_generated
|
// auto_generated
|
||||||
if (config.auto_generated)
|
if (config.auto_generated)
|
||||||
{
|
{
|
||||||
console.log("[ ERROR ] `autogenerated` option set to true\nplease edit the config.json file to include your relevant information, then set to false or remove the autogenerated option.")
|
console.log("[ ERROR ] `autogenerated` option set to true\nplease edit the config.json file to include your relevant information, then set to false or remove the autogenerated option.")
|
||||||
exit_flag = true
|
exit_flag = true
|
||||||
}
|
}
|
||||||
// Check required values are present
|
// Check required values are present
|
||||||
required_values.forEach((value) => { // Use a loop to check each required value is present
|
required_values.forEach((value) => { // Use a loop to check each required value is present
|
||||||
if (typeof config[value] == 'undefined') {
|
if (typeof config[value] == 'undefined') {
|
||||||
exit_flag = true
|
exit_flag = true
|
||||||
console.log(`[ ERROR ] \`${value}\` is undefined\nPlease set it to something, read the documentation for help.`)
|
console.log(`[ ERROR ] \`${value}\` is undefined\nPlease set it to something, read the documentation for help.`)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (exit_flag)
|
if (exit_flag)
|
||||||
{
|
{
|
||||||
console.log("Exiting due to errors.")
|
console.log("Exiting due to errors.")
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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}${config.site_path} webroot: ${config.root_path}`);
|
||||||
console.log("Running in: ", __dirname)
|
console.log("Running in: ", __dirname)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,22 +1,27 @@
|
|||||||
<!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">
|
<div id="main">
|
||||||
<input name="userID" type="hidden" value="<%= userID %>">
|
<header id="site-header">
|
||||||
<label><%= locale.password %>:</label><br/>
|
<%- include("../headers/site_wide") %>
|
||||||
<input type="password" required id="password" name="password"><br/><br/>
|
</header>
|
||||||
|
<form action="<%= config.site_path %>/submit_edit_user" method="POST">
|
||||||
|
<input name="userID" type="hidden" value="<%= userID %>">
|
||||||
|
<label><%= locale.password %>:</label><br/>
|
||||||
|
<input type="password" required id="password" name="password"><br/><br/>
|
||||||
|
|
||||||
<label><%= locale.prettyname %>:</label><br/>
|
<label><%= locale.prettyname %>:</label><br/>
|
||||||
<input name="prettyname" value="<%= user.prettyname %>"><br/><br/>
|
<input name="prettyname" value="<%= user.prettyname %>"><br/><br/>
|
||||||
|
|
||||||
<label><%= locale.description %>:</label><br/>
|
<label><%= locale.description %>:</label><br/>
|
||||||
<textarea name="description"><%= user.description %></textarea><br/><br/>
|
<textarea name="description"><%= user.description %></textarea><br/><br/>
|
||||||
|
|
||||||
<label><%- locale.delete_account_confirmation %>: </label><input type="checkbox" name="agreement"><br/>
|
<label><%- locale.delete_account_confirmation %>: </label><input type="checkbox" name="agreement"><br/>
|
||||||
<input type="submit" value="Submit"><br/>
|
<input type="submit" value="Submit"><br/>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+24
-19
@@ -1,27 +1,32 @@
|
|||||||
<!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_post" method="POST" onsubmit="sha512password()">
|
<div id="main">
|
||||||
<input name="userID" type="hidden" value="<%= post['userID'] %>">
|
<header id="site-header">
|
||||||
<input name="postID" type="hidden" value="<%= postID %>">
|
<%- include("../headers/site_wide") %>
|
||||||
|
</header>
|
||||||
|
<form action="<%= config.site_path %>/submit_edit_post" method="POST" onsubmit="sha512password()">
|
||||||
|
<input name="userID" type="hidden" value="<%= post['userID'] %>">
|
||||||
|
<input name="postID" type="hidden" value="<%= postID %>">
|
||||||
|
|
||||||
<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/>
|
||||||
|
|
||||||
<label><%= locale.title %>:</label><br/>
|
<label><%= locale.title %>:</label><br/>
|
||||||
<input value="<%=post['title'] %>" required name="title"><br/><br/>
|
<input value="<%=post['title'] %>" required name="title"><br/><br/>
|
||||||
|
|
||||||
<label><%= locale.post_content %>:</label><br/>
|
<label><%= locale.post_content %>:</label><br/>
|
||||||
<textarea required name="content"><%= post['content'] %></textarea><br/><br/>
|
<textarea required name="content"><%= post['content'] %></textarea><br/><br/>
|
||||||
|
|
||||||
<label><%= locale.tags %>:</label><br/>
|
<label><%= locale.tags %>:</label><br/>
|
||||||
<input value="<%= post['tags'] %>" name="tags"><br/><br/>
|
<input value="<%= post['tags'] %>" name="tags"><br/><br/>
|
||||||
|
|
||||||
<label>Delete forever (no undo): </label><input name="delete" type="checkbox"><br/>
|
<label>Delete forever (no undo): </label><input name="delete" type="checkbox"><br/>
|
||||||
<input type="submit" value="Submit"><br/>
|
<input type="submit" value="Submit"><br/>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+20
-14
@@ -4,22 +4,28 @@
|
|||||||
<%- include('../partials/head.ejs') %>
|
<%- include('../partials/head.ejs') %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/submit_post" method="POST">
|
<div id="main">
|
||||||
<label><%= locale.username %>:</label><br/>
|
<header id="site-header">
|
||||||
<input required name="username"><br/><br/>
|
<%- include("../headers/site_wide") %>
|
||||||
|
</header>
|
||||||
|
<form action="<%= config.site_path %>/submit_post" method="POST">
|
||||||
|
<label><%= locale.username %>:</label><br/>
|
||||||
|
<input required name="username"><br/><br/>
|
||||||
|
|
||||||
<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/>
|
||||||
|
|
||||||
<label><%= locale.title %>:</label><br/>
|
<label><%= locale.title %>:</label><br/>
|
||||||
<input required name="title"><br/><br/>
|
<input required name="title"><br/><br/>
|
||||||
|
|
||||||
<label><%= locale.post_content %>:</label><br/>
|
<label><%= locale.post_content %>:</label><br/>
|
||||||
<textarea required name="content"></textarea><br/><br/>
|
<textarea required name="content"></textarea><br/><br/>
|
||||||
|
|
||||||
<label><%= locale.tags %>:</label><br/>
|
<label><%= locale.tags %>:</label><br/>
|
||||||
<input name="tags"><br/><br/>
|
<input name="tags"><br/><br/>
|
||||||
|
|
||||||
<input type="submit" value="Submit"><br/>
|
<input type="submit" value="Submit"><br/>
|
||||||
</body>
|
</form>
|
||||||
</form></html>
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
+22
-17
@@ -1,24 +1,29 @@
|
|||||||
<!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_signup" method="POST">
|
<div id="main">
|
||||||
<label><%= locale.username %></label><br/>
|
<header id="site-header">
|
||||||
<input required name="username"><br/><br/>
|
<%- include("../headers/site_wide") %>
|
||||||
|
</header>
|
||||||
|
<form action="<%= config.site_path %>/submit_signup" method="POST">
|
||||||
|
<label><%= locale.username %></label><br/>
|
||||||
|
<input required name="username"><br/><br/>
|
||||||
|
|
||||||
<label><%= locale.prettyname %></label><br/>
|
<label><%= locale.prettyname %></label><br/>
|
||||||
<input required name="prettyname"><br/><br/>
|
<input required name="prettyname"><br/><br/>
|
||||||
|
|
||||||
<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/>
|
||||||
|
|
||||||
<label><%= locale.description %></label><br/>
|
<label><%= locale.description %></label><br/>
|
||||||
<textarea id="description" name="description"></textarea><br/><br/>
|
<textarea id="description" name="description"></textarea><br/><br/>
|
||||||
|
|
||||||
<label><%- locale.signup_agreement %>: </label><input type="checkbox" name="agreement" required><br/>
|
<label><%- locale.signup_agreement %>: </label><input type="checkbox" name="agreement" required><br/>
|
||||||
<input type="submit" value="Submit"><br/>
|
<input type="submit" value="Submit"><br/>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -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 %>
|
||||||
|
|||||||
+46
-44
@@ -1,47 +1,49 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= config.charset %>">
|
<html lang="<%= config.charset %>">
|
||||||
<head>
|
<head>
|
||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Misc:<br/>
|
<div id="main">
|
||||||
<a href="/">Home Page</a><br/>
|
Misc:<br/>
|
||||||
<a href="<%= config.new_post_url %>">New Post Form</a><br/>
|
<a href="<%= config.site_path %>/">Home Page</a><br/>
|
||||||
<a href="<%= config.signup_url %>">Signup Form</a><br/>
|
<a href="<%= config.site_path %><%= config.new_post_url %>">New Post Form</a><br/>
|
||||||
Indexes:<br/>
|
<a href="<%= config.site_path %><%= config.signup_url %>">Signup Form</a><br/>
|
||||||
<a href="/index/posts">Posts Index</a><br/>
|
Indexes:<br/>
|
||||||
<a href="/index/users">Users Index</a><br/>
|
<a href="<%= config.site_path %>/index/posts">Posts Index</a><br/>
|
||||||
<a href="/index/comments">Comments Index</a><br/>
|
<a href="<%= config.site_path %>/index/users">Users Index</a><br/>
|
||||||
Posts:<br/>
|
<a href="<%= config.site_path %>/index/comments">Comments Index</a><br/>
|
||||||
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
Posts:<br/>
|
||||||
<% if (posts[postID]["deleted"] != true) { %>
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
<a href="/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %>/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Comments:<br/>
|
<% }; %>
|
||||||
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
Comments:<br/>
|
||||||
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].length; comment_index++) { %>
|
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
||||||
<a href="/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
|
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].length; comment_index++) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %>/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Users:<br/>
|
<% }; %>
|
||||||
<% for (let userID = 0; userID < users.length; userID++) { %>
|
Users:<br/>
|
||||||
<% if (users[userID]["deleted"] != true) { %>
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
<a href="/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %>/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Edit Posts:<br/>
|
<% }; %>
|
||||||
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
Edit Posts:<br/>
|
||||||
<% if (posts[postID]["deleted"] != true) { %>
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
<a href="<%= config.edit_post_base_url %>/<%= postID %>">Edit <%= posts[postID]["title"] %></a><br/>
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %><%= config.edit_post_base_url %>/<%= postID %>">Edit <%= posts[postID]["title"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
Edit Users:<br/>
|
<% }; %>
|
||||||
<% for (let userID = 0; userID < users.length; userID++) { %>
|
Edit Users:<br/>
|
||||||
<% if (users[userID]["deleted"] != true) { %>
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
<a href="<%= config.edit_account_base_url %>/<%= users[userID]["username"] %>">Edit <%= users[userID]["username"] %></a><br/>
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %><%= config.edit_account_base_url %>/<%= users[userID]["username"] %>">Edit <%= users[userID]["username"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
<!-- TODO add tags -->
|
<% }; %>
|
||||||
</body>
|
<!-- TODO add tags -->
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+12
-10
@@ -1,13 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= config.charset %>">
|
<html lang="<%= config.charset %>">
|
||||||
<head>
|
<head>
|
||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
<div id="main">
|
||||||
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].length; comment_index++) { %>
|
<% for (let postID = 0; postID < comments.length; postID++) { %>
|
||||||
<a href="/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
|
<% for (let comment_index = 0; comment_index < comments[postID]['comments'].length; comment_index++) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %>/comment/<%= postID %>-<%= comment_index %>"><%= postID %>-<%= comment_index %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
</body>
|
<% }; %>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+12
-10
@@ -1,13 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= config.charset %>">
|
<html lang="<%= config.charset %>">
|
||||||
<head>
|
<head>
|
||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
<div id="main">
|
||||||
<% if (posts[postID]["deleted"] != true) { %>
|
<% for (let postID = 0; postID < posts.length; postID++) { %>
|
||||||
<a href="/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
<% if (posts[postID]["deleted"] != true) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %>/post/<%= postID %>"><%= posts[postID]["title"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
</body>
|
<% }; %>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+12
-10
@@ -1,13 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= config.charset %>">
|
<html lang="<%= config.charset %>">
|
||||||
<head>
|
<head>
|
||||||
<%- include("../partials/head") %>
|
<%- include("../partials/head") %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<% for (let userID = 0; userID < users.length; userID++) { %>
|
<div id="main">
|
||||||
<% if (users[userID]["deleted"] != true) { %>
|
<% for (let userID = 0; userID < users.length; userID++) { %>
|
||||||
<a href="/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
<% if (users[userID]["deleted"] != true) { %>
|
||||||
<% }; %>
|
<a href="<%= config.site_path %>/user/<%= users[userID]["username"] %>"><%= users[userID]["username"] %></a><br/>
|
||||||
<% }; %>
|
<% }; %>
|
||||||
</body>
|
<% }; %>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+25
-23
@@ -1,26 +1,28 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header id="site-header">
|
<div id="main">
|
||||||
<%- include("../headers/site_wide") %>
|
<header id="site-header">
|
||||||
</header>
|
<%- include("../headers/site_wide") %>
|
||||||
<div id="comment">
|
</header>
|
||||||
<%- include("../partials/comment"); %>
|
<div id="comment">
|
||||||
</div>
|
<%- include("../partials/comment"); %>
|
||||||
<%- config.seperator %>
|
</div>
|
||||||
<b><%= locale.reply %>:</b>
|
<%- config.seperator %>
|
||||||
<div id="post-commentform">
|
<b><%= locale.reply %>:</b>
|
||||||
<!-- Comment form -->
|
<div id="post-commentform">
|
||||||
<form method="POST" action="/submit_comment">
|
<!-- Comment form -->
|
||||||
<input type="hidden" name="post_index" value="<%= postID %>">
|
<form method="POST" action="/submit_comment">
|
||||||
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
|
<input type="hidden" name="post_index" value="<%= postID %>">
|
||||||
<label><%= locale.comment %>:</label><br/><textarea name="content">>> <%- postID %>-<%- commentID %>
|
<label><%= locale.username %>:</label><br/><input name="name"><br/><br/>
|
||||||
</textarea><br/>
|
<label><%= locale.comment %>:</label><br/><textarea name="content">>> <%- postID %>-<%- commentID %>
|
||||||
<button type="submit"><%= locale.submit %></button>
|
</textarea><br/>
|
||||||
</form>
|
<button type="submit"><%= locale.submit %></button>
|
||||||
</div>
|
</form>
|
||||||
</body>
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+16
-14
@@ -1,17 +1,19 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header id="site-header">
|
<div id="main">
|
||||||
<%- include("../headers/site_wide") %>
|
<header id="site-header">
|
||||||
</header>
|
<%- include("../headers/site_wide") %>
|
||||||
<div id="posts">
|
</header>
|
||||||
<%- include('../posts/post'); %>
|
<div id="posts">
|
||||||
</div>
|
<%- include('../posts/post'); %>
|
||||||
<footer id='footer'>
|
</div>
|
||||||
<%- include('../partials/footer'); %>
|
<footer id='footer'>
|
||||||
</footer>
|
<%- include('../partials/footer'); %>
|
||||||
</body>
|
</footer>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+26
-24
@@ -4,34 +4,36 @@
|
|||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id='site-header'>
|
<div id="main">
|
||||||
<%- include('../headers/site_wide'); %>
|
<div id='site-header'>
|
||||||
</div>
|
<%- include('../headers/site_wide'); %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id='advanced-search'>
|
<div id='advanced-search'>
|
||||||
<form method="GET" action="/search">
|
<form method="GET" action="/search">
|
||||||
<label>Search Term:</label>
|
<label>Search Term:</label>
|
||||||
<input type='text' placeholder='🔍' name='q' value='<%- search_term %>'><br/>
|
<input type='text' placeholder='🔍' name='q' value='<%- search_term %>'><br/>
|
||||||
|
|
||||||
<label>Search for:</label><br/>
|
<label>Search for:</label><br/>
|
||||||
<label>Post:</label>
|
<label>Post:</label>
|
||||||
<input type="checkbox" name="type" value="post" <% if (search_type.includes('post')) {%>checked<% } %>><br/>
|
<input type="checkbox" name="type" value="post" <% if (search_type.includes('post')) {%>checked<% } %>><br/>
|
||||||
<label>User:</label>
|
<label>User:</label>
|
||||||
<input type="checkbox" name="type" value="user" <% if (search_type.includes('user')) {%>checked<% } %>><br/>
|
<input type="checkbox" name="type" value="user" <% if (search_type.includes('user')) {%>checked<% } %>><br/>
|
||||||
|
|
||||||
<input type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%- config.seperator %>
|
<%- config.seperator %>
|
||||||
|
|
||||||
<div id='results'>
|
<div id='results'>
|
||||||
<% search_results.posts.forEach((result, index) => { %>
|
<% search_results.posts.forEach((result, index) => { %>
|
||||||
<a href="/post/<%- result.id %>"><%- result.title %></a><br/>
|
<a href="/post/<%- result.id %>"><%- result.title %></a><br/>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
<% search_results.users.forEach((result, index) => { %>
|
<% search_results.users.forEach((result, index) => { %>
|
||||||
<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>
|
||||||
|
|||||||
+27
-25
@@ -1,28 +1,30 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header id="site-header">
|
<div id="main">
|
||||||
<%- include('../headers/site_wide'); %>
|
<header id="site-header">
|
||||||
</header>
|
<%- include('../headers/site_wide'); %>
|
||||||
<header id='page-header'>
|
</header>
|
||||||
<%- include('../headers/tag'); %>
|
<header id='page-header'>
|
||||||
</header>
|
<%- include('../headers/tag'); %>
|
||||||
<div id="posts">
|
</header>
|
||||||
<% for (let index = posts.length - 1; index >= 0; index--) { %>
|
<div id="posts">
|
||||||
<% if ( posts[index].deleted != true) { %>
|
<% for (let index = posts.length - 1; index >= 0; index--) { %>
|
||||||
<% posts[index].tags.forEach((current_tag, tag_index) => { %>
|
<% if ( posts[index].deleted != true) { %>
|
||||||
<% if (current_tag.toLowerCase() == tag.toLowerCase()) { %>
|
<% posts[index].tags.forEach((current_tag, tag_index) => { %>
|
||||||
<%- include('../posts/tag', {post: posts[index], postID: index, user: users[posts[index].userID], comments: comments[index]}); %>
|
<% if (current_tag.toLowerCase() == tag.toLowerCase()) { %>
|
||||||
<% } %>
|
<%- include('../posts/tag', {post: posts[index], postID: index, user: users[posts[index].userID], comments: comments[index]}); %>
|
||||||
<% }) %>
|
<% } %>
|
||||||
<% } %>
|
<% }) %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
<% } %>
|
||||||
<footer id='footer'>
|
</div>
|
||||||
<%- include('../partials/footer'); %>
|
<footer id='footer'>
|
||||||
</footer>
|
<%- include('../partials/footer'); %>
|
||||||
</body>
|
</footer>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+23
-35
@@ -1,38 +1,26 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header id="site-header">
|
<div id="main">
|
||||||
<%- include("../headers/site_wide") %>
|
<header id="site-header">
|
||||||
</header>
|
<%- include("../headers/site_wide") %>
|
||||||
<header id='page-header'>
|
</header>
|
||||||
<%- include('../headers/timeline'); %>
|
<header id='page-header'>
|
||||||
</header>
|
<%- include('../headers/timeline'); %>
|
||||||
<form method="POST" action="/submit_nothing" style="display:none">
|
</header>
|
||||||
<!-- Form is used to help mitigate spam as it is the first form on the front page -->
|
<div id="posts">
|
||||||
<input type="hidden" name="post_index" value="0">
|
<% for (let index = posts.length - 1; index >= 0; index--) { %>
|
||||||
<input placeholder="username" name="name"><br/>
|
<% if (posts[index]["deleted"] != true) { %>
|
||||||
<textarea placeholder="comment" name="content"></textarea><br/>
|
<%- include('../posts/timeline', {post: posts[index], postID: index, user: users[posts[index].userID], comments: comments[index]}); %>
|
||||||
<button type="submit">Submit</button>
|
<% } %>
|
||||||
</form>
|
<% } %>
|
||||||
<div id="posts">
|
</div>
|
||||||
<% for (let index = posts.length - 1; index >= 0; index--) { %>
|
<footer id='footer'>
|
||||||
<% if (posts[index]["deleted"] != true) { %>
|
<%- include('../partials/footer'); %>
|
||||||
<%- include('../posts/timeline', {post: posts[index], postID: index, user: users[posts[index].userID], comments: comments[index]}); %>
|
</footer>
|
||||||
<% } %>
|
</div>
|
||||||
<% } %>
|
</body>
|
||||||
</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>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+23
-21
@@ -1,24 +1,26 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<%- include('../partials/head'); %>
|
<%- include('../partials/head'); %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header id="site-header">
|
<div id="main">
|
||||||
<%- include("../headers/site_wide") %>
|
<header id="site-header">
|
||||||
</header>
|
<%- include("../headers/site_wide") %>
|
||||||
<header id='page-header'>
|
</header>
|
||||||
<%- include('../headers/user'); %>
|
<header id='page-header'>
|
||||||
</header>
|
<%- include('../headers/user'); %>
|
||||||
<div id="posts">
|
</header>
|
||||||
<% for (let index = posts.length - 1; index >= 0; index--) { %>
|
<div id="posts">
|
||||||
<% if (posts[index].userID == userID) { %>
|
<% for (let index = posts.length - 1; index >= 0; index--) { %>
|
||||||
<%- include('../posts/user', {post: posts[index], postID: index, user: user, comments: comments[index]}); %>
|
<% if (posts[index].userID == userID) { %>
|
||||||
<% } %>
|
<%- include('../posts/user', {post: posts[index], postID: index, user: user, comments: comments[index]}); %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
<% } %>
|
||||||
<footer id='footer'>
|
</div>
|
||||||
<%- include('../partials/footer'); %>
|
<footer id='footer'>
|
||||||
</footer>
|
<%- include('../partials/footer'); %>
|
||||||
</body>
|
</footer>
|
||||||
|
</div>
|
||||||
|
</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 %>">
|
||||||
|
<meta name='robots' content='noindex'>
|
||||||
<title><%= config.site_name %></title>
|
<title><%= config.site_name %></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,16 +15,20 @@
|
|||||||
</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.site_path %>/<%= config.edit_account_base_url %>/<%= user.id %>">
|
||||||
|
<img class='icon' src='<%= config.site_path %>/icons/edit.png' alt='<%= locale.edit_account %>' title='<%= locale.edit_account %>'>
|
||||||
|
</a>
|
||||||
-
|
-
|
||||||
<span id="post-pubdate">
|
<span id="post-pubdate">
|
||||||
<i><%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
|
<i><%= func.unix_time_to_date_format(post.pubdate) %></i><br/>
|
||||||
</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>
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
+6
-2
@@ -30,7 +30,6 @@ a {
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 0px;
|
border-radius: 0px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
@@ -56,7 +55,9 @@ a:hover {
|
|||||||
.comment:nth-child(even) {
|
.comment:nth-child(even) {
|
||||||
background: #1E1E1E;
|
background: #1E1E1E;
|
||||||
}
|
}
|
||||||
|
.named-fence-filename {
|
||||||
|
border: 1px white solid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: light) {
|
@media (prefers-color-scheme: light) {
|
||||||
@@ -70,4 +71,7 @@ a:hover {
|
|||||||
.comment:nth-child(even) {
|
.comment:nth-child(even) {
|
||||||
background: #EEEEEE;
|
background: #EEEEEE;
|
||||||
}
|
}
|
||||||
|
.named-fence-filename {
|
||||||
|
border: 1px black solid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user