This commit is contained in:
parent
dc22ea9d74
commit
52998ba443
|
@ -13,7 +13,6 @@
|
|||
"@leafac/sqlite": "^1.1.2",
|
||||
"@leafac/sqlite-migration": "^1.0.3",
|
||||
"crypto-random-string": "^3.3.1",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"express": "^4.17.1",
|
||||
"fs-extra": "^9.1.0",
|
||||
"mailparser": "^3.1.0",
|
||||
|
@ -2973,17 +2972,6 @@
|
|||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||
},
|
||||
"node_modules/escape-string-regexp": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/escodegen": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz",
|
||||
|
@ -11407,11 +11395,6 @@
|
|||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="
|
||||
},
|
||||
"escodegen": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz",
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
"@leafac/sqlite": "^1.1.2",
|
||||
"@leafac/sqlite-migration": "^1.0.3",
|
||||
"crypto-random-string": "^3.3.1",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"express": "^4.17.1",
|
||||
"fs-extra": "^9.1.0",
|
||||
"mailparser": "^3.1.0",
|
||||
|
|
14
src/index.ts
14
src/index.ts
|
@ -4,7 +4,6 @@ import path from "path";
|
|||
import express from "express";
|
||||
import { SMTPServer } from "smtp-server";
|
||||
import mailparser from "mailparser";
|
||||
import escapeStringRegexp from "escape-string-regexp";
|
||||
import fs from "fs-extra";
|
||||
import cryptoRandomString from "crypto-random-string";
|
||||
import { html, HTML } from "@leafac/html";
|
||||
|
@ -48,6 +47,12 @@ export default function killTheNewsletter(
|
|||
"author" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TRIGGER "feedsUpdatedAt"
|
||||
AFTER INSERT ON "entries"
|
||||
BEGIN
|
||||
UPDATE "feeds" SET "updatedAt" = datetime('now') WHERE "id" = "NEW"."feed";
|
||||
END;
|
||||
`,
|
||||
]);
|
||||
|
||||
|
@ -458,12 +463,7 @@ export default function killTheNewsletter(
|
|||
)
|
||||
`
|
||||
);
|
||||
// TODO: Do this with a trigger.
|
||||
database.run(
|
||||
sql`UPDATE "feeds" SET "updatedAt" = datetime('now') WHERE "id" = ${feed.id}`
|
||||
);
|
||||
|
||||
while (renderFeed(feedReference)!.length > 500_00)
|
||||
while (renderFeed(feedReference)!.length > 500_000)
|
||||
database.run(
|
||||
sql`DELETE FROM "entries" WHERE "feed" = ${feed.id} ORDER BY "createdAt" ASC LIMIT 1`
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue