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();
|
||||
|
||||
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}’.`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue