From 177a7bb6375e32afd540bb98ac572ea59d1db11e Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 3 Feb 2026 16:32:14 -0700 Subject: [PATCH] Make the API publicly accessible (closes #25) --- module/api.mjs | 5 ++--- module/hooks/init.mjs | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/module/api.mjs b/module/api.mjs index 569529e..5d4dc5e 100644 --- a/module/api.mjs +++ b/module/api.mjs @@ -5,7 +5,7 @@ import { ArtistBrowser } from "./apps/ArtistBrowser.mjs"; import { ImageApp } from "./apps/ImageApp.mjs"; // Utils -import { getFile, hashFile, lastModifiedAt, uploadJson } from "./utils/fs.mjs"; +import { getFileSize, hashFile, lastModifiedAt } from "./utils/fs.mjs"; const { deepFreeze } = foundry.utils; @@ -20,8 +20,7 @@ export const api = deepFreeze({ fs: { hashFile, lastModifiedAt, - getFile, - uploadJson, + getFileSize, }, }, }); diff --git a/module/hooks/init.mjs b/module/hooks/init.mjs index d226b33..62cd8c4 100644 --- a/module/hooks/init.mjs +++ b/module/hooks/init.mjs @@ -1,5 +1,7 @@ +import { api } from "../api.mjs"; import { ArtSidebar } from "../apps/ArtSidebar.mjs"; import { registerCustomComponents } from "../apps/elements/_index.mjs"; +import { __ID__ } from "../consts.mjs"; import helpers from "../handlebarsHelpers/_index.mjs"; import { registerUserSettings } from "../settings/user.mjs"; @@ -20,4 +22,6 @@ Hooks.on(`init`, () => { const temp = CONFIG.ui.sidebar.TABS.settings; delete CONFIG.ui.sidebar.TABS.settings; CONFIG.ui.sidebar.TABS.settings = temp; + + game.modules.get(__ID__).api = api; });