Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 3aa38b9

Browse files
committed
server: Address requested changes
1 parent 45bf75b commit 3aa38b9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/routes/api/image.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Request, Response } from 'express';
77
import BNote from "../../becca/entities/bnote.js";
88
import BRevision from "../../becca/entities/brevision.js";
99
import { AppRequest } from '../route-interface';
10-
import resource_dir from "../../services/resource_dir.js";
10+
import { RESOURCE_DIR } from "../../services/resource_dir.js";
1111

1212
function returnImageFromNote(req: Request, res: Response) {
1313
const image = becca.getNote(req.params.noteId);
@@ -24,7 +24,7 @@ function returnImageFromRevision(req: Request, res: Response) {
2424
function returnImageInt(image: BNote | BRevision | null, res: Response) {
2525
if (!image) {
2626
res.set('Content-Type', 'image/png');
27-
return res.send(fs.readFileSync(`${resource_dir.RESOURCE_DIR}/db/image-deleted.png`));
27+
return res.send(fs.readFileSync(`${RESOURCE_DIR}/db/image-deleted.png`));
2828
} else if (!["image", "canvas", "mermaid"].includes(image.type)) {
2929
return res.sendStatus(400);
3030
}
@@ -66,7 +66,7 @@ function returnAttachedImage(req: Request, res: Response) {
6666

6767
if (!attachment) {
6868
res.set('Content-Type', 'image/png');
69-
return res.send(fs.readFileSync(`${resource_dir.RESOURCE_DIR}/db/image-deleted.png`));
69+
return res.send(fs.readFileSync(`${RESOURCE_DIR}/db/image-deleted.png`));
7070
}
7171

7272
if (!["image"].includes(attachment.role)) {

src/services/export/zip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import AttachmentMeta from "../meta/attachment_meta.js";
2020
import AttributeMeta from "../meta/attribute_meta.js";
2121
import BBranch from "../../becca/entities/bbranch.js";
2222
import { Response } from 'express';
23-
import resource_dir from "../resource_dir.js";
23+
import { RESOURCE_DIR } from "../resource_dir.js";
2424

2525
async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "html" | "markdown", res: Response | fs.WriteStream, setHeaders = true) {
2626
if (!['html', 'markdown'].includes(format)) {
@@ -473,7 +473,7 @@ ${markdownContent}`;
473473
}
474474

475475
function saveCss(rootMeta: NoteMeta, cssMeta: NoteMeta) {
476-
const cssContent = fs.readFileSync(`${resource_dir.RESOURCE_DIR}/libraries/ckeditor/ckeditor-content.css`);
476+
const cssContent = fs.readFileSync(`${RESOURCE_DIR}/libraries/ckeditor/ckeditor-content.css`);
477477

478478
archive.append(cssContent, { name: cssMeta.dataFileName });
479479
}

src/services/resource_dir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import log from "./log.js";
22
import path from "path";
33
import fs from "fs";
44

5-
const RESOURCE_DIR = path.resolve(__dirname, "../..");
5+
export const RESOURCE_DIR = path.resolve(__dirname, "../..");
66

77
// where the "trilium" executable is
88
const ELECTRON_APP_ROOT_DIR = path.resolve(RESOURCE_DIR, "../..");

0 commit comments

Comments
 (0)