From 5d2164aa53e68499ffebd4de9bf7256d7a9e7ced Mon Sep 17 00:00:00 2001 From: futurGH Date: Sat, 27 Dec 2025 19:02:53 -0500 Subject: [PATCH] Account migration page --- bin/main.ml | 3 + frontend/client/Router.mlx | 1 + .../src/templates/AccountPermissionsPage.mlx | 8 +- frontend/src/templates/LoginPage.mlx | 24 +- frontend/src/templates/MigratePage.mlx | 636 +++++ frontend/src/templates/SignupPage.mlx | 6 + pegasus/lib/api/account_/migrate.ml | 2053 +++++++++++++++++ .../identity/getRecommendedDidCredentials.ml | 27 +- .../lib/api/identity/submitPlcOperation.ml | 33 +- pegasus/lib/api/server/checkAccountStatus.ml | 77 +- pegasus/lib/api/server/getSession.ml | 8 +- pegasus/lib/auth.ml | 114 +- pegasus/lib/errors.ml | 14 + pegasus/lib/jwt.ml | 85 + pegasus/lib/plc.ml | 32 + pegasus/lib/repository.ml | 7 +- pegasus/lib/util.ml | 7 + public/main.css | 5 + 18 files changed, 2958 insertions(+), 182 deletions(-) create mode 100644 frontend/src/templates/MigratePage.mlx create mode 100644 pegasus/lib/api/account_/migrate.ml diff --git a/bin/main.ml b/bin/main.ml index 920ec14..86c8ca2 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -40,6 +40,8 @@ let handlers = ; ( get , "/account/signup/check-handle" , Api.Account_.Signup.check_handle_handler ) + ; (get, "/account/migrate", Api.Account_.Migrate.get_handler) + ; (post, "/account/migrate", Api.Account_.Migrate.post_handler) ; (post, "/account/switch", Api.Account_.Login.switch_account_handler) ; (get, "/account/logout", Api.Account_.Logout.handler) ; (* admin ui *) @@ -203,6 +205,7 @@ let static_routes = let serve () = Printexc.record_backtrace true ; + Printexc.register_printer Errors.printer ; Dream.initialize_log ~level:Env.log_level () ; List.iter (fun src -> match Logs.Src.name src with diff --git a/frontend/client/Router.mlx b/frontend/client/Router.mlx index 91c30c5..a10305e 100644 --- a/frontend/client/Router.mlx +++ b/frontend/client/Router.mlx @@ -17,6 +17,7 @@ let routes = ; {path= "/oauth/authorize"; template= (module OauthAuthorizePage)} ; {path= "/account/login"; template= (module LoginPage)} ; {path= "/account/signup"; template= (module SignupPage)} + ; {path= "/account/migrate"; template= (module MigratePage)} ; {path= "/account"; template= (module AccountPage)} ; {path= "/account/permissions"; template= (module AccountPermissionsPage)} ; {path= "/admin/login"; template= (module AdminLoginPage)} diff --git a/frontend/src/templates/AccountPermissionsPage.mlx b/frontend/src/templates/AccountPermissionsPage.mlx index 6840667..dd7ec67 100644 --- a/frontend/src/templates/AccountPermissionsPage.mlx +++ b/frontend/src/templates/AccountPermissionsPage.mlx @@ -89,7 +89,9 @@ let[@react.component] make