From 4b8da4b1ed3a1cff7abc39444b8fc369f899a639 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 16 Feb 2026 12:09:08 +0100 Subject: [PATCH 1/6] fix: add paths for client app --- .gitignore | 3 +++ lib/admin_web.ex | 2 +- .../controllers/client_controller.ex | 19 +++++++++++++++++++ lib/admin_web/router.ex | 9 +++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 lib/admin_web/controllers/client_controller.ex diff --git a/.gitignore b/.gitignore index ef15e74f9..67ec8828a 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,6 @@ npm-debug.log # PLT caches /priv/plts/*.plt /priv/plts/*.plt.hash + +# client SPA artifacts +/priv/static/client diff --git a/lib/admin_web.ex b/lib/admin_web.ex index d33a4bcab..2fe8286d8 100644 --- a/lib/admin_web.ex +++ b/lib/admin_web.ex @@ -18,7 +18,7 @@ defmodule AdminWeb do """ def static_paths, - do: ~w(assets fonts images icons favicon.ico favicons robots.txt) + do: ~w(assets fonts images icons client favicon.ico favicons robots.txt) def router do quote do diff --git a/lib/admin_web/controllers/client_controller.ex b/lib/admin_web/controllers/client_controller.ex new file mode 100644 index 000000000..45a8ac225 --- /dev/null +++ b/lib/admin_web/controllers/client_controller.ex @@ -0,0 +1,19 @@ +defmodule AdminWeb.ClientController do + use AdminWeb, :controller + + def index(conn, _params) do + conn + |> put_resp_content_type("text/html") + |> send_resp(200, render_react_app()) + end + + # Serve the index.html file as-is and let React + # take care of the rendering and client-side rounting. + # + # Potential improvement: Cache the file contents here + # in an ETS table so we don't read from the disk for every request. + defp render_react_app() do + Application.app_dir(:admin, "priv/static/client/index.html") + |> File.read!() + end +end diff --git a/lib/admin_web/router.ex b/lib/admin_web/router.ex index 729dc6e80..124541fa0 100644 --- a/lib/admin_web/router.ex +++ b/lib/admin_web/router.ex @@ -57,6 +57,15 @@ defmodule AdminWeb.Router do delete "/locale", LandingController, :remove_locale generate_localized_routes() + + get "/home", ClientController, :index + get "/published", ClientController, :index + get "/recycled", ClientController, :index + get "/account/*path", ClientController, :index + get "/auth/*path", ClientController, :index + get "/builder/*path", ClientController, :index + get "/player/*path", ClientController, :index + # redirections for now get "/library", RedirectionController, :library get "/auth/login", RedirectionController, :login From 73585ac3757f43f200a2d4f337aeef774472e1db Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 16 Feb 2026 14:47:55 +0100 Subject: [PATCH 2/6] fix: update --- lib/admin/docs.ex | 0 lib/admin_web/controllers/client_controller.ex | 2 +- lib/admin_web/controllers/docs_html.ex | 0 lib/admin_web/controllers/redirection_controller.ex | 4 ---- lib/admin_web/router.ex | 1 - 5 files changed, 1 insertion(+), 6 deletions(-) create mode 100644 lib/admin/docs.ex create mode 100644 lib/admin_web/controllers/docs_html.ex diff --git a/lib/admin/docs.ex b/lib/admin/docs.ex new file mode 100644 index 000000000..e69de29bb diff --git a/lib/admin_web/controllers/client_controller.ex b/lib/admin_web/controllers/client_controller.ex index 45a8ac225..f8939ea01 100644 --- a/lib/admin_web/controllers/client_controller.ex +++ b/lib/admin_web/controllers/client_controller.ex @@ -12,7 +12,7 @@ defmodule AdminWeb.ClientController do # # Potential improvement: Cache the file contents here # in an ETS table so we don't read from the disk for every request. - defp render_react_app() do + defp render_react_app do Application.app_dir(:admin, "priv/static/client/index.html") |> File.read!() end diff --git a/lib/admin_web/controllers/docs_html.ex b/lib/admin_web/controllers/docs_html.ex new file mode 100644 index 000000000..e69de29bb diff --git a/lib/admin_web/controllers/redirection_controller.ex b/lib/admin_web/controllers/redirection_controller.ex index fa9f1abc7..b098eb483 100644 --- a/lib/admin_web/controllers/redirection_controller.ex +++ b/lib/admin_web/controllers/redirection_controller.ex @@ -4,8 +4,4 @@ defmodule AdminWeb.RedirectionController do def library(conn, _params) do redirect(conn, external: Application.get_env(:admin, :library_origin)) end - - def login(conn, _params) do - redirect(conn, external: "#{Application.get_env(:admin, :client_origin)}/auth/login") - end end diff --git a/lib/admin_web/router.ex b/lib/admin_web/router.ex index 124541fa0..c78d109f1 100644 --- a/lib/admin_web/router.ex +++ b/lib/admin_web/router.ex @@ -68,7 +68,6 @@ defmodule AdminWeb.Router do # redirections for now get "/library", RedirectionController, :library - get "/auth/login", RedirectionController, :login end scope "/admin", AdminWeb do From e8857fe5ce8463e27a875f956d6c3708151437f2 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 16 Feb 2026 15:25:11 +0100 Subject: [PATCH 3/6] fix: add client env vars --- .github/workflows/deploy.yaml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index fb0b042ab..979d2aede 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -30,7 +30,30 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 + + - name: Checkout code + uses: actions/checkout@v6 + with: + repository: graasp/client + path: client + + - name: build client + run: cd client && mise run build + env: + VITE_VERSION: ${{ inputs.version || github.sha }} + VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }} + VITE_GRAASP_WS_HOST: ${{ vars.VITE_GRAASP_WS_HOST }} + VITE_GRAASP_LIBRARY_HOST: ${{ vars.VITE_GRAASP_LIBRARY_HOST }} + VITE_SENTRY_ENV: ${{ inputs.environment || 'development' }} + VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }} + VITE_SHOW_NOTIFICATIONS: true + VITE_UMAMI_WEBSITE_ID: ${{ secrets.VITE_UMAMI_WEBSITE_ID }} + VITE_UMAMI_HOST: ${{ vars.VITE_UMAMI_HOST }} + VITE_RECAPTCHA: ${{ secrets.VITE_RECAPTCHA_SITE_KEY }} + VITE_GRAASP_H5P_INTEGRATION_URL: ${{ vars.VITE_GRAASP_H5P_INTEGRATION_URL }} + VITE_GRAASP_REDIRECTION_HOST: ${{ vars.VITE_GRAASP_REDIRECTION_HOST }} + shell: bash - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 From dc462b5ad60945a7a8dbe333f077e1012e0a0af7 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 16 Feb 2026 15:27:49 +0100 Subject: [PATCH 4/6] fix: add mise to the workflow --- .github/workflows/deploy.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 979d2aede..4df7722e8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -38,6 +38,9 @@ jobs: repository: graasp/client path: client + - name: Install Mise + uses: jdx/mise-action@v3 + - name: build client run: cd client && mise run build env: From d11ca21b40bde7faa6adc5ba2c5f29babe824b07 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 16 Feb 2026 15:30:12 +0100 Subject: [PATCH 5/6] fix: add copy of assets --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4df7722e8..b4a67a80d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -42,7 +42,7 @@ jobs: uses: jdx/mise-action@v3 - name: build client - run: cd client && mise run build + run: cd client && mise run build && cp -r dist ../priv/static/client env: VITE_VERSION: ${{ inputs.version || github.sha }} VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }} From 113af20f4c0dde02a57c9bec77c5c4944f4f79e7 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 16 Feb 2026 15:40:08 +0100 Subject: [PATCH 6/6] fix: use a specific branch name --- .github/workflows/deploy.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b4a67a80d..6dc2b8bf8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -14,6 +14,11 @@ on: required: true default: development type: environment + client-ref: + description: "Client branch or tag" + required: false + default: main + type: string permissions: id-token: write # This is required for requesting the JWT for OIDC @@ -36,6 +41,7 @@ jobs: uses: actions/checkout@v6 with: repository: graasp/client + ref: ${{ inputs.client-ref || 'main' }} path: client - name: Install Mise