You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[5. Setup the environment variables](#5-setup-the-environment-variables)
43
+
-[6. Build and Run](#6-build-and-run)
44
+
-[7. Create the System User](#7-create-the-system-user)
45
+
-[8. Build the Android App.](#8-build-the-android-app)
45
46
-[License](#license)
46
47
47
48
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -164,15 +165,23 @@ const firebaseConfig = {
164
165
The httpSMS application uses [SMTP](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol) to send emails to users e.g. when your Android phone has been offline for a long period of time.
165
166
You can use a service like [mailtrap](https://mailtrap.io/) to create an SMTP server for development purposes.
166
167
167
-
### 3. Download the code
168
+
### 3. Setup Cloudflare Turnstile
169
+
170
+
The message search route (`/v1/messages/search`) is protected by a [Cloudflare Turnstile](https://developers.cloudflare.com/turnstile/get-started/) captcha to prevent abuse. You need to set up a Turnstile widget for the search messages feature to work.
171
+
172
+
1. Go to the [Cloudflare dashboard](https://dash.cloudflare.com/) and navigate to **Turnstile**.
173
+
2. Add a new site and configure it for your self-hosted domain (e.g., `localhost` for local development).
174
+
3. Note down the **Site Key** and **Secret Key** — you will need them for the frontend and backend environment variables respectively.
- Copy the `.env.docker` file in the `web` directory into `.env`
178
187
@@ -190,6 +199,9 @@ FIREBASE_STORAGE_BUCKET=
190
199
FIREBASE_MESSAGING_SENDER_ID=
191
200
FIREBASE_APP_ID=
192
201
FIREBASE_MEASUREMENT_ID=
202
+
203
+
# Cloudflare Turnstile site key from step 3
204
+
CLOUDFLARE_TURNSTILE_SITE_KEY=
193
205
```
194
206
195
207
- Copy the `.env.docker` file in the `api` directory into `.env`
@@ -198,7 +210,7 @@ FIREBASE_MEASUREMENT_ID=
198
210
cp api/.env.docker api/.env
199
211
```
200
212
201
-
- Update the environment variables in the `.env` file in the `api` directory with your firebase service account credentials and SMTP server details.
213
+
- Update the environment variables in the `.env` file in the `api` directory with your firebase service account credentials, SMTP server details, and Cloudflare Turnstile secret key.
202
214
203
215
```dotenv
204
216
# SMTP email server settings
@@ -212,11 +224,14 @@ FIREBASE_CREDENTIALS=
212
224
213
225
# This is the `projectId` from your firebase web config
214
226
GCP_PROJECT_ID=
227
+
228
+
# Cloudflare Turnstile secret key from step 3
229
+
CLOUDFLARE_TURNSTILE_SECRET_KEY=
215
230
```
216
231
217
232
- Don't bother about the `EVENTS_QUEUE_USER_API_KEY` and `EVENTS_QUEUE_USER_ID` settings. We will set that up later.
218
233
219
-
### 5. Build and Run
234
+
### 6. Build and Run
220
235
221
236
- Build and run the API, the web UI, database and cache using the `docker-compose.yml` file. It takes a while for build and download all the docker images.
222
237
When it's finished, you'll be able to access the web UI at http://localhost:3000 and the API at http://localhost:8000
@@ -225,7 +240,7 @@ GCP_PROJECT_ID=
225
240
docker compose up --build
226
241
```
227
242
228
-
### 6. Create the System User
243
+
### 7. Create the System User
229
244
230
245
- The application uses the concept of a system user to process events async. You should manually create this user in `users` table in your database. Make sure you use the same `id` and `api_key` as the `EVENTS_QUEUE_USER_ID`, and `EVENTS_QUEUE_USER_API_KEY` in your `.env` file.
231
246
@@ -236,7 +251,7 @@ docker compose up --build
236
251
> [!IMPORTANT]
237
252
> Restart your API docker container after modifying `EVENTS_QUEUE_USER_ID`, and `EVENTS_QUEUE_USER_API_KEY` in your `.env` file so that the httpSMS API can pick up the changes.
238
253
239
-
### 7. Build the Android App.
254
+
### 8. Build the Android App.
240
255
241
256
- Before building the Android app in [Android Studio](https://developer.android.com/studio), you need to replace the `google-services.json` file in the `android/app` directory with the file which you got from step 1. You need to do this for the firebase FCM messages to work properly.
0 commit comments