From d5cf9aeb9d76070164d2cc980386849739199607 Mon Sep 17 00:00:00 2001 From: "Luna D." Date: Fri, 20 Dec 2024 18:50:44 +0100 Subject: [PATCH] add api for themes --- .../controllers/api/json/theme_controller.ex | 11 +++++++++++ lib/philomena_web/router.ex | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 lib/philomena_web/controllers/api/json/theme_controller.ex diff --git a/lib/philomena_web/controllers/api/json/theme_controller.ex b/lib/philomena_web/controllers/api/json/theme_controller.ex new file mode 100644 index 000000000..34f195f22 --- /dev/null +++ b/lib/philomena_web/controllers/api/json/theme_controller.ex @@ -0,0 +1,11 @@ +defmodule PhilomenaWeb.Api.Json.ThemeController do + use PhilomenaWeb, :controller + + alias PhilomenaWeb.SettingView + + def index(conn, _params) do + conn + |> put_resp_content_type("application/json") + |> send_resp(200, SettingView.theme_paths_json(conn)) + end +end diff --git a/lib/philomena_web/router.ex b/lib/philomena_web/router.ex index 2ed82dc19..a0744ac70 100644 --- a/lib/philomena_web/router.ex +++ b/lib/philomena_web/router.ex @@ -157,6 +157,8 @@ defmodule PhilomenaWeb.Router do resources "/posts", Forum.Topic.PostController, only: [:show, :index] end end + + resources "/themes", ThemeController, only: [:index] end scope "/", PhilomenaWeb do