diff --git a/pkgs/clan-cli/clan_cli/api/__init__.py b/pkgs/clan-cli/clan_cli/api/__init__.py index b391803c3..03be06d4c 100644 --- a/pkgs/clan-cli/clan_cli/api/__init__.py +++ b/pkgs/clan-cli/clan_cli/api/__init__.py @@ -134,6 +134,18 @@ API.register(open_file) ) ], ) + except Exception as e: + return ErrorDataClass( + op_key=op_key, + status="error", + errors=[ + ApiError( + message=str(e), + description="An unexpected error occurred", + location=[fn.__name__], + ) + ], + ) # @wraps preserves all metadata of fn # we need to update the annotation, because our wrapper changes the return type diff --git a/pkgs/clan-cli/clan_cli/api/admin.py b/pkgs/clan-cli/clan_cli/api/admin.py index bb076fd97..6127acae1 100644 --- a/pkgs/clan-cli/clan_cli/api/admin.py +++ b/pkgs/clan-cli/clan_cli/api/admin.py @@ -1,5 +1,3 @@ -from pathlib import Path - from clan_cli.inventory import ( AdminConfig, ServiceAdmin, @@ -27,7 +25,7 @@ def get_admin_service(base_url: str) -> ServiceAdmin | None: @API.register def set_admin_service( base_url: str, - allowed_keys: dict[str, Path], + allowed_keys: dict[str, str], instance_name: str = "admin", extra_machines: list[str] | None = None, ) -> None: @@ -43,24 +41,15 @@ def set_admin_service( msg = "At least one key must be provided to ensure access" raise ValueError(msg) - keys = {} - for name, keyfile in allowed_keys.items(): - if not keyfile.is_absolute(): - msg = f"Keyfile '{keyfile}' must be an absolute path" - raise ValueError(msg) - with keyfile.open() as f: - pubkey = f.read() - keys[name] = pubkey - instance = ServiceAdmin( meta=ServiceMeta(name=instance_name), roles=ServiceAdminRole( default=ServiceAdminRoleDefault( - config=AdminConfig(allowedKeys=keys), machines=extra_machines, tags=["all"], ) ), + config=AdminConfig(allowedKeys=allowed_keys), ) inventory.services.admin[instance_name] = instance diff --git a/pkgs/webview-ui/app/src/components/TextInput.tsx b/pkgs/webview-ui/app/src/components/TextInput.tsx index 18266ac10..8c735edf0 100644 --- a/pkgs/webview-ui/app/src/components/TextInput.tsx +++ b/pkgs/webview-ui/app/src/components/TextInput.tsx @@ -1,6 +1,7 @@ import { FieldValues, FormStore, ResponseData } from "@modular-forms/solid"; -import { Show, type JSX } from "solid-js"; +import { createEffect, Show, type JSX } from "solid-js"; import cx from "classnames"; +import { createECDH } from "crypto"; interface TextInputProps { formStore: FormStore; @@ -22,6 +23,12 @@ interface TextInputProps { export function TextInput( props: TextInputProps, ) { + const value = () => props.value; + + createEffect(() => { + console.log("rendering text input", props.value); + }); + return (