Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
clean up code
Tom1a4bc0b989f8
diff --git a/src/app.js b/src/app.jsindex b040bad062..c024e15c0e 100644--- a/src/app.js+++ b/src/app.js@@ -30,10 +30,7 @@ app.use(express.urlencoded({extended: false}));app.use(cookieParser());app.use(express.static(path.join(__dirname, 'public')));app.use('/libraries', express.static(path.join(__dirname, '..', 'libraries')));-/**- * FIXME: is it (~~crazy~~) insecure to expose node_modules globally without auth?- * without out is required for excalidraw-view mode in shared notes- */+// node_modules required for excalidraw-view mode in shared notesapp.use('/node_modules', express.static(path.join(__dirname, '..', 'node_modules')));app.use('/images', express.static(path.join(__dirname, '..', 'images')));const sessionParser = session({diff --git a/src/public/app/widgets/type_widgets/canvas_note.js b/src/public/app/widgets/type_widgets/canvas_note.jsindex d6690405d9..fa8cb1b376 100644--- a/src/public/app/widgets/type_widgets/canvas_note.js+++ b/src/public/app/widgets/type_widgets/canvas_note.js@@ -54,15 +54,6 @@ const TPL = `* (However, using trilium desktop instance, does not care too much about bandwidth. Size increase is probably* acceptable, as a trade off.)*/-/**- * FIXME: Buttons from one excalidraw get activated. Problems with instance?! (maybe it is only visually, once- * mouse is over one instance they change?)- */-/**- * FIXME: FONTS from unpkg.com are loaded. Change font to HELVETICA?- * See: https://www.npmjs.com/package/@excalidraw/excalidraw => FONT_FAMILY- * => window.EXCALIDRAW_ASSET_PATH is set, however svg still contains wrong link (to excalidraw.com)- */export default class ExcalidrawTypeWidget extends TypeWidget {constructor() {super();@@ -418,18 +409,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget {detectScroll: false,handleKeyboardGlobally: false,autoFocus: true,- // renderTopRightUI: () => {- // return React.createElement(- // React.Fragment,- // null,- // React.createElement(- // "div",- // {- // className: "excalidraw-top-right-ui",- // },- // synchronized?"✔️":"⏳ unsaved changes"- // ));- // },onLinkOpen,}))diff --git a/src/routes/api/image.js b/src/routes/api/image.jsindex 78ea0f1249..30e7b9899b 100644--- a/src/routes/api/image.js+++ b/src/routes/api/image.js@@ -20,15 +20,14 @@ function returnImage(req, res) {}/**- * special "image" type. the canvas-note is actually type application/json but can be- * rendered on the fly to svg.+ * special "image" type. the canvas-note is actually type application/json+ * to avoid bitrot and enable usage as referenced image the svg is included.*/if (image.type === 'canvas-note') {- // render the svg in node.js using excalidraw and jsdomconst content = image.getContent();try {const data = JSON.parse(content);-+const svg = data.svg || '<svg />'res.set('Content-Type', "image/svg+xml");res.set("Cache-Control", "no-cache, no-store, must-revalidate");diff --git a/src/share/routes.js b/src/share/routes.jsindex 44d1cd26dd..684dde3e0d 100644--- a/src/share/routes.js+++ b/src/share/routes.js@@ -122,13 +122,14 @@ function register(router) {return res.status(400).send("Requested note is not a shareable image");} else if (image.type === "canvas-note") {/**- * FIXME: deduplicate the code from api/image.js+ * special "image" type. the canvas-note is actually type application/json+ * to avoid bitrot and enable usage as referenced image the svg is included.*/- // render the svg in node.js using excalidraw and jsdomconst content = image.getContent();try {- const data = JSON.parse(content)- const svg = data.svg || '<svg />'+ const data = JSON.parse(content);++ const svg = data.svg || '<svg />';addNoIndexHeader(image, res);res.set('Content-Type', "image/svg+xml");res.set("Cache-Control", "no-cache, no-store, must-revalidate");diff --git a/src/share/shaca/entities/attribute.js b/src/share/shaca/entities/attribute.jsindex 4b486d6da4..9898a5f3b5 100644--- a/src/share/shaca/entities/attribute.js+++ b/src/share/shaca/entities/attribute.js@@ -38,7 +38,8 @@ class Attribute extends AbstractEntity {/*** FIXME: why can we have branch is undefined? issue when- * sharing and not sharing notes? canvas-note specific?+ * sharing and not sharing notes? canvas-note specific?+ * This error occured during development.*/if(branch) {branch.isHidden = true;