diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts index d25a014607..5599913a18 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts @@ -14,10 +14,11 @@ export const addReceivedOpenAPISchemaListener = () => { const schemaJSON = action.payload; log.debug({ schemaJSON }, 'Received OpenAPI schema'); - + const { nodesAllowlist, nodesDenylist } = getState().config; const nodeTemplates = parseSchema( schemaJSON, - getState().config.nodesDenylist + nodesAllowlist, + nodesDenylist ); log.debug( diff --git a/invokeai/frontend/web/src/app/types/invokeai.ts b/invokeai/frontend/web/src/app/types/invokeai.ts index 50c1e64250..a02c16cf7a 100644 --- a/invokeai/frontend/web/src/app/types/invokeai.ts +++ b/invokeai/frontend/web/src/app/types/invokeai.ts @@ -50,7 +50,8 @@ export type AppConfig = { disabledFeatures: AppFeature[]; disabledSDFeatures: SDFeature[]; canRestoreDeletedImagesFromBin: boolean; - nodesDenylist: string[]; + nodesAllowlist: string[] | undefined; + nodesDenylist: string[] | undefined; sd: { defaultModel?: string; disabledControlNetModels: string[]; diff --git a/invokeai/frontend/web/src/features/nodes/util/parseSchema.ts b/invokeai/frontend/web/src/features/nodes/util/parseSchema.ts index 05ed1e8705..8615a12c46 100644 --- a/invokeai/frontend/web/src/features/nodes/util/parseSchema.ts +++ b/invokeai/frontend/web/src/features/nodes/util/parseSchema.ts @@ -61,13 +61,21 @@ const isNotInDenylist = (schema: InvocationSchemaObject) => export const parseSchema = ( openAPI: OpenAPIV3.Document, - nodesDenylistExtra: string[] = [] + nodesAllowlistExtra: string[] | undefined = undefined, + nodesDenylistExtra: string[] | undefined = undefined ): Record => { const filteredSchemas = Object.values(openAPI.components?.schemas ?? {}) .filter(isInvocationSchemaObject) .filter(isNotInDenylist) - .filter( - (schema) => !nodesDenylistExtra.includes(schema.properties.type.default) + .filter((schema) => + nodesAllowlistExtra + ? nodesAllowlistExtra.includes(schema.properties.type.default) + : true + ) + .filter((schema) => + nodesDenylistExtra + ? !nodesDenylistExtra.includes(schema.properties.type.default) + : true ); const invocations = filteredSchemas.reduce< diff --git a/invokeai/frontend/web/src/features/system/store/configSlice.ts b/invokeai/frontend/web/src/features/system/store/configSlice.ts index 49f7c3c704..36a61be969 100644 --- a/invokeai/frontend/web/src/features/system/store/configSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/configSlice.ts @@ -15,7 +15,8 @@ export const initialConfigState: AppConfig = { 'perlinNoise', 'noiseThreshold', ], - nodesDenylist: [], + nodesAllowlist: undefined, + nodesDenylist: undefined, canRestoreDeletedImagesFromBin: true, sd: { disabledControlNetModels: [],