diff --git a/backend/funix/__init__.py b/backend/funix/__init__.py index a27724e..1ad0a41 100644 --- a/backend/funix/__init__.py +++ b/backend/funix/__init__.py @@ -103,9 +103,10 @@ def __prep( path_difference: str | None = None if base_dir: # dir mode - path_difference = get_path_difference( - base_dir, sep.join(module_or_file.split(sep)[0:-1]) - ) + module = module_or_file.split(sep) + module[-1] = module[-1][:-3] # remove .py + module = sep.join(module) + path_difference = get_path_difference(base_dir, module) if module_or_file: if is_module: module = import_module(module_or_file) diff --git a/backend/funix/decorator/__init__.py b/backend/funix/decorator/__init__.py index bdb4800..26a3ff0 100644 --- a/backend/funix/decorator/__init__.py +++ b/backend/funix/decorator/__init__.py @@ -503,7 +503,9 @@ def decorator(function: callable) -> callable: # only when funix starts with `-R`, it will be not None if safe_module_now: - unique_function_name = safe_module_now + "_AnD_" + function_name + unique_function_name = ( + now_module.replace(".", "/") + "/" + function_name + ) if function_name in banned_function_name_and_path: raise ValueError( @@ -1212,6 +1214,7 @@ def parse_widget(widget_info: str | tuple | list) -> list[str] | str: } get_wrapper_id = app.get(f"/param/{function_id}") + get_wrapper_endpoint = app.get(f"/param/{endpoint}") def decorated_function_param_getter(): """ @@ -1260,13 +1263,11 @@ def decorated_function_param_getter(): ) get_wrapper_id(decorated_function_param_getter) - - if not safe_module_now: - get_wrapper_endpoint = app.get(f"/param/{endpoint}") - get_wrapper_endpoint(decorated_function_param_getter) + get_wrapper_endpoint(decorated_function_param_getter) if secret_key: verify_secret_id = app.post(f"/verify/{function_id}") + verify_secret_endpoint = app.post(f"/verify/{endpoint}") def verify_secret(): """ @@ -1321,10 +1322,8 @@ def verify_secret(): verify_secret.__setattr__( "__name__", decorated_function_verify_secret_name ) - if not safe_module_now: - verify_secret_endpoint = app.post(f"/verify/{endpoint}") - verify_secret_endpoint(verify_secret) + verify_secret_endpoint(verify_secret) verify_secret_id(verify_secret) @wraps(function) @@ -1738,8 +1737,7 @@ def wrapped_function(**wrapped_function_kwargs): if safe_module_now: wrapper.__setattr__("__name__", safe_module_now + "_" + function_name) - if not safe_module_now: - app.post(f"/call/{endpoint}")(wrapper) + app.post(f"/call/{endpoint}")(wrapper) app.post(f"/call/{function_id}")(wrapper) return function diff --git a/frontend/src/components/FunixFunctionList.tsx b/frontend/src/components/FunixFunctionList.tsx index 77f833e..b6d7a68 100644 --- a/frontend/src/components/FunixFunctionList.tsx +++ b/frontend/src/components/FunixFunctionList.tsx @@ -169,13 +169,10 @@ const FunixFunctionList: React.FC = ({ backend }) => { }; useEffect(() => { - const pathParams = pathname.split("/").filter((value) => value !== ""); - if ( - pathParams.length !== 0 && - state.length !== 0 && - pathParams[0] !== radioGroupValue - ) { - const functionPath = decodeURIComponent(pathParams[0]); + const pathParam = pathname.substring(1); + console.log(pathParam); + if (pathParam !== radioGroupValue) { + const functionPath = decodeURIComponent(pathParam); const selectedFunctionPreview = state.filter( (preview) => preview.path === functionPath ); @@ -290,7 +287,9 @@ const FunixFunctionList: React.FC = ({ backend }) => { > } - disableTypography + sx={{ + wordWrap: "break-word", + }} /> {treeState.hasOwnProperty(`${k}${v}`) ? ( treeState[`${k}${v}`] ? (