From b982573d298a7cb61e00f1aa58bf4ec3d65c15d8 Mon Sep 17 00:00:00 2001 From: Adrian Salceanu Date: Fri, 8 Nov 2024 16:24:20 +0100 Subject: [PATCH] Delete endpoint --- Project.toml | 6 ++--- .../applications/ApplicationsController.jl | 22 +++++++++++++++++++ routes.jl | 5 +++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 63a1f37..b1d06dd 100755 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GenieBuilder" uuid = "c9453c14-af8a-11ec-351d-c7c9a2035d70" authors = ["Adrian Salceanu"] -version = "0.19.2" +version = "0.19.4" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -34,7 +34,7 @@ Genie = "5.31" GenieAutoReload = "2.2.4" GenieCache = "2" GenieCacheFileCache = "2" -GenieDevTools = "2.11" +GenieDevTools = "2.12" GeniePackageManager = "1.1.0" HTTP = "1" Inflector = "1" @@ -44,7 +44,7 @@ RemoteREPL = "0.2" Scratch = "1.1" SearchLight = "2.10" SearchLightSQLite = "2.2.2" -Stipple = "0.28.17" +Stipple = "0.28.18" StippleUI = "0.23" TOML = "1" ZipFile = "0.10.1" diff --git a/app/resources/applications/ApplicationsController.jl b/app/resources/applications/ApplicationsController.jl index fff8ee0..ec52896 100755 --- a/app/resources/applications/ApplicationsController.jl +++ b/app/resources/applications/ApplicationsController.jl @@ -917,6 +917,28 @@ function save(app::Application) end end +""" + delete(app) + +Deletes a file from an app +""" +function delete(app::Application) + if @isonline(app) + res = try + @async notify("started:delete", app.id) |> errormonitor + + HTTP.request("GET", "$(apphost):$(app.port)$(GenieDevTools.defaultroute)/delete?path=$(params(:path, "."))") + catch ex + @error ex + @async notify("failed:delete", app.id, FAILSTATUS, ERROR_STATUS) |> errormonitor + end + + @async notify("ended:delete", app.id) |> errormonitor + + res |> json2json + end +end + """ pages(app) diff --git a/routes.jl b/routes.jl index 8dca84a..c5f43fc 100755 --- a/routes.jl +++ b/routes.jl @@ -160,6 +160,11 @@ function register_routes() ApplicationsController.save(params(:appid) |> ApplicationsController.get) end + # returns the contents of a file from an app + route("$api_route$app_route/delete") do + ApplicationsController.delete(params(:appid) |> ApplicationsController.get) + end + # returns the pages of an app route("$api_route$app_route/pages") do ApplicationsController.pages(params(:appid) |> ApplicationsController.get)