From d84a43f33d64978fe3c14ab96dd3aa758e941a9d Mon Sep 17 00:00:00 2001 From: boybook Date: Sun, 8 Dec 2024 13:17:07 +0800 Subject: [PATCH] Add Amazon S3 access and use async page setting Include "https://*.amazonaws.com" to allowed domains for network access to enable communication with Amazon S3. Replace synchronous calls with asynchronous alternatives for setting the current page in multiple code instances to improve performance and prevent blocking the execution thread. --- manifest.json | 3 ++- src/code.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index de7a5aa..2214018 100644 --- a/manifest.json +++ b/manifest.json @@ -12,7 +12,8 @@ "networkAccess": { "allowedDomains": [ "https://notion.boybook.workers.dev", - "https://api.figma.com" + "https://api.figma.com", + "https://*.amazonaws.com" ] }, "permissions": [ diff --git a/src/code.ts b/src/code.ts index da8c144..8748e78 100644 --- a/src/code.ts +++ b/src/code.ts @@ -171,7 +171,7 @@ handleEvent('request-selection', () => { handleEvent('select-node', async (nodeId: string) => { const node = await figma.getNodeByIdAsync(nodeId); if (node) { - figma.currentPage = getPageNode(node); + await figma.setCurrentPageAsync(getPageNode(node)); if (node.type !== 'PAGE') { figma.currentPage.selection = [getPageRootNode(node)]; figma.viewport.scrollAndZoomIntoView([node]); @@ -250,7 +250,7 @@ async function checkSelectCanvasTag() { const nodeId = select.name.slice(4); const node = await figma.getNodeByIdAsync(nodeId); if (node) { - figma.currentPage = getPageNode(node); + await figma.setCurrentPageAsync(getPageNode(node)); figma.currentPage.selection = [ node]; } }