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
fix(web-clipper): missing utils import
Elian Doranb5ff71b1a03a
diff --git a/apps/web-clipper/entrypoints/background/index.js b/apps/web-clipper/entrypoints/background/index.jsindex 4492e862b6..e8d3c6d038 100644--- a/apps/web-clipper/entrypoints/background/index.js+++ b/apps/web-clipper/entrypoints/background/index.js@@ -1,3 +1,4 @@+import { randomString } from "../../utils";import TriliumServerFacade, { isDevEnv } from "./trilium_server_facade";export default defineBackground(() => {diff --git a/apps/web-clipper/entrypoints/content/index.js b/apps/web-clipper/entrypoints/content/index.jsindex 99d30ae6a2..6711223841 100644--- a/apps/web-clipper/entrypoints/content/index.js+++ b/apps/web-clipper/entrypoints/content/index.js@@ -1,3 +1,5 @@+import { getBaseUrl, getPageLocationOrigin, randomString } from "../../utils.js";+export default defineContentScript({matches: ["<all_urls>"diff --git a/apps/web-clipper/manifest.json b/apps/web-clipper/manifest.jsonindex 282d5230ab..12694338c9 100644--- a/apps/web-clipper/manifest.json+++ b/apps/web-clipper/manifest.json@@ -16,15 +16,13 @@"content_scripts": [{"js": [- "lib/browser-polyfill.js",- "utils.js"+ "lib/browser-polyfill.js"]}],"background": {"scripts": [- "lib/browser-polyfill.js",- "utils.js"+ "lib/browser-polyfill.js"]},"commands": {diff --git a/apps/web-clipper/utils.js b/apps/web-clipper/utils.jsindex 9ec82b2c23..aab69e12cd 100644--- a/apps/web-clipper/utils.js+++ b/apps/web-clipper/utils.js@@ -1,4 +1,4 @@-function randomString(len) {+export function randomString(len) {let text = "";const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";@@ -9,7 +9,7 @@ function randomString(len) {return text;}-function getBaseUrl() {+export function getBaseUrl() {let output = getPageLocationOrigin() + location.pathname;if (output[output.length - 1] !== '/') {@@ -21,7 +21,7 @@ function getBaseUrl() {return output;}-function getPageLocationOrigin() {+export function getPageLocationOrigin() {// location.origin normally returns the protocol + domain + port (eg. https://example.com:8080)// but for file:// protocol this is browser dependant and in particular Firefox returns "null" in this case.return location.protocol === 'file:' ? 'file://' : location.origin;