diff --git a/insert/env/fs.mjs b/insert/env/fs.mjs index ab72280..6f913f9 100644 --- a/insert/env/fs.mjs +++ b/insert/env/fs.mjs @@ -32,7 +32,9 @@ export const localPath = (path) => `notion://www.notion.so/__notion-enhancer/${p * @returns {object} the json value of the requested file as a js object */ export const getJSON = (path, opts = {}) => { - if (path.startsWith('http')) return fetch(path, opts).then((res) => res.json()); + path = path.replace(/^https:\/\/www\.notion\.so\//, 'notion://www.notion.so/'); + const networkPath = path.startsWith('http') || path.startsWith('notion://'); + if (networkPath) return fetch(path, opts).then((res) => res.json()); try { return globalThis.__enhancerElectronApi.nodeRequire(`notion-enhancer/${path}`); } catch (err) { @@ -47,7 +49,9 @@ export const getJSON = (path, opts = {}) => { * @returns {string} the text content of the requested file */ export const getText = (path, opts = {}) => { - if (path.startsWith('http')) return fetch(path, opts).then((res) => res.text()); + path = path.replace(/^https:\/\/www\.notion\.so\//, 'notion://www.notion.so/'); + const networkPath = path.startsWith('http') || path.startsWith('notion://'); + if (networkPath) return fetch(path, opts).then((res) => res.text()); try { const fs = globalThis.__enhancerElectronApi.nodeRequire('fs'); return fs.readFileSync(notionPath(`notion-enhancer/${path}`)); diff --git a/insert/repo b/insert/repo index 33d70f9..5a03954 160000 --- a/insert/repo +++ b/insert/repo @@ -1 +1 @@ -Subproject commit 33d70f998901cf1c9cbf857f68c1d2bf4d5c8ceb +Subproject commit 5a039543b275503ee0df6a888390821dae9807b4