diff --git a/.gitignore b/.gitignore index 283568d..65a8dc1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ dist-ssr dist-electron release *.local -build settings.json # Editor directories and files diff --git a/build/icon.icns b/build/icon.icns index 56b37d5..1b52fe6 100644 Binary files a/build/icon.icns and b/build/icon.icns differ diff --git a/build/icon.ico b/build/icon.ico index e02df37..9d08a87 100644 Binary files a/build/icon.ico and b/build/icon.ico differ diff --git a/build/icon.png b/build/icon.png new file mode 100644 index 0000000..ea12d53 Binary files /dev/null and b/build/icon.png differ diff --git a/electron/main/index.ts b/electron/main/index.ts index 4a8c0e7..a4101db 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -32,9 +32,6 @@ if (!app.requestSingleInstanceLock()) { process.exit(0); } -app.commandLine.appendArgument("–-allow-file-access-from-files"); -app.commandLine.appendArgument("--disable-web-security"); - // Remove electron security warnings // This warning only shows in development mode // Read more on https://www.electronjs.org/docs/latest/tutorial/security diff --git a/public/electron-vite.svg b/public/electron-vite.svg index 7054266..7607f92 100644 --- a/public/electron-vite.svg +++ b/public/electron-vite.svg @@ -2,17 +2,15 @@ - - +L 21.05 10.95 +Q 21.7 10.95 22.2 10.5 22.65 10.05 22.65 9.4 +L 22.65 4.7 +Q 22.65 4.05 22.2 3.6 Z"/> diff --git a/public/logo.svg b/public/logo copy.svg similarity index 90% rename from public/logo.svg rename to public/logo copy.svg index 7054266..7607f92 100644 --- a/public/logo.svg +++ b/public/logo copy.svg @@ -2,17 +2,15 @@ - - +L 21.05 10.95 +Q 21.7 10.95 22.2 10.5 22.65 10.05 22.65 9.4 +L 22.65 4.7 +Q 22.65 4.05 22.2 3.6 Z"/> diff --git a/src/components/register-node.ts b/src/components/register-node.ts index 814dbee..69a591d 100644 --- a/src/components/register-node.ts +++ b/src/components/register-node.ts @@ -1,5 +1,6 @@ import { useWorkspace } from "@/contexts/workspace-context"; -import { toBreakWord } from "@/misc/b3util"; +import { TreeGraphData } from "@/misc/b3type"; +import { checkTreeData, toBreakWord } from "@/misc/b3util"; import i18n from "@/misc/i18n"; import G6 from "@antv/g6"; @@ -76,7 +77,8 @@ G6.registerNode( let color = nodeDef.color || NODE_COLORS[classify] || NODE_COLORS["Other"]; if ( !workspace.hasNodeDef(cfg.name as string) || - (cfg.path && (!cfg.children || (cfg.children as []).length == 0)) + (cfg.path && (!cfg.children || (cfg.children as []).length == 0)) || + !checkTreeData(cfg as TreeGraphData) ) { classify = "Error"; color = NODE_COLORS[classify]; diff --git a/src/misc/b3util.ts b/src/misc/b3util.ts index b1af1b0..bcd43a3 100644 --- a/src/misc/b3util.ts +++ b/src/misc/b3util.ts @@ -147,6 +147,54 @@ export const calcTreeDataSize = (data: TreeGraphData) => { return [200, height]; }; +export const checkTreeData = (data: TreeGraphData) => { + const conf = data.def; + if (conf.input) { + for (let i = 0; i < conf.input.length; i++) { + if (conf.input[i].indexOf("?") === -1 && !data.input?.[i]) { + return false; + } + } + } + if (conf.output) { + for (let i = 0; i < conf.output.length; i++) { + if (conf.output[i].indexOf("?") === -1 && !data.output?.[i]) { + return false; + } + } + } + if (conf.args) { + for (let i = 0; i < conf.args.length; i++) { + const arg = conf.args[i]; + if (arg.type.indexOf("?") === -1) { + const value = data.args?.[arg.name]; + if (arg.type === "float") { + if (typeof value !== "number") { + return false; + } + } else if (arg.type === "int") { + if (typeof value !== "number" || value !== Math.floor(value)) { + return false; + } + } else if (arg.type === "string") { + if (!value || typeof value !== "string") { + return false; + } + } else if (arg.type === "enum") { + if (!arg.options?.find((option) => option.value === value)) { + return false; + } + } else if (arg.type == "code") { + if (!value || typeof value !== "string") { + return false; + } + } + } + } + } + return true; +}; + export const createTreeData = (node: NodeModel, parent?: string) => { const workspace = useWorkspace.getState(); let treeData: TreeGraphData = {