From 2eda5beb923f8c64d9012f4d222f87ca06f8a3d9 Mon Sep 17 00:00:00 2001 From: Gusti Triandi Winata Date: Wed, 20 Oct 2021 23:55:48 +0700 Subject: [PATCH] Starter code for A sample using native code that communicates with a plugin via websocket #50 --- io-websocket-fastapi-example/README.md | 1 + io-websocket-fastapi-example/plugin/index.html | 9 +++++++++ io-websocket-fastapi-example/plugin/index.js | 4 ++++ io-websocket-fastapi-example/plugin/manifest.json | 11 +++++++++++ io-websocket-fastapi-example/server/main.py | 8 ++++++++ io-websocket-fastapi-example/server/requirements.txt | 2 ++ 6 files changed, 35 insertions(+) create mode 100644 io-websocket-fastapi-example/README.md create mode 100644 io-websocket-fastapi-example/plugin/index.html create mode 100644 io-websocket-fastapi-example/plugin/index.js create mode 100644 io-websocket-fastapi-example/plugin/manifest.json create mode 100644 io-websocket-fastapi-example/server/main.py create mode 100644 io-websocket-fastapi-example/server/requirements.txt diff --git a/io-websocket-fastapi-example/README.md b/io-websocket-fastapi-example/README.md new file mode 100644 index 0000000..7c18999 --- /dev/null +++ b/io-websocket-fastapi-example/README.md @@ -0,0 +1 @@ +This readme gonna be updated \ No newline at end of file diff --git a/io-websocket-fastapi-example/plugin/index.html b/io-websocket-fastapi-example/plugin/index.html new file mode 100644 index 0000000..ddad019 --- /dev/null +++ b/io-websocket-fastapi-example/plugin/index.html @@ -0,0 +1,9 @@ + + + + + + +
+ + \ No newline at end of file diff --git a/io-websocket-fastapi-example/plugin/index.js b/io-websocket-fastapi-example/plugin/index.js new file mode 100644 index 0000000..02abe75 --- /dev/null +++ b/io-websocket-fastapi-example/plugin/index.js @@ -0,0 +1,4 @@ +const app = require('photoshop').app; +const doc = app.activeDocument + +doc.title = "Change me" \ No newline at end of file diff --git a/io-websocket-fastapi-example/plugin/manifest.json b/io-websocket-fastapi-example/plugin/manifest.json new file mode 100644 index 0000000..3389eec --- /dev/null +++ b/io-websocket-fastapi-example/plugin/manifest.json @@ -0,0 +1,11 @@ +{ + "name": "Photoshop UXP Starter Script", + "id": "com.adobe.photoshop.uxp_script", + "version": "0.1.0", + "main": "index.html", + "host": { + "app": "PS", + "minVersion": "21.0.0" + }, + "runOnStartup": true +} \ No newline at end of file diff --git a/io-websocket-fastapi-example/server/main.py b/io-websocket-fastapi-example/server/main.py new file mode 100644 index 0000000..ee60be1 --- /dev/null +++ b/io-websocket-fastapi-example/server/main.py @@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + + +@app.get("/") +async def root(): + return {"message": "Hello World"} diff --git a/io-websocket-fastapi-example/server/requirements.txt b/io-websocket-fastapi-example/server/requirements.txt new file mode 100644 index 0000000..f0615cf --- /dev/null +++ b/io-websocket-fastapi-example/server/requirements.txt @@ -0,0 +1,2 @@ +fastapi +uvicorn \ No newline at end of file