There is now a Makefile because I learnt make syntax
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,5 +7,6 @@ config.json
|
|||||||
data.json
|
data.json
|
||||||
hitcount.txt
|
hitcount.txt
|
||||||
*.swp
|
*.swp
|
||||||
data/
|
data
|
||||||
|
webroot
|
||||||
images/*
|
images/*
|
||||||
|
|||||||
41
Makefile
Normal file
41
Makefile
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
DATA_DIR=data
|
||||||
|
WEBROOT_DIR=webroot
|
||||||
|
|
||||||
|
all: config css users posts comments data
|
||||||
|
clean:
|
||||||
|
rm -rf data
|
||||||
|
rm -rf webroot
|
||||||
|
rm -f config.json
|
||||||
|
|
||||||
|
# config file
|
||||||
|
config: config.json
|
||||||
|
config.json:
|
||||||
|
cp example-config.json config.json
|
||||||
|
echo '!!!PLEASE MODIFY config.json ACCORDING TO YOUR NEEDS!!!'
|
||||||
|
|
||||||
|
# custom.css
|
||||||
|
css: $(WEBROOT_DIR)/custom.css
|
||||||
|
$(WEBROOT_DIR)/custom.css:
|
||||||
|
mkdir -p webroot
|
||||||
|
echo '* {\n font-family: sans-serif;\n}' > $(WEBROOT_DIR)/custom.css
|
||||||
|
|
||||||
|
# users.json
|
||||||
|
users: $(DATA_DIR)/users.json
|
||||||
|
$(DATA_DIR)/users.json:
|
||||||
|
mkdir -p data
|
||||||
|
echo '[]' > $(DATA_DIR)/users.json
|
||||||
|
# posts.json
|
||||||
|
posts: $(DATA_DIR)/posts.json
|
||||||
|
$(DATA_DIR)/posts.json:
|
||||||
|
mkdir -p data
|
||||||
|
echo '[]' > $(DATA_DIR)/posts.json
|
||||||
|
# comments.json
|
||||||
|
comments: $(DATA_DIR)/comments.json
|
||||||
|
$(DATA_DIR)/comments.json:
|
||||||
|
mkdir -p data
|
||||||
|
echo '[]' > $(DATA_DIR)/comments.json
|
||||||
|
# data.json
|
||||||
|
data: $(DATA_DIR)/data.json
|
||||||
|
$(DATA_DIR)/data.json:
|
||||||
|
mkdir -p data
|
||||||
|
echo '{"hitcount": 0}' > $(DATA_DIR)/data.json
|
||||||
@@ -2,10 +2,8 @@
|
|||||||
This program is currently just ran manually.<br/>
|
This program is currently just ran manually.<br/>
|
||||||
All you need to do is clone the git repository:<br/>
|
All you need to do is clone the git repository:<br/>
|
||||||
```git clone https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs.git```<br/>
|
```git clone https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs.git```<br/>
|
||||||
Then navigate to /src:<br/>
|
Then run the Makefile:<br/>
|
||||||
```cd src```<br/>
|
```make```
|
||||||
Then run the initialisation function:<br/>
|
|
||||||
```node server.js --first-time```<br/>
|
|
||||||
Then you should modify config.json in / to suit your needs.<br/>
|
Then you should modify config.json in / to suit your needs.<br/>
|
||||||
# Running
|
# Running
|
||||||
I would reccomend running the program in tmux so it does not stop running when you close the terminal window.<br/>
|
I would reccomend running the program in tmux so it does not stop running when you close the terminal window.<br/>
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
import { createRequire } from 'module';
|
|
||||||
const require = createRequire(import.meta.url)
|
|
||||||
// Initialise the program by creating users.js, comments.js, posts.js and config.js
|
|
||||||
// All require default content in them to start off with
|
|
||||||
// Then exit successfully
|
|
||||||
// returns nothing
|
|
||||||
export function initialise() {
|
|
||||||
const fs = require("fs");
|
|
||||||
try {
|
|
||||||
const users = require("../data/users.json");
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("Creating users file")
|
|
||||||
fs.writeFileSync(`../data/users.json`, `[]`)
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const posts = require("../data/posts.json");
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("Creating posts file")
|
|
||||||
fs.writeFileSync(`../data/posts.json`, `[]`)
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const comments = require("../data/comments.json");
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("Creating comments file")
|
|
||||||
fs.writeFileSync(`../data/comments.json`, `[]`)
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const comments = require("../data/data.json");
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("Creating generic data file")
|
|
||||||
fs.writeFileSync(`../data/data.json`, `{"hitcount": 0}`)
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const config = require("../config.json");
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log("Copying the example config to config.js")
|
|
||||||
console.log("!!! PLEASE MODIFY config.json TO YOUR NEEDS !!!")
|
|
||||||
fs.copyFile('../example-config.json', '../config.json', (err) => {
|
|
||||||
console.log("Error copying file")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Successfully initialised")
|
|
||||||
process.exit(0)
|
|
||||||
}
|
|
||||||
@@ -10,15 +10,8 @@ const { fromUnixTime, format, getUnixTime } = require("date-fns") // A date util
|
|||||||
const ejs = require("ejs")
|
const ejs = require("ejs")
|
||||||
const func = require("./functions.js")
|
const func = require("./functions.js")
|
||||||
const data = require("./data.js")
|
const data = require("./data.js")
|
||||||
const init = require("./initialise.js")
|
|
||||||
|
|
||||||
|
|
||||||
// There's only one possible argument, so we can just check if the user passed that one
|
|
||||||
// TODO I plan on adding more such as --help and --post so I should make this more robust at some point
|
|
||||||
if (process.argv[2] == "--first-time") {
|
|
||||||
init.initialise() // Creates any files such users.js, posts.js, comments.js or config.js if they are not present
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define the modules now so they are global
|
// Define the modules now so they are global
|
||||||
let users // contains a list of users, each user is an object containing username,prettyname,hash and description
|
let users // contains a list of users, each user is an object containing username,prettyname,hash and description
|
||||||
let posts // contains a list of posts,
|
let posts // contains a list of posts,
|
||||||
@@ -37,7 +30,7 @@ if (config["data_storage"] == "json") {
|
|||||||
// if they don't all import then
|
// if they don't all import then
|
||||||
// inform the user to pass --first-time and exit with an error code
|
// inform the user to pass --first-time and exit with an error code
|
||||||
console.log("A file is missing!")
|
console.log("A file is missing!")
|
||||||
console.log("Run with --first-time to initialise the program")
|
console.log("Run 'make' to initialise the data files")
|
||||||
console.log(error)
|
console.log(error)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
/* Put any CSS you want in here, it will be applied to the whole website */
|
|
||||||
* {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
User-agent: AddSearchBot
|
|
||||||
User-agent: AI2Bot
|
|
||||||
User-agent: Ai2Bot-Dolma
|
|
||||||
User-agent: aiHitBot
|
|
||||||
User-agent: Amazonbot
|
|
||||||
User-agent: Andibot
|
|
||||||
User-agent: anthropic-ai
|
|
||||||
User-agent: Applebot
|
|
||||||
User-agent: Applebot-Extended
|
|
||||||
User-agent: Awario
|
|
||||||
User-agent: bedrockbot
|
|
||||||
User-agent: bigsur.ai
|
|
||||||
User-agent: Brightbot 1.0
|
|
||||||
User-agent: Bytespider
|
|
||||||
User-agent: CCBot
|
|
||||||
User-agent: ChatGPT Agent
|
|
||||||
User-agent: ChatGPT-User
|
|
||||||
User-agent: Claude-SearchBot
|
|
||||||
User-agent: Claude-User
|
|
||||||
User-agent: Claude-Web
|
|
||||||
User-agent: ClaudeBot
|
|
||||||
User-agent: CloudVertexBot
|
|
||||||
User-agent: cohere-ai
|
|
||||||
User-agent: cohere-training-data-crawler
|
|
||||||
User-agent: Cotoyogi
|
|
||||||
User-agent: Crawlspace
|
|
||||||
User-agent: Datenbank Crawler
|
|
||||||
User-agent: DeepSeekBot
|
|
||||||
User-agent: Devin
|
|
||||||
User-agent: Diffbot
|
|
||||||
User-agent: DuckAssistBot
|
|
||||||
User-agent: Echobot Bot
|
|
||||||
User-agent: EchoboxBot
|
|
||||||
User-agent: FacebookBot
|
|
||||||
User-agent: facebookexternalhit
|
|
||||||
User-agent: Factset_spyderbot
|
|
||||||
User-agent: FirecrawlAgent
|
|
||||||
User-agent: FriendlyCrawler
|
|
||||||
User-agent: Gemini-Deep-Research
|
|
||||||
User-agent: Google-CloudVertexBot
|
|
||||||
User-agent: Google-Extended
|
|
||||||
User-agent: Google-Firebase
|
|
||||||
User-agent: GoogleAgent-Mariner
|
|
||||||
User-agent: GoogleOther
|
|
||||||
User-agent: GoogleOther-Image
|
|
||||||
User-agent: GoogleOther-Video
|
|
||||||
User-agent: GPTBot
|
|
||||||
User-agent: iaskspider/2.0
|
|
||||||
User-agent: ICC-Crawler
|
|
||||||
User-agent: ImagesiftBot
|
|
||||||
User-agent: img2dataset
|
|
||||||
User-agent: ISSCyberRiskCrawler
|
|
||||||
User-agent: Kangaroo Bot
|
|
||||||
User-agent: LinerBot
|
|
||||||
User-agent: meta-externalagent
|
|
||||||
User-agent: Meta-ExternalAgent
|
|
||||||
User-agent: meta-externalfetcher
|
|
||||||
User-agent: Meta-ExternalFetcher
|
|
||||||
User-agent: meta-webindexer
|
|
||||||
User-agent: MistralAI-User
|
|
||||||
User-agent: MistralAI-User/1.0
|
|
||||||
User-agent: MyCentralAIScraperBot
|
|
||||||
User-agent: netEstate Imprint Crawler
|
|
||||||
User-agent: NovaAct
|
|
||||||
User-agent: OAI-SearchBot
|
|
||||||
User-agent: omgili
|
|
||||||
User-agent: omgilibot
|
|
||||||
User-agent: OpenAI
|
|
||||||
User-agent: Operator
|
|
||||||
User-agent: PanguBot
|
|
||||||
User-agent: Panscient
|
|
||||||
User-agent: panscient.com
|
|
||||||
User-agent: Perplexity-User
|
|
||||||
User-agent: PerplexityBot
|
|
||||||
User-agent: PetalBot
|
|
||||||
User-agent: PhindBot
|
|
||||||
User-agent: Poseidon Research Crawler
|
|
||||||
User-agent: QualifiedBot
|
|
||||||
User-agent: QuillBot
|
|
||||||
User-agent: quillbot.com
|
|
||||||
User-agent: SBIntuitionsBot
|
|
||||||
User-agent: Scrapy
|
|
||||||
User-agent: SemrushBot-OCOB
|
|
||||||
User-agent: SemrushBot-SWA
|
|
||||||
User-agent: ShapBot
|
|
||||||
User-agent: Sidetrade indexer bot
|
|
||||||
User-agent: TerraCotta
|
|
||||||
User-agent: Thinkbot
|
|
||||||
User-agent: TikTokSpider
|
|
||||||
User-agent: Timpibot
|
|
||||||
User-agent: VelenPublicWebCrawler
|
|
||||||
User-agent: WARDBot
|
|
||||||
User-agent: Webzio-Extended
|
|
||||||
User-agent: wpbot
|
|
||||||
User-agent: YaK
|
|
||||||
User-agent: YandexAdditional
|
|
||||||
User-agent: YandexAdditionalBot
|
|
||||||
User-agent: YouBot
|
|
||||||
Disallow: /
|
|
||||||
Reference in New Issue
Block a user