From 656f2266e37b6158a5314ae071610766de0f5da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Tue, 17 Oct 2023 14:50:34 +0200 Subject: [PATCH] feat: add scripts to enable login flow from localhost --- frontend/app/README.md | 15 ++++++++++++++- frontend/app/package.json | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/app/README.md b/frontend/app/README.md index 7f489316..32113c46 100644 --- a/frontend/app/README.md +++ b/frontend/app/README.md @@ -52,7 +52,7 @@ All the npm scripts are defined in `package.json` [file](package.json). It is re ## Most useful commands -## Editing the Ionic Database from the browser +### Editing the Ionic Database from the browser Add the following function using the browser console @@ -90,6 +90,19 @@ You'll need to run _Chromium_ using pnpm chromium:no-cors ``` +### Help, I can't log in! + +Login services will often block hosts not coming from the production +server. You can circumvent this locally by using the `:virtual-host` +scripts: + +```shell +# Start the dev server on mobile.app.uni-frankfurt.de +pnpm start:virtual-host +# Run chromium with flags that redirect mobile.app.uni-frankfurt.de to localhost:8100 +pnpm chromium:virtual-host +``` + ### Running the app Install the npm packages needed for running the app (as for any other node project which uses npm): diff --git a/frontend/app/package.json b/frontend/app/package.json index e5c62f92..6596fd17 100644 --- a/frontend/app/package.json +++ b/frontend/app/package.json @@ -23,6 +23,7 @@ "changelog": "conventional-changelog -p angular -i src/assets/about/CHANGELOG.md -s -r 0", "check-icons": "ts-node-esm scripts/check-icon-correctness.ts", "chromium:no-cors": "chromium --disable-web-security --user-data-dir=\".browser-data/chromium\"", + "chromium:virtual-host": "chromium --host-resolver-rules=\"MAP mobile.app.uni-frankfurt.de:* localhost:8100\" --ignore-certificate-errors", "cypress:open": "cypress open", "cypress:run": "cypress run", "docker:build": "sudo docker run -p 8100:8100 -p 35729:35729 -p 53703:53703 -v $PWD:/app -it registry.gitlab.com/openstapps/app bash -c \"npm install && npm run build\"", @@ -47,6 +48,7 @@ "start": "ionic serve", "start:external": "ionic serve --external", "start:prod": "ionic serve --prod", + "start:virtual-host": "ionic serve --public-host=mobile.app.uni-frankfurt.de --ssl=true --open=false", "test": "ng test --code-coverage", "test:integration": "sh integration-test.sh" },