diff --git a/server.py b/server.py index cfc103cb..64b2f70a 100644 --- a/server.py +++ b/server.py @@ -5,6 +5,7 @@ import nodes import execution import uuid import json +import glob try: import aiohttp @@ -52,6 +53,11 @@ class PromptServer(): async def get_root(request): return web.FileResponse(os.path.join(self.web_root, "index.html")) + @routes.get("/extensions") + async def get_extensions(request): + files = glob.glob(os.path.join(self.web_root, 'extensions/**/*.js'), recursive=True) + return web.json_response(list(map(lambda f: "/" + os.path.relpath(f, self.web_root).replace("\\", "/"), files))) + @routes.get("/view/{file}") async def view_image(request): if "file" in request.match_info: diff --git a/web/extensions/logging.js.example b/web/extensions/logging.js.example index ce0b346e..d015096a 100644 --- a/web/extensions/logging.js.example +++ b/web/extensions/logging.js.example @@ -1,6 +1,7 @@ import { app } from "../scripts/app.js"; const ext = { + // Unique name for the extension name: "Example.LoggingExtension", async init(app) { // Any initial setup to run as soon as the page loads diff --git a/web/index.html b/web/index.html index 1236d754..cd95594f 100644 --- a/web/index.html +++ b/web/index.html @@ -6,9 +6,6 @@