${this.profile && html`
`}
diff --git a/src/env.ts b/src/env.ts
index dc356af..d6389a3 100644
--- a/src/env.ts
+++ b/src/env.ts
@@ -24,7 +24,7 @@ const NSITE_HOST = process.env.NSITE_HOST || "0.0.0.0";
const NSITE_PORT = process.env.NSITE_PORT ? parseInt(process.env.NSITE_PORT) : 3000;
const HOST = `${NSITE_HOST}:${NSITE_PORT}`;
-const ENABLE_SCREENSHOTS = process.env.SCREENSHOTS_DIR !== "false";
+const ENABLE_SCREENSHOTS = process.env.ENABLE_SCREENSHOTS === "true";
const SCREENSHOTS_DIR = process.env.SCREENSHOTS_DIR || "./screenshots";
export {
diff --git a/src/index.ts b/src/index.ts
index dd8068c..d715361 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -25,7 +25,6 @@ import {
import { userDomains, userRelays, userServers } from "./cache.js";
import { invalidatePubkeyPath } from "./nginx.js";
import pool, { getUserOutboxes, subscribeForEvents } from "./nostr.js";
-import { getScreenshotPath, hasScreenshot, removeScreenshot, takeScreenshot } from "./screenshots.js";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -165,6 +164,7 @@ if (ENABLE_SCREENSHOTS) {
const [pubkey, etx] = basename(ctx.path).split(".");
if (pubkey) {
+ const { hasScreenshot, takeScreenshot, getScreenshotPath } = await import("./screenshots.js");
if (!(await hasScreenshot(pubkey))) await takeScreenshot(pubkey);
await send(ctx, getScreenshotPath(pubkey));
@@ -190,7 +190,8 @@ if (SUBSCRIPTION_RELAYS.length > 0) {
}
// invalidate screenshot for nsite
- if ((ENABLE_SCREENSHOTS && nsite.path === "/") || nsite.path === "/index.html") {
+ if (ENABLE_SCREENSHOTS && (nsite.path === "/" || nsite.path === "/index.html")) {
+ const { removeScreenshot } = await import("./screenshots.js");
await removeScreenshot(nsite.pubkey);
}
}