This commit is contained in:
Leandro Facchinetti 2021-03-11 11:22:54 +00:00
parent 002be23176
commit 5525d199da
1 changed files with 72 additions and 70 deletions

View File

@ -428,31 +428,10 @@ export default function killTheNewsletter(
);
});
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({
const emailApplication = new SMTPServer({
disabledCommands: ["AUTH", "STARTTLS"],
async onData(stream, session, callback) {
/*
try {
const email = await mailparser.simpleParser(stream);
const content =
@ -489,14 +468,18 @@ export const emailServer = new SMTPServer({
X(email.from?.text ?? ""),
X(content)
);
const firstEntry = document.querySelector("feed > entry:first-of-type");
const firstEntry = document.querySelector(
"feed > entry:first-of-type"
);
if (firstEntry === null)
document
.querySelector("feed")!
.insertAdjacentHTML("beforeend", renderedEntry);
else firstEntry.insertAdjacentHTML("beforebegin", renderedEntry);
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;
lastEntry.remove();
}
@ -514,6 +497,25 @@ export const emailServer = new SMTPServer({
stream.resume();
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}.`);
}