From f0afe7272432f45baedfb41dded6ef3fe4cf9560 Mon Sep 17 00:00:00 2001 From: Sigmanificient Date: Sun, 2 Nov 2025 23:42:00 +0100 Subject: [PATCH 01/20] feat: add how to contribute --- HOW_TO_CONTRIBUTE.md | 89 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 HOW_TO_CONTRIBUTE.md diff --git a/HOW_TO_CONTRIBUTE.md b/HOW_TO_CONTRIBUTE.md new file mode 100644 index 0000000..2458cce --- /dev/null +++ b/HOW_TO_CONTRIBUTE.md @@ -0,0 +1,89 @@ +Here’s a concise `HOW_TO_CONTRIBUTE.md` for adding a new OAuth service to your project based on the Discord example: + +--- + +# How to Contribute a New OAuth Service + +This guide explains how to add a new OAuth service to our platform using the existing Discord integration as a reference. + +## 1. Create a Config Model + +In your service module, create a `Config` Pydantic model that defines the OAuth configuration: + +```python +from pydantic import BaseModel + +class Config(BaseModel): + service: str = "google" + client_id: str + client_secret: str + auth_base: str = "..." + token_url: str = "..." + api_base: str = "..." + api_resource: str = "..." + profile_endpoint: str = "..." + redirect_uri: str = "..." + scope: str = "..." + pkce: bool = True +``` + +* Set `service` to a unique identifier for the platform. +* Specify the authorization URL (`auth_base`), token URL (`token_url`), API endpoints, and scopes. +* `redirect_uri` should point to your API route for handling the callback. + +## 2. Instantiate the OAuth Provider + +Use the shared `OAuthProvider` class: + +```python +from fastapi import APIRouter +import pathlib +from .oauth_base import OAuthProvider + +router = APIRouter(prefix="/[my_service]", tags=["[my_service]"]) + +provider = OAuthProvider( + package=__package__, + config_model=Config, + icon=(pathlib.Path(__file__).parent / "icon.svg").read_text() +) +``` + +* The `icon` will be displayed in the frontend service cards. + +## 3. Add API Routes + +Define FastAPI routes to handle connecting, authentication, token refresh, and user info: + +```python +@router.get("/connect") +async def google_connect(token: str, platform: str): + return await provider.connect(token, platform) + +@router.get("/auth") +async def google_auth(code: str, state: str, db=Depends(get_session)): + return await provider.auth(code, state, db) + +@router.get("/refresh") +async def google_refresh(user=Depends(get_current_user), db=Depends(get_session)): + return await provider.refresh(user, db) + +@router.get("/me") +async def google_me(user=Depends(get_current_user), db=Depends(get_session)): + return await provider.me(user, db) +``` + +* `/connect` initiates the OAuth connection. +* `/auth` handles the callback from the OAuth provider. +* `/refresh` refreshes the access token. +* `/me` retrieves the current user’s profile info from the service. + +## 4. Add Service Icon + +Place an SVG icon named `icon.svg` in the service module folder. This will be displayed in the frontend cards for connecting services. + +## 5. Test + +1. Login in to the area +2. Go to `/services` +3. You should see you newly added service and be able to connect to it From 7e5fa54e3f5004a5ad2f24fa405e3adfe93663e4 Mon Sep 17 00:00:00 2001 From: Fenriir42 Date: Tue, 16 Sep 2025 16:01:18 +0200 Subject: [PATCH 02/20] docs(root): Add the readme.md of the project --- README.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b741ac --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# Action-Reaction + +## Create an Automation Platform (similar to IFTTT / Zapier) + +## πŸ“Œ Overview + +Action-Reaction is an automation platform designed to connect services together. +Users can define **AREAs** (*Action + REAction*) that automatically execute when certain events occur. + +The system is composed of three main parts: + +- **Application Server**: Business logic & REST API. +- **Web Client**: Browser-based UI, communicates with the server. +- **Mobile Client**: Android app, communicates with the server. + +--- + +## ✨ Features + +- User registration & authentication (password-based + OAuth2). +- Service subscription (Google, Outlook, Dropbox, etc.). +- Action components (event triggers). +- REAction components (automated tasks). +- AREAs: link Actions to REActions. +- Hooks: monitor & trigger automation. + +--- + +## πŸ— Architecture + +- **Server**: Runs business logic, exposes REST API (`http://localhost:8080`). +- **Web Client**: User interface (`http://localhost:8081`). +- **Mobile Client**: Android application, distributed via APK. +- **Docker Compose**: Orchestration of all components. + +--- + +## πŸš€ Getting Started + +### Prerequisites + +- [Docker](https://docs.docker.com/get-docker/) +- [Docker Compose](https://docs.docker.com/compose/) + +### Installation + +WIP + +### Services + +- Server -> `http://localhost:8080/about.json` +- Web Client -> `http://localhost:8081/` +- Mobile Client APK -> YES + +--- + +## πŸ“œ API Example: `about.json` + +WIP + +--- + +## πŸ›  Contributing + +WIP + +--- + +## πŸ“… Project Timeline + +- **21/09/2025**: Tech stack selection, PoC, task distribution. +- **06/10/2025**: Core architecture & base functionality. +- **02/11/2025**: Full feature set, UI, Docker deployment. + +--- + +## πŸ“– Documentation + +WIP From 02c796336e02d76f7dcaeebde4b42bee6a8e2fb2 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Sun, 2 Nov 2025 16:22:21 +0100 Subject: [PATCH 03/20] feat(readme): add installation and start contributing sections --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b741ac..57d574a 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,10 @@ The system is composed of three main parts: ### Installation -WIP +- **Step 1**: Connect your phone with your laptop via a cable +- **Step 2**: docker-compose build && docker-compose up +- **Step 3**: Go to your browser -> connect to http://localhost:8081/ to be at the web interface +- **Step 4**:Connect to http://localhost:8081/client.apk to download the mobile app ### Services @@ -62,6 +65,21 @@ WIP ## πŸ›  Contributing +### Languages and framework + +- Web App: React + SCSS +- Mobile App: React + Capacitor + SCSS +- Server: Python + fastapi + +### How to add a service + +-> Go to area/back/app/routes +-> Add a folder and name it after the service you want to add +-> Create a `__init__.py` file following other examples +-> Create the .py file for the service and complete it following the other examples + +### How to add an A-REA + WIP --- From 4e27def271b3a4e7703b1fed7a2ffbf113a043e4 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Sun, 2 Nov 2025 16:28:19 +0100 Subject: [PATCH 04/20] fix(readme): fix layout of contributing/service --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 57d574a..5a4a4de 100644 --- a/README.md +++ b/README.md @@ -73,10 +73,10 @@ WIP ### How to add a service --> Go to area/back/app/routes --> Add a folder and name it after the service you want to add --> Create a `__init__.py` file following other examples --> Create the .py file for the service and complete it following the other examples +- Go to area/back/app/routes +- Add a folder and name it after the service you want to add +- Create a `__init__.py` file following other examples +- Create the .py file for the service and complete it following the other examples ### How to add an A-REA From 1dcdb8066def53098d1b2d8065160110e03603cb Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Sun, 2 Nov 2025 17:08:00 +0100 Subject: [PATCH 05/20] feat(README): add link to API documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a4a4de..889f2b7 100644 --- a/README.md +++ b/README.md @@ -94,4 +94,4 @@ WIP ## πŸ“– Documentation -WIP +- **API**: http://localhost:8080/docs From d2893a2a02c2cd9cc54ebb79b651395975f4d2b1 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Sun, 2 Nov 2025 18:06:04 +0100 Subject: [PATCH 06/20] feat(readme): add step-by-step apk creation feat(readme): add step to get apk on via client.apk --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 889f2b7..58b665d 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,52 @@ The system is composed of three main parts: ### Installation - **Step 1**: Connect your phone with your laptop via a cable -- **Step 2**: docker-compose build && docker-compose up +- **Step 2**: docker build -t test -f android/Dockerfile . && docker run test:latest - **Step 3**: Go to your browser -> connect to http://localhost:8081/ to be at the web interface -- **Step 4**:Connect to http://localhost:8081/client.apk to download the mobile app +- **Step 4**: Connect to http://localhost:8081/client.apk to download the mobile app + +#### Mobile installation + +- **Step 1**: Go to front/android and create a \`gradle.properties\` file. Fill it with those informations: + +\# Project-wide Gradle settings. + +\# IDE (e.g. Android Studio) users: +\# Gradle settings configured through the IDE *will override* +\# any settings specified in this file. + +\# For more details on how to configure your build environment visit +\# http://www.gradle.org/docs/current/userguide/build_environment.html + +\# Specifies the JVM arguments used for the daemon process. +\# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +\# When configured, Gradle will run in incubating parallel mode. +\# This option should only be used with decoupled projects. More details, visit +\# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +\# org.gradle.parallel=true + +\# AndroidX package structure to make it clearer which packages are bundled with the +\# Android operating system, and which are packaged with your app's APK +\# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +RELEASE_STORE_FILE=/build/apk_key.jks +RELEASE_STORE_PASSWORD=xxxxxx +RELEASE_KEY_ALIAS=alias +RELEASE_KEY_PASSWORD=xxxxxx + +Replace both of the "xxxxxx" with an actual password. That password need to be at least 6 characters long. + +- **Step 2**: In your terminal run `keytool -genkey -v -keystore apk_key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias alias;`. +It will ask for a keystore password, put the one you chose for the first step. It will follow by asking more information; those information don't need to be necesarilly true. +Enter 'y' to confirm the datas you entered. + +- **Step 3**: run `docker build -t test -f android/Dockerfile . && docker run test:latest`. + +- **Step 4**: Connect to http://localhost:8081/client.apk to download the mobile app. + + ### Services @@ -95,3 +138,10 @@ WIP ## πŸ“– Documentation - **API**: http://localhost:8080/docs + +keytool -genkey -v -keystore apk_key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias alias; + +RELEASE_STORE_FILE=/build/apk_key.jks +RELEASE_STORE_PASSWORD=xxxx +RELEASE_KEY_ALIAS=alias +RELEASE_KEY_PASSWORD=xxxx \ No newline at end of file From 5d017c67d479dc965a29fd3fa3e708ba14c17cb4 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Sun, 2 Nov 2025 18:34:49 +0100 Subject: [PATCH 07/20] feat(readme): add environnement element to technologies --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 58b665d..f28565b 100644 --- a/README.md +++ b/README.md @@ -108,11 +108,12 @@ WIP ## πŸ›  Contributing -### Languages and framework +### Languages, frameworks and technologies - Web App: React + SCSS - Mobile App: React + Capacitor + SCSS - Server: Python + fastapi +- Environment: Nix + Docker ### How to add a service From 1040cbe45a66cbd5c150081e08841956e657f713 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Sun, 2 Nov 2025 22:31:44 +0100 Subject: [PATCH 08/20] fix(readme): remove unwanted data fix(readme): remove useless steps --- README.md | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/README.md b/README.md index f28565b..3d30442 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,6 @@ The system is composed of three main parts: ### Installation -- **Step 1**: Connect your phone with your laptop via a cable -- **Step 2**: docker build -t test -f android/Dockerfile . && docker run test:latest -- **Step 3**: Go to your browser -> connect to http://localhost:8081/ to be at the web interface -- **Step 4**: Connect to http://localhost:8081/client.apk to download the mobile app - #### Mobile installation - **Step 1**: Go to front/android and create a \`gradle.properties\` file. Fill it with those informations: @@ -108,12 +103,11 @@ WIP ## πŸ›  Contributing -### Languages, frameworks and technologies +### Languages and frameworks - Web App: React + SCSS - Mobile App: React + Capacitor + SCSS - Server: Python + fastapi -- Environment: Nix + Docker ### How to add a service @@ -139,10 +133,3 @@ WIP ## πŸ“– Documentation - **API**: http://localhost:8080/docs - -keytool -genkey -v -keystore apk_key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias alias; - -RELEASE_STORE_FILE=/build/apk_key.jks -RELEASE_STORE_PASSWORD=xxxx -RELEASE_KEY_ALIAS=alias -RELEASE_KEY_PASSWORD=xxxx \ No newline at end of file From fddbcb2331742b687b2524eae2d2b0d444d4f593 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Mon, 3 Nov 2025 23:10:41 +0100 Subject: [PATCH 09/20] feat(readme): add config.toml config --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3d30442..f7d867e 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,26 @@ The system is composed of three main parts: ### Installation -#### Mobile installation + - **Step 1**: Go to back and a create a \`config.toml\` file. Fill it with: -- **Step 1**: Go to front/android and create a \`gradle.properties\` file. Fill it with those informations: +[security] +jwt_secret = "hello_world_3301@083280948390" + +[db] +uri="sqlite+aiosqlite:///app.db" + +[providers] + +[providers.discord] +client_id = id_exemple #1418965246885761106 +client_secret = secret_example #"JgGHjCxByc56UweRxbS978hWq9tpRbs4" + +[providers.github] +\# ... + +In the providers, replace the client_id and client_secret with your client_id and client_secret. Repeat for every provider. (They can be found in back/app/routes) + +- **Step 2**: Go to front/android and create a \`gradle.properties\` file. Fill it with those informations: \# Project-wide Gradle settings. @@ -77,13 +94,13 @@ RELEASE_KEY_PASSWORD=xxxxxx Replace both of the "xxxxxx" with an actual password. That password need to be at least 6 characters long. -- **Step 2**: In your terminal run `keytool -genkey -v -keystore apk_key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias alias;`. +- **Step 3**: In your terminal run `keytool -genkey -v -keystore apk_key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias alias;`. It will ask for a keystore password, put the one you chose for the first step. It will follow by asking more information; those information don't need to be necesarilly true. Enter 'y' to confirm the datas you entered. -- **Step 3**: run `docker build -t test -f android/Dockerfile . && docker run test:latest`. +- **Step 4**: run `docker build -t test -f android/Dockerfile . && docker run test:latest`. -- **Step 4**: Connect to http://localhost:8081/client.apk to download the mobile app. +- **Step 5**: Connect to http://localhost:8081/client.apk to download the mobile app. From b6df3b3dc1b5a65b3a474c1d4a90eb296b5604c3 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Mon, 3 Nov 2025 23:11:23 +0100 Subject: [PATCH 10/20] refactor(readme): remove contributing section of readme --- README.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/README.md b/README.md index f7d867e..07a1ab9 100644 --- a/README.md +++ b/README.md @@ -118,27 +118,6 @@ WIP --- -## πŸ›  Contributing - -### Languages and frameworks - -- Web App: React + SCSS -- Mobile App: React + Capacitor + SCSS -- Server: Python + fastapi - -### How to add a service - -- Go to area/back/app/routes -- Add a folder and name it after the service you want to add -- Create a `__init__.py` file following other examples -- Create the .py file for the service and complete it following the other examples - -### How to add an A-REA - -WIP - ---- - ## πŸ“… Project Timeline - **21/09/2025**: Tech stack selection, PoC, task distribution. From 3021faa965b0f151d452466f87e50954c570ec04 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Tue, 4 Nov 2025 11:38:00 +0100 Subject: [PATCH 11/20] refactor(readme): move exemples into separate files --- README.md | 52 +++-------------------------------------- exemples/exemple_config | 14 +++++++++++ exemples/exemple_gradle | 26 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 49 deletions(-) create mode 100644 exemples/exemple_config create mode 100644 exemples/exemple_gradle diff --git a/README.md b/README.md index 07a1ab9..913bd7e 100644 --- a/README.md +++ b/README.md @@ -44,58 +44,12 @@ The system is composed of three main parts: ### Installation - - **Step 1**: Go to back and a create a \`config.toml\` file. Fill it with: + - **Step 1**: Go to back and a create a \`config.toml\` file. Fill it based on the data in exemples/exemple_config. In the provider section, replace the client_id and client_secret with your client_id and client_secret. Repeat for every provider. (They can be found in back/app/routes) -[security] -jwt_secret = "hello_world_3301@083280948390" - -[db] -uri="sqlite+aiosqlite:///app.db" - -[providers] - -[providers.discord] -client_id = id_exemple #1418965246885761106 -client_secret = secret_example #"JgGHjCxByc56UweRxbS978hWq9tpRbs4" - -[providers.github] -\# ... - -In the providers, replace the client_id and client_secret with your client_id and client_secret. Repeat for every provider. (They can be found in back/app/routes) - -- **Step 2**: Go to front/android and create a \`gradle.properties\` file. Fill it with those informations: - -\# Project-wide Gradle settings. - -\# IDE (e.g. Android Studio) users: -\# Gradle settings configured through the IDE *will override* -\# any settings specified in this file. - -\# For more details on how to configure your build environment visit -\# http://www.gradle.org/docs/current/userguide/build_environment.html - -\# Specifies the JVM arguments used for the daemon process. -\# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m - -\# When configured, Gradle will run in incubating parallel mode. -\# This option should only be used with decoupled projects. More details, visit -\# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -\# org.gradle.parallel=true - -\# AndroidX package structure to make it clearer which packages are bundled with the -\# Android operating system, and which are packaged with your app's APK -\# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true -RELEASE_STORE_FILE=/build/apk_key.jks -RELEASE_STORE_PASSWORD=xxxxxx -RELEASE_KEY_ALIAS=alias -RELEASE_KEY_PASSWORD=xxxxxx - -Replace both of the "xxxxxx" with an actual password. That password need to be at least 6 characters long. +- **Step 2**: Go to front/android and create a \`gradle.properties\` file. Fill it with the informations in exemples/exemple_gradle. Fill `RELEASE_STORE_PASSWORD` and `RELEASE_KEY_PASSWORD` with your own password. The two must have an identical one. - **Step 3**: In your terminal run `keytool -genkey -v -keystore apk_key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias alias;`. -It will ask for a keystore password, put the one you chose for the first step. It will follow by asking more information; those information don't need to be necesarilly true. +It will ask for a keystore password, put the one you chose for the second step. It will follow by asking more information; those information don't need to be necesarilly true. Enter 'y' to confirm the datas you entered. - **Step 4**: run `docker build -t test -f android/Dockerfile . && docker run test:latest`. diff --git a/exemples/exemple_config b/exemples/exemple_config new file mode 100644 index 0000000..9647a70 --- /dev/null +++ b/exemples/exemple_config @@ -0,0 +1,14 @@ +[security] +jwt_secret = "hello_world_3301@083280948390" + +[db] +uri="sqlite+aiosqlite:///app.db" + +[providers] + +[providers.discord] +client_id = id_exemple #1418965246885761106 +client_secret = secret_example #"JgGHjCxByc56UweRxbS978hWq9tpRbs4" + +[providers.github] +\# ... \ No newline at end of file diff --git a/exemples/exemple_gradle b/exemples/exemple_gradle new file mode 100644 index 0000000..5b9f34c --- /dev/null +++ b/exemples/exemple_gradle @@ -0,0 +1,26 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true + +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +RELEASE_STORE_FILE=/build/apk_key.jks +RELEASE_STORE_PASSWORD=xxxxxx +RELEASE_KEY_ALIAS=alias +RELEASE_KEY_PASSWORD=xxxxxx \ No newline at end of file From 33328b8bb22c7f565301308e2a655a870b10c4a8 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Tue, 4 Nov 2025 18:32:31 +0100 Subject: [PATCH 12/20] refactor(readme): update config exemple --- README.md | 7 +++++- exemples/exemple_config | 54 +++++++++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 913bd7e..643a001 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,12 @@ The system is composed of three main parts: ### Installation - - **Step 1**: Go to back and a create a \`config.toml\` file. Fill it based on the data in exemples/exemple_config. In the provider section, replace the client_id and client_secret with your client_id and client_secret. Repeat for every provider. (They can be found in back/app/routes) + - **Step 1**: Go to back and a create a \`config.toml\` file. Fill it based on the data in exemples/exemple_config: + The `jwt_secret` is an ascii string. + For each routes fill the `client_id` and `client_secret` with your own. + Note for caldav/gmail/youtube, use the same `client_id`/`client_secret`. The `client_id` must finish with `.apps.googleusercontent.com`. + + In the provider section, replace the client_id and client_secret with your client_id and client_secret. Repeat for every provider. (They can be found in back/app/routes) - **Step 2**: Go to front/android and create a \`gradle.properties\` file. Fill it with the informations in exemples/exemple_gradle. Fill `RELEASE_STORE_PASSWORD` and `RELEASE_KEY_PASSWORD` with your own password. The two must have an identical one. diff --git a/exemples/exemple_config b/exemples/exemple_config index 9647a70..c279c1e 100644 --- a/exemples/exemple_config +++ b/exemples/exemple_config @@ -1,14 +1,54 @@ [security] -jwt_secret = "hello_world_3301@083280948390" +jwt_secret = "" [db] uri="sqlite+aiosqlite:///app.db" -[providers] -[providers.discord] -client_id = id_exemple #1418965246885761106 -client_secret = secret_example #"JgGHjCxByc56UweRxbS978hWq9tpRbs4" +[routes.discord] +client_id = "" +client_secret = "" -[providers.github] -\# ... \ No newline at end of file +[routes.spotify] +# scope = "user-read-email user-read-currently-playing user-follow-read" +client_id = "" +client_secret = "" + +[routes.gmail] +# Provide your Google OAuth 2.0 Web client credentials +# Ensure the redirect URI http://127.0.0.1:8080/gmail/auth is added in Google Cloud Console +client_id = "" +client_secret = "" +# Optional: override scope or redirect URI here if needed +# scope = "https://www.googleapis.com/auth/gmail.readonly openid email profile" +# redirect_uri = "http://127.0.0.1:8080/gmail/auth" + +[routes.caldav] +# Uses Google OAuth credentials (you can reuse the same client as Gmail/YouTube) +# Add redirect URI: http://127.0.0.1:8080/caldav/auth +client_id = "" +client_secret = "" +# Optional overrides +# scope = "https://www.googleapis.com/auth/calendar.readonly openid email profile" +# redirect_uri = "http://127.0.0.1:8080/caldav/auth" + +[routes.youtube] +# Create OAuth credentials at https://console.cloud.google.com/apis/credentials +# Add http://127.0.0.1:8080/youtube/auth as an authorized redirect URI +client_id = "-." +client_secret = "" +# Optional overrides +# scope = "https://www.googleapis.com/auth/youtube.readonly openid email profile" +# redirect_uri = "http://127.0.0.1:8080/youtube/auth" + +[routes.reddit] +# Create a Reddit app at https://www.reddit.com/prefs/apps +# For local dev, use type: installed app (or web app) and add redirect URI: +# http://127.0.0.1:8080/reddit/auth +# Note: Installed apps have no secret; keep client_secret empty. Web apps have a secret. +client_id = "" +client_secret = "" +# Optional overrides: +# scope = "identity read" +# redirect_uri = "http://127.0.0.1:8080/reddit/auth" +# resource_headers.User-Agent should be descriptive; override via code if needed \ No newline at end of file From 5ce129e38de419b0a02b067a9be0d8b8d27b2be0 Mon Sep 17 00:00:00 2001 From: Ciznia Date: Sun, 2 Nov 2025 17:17:08 +0100 Subject: [PATCH 13/20] build(mobile): add dockerfile that build the apk --- front/.gitignore | 1 + front/android/.gitignore | 1 + front/android/Dockerfile | 58 +++++++++++++++++++++++++++++++++ front/android/app/build.gradle | 14 +++++++- front/android/gradle.properties | 22 ------------- front/entrypoint.sh | 29 +++++++++++++++++ 6 files changed, 102 insertions(+), 23 deletions(-) create mode 100644 front/android/Dockerfile delete mode 100644 front/android/gradle.properties create mode 100644 front/entrypoint.sh diff --git a/front/.gitignore b/front/.gitignore index 65b27d6..f716dd0 100644 --- a/front/.gitignore +++ b/front/.gitignore @@ -6,3 +6,4 @@ node_modules dist dist-ssr *.local +*.jks diff --git a/front/android/.gitignore b/front/android/.gitignore index 4bf83a8..86c68a7 100644 --- a/front/android/.gitignore +++ b/front/android/.gitignore @@ -12,6 +12,7 @@ out/ .gradle/ build/ local.properties +gradle.properties *.log diff --git a/front/android/Dockerfile b/front/android/Dockerfile new file mode 100644 index 0000000..b2545b1 --- /dev/null +++ b/front/android/Dockerfile @@ -0,0 +1,58 @@ +FROM node:20-bookworm-slim + +# --- System Dependencies --- +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + bash curl unzip git ca-certificates && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +# --- Install OpenJDK 21 (Temurin) --- +RUN curl -L https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.9+10/OpenJDK21U-jdk_x64_linux_hotspot_21.0.9_10.tar.gz \ + -o /tmp/jdk21.tar.gz && \ + mkdir -p /usr/lib/jvm && \ + tar -xzf /tmp/jdk21.tar.gz -C /usr/lib/jvm && \ + rm /tmp/jdk21.tar.gz && \ + ln -s /usr/lib/jvm/jdk-21*/bin/java /usr/bin/java && \ + ln -s /usr/lib/jvm/jdk-21*/bin/javac /usr/bin/javac + +ENV JAVA_HOME=/usr/lib/jvm/jdk-21.0.9+10/ +ENV PATH="$JAVA_HOME/bin:$PATH" + + +# --- Install Android SDK --- +ENV ANDROID_SDK_ROOT="/sdk" \ + ANDROID_HOME="/sdk" \ + PATH="$PATH:/sdk/cmdline-tools/bin:/sdk/platform-tools" + +RUN mkdir /sdk && \ + curl -s https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -o /cmdline-tools.zip && \ + unzip /cmdline-tools.zip -d /sdk/ && \ + rm /cmdline-tools.zip && \ + mkdir -p /sdk/cmdline-tools/latest && \ + mv /sdk/cmdline-tools/* /sdk/cmdline-tools/latest/ || true && \ + yes | /sdk/cmdline-tools/latest/bin/sdkmanager --sdk_root=/sdk --install \ + "platform-tools" "platforms;android-35" "build-tools;35.0.0" "cmdline-tools;latest" + +# --- Install Gradle --- +RUN curl -sL https://services.gradle.org/distributions/gradle-8.10-bin.zip -o gradle.zip && \ + mkdir /opt/gradle && \ + unzip gradle.zip -d /opt/gradle && \ + rm gradle.zip +ENV PATH="/opt/gradle/gradle-8.10/bin:$PATH" + +# --- Install pnpm --- +RUN npm install -g pnpm + +# --- Web Build --- +WORKDIR /build +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile + +COPY . . +RUN pnpm run build:web +RUN npx cap sync android + +# --- Prepare Android Build --- +RUN chmod +x /build/entrypoint.sh + +CMD ["bash", "entrypoint.sh"] diff --git a/front/android/app/build.gradle b/front/android/app/build.gradle index 55c89ad..c66e170 100644 --- a/front/android/app/build.gradle +++ b/front/android/app/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'com.android.application' android { namespace "io.github.sigmapitech" compileSdk rootProject.ext.compileSdkVersion + defaultConfig { applicationId "io.github.sigmapitech" minSdkVersion rootProject.ext.minSdkVersion @@ -13,15 +14,26 @@ android { ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' } } + + signingConfigs { + release { + storeFile file(RELEASE_STORE_FILE) + storePassword RELEASE_STORE_PASSWORD + keyAlias RELEASE_KEY_ALIAS + keyPassword RELEASE_KEY_PASSWORD + } + } + buildTypes { release { minifyEnabled false + signingConfig signingConfigs.release } } } repositories { - flatDir{ + flatDir { dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' } } diff --git a/front/android/gradle.properties b/front/android/gradle.properties deleted file mode 100644 index 2e87c52..0000000 --- a/front/android/gradle.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true - -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true diff --git a/front/entrypoint.sh b/front/entrypoint.sh new file mode 100644 index 0000000..6946ce7 --- /dev/null +++ b/front/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Output dir +OUTPUT_DIR=/app +APK_NAME=client.apk + +# Ensure output folder exist +mkdir -p $OUTPUT_DIR +npx cap sync android +cd android +# Clean previous build +./gradlew clean + +# Sync dependencies +./gradlew build --no-daemon --refresh-dependencies + +# Build project for release +./gradlew assembleRelease + +# Copy apk to output dir +cp /build/android/app/build/outputs/apk/release/app-release.apk $OUTPUT_DIR/$APK_NAME + +# Ensure build success +if [ -f "$OUTPUT_DIR/$APK_NAME" ]; then + echo "APK successfully generated : $OUTPUT_DIR/$APK_NAME" +else + echo "APK generation failed." + exit 1 +fi From ea836fbe57b4367b79e227daedd13302b70a0bf5 Mon Sep 17 00:00:00 2001 From: Ciznia Date: Sun, 2 Nov 2025 18:30:27 +0100 Subject: [PATCH 14/20] build(nix): readd a nix builder for the front --- flake.nix | 1 + front/default.nix | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 front/default.nix diff --git a/flake.nix b/flake.nix index 73e00ea..c31047b 100644 --- a/flake.nix +++ b/flake.nix @@ -141,6 +141,7 @@ packages = forAllSystems (pkgs: { back = pkgs.callPackage ./back {}; + front = pkgs.callPackage ./front {}; }); }; } diff --git a/front/default.nix b/front/default.nix new file mode 100644 index 0000000..91da451 --- /dev/null +++ b/front/default.nix @@ -0,0 +1,62 @@ +{ + lib, + stdenvNoCC, + nodejs, + pnpm, + serve, + mode ? "web", +}: +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "area-front"; + version = "0.0.0"; + + src = ./.; + + nativeBuildInputs = [ + nodejs + pnpm.configHook + ]; + + pnpmDeps = pnpm.fetchDeps { + inherit (finalAttrs) pname src; + + fetcherVersion = 2; + hash = "sha256-FSQA/Li1XsqQwwosbItC42e1OjCN0soe4Yhn3Od7frA="; + }; + + # using sass-embedded fails at executing dart-sass from node-modules + preBuild = '' + rm -rf node_modules/{.pnpm/,}sass-embedded* + ''; + + buildPhase = '' + runHook preBuild + + pnpm run build:${mode} + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/area-front + cp -r dist/* $out/share/area-front/ + + mkdir -p $out/bin + cat > $out/bin/web <<'EOF' + #!${stdenvNoCC.shell} + exec ${lib.getExe serve} "$out/share/area-front" -p 8081 + EOF + chmod +x $out/bin/web + + runHook postInstall + ''; + + meta = { + description = "Area front-end"; + maintainers = with lib.maintainers; [sigmanificient]; + license = lib.licenses.bsd3; + mainProgram = "web"; + }; +}) From 976a96bd2f78db00f97ef776c36b52757d33a911 Mon Sep 17 00:00:00 2001 From: Ciznia Date: Tue, 4 Nov 2025 13:16:27 +0100 Subject: [PATCH 15/20] fix(docker): fix mobile/back docker WIP --- back/Dockerfile | 3 ++- back/app/main.py | 2 +- docker-compose.yml | 37 +++++++++++++++++++++---------------- front/default.nix | 2 +- front/entrypoint.sh | 2 +- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/back/Dockerfile b/back/Dockerfile index 6f40538..a469405 100644 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -21,10 +21,11 @@ FROM scratch # Copy /nix/store and the built result COPY --from=builder /tmp/nix-store-closure /nix/store COPY --from=builder /tmp/build/result /app +COPY --from=builder /tmp/build/back/config.toml /app/config.toml # Expose server port and run ENV PORT=8080 WORKDIR /app EXPOSE 8080 # Pass "dev" to enable the CORS branch in app.main -CMD ["/app/bin/area", "dev"] +CMD ["/app/bin/area", "run"] diff --git a/back/app/main.py b/back/app/main.py index 17bb1a1..2577a06 100644 --- a/back/app/main.py +++ b/back/app/main.py @@ -33,4 +33,4 @@ async def lifespan(_: FastAPI): def main(): - uvicorn.run(app, host="127.0.0.1", port=8080) + uvicorn.run(app, host="0.0.0.0", port=8080) diff --git a/docker-compose.yml b/docker-compose.yml index b5edab1..dd374f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,17 @@ services: + client_mobile: + build: + context: front + dockerfile: ./android/Dockerfile + volumes: + - shared-artifacts:/shared + # Optional: wait for a short while on first run to produce the APK + healthcheck: + test: ["CMD", "test", "-f", "/shared/client.apk"] + interval: 10s + timeout: 5s + retries: 30 + server: build: context: . @@ -6,33 +19,25 @@ services: ports: - "8080:8080" working_dir: /app - volumes: - - ./back/config.toml:/app/config.toml:ro - - # client_mobile: - # build: - # context: . - # dockerfile: front/android/Dockerfile - # volumes: - # - shared-artifacts:/shared - # # Optional: wait for a short while on first run to produce the APK - # healthcheck: - # test: ["CMD", "test", "-f", "/shared/client.apk"] - # interval: 10s - # timeout: 5s - # retries: 30 client_web: build: context: . dockerfile: front/Dockerfile depends_on: - server: condition: service_started + client_mobile: + condition: service_completed_successfully + networks: + - backToFront ports: - "8081:8081" volumes: - ./shared-artifacts:/app/share/www +volumes: + shared-artifacts: +networks: + backToFront: diff --git a/front/default.nix b/front/default.nix index 91da451..507b5c6 100644 --- a/front/default.nix +++ b/front/default.nix @@ -21,7 +21,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { inherit (finalAttrs) pname src; fetcherVersion = 2; - hash = "sha256-FSQA/Li1XsqQwwosbItC42e1OjCN0soe4Yhn3Od7frA="; + hash = "sha256-igUdfQtmFH8arU+dpLRBziJZ75108yq0kN5Jqf/Nuew="; }; # using sass-embedded fails at executing dart-sass from node-modules diff --git a/front/entrypoint.sh b/front/entrypoint.sh index 6946ce7..1043c49 100644 --- a/front/entrypoint.sh +++ b/front/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash # Output dir -OUTPUT_DIR=/app +OUTPUT_DIR=/shared APK_NAME=client.apk # Ensure output folder exist From 2f9879641bfe8223b843d4b3ae240eeb7de1e0a3 Mon Sep 17 00:00:00 2001 From: Ciznia Date: Tue, 4 Nov 2025 20:15:25 +0100 Subject: [PATCH 16/20] fix(docker): fix the dockerfile for the front and serve the apk at the good endpoint --- docker-compose.yml | 10 +++++--- flake.nix | 1 - front/Dockerfile | 48 +++++++++++++++++++---------------- front/default.nix | 62 ---------------------------------------------- front/nginx.conf | 19 ++++++++++++++ 5 files changed, 52 insertions(+), 88 deletions(-) delete mode 100644 front/default.nix create mode 100644 front/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index dd374f0..4abe949 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,14 +16,16 @@ services: build: context: . dockerfile: back/Dockerfile + networks: + - backToFront ports: - "8080:8080" working_dir: /app client_web: build: - context: . - dockerfile: front/Dockerfile + context: front + dockerfile: ./Dockerfile depends_on: server: condition: service_started @@ -32,9 +34,9 @@ services: networks: - backToFront ports: - - "8081:8081" + - "8081:80" volumes: - - ./shared-artifacts:/app/share/www + - shared-artifacts:/shared/:ro volumes: shared-artifacts: diff --git a/flake.nix b/flake.nix index c31047b..73e00ea 100644 --- a/flake.nix +++ b/flake.nix @@ -141,7 +141,6 @@ packages = forAllSystems (pkgs: { back = pkgs.callPackage ./back {}; - front = pkgs.callPackage ./front {}; }); }; } diff --git a/front/Dockerfile b/front/Dockerfile index 0a8e887..ebcf49e 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -1,27 +1,33 @@ -# Nix builder -FROM nixos/nix:latest AS builder +FROM node:22-bookworm-slim AS build -# Copy our source and setup our working dir. -COPY .. /tmp/build -WORKDIR /tmp/build +ENV DEBIAN_FRONTEND=noninteractive -# Build our Nix environment (front-web helper) -RUN nix \ - --extra-experimental-features "nix-command flakes" \ - --option filter-syscalls false \ - build .#front +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + curl \ + ca-certificates && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* -# Copy the Nix store closure into a directory. -RUN mkdir /tmp/nix-store-closure -RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure +RUN corepack enable && corepack prepare pnpm@latest --activate -# Final image is based on scratch. -FROM scratch +RUN npm install -g serve -# Copy /nix/store and the built result -COPY --from=builder /tmp/nix-store-closure /nix/store -COPY --from=builder /tmp/build/result /app +WORKDIR /app -# Expose client_web port and run -EXPOSE 8081 -CMD ["/app/bin/web"] +COPY package.json pnpm-lock.yaml ./ + +ENV CI=true +RUN pnpm install --frozen-lockfile + +COPY . . + +RUN pnpm build:web + +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Expose to 80 and remap it in compose since nginx defaults to 80 without parameters possible +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/front/default.nix b/front/default.nix deleted file mode 100644 index 507b5c6..0000000 --- a/front/default.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - lib, - stdenvNoCC, - nodejs, - pnpm, - serve, - mode ? "web", -}: -stdenvNoCC.mkDerivation (finalAttrs: { - pname = "area-front"; - version = "0.0.0"; - - src = ./.; - - nativeBuildInputs = [ - nodejs - pnpm.configHook - ]; - - pnpmDeps = pnpm.fetchDeps { - inherit (finalAttrs) pname src; - - fetcherVersion = 2; - hash = "sha256-igUdfQtmFH8arU+dpLRBziJZ75108yq0kN5Jqf/Nuew="; - }; - - # using sass-embedded fails at executing dart-sass from node-modules - preBuild = '' - rm -rf node_modules/{.pnpm/,}sass-embedded* - ''; - - buildPhase = '' - runHook preBuild - - pnpm run build:${mode} - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out/share/area-front - cp -r dist/* $out/share/area-front/ - - mkdir -p $out/bin - cat > $out/bin/web <<'EOF' - #!${stdenvNoCC.shell} - exec ${lib.getExe serve} "$out/share/area-front" -p 8081 - EOF - chmod +x $out/bin/web - - runHook postInstall - ''; - - meta = { - description = "Area front-end"; - maintainers = with lib.maintainers; [sigmanificient]; - license = lib.licenses.bsd3; - mainProgram = "web"; - }; -}) diff --git a/front/nginx.conf b/front/nginx.conf new file mode 100644 index 0000000..a346006 --- /dev/null +++ b/front/nginx.conf @@ -0,0 +1,19 @@ +server { + listen 80; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri /index.html =404; + } + + location /client.apk { + alias /shared/client.apk; + } + + location /shared/ { + alias /shared/; + autoindex on; + } +} From 32072f3aa2b7f33764c817a4cfb73db34903b8e4 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Wed, 5 Nov 2025 00:26:00 +0100 Subject: [PATCH 17/20] fix(examples): fix orthographe mistakes --- exemples/exemple_config => examples/example_config | 0 exemples/exemple_gradle => examples/example_gradle | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename exemples/exemple_config => examples/example_config (100%) rename exemples/exemple_gradle => examples/example_gradle (100%) diff --git a/exemples/exemple_config b/examples/example_config similarity index 100% rename from exemples/exemple_config rename to examples/example_config diff --git a/exemples/exemple_gradle b/examples/example_gradle similarity index 100% rename from exemples/exemple_gradle rename to examples/example_gradle From d8728112c1d0d2edde00877c61085af790f7514a Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Wed, 5 Nov 2025 00:29:07 +0100 Subject: [PATCH 18/20] refactor(readme): remove useless steps --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 643a001..c1543d3 100644 --- a/README.md +++ b/README.md @@ -51,16 +51,13 @@ The system is composed of three main parts: In the provider section, replace the client_id and client_secret with your client_id and client_secret. Repeat for every provider. (They can be found in back/app/routes) -- **Step 2**: Go to front/android and create a \`gradle.properties\` file. Fill it with the informations in exemples/exemple_gradle. Fill `RELEASE_STORE_PASSWORD` and `RELEASE_KEY_PASSWORD` with your own password. The two must have an identical one. +- **Step 2**: Go to front and create a \`gradle.properties\` file. Fill it with the informations in exemples/exemple_gradle. Fill `RELEASE_STORE_PASSWORD` and `RELEASE_KEY_PASSWORD` with your own password. The two must have an identical one. - **Step 3**: In your terminal run `keytool -genkey -v -keystore apk_key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias alias;`. It will ask for a keystore password, put the one you chose for the second step. It will follow by asking more information; those information don't need to be necesarilly true. Enter 'y' to confirm the datas you entered. -- **Step 4**: run `docker build -t test -f android/Dockerfile . && docker run test:latest`. - -- **Step 5**: Connect to http://localhost:8081/client.apk to download the mobile app. - +- **Step 4**: Run `docker compose up --build` ### Services From 3920bf4b39ef8353a84cba14d869ab0c8a036e21 Mon Sep 17 00:00:00 2001 From: Lilian Bazantay Date: Wed, 5 Nov 2025 00:37:32 +0100 Subject: [PATCH 19/20] feat(readme): add database and routes explanations --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c1543d3..ab92c9e 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,11 @@ The system is composed of three main parts: - **Step 1**: Go to back and a create a \`config.toml\` file. Fill it based on the data in exemples/exemple_config: The `jwt_secret` is an ascii string. + Create an `uri` (or copy for exemples/exemple_config) and fill it with `"sqlite+aiosqlite:///app.db"`. + Each routes is defined following that structure: [routes.{service}]. The list of services can be found in back/app/routes. For each routes fill the `client_id` and `client_secret` with your own. Note for caldav/gmail/youtube, use the same `client_id`/`client_secret`. The `client_id` must finish with `.apps.googleusercontent.com`. - In the provider section, replace the client_id and client_secret with your client_id and client_secret. Repeat for every provider. (They can be found in back/app/routes) - **Step 2**: Go to front and create a \`gradle.properties\` file. Fill it with the informations in exemples/exemple_gradle. Fill `RELEASE_STORE_PASSWORD` and `RELEASE_KEY_PASSWORD` with your own password. The two must have an identical one. From 0a89fc806c7c0a3d8bb520cf1a4c95d83e60dd47 Mon Sep 17 00:00:00 2001 From: Sigmanificient Date: Tue, 4 Nov 2025 23:50:03 +0100 Subject: [PATCH 20/20] fix(front): setup api url properly --- front/nginx.conf | 5 +++++ front/src/api_url.ts | 4 +++- front/src/routes/login/index.tsx | 2 +- front/src/routes/register/index.tsx | 2 +- front/vite-env.d.ts | 8 ++++++++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/front/nginx.conf b/front/nginx.conf index a346006..00b072f 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -8,6 +8,11 @@ server { try_files $uri /index.html =404; } + location /api/ { + proxy_pass http://server:8080/; + proxy_set_header Host $host; + } + location /client.apk { alias /shared/client.apk; } diff --git a/front/src/api_url.ts b/front/src/api_url.ts index 51e40d0..95b0033 100644 --- a/front/src/api_url.ts +++ b/front/src/api_url.ts @@ -1 +1,3 @@ -export const API_BASE_URL = "http://127.0.0.1:8080"; +export const API_BASE_URL = import.meta.env.PROD + ? "http://localhost:8081/api" + : "http://localhost:8080"; diff --git a/front/src/routes/login/index.tsx b/front/src/routes/login/index.tsx index a23e584..f86c90e 100644 --- a/front/src/routes/login/index.tsx +++ b/front/src/routes/login/index.tsx @@ -57,7 +57,7 @@ export default function LoginPage() { const { email, password } = formData; handleFormSubmit({ - url: `${API_BASE_URL}/auth/login/`, + url: `${API_BASE_URL}/auth/login`, body: { email, password }, onSuccess: (data) => { login(data.token); diff --git a/front/src/routes/register/index.tsx b/front/src/routes/register/index.tsx index da79af6..321b53d 100644 --- a/front/src/routes/register/index.tsx +++ b/front/src/routes/register/index.tsx @@ -94,7 +94,7 @@ export default function RegisterPage() { } handleFormSubmit({ - url: `${API_BASE_URL}/auth/register/`, + url: `${API_BASE_URL}/auth/register`, body: { email, name, password }, onSuccess: (data) => { login(data.token); diff --git a/front/vite-env.d.ts b/front/vite-env.d.ts index c934b98..c555498 100644 --- a/front/vite-env.d.ts +++ b/front/vite-env.d.ts @@ -2,4 +2,12 @@ /// +interface ImportMetaEnv { + readonly PROD: boolean; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} + declare const __APP_PLATFORM__: "mobile" | "web";