This commit is contained in:
parent
002be23176
commit
5525d199da
56
src/index.ts
56
src/index.ts
|
@ -428,31 +428,10 @@ export default function killTheNewsletter(
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const emailApplication = new SMTPServer();
|
const emailApplication = new SMTPServer({
|
||||||
|
|
||||||
function newReference(): string {
|
|
||||||
return cryptoRandomString({
|
|
||||||
length: 16,
|
|
||||||
characters: "abcdefghijklmnopqrstuvwxyz0123456789",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return { webApplication, emailApplication };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (require.main === module) {
|
|
||||||
console.log(`Kill the Newsletter!/${VERSION}`);
|
|
||||||
const configurationFile = path.resolve(
|
|
||||||
process.argv[2] ?? path.join(process.cwd(), "configuration.js")
|
|
||||||
);
|
|
||||||
require(configurationFile)(require);
|
|
||||||
console.log(`Configuration file loaded from ‘${configurationFile}’.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
export const emailServer = new SMTPServer({
|
|
||||||
disabledCommands: ["AUTH", "STARTTLS"],
|
disabledCommands: ["AUTH", "STARTTLS"],
|
||||||
async onData(stream, session, callback) {
|
async onData(stream, session, callback) {
|
||||||
|
/*
|
||||||
try {
|
try {
|
||||||
const email = await mailparser.simpleParser(stream);
|
const email = await mailparser.simpleParser(stream);
|
||||||
const content =
|
const content =
|
||||||
|
@ -489,14 +468,18 @@ export const emailServer = new SMTPServer({
|
||||||
X(email.from?.text ?? ""),
|
X(email.from?.text ?? ""),
|
||||||
X(content)
|
X(content)
|
||||||
);
|
);
|
||||||
const firstEntry = document.querySelector("feed > entry:first-of-type");
|
const firstEntry = document.querySelector(
|
||||||
|
"feed > entry:first-of-type"
|
||||||
|
);
|
||||||
if (firstEntry === null)
|
if (firstEntry === null)
|
||||||
document
|
document
|
||||||
.querySelector("feed")!
|
.querySelector("feed")!
|
||||||
.insertAdjacentHTML("beforeend", renderedEntry);
|
.insertAdjacentHTML("beforeend", renderedEntry);
|
||||||
else firstEntry.insertAdjacentHTML("beforebegin", renderedEntry);
|
else firstEntry.insertAdjacentHTML("beforebegin", renderedEntry);
|
||||||
while (feed.serialize().length > 500_000) {
|
while (feed.serialize().length > 500_000) {
|
||||||
const lastEntry = document.querySelector("feed > entry:last-of-type");
|
const lastEntry = document.querySelector(
|
||||||
|
"feed > entry:last-of-type"
|
||||||
|
);
|
||||||
if (lastEntry === null) break;
|
if (lastEntry === null) break;
|
||||||
lastEntry.remove();
|
lastEntry.remove();
|
||||||
}
|
}
|
||||||
|
@ -514,6 +497,25 @@ export const emailServer = new SMTPServer({
|
||||||
stream.resume();
|
stream.resume();
|
||||||
callback(new Error("Failed to receive message. Please try again."));
|
callback(new Error("Failed to receive message. Please try again."));
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}).listen(EMAIL_PORT);
|
|
||||||
*/
|
*/
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function newReference(): string {
|
||||||
|
return cryptoRandomString({
|
||||||
|
length: 16,
|
||||||
|
characters: "abcdefghijklmnopqrstuvwxyz0123456789",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { webApplication, emailApplication };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
console.log(`Kill the Newsletter!/${VERSION}`);
|
||||||
|
const configurationFile = path.resolve(
|
||||||
|
process.argv[2] ?? path.join(process.cwd(), "configuration.js")
|
||||||
|
);
|
||||||
|
require(configurationFile)(require);
|
||||||
|
console.log(`Configuration file loaded from ‘${configurationFile}’.`);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue