This commit is contained in:
Leandro Facchinetti 2022-11-02 19:09:06 +00:00
parent a63c2a5d6a
commit bf28279d50
16 changed files with 38 additions and 7794 deletions

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,35 +0,0 @@
module.exports = async (require) => {
const path = require("path");
const express = require("express");
const AutoEncrypt = require("@small-tech/auto-encrypt");
const killTheNewsletter = require(".").default;
const { webApplication, emailApplication } = killTheNewsletter(
path.join(__dirname, "data")
);
webApplication.set("url", "https://kill-the-newsletter.com");
webApplication.set("email", "smtp://kill-the-newsletter.com");
webApplication.set("administrator", "mailto:kill-the-newsletter@leafac.com");
const reverseProxy = express();
reverseProxy.use((req, res, next) => {
if (req.hostname !== new URL(webApplication.get("url")).hostname)
return res.redirect(`${webApplication.get("url")}${req.originalUrl}`);
next();
});
reverseProxy.use(webApplication);
AutoEncrypt.https
.createServer(
{
domains: ["kill-the-newsletter.com", "www.kill-the-newsletter.com"],
settingsPath: path.join(__dirname, "data/keys/tls"),
},
reverseProxy
)
.listen(443);
emailApplication.listen(25, () => {
console.log("Email server started");
});
};

View File

@ -1,12 +0,0 @@
[Unit]
Description=Kill the Newsletter!
After=network.target
[Service]
ExecStart=/root/kill-the-newsletter/kill-the-newsletter /root/kill-the-newsletter/configuration.js
Environment=NODE_ENV=production
User=root
Restart=always
[Install]
WantedBy=multi-user.target

7734
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,9 +22,16 @@
"license": "MIT", "license": "MIT",
"bin": "./build/index.mjs", "bin": "./build/index.mjs",
"scripts": { "scripts": {
"start": "node-dev source/index.ts", "postinstall": "(cd ./server/ && npm install && cd ..) && (cd ./static/ && npm install && cd ..)",
"test": "prettier --check \"source/**/*\" --end-of-line auto && jest", "prepare": "(cd ./server/ && npm run prepare && cd ..) && (cd ./static/ && npm run prepare && cd ..)",
"prepare": "tsc" "start": "nodemon --watch \"./server/**/*.mts\" --watch \"./static/{{prepare,leafac--javascript}.mjs,**/*.{png,jpeg,ico}}\" --watch \"./configuration/**/*.mjs\" --ext \"*\" --exec \"npm run prepare && node ./build/server/index.mjs ./configuration/development.mjs\"",
"start:clean:data": "npm run clean:data && npm run start",
"test": "prettier --check \"./server/**/*.mts\" --check \"./static/prepare.mjs\" --check \"./configuration/**/*.mjs\" --end-of-line auto",
"clean:all": "npm run clean:build && npm run clean:data && npm run clean:node_modules",
"clean:build": "shx rm -rf ./build/",
"clean:data": "shx rm -rf ./data/",
"clean:node_modules": "shx rm -rf ./node_modules/ ./server/node_modules/ ./static/node_modules/",
"update": "npm-check-updates --upgrade && (cd ./server/ && npm-check-updates --upgrade && cd ..) && (cd ./static/ && npm-check-updates --upgrade && cd ..) && npm install"
}, },
"dependencies": { "dependencies": {
"@leafac/caddy": "^1.0.5", "@leafac/caddy": "^1.0.5",
@ -39,17 +46,10 @@
"smtp-server": "^3.11.0" "smtp-server": "^3.11.0"
}, },
"devDependencies": { "devDependencies": {
"@types/express": "^4.17.14",
"@types/mailparser": "^3.4.0",
"@types/node": "^18.11.9",
"@types/nodemailer": "^6.4.6",
"@types/smtp-server": "^3.5.7",
"caxa": "^3.0.1", "caxa": "^3.0.1",
"esbuild": "^0.15.12",
"got": "^12.5.2", "got": "^12.5.2",
"nodemailer": "^6.8.0", "nodemailer": "^6.8.0",
"nodemon": "^2.0.20", "nodemon": "^2.0.20",
"prettier": "^2.7.1", "prettier": "^2.7.1"
"typescript": "^4.8.4"
} }
} }

1
server/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules/

0
server/index.mts Normal file
View File

10
server/package.json Normal file
View File

@ -0,0 +1,10 @@
{
"devDependencies": {
"@types/express": "^4.17.14",
"@types/mailparser": "^3.4.0",
"@types/node": "^18.11.9",
"@types/nodemailer": "^6.4.6",
"@types/smtp-server": "^3.5.7",
"typescript": "^4.8.4"
}
}

View File

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"rootDir": "./source/", "rootDir": "./",
"outDir": "./build/", "outDir": "../build/server/",
"module": "ESNext", "module": "ESNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",

1
static/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules/

12
static/package.json Normal file
View File

@ -0,0 +1,12 @@
{
"scripts": {
"prepare": "node ./prepare.mjs"
},
"dependencies": {
"@fontsource/jetbrains-mono": "^4.5.11",
"tippy.js": "^6.3.7"
},
"devDependencies": {
"esbuild": "^0.15.12"
}
}

1
static/prepare.mjs Normal file
View File

@ -0,0 +1 @@
console.log("BUILD STATIC BUNDLE");