Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fix firebase

Acho Arnold Ewin94eab767dc28
diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml
index 957fc2d8..b8f98a7d 100644
--- a/.github/workflows/web.yml
+++ b/.github/workflows/web.yml
@@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
- node: [20]
+ node: [24]
steps:
- name: Checkout πŸ›Ž
@@ -34,7 +34,7 @@ jobs:
- uses: pnpm/action-setup@v6
name: Install pnpm
with:
- version: 10
+ version: 11
- name: Install dependencies πŸ“¦
run: pnpm install
@@ -46,7 +46,7 @@ jobs:
run: pnpm test
- name: Build πŸ—οΈ
- run: pnpm run build
+ run: mv .env.production .env && echo "GITHUB_SHA=${GITHUB_SHA}" >> .env && pnpm run generate
deploy:
name: Deploy
@@ -61,13 +61,13 @@ jobs:
- uses: pnpm/action-setup@v6
name: Install pnpm
with:
- version: 10
+ version: 11
- name: Install dependencies πŸ“¦
run: pnpm install
- name: Build πŸ—οΈ
- run: pnpm run build
+ run: mv .env.production .env && echo "GITHUB_SHA=${GITHUB_SHA}" >> .env && pnpm run generate
- name: Cloudflare Deploy πŸš€
uses: cloudflare/pages-action@1
diff --git a/web/.env.docker b/web/.env.docker
new file mode 100644
index 00000000..b1751dfb
--- /dev/null
+++ b/web/.env.docker
@@ -0,0 +1,21 @@
+API_BASE_URL=http://localhost:8000
+
+APP_URL=http://localhost:3000
+APP_NAME=httpSMS
+APP_GITHUB_URL=https://github.com/NdoleStudio/httpsms
+APP_DOCUMENTATION_URL=https://docs.httpsms.com
+APP_DOWNLOAD_URL=https://github.com/NdoleStudio/httpsms/releases/latest/download/HttpSms.apk
+APP_ENV=production
+
+# Firebase credentials
+FIREBASE_API_KEY=AIzaSyAKqPvj51igvvNNcRt_gL0A6cgx3ZB-kuQ
+FIREBASE_AUTH_DOMAIN=httpsms-docker.firebaseapp.com
+FIREBASE_PROJECT_ID=httpsms-docker
+FIREBASE_STORAGE_BUCKET=httpsms-docker.appspot.com
+FIREBASE_MESSAGING_SENDER_ID=668063041624
+FIREBASE_APP_ID=668063041624:web:29b9e3b7027965ba08a22d
+FIREBASE_MEASUREMENT_ID=G-18VRYL22PZ
+
+# Cloudflare Turnstile site key for captcha on the search messages page
+# Get your site key at https://developers.cloudflare.com/turnstile/get-started/
+CLOUDFLARE_TURNSTILE_SITE_KEY=
diff --git a/web/.env.example b/web/.env.example
deleted file mode 100644
index eade4119..00000000
--- a/web/.env.example
+++ /dev/null
@@ -1,28 +0,0 @@
-# Firebase
-FIREBASE_API_KEY=
-FIREBASE_AUTH_DOMAIN=
-FIREBASE_PROJECT_ID=
-FIREBASE_STORAGE_BUCKET=
-FIREBASE_MESSAGING_SENDER_ID=
-FIREBASE_APP_ID=
-FIREBASE_MEASUREMENT_ID=
-
-# App
-API_BASE_URL=http://localhost:8000
-APP_URL=https://httpsms.com
-APP_NAME=HTTP SMS
-APP_GITHUB_URL=https://github.com/NdoleStudio/httpsms
-APP_DOCUMENTATION_URL=https://docs.httpsms.com
-APP_DOWNLOAD_URL=https://apk.httpsms.com/HttpSms.apk
-APP_ENV=local
-
-# Billing
-CHECKOUT_URL=
-ENTERPRISE_CHECKOUT_URL=
-
-# Cloudflare
-CLOUDFLARE_TURNSTILE_SITE_KEY=
-
-# Pusher
-PUSHER_KEY=
-PUSHER_CLUSTER=
diff --git a/web/.env.production b/web/.env.production
new file mode 100644
index 00000000..30cbebd0
--- /dev/null
+++ b/web/.env.production
@@ -0,0 +1,24 @@
+API_BASE_URL=https://api.httpsms.com
+
+APP_URL=https://httpsms.com
+APP_NAME=httpSMS
+APP_GITHUB_URL=https://github.com/NdoleStudio/httpsms
+APP_DOCUMENTATION_URL=https://docs.httpsms.com
+APP_DOWNLOAD_URL=https://apk.httpsms.com/HttpSms.apk
+APP_ENV=production
+
+CHECKOUT_URL=https://httpsms.lemonsqueezy.com/checkout/buy/706c5638-4c8d-40db-a6f2-b6371b7e0af4
+ENTERPRISE_CHECKOUT_URL=https://httpsms.lemonsqueezy.com/checkout/buy/d107cf05-4b13-4ebd-a770-c2cc75c69a14
+
+FIREBASE_API_KEY=AIzaSyClL8AX2H_F77_n8yu5FgLzBmJTiSM0NsQ
+FIREBASE_AUTH_DOMAIN=httpsms-86c51.firebaseapp.com
+FIREBASE_PROJECT_ID=httpsms-86c51
+FIREBASE_STORAGE_BUCKET=httpsms-86c51.appspot.com
+FIREBASE_MESSAGING_SENDER_ID=877524083399
+FIREBASE_APP_ID=1:877524083399:web:430d6a29a0d808946514e2
+FIREBASE_MEASUREMENT_ID=G-EZ5W9DVK8T
+
+CLOUDFLARE_TURNSTILE_SITE_KEY=0x4AAAAAAA6Hpp8SDyMMPhWg
+
+PUSHER_KEY=a4809008d8f03aaab022
+PUSHER_CLUSTER=mt1
diff --git a/web/.gitignore b/web/.gitignore
index 4a7f73a2..92908270 100644
--- a/web/.gitignore
+++ b/web/.gitignore
@@ -22,3 +22,5 @@ logs
.env
.env.*
!.env.example
+!.env.docker
+!.env.production
diff --git a/web/app/components/FirebaseAuth.vue b/web/app/components/FirebaseAuth.vue
index da5d2683..5d441e60 100644
--- a/web/app/components/FirebaseAuth.vue
+++ b/web/app/components/FirebaseAuth.vue
@@ -35,7 +35,7 @@ async function signInWithGoogle() {
const result = await signInWithPopup(auth, new GoogleAuthProvider());
onSuccess(result.user);
} catch (error: unknown) {
- handleError(error);
+ handleError(error, true);
} finally {
loading.value = false;
}
@@ -48,7 +48,7 @@ async function signInWithGithub() {
const result = await signInWithPopup(auth, new GithubAuthProvider());
onSuccess(result.user);
} catch (error: unknown) {
- handleError(error);
+ handleError(error, true);
} finally {
loading.value = false;
}
@@ -90,19 +90,30 @@ function onSuccess(user: unknown) {
router.push({ path: props.to });
}
-function handleError(error: unknown) {
+function handleError(error: unknown, isSocial = false) {
const firebaseError = error as { code?: string; message?: string };
const code = firebaseError.code || "";
+ let message = "";
if (code === "auth/user-not-found" || code === "auth/invalid-credential") {
- emailError.value = "Invalid email or password";
+ message = "Invalid email or password";
} else if (code === "auth/email-already-in-use") {
- emailError.value = "An account with this email already exists";
+ message = "An account with this email already exists";
} else if (code === "auth/weak-password") {
- emailError.value = "Password must be at least 6 characters";
- } else if (code === "auth/popup-closed-by-user") {
- // User closed popup, no error to show
+ message = "Password must be at least 6 characters";
+ } else if (
+ code === "auth/popup-closed-by-user" ||
+ code === "auth/cancelled-popup-request"
+ ) {
+ // User closed the popup, no error to show
+ return;
+ } else {
+ message = firebaseError.message || "An error occurred";
+ }
+
+ if (isSocial) {
+ notificationsStore.addNotification({ message, type: "error" });
} else {
- emailError.value = firebaseError.message || "An error occurred";
+ emailError.value = message;
}
}
</script>
diff --git a/web/app/composables/useApi.ts b/web/app/composables/useApi.ts
index fd3ec71a..591d6e46 100644
--- a/web/app/composables/useApi.ts
+++ b/web/app/composables/useApi.ts
@@ -13,12 +13,13 @@ export function setApiKey(key: string | null) {
function createApiFetch(): $Fetch {
const config = useRuntimeConfig();
- const baseURL = (config.public as Record<string, string>).apiBaseUrl;
+ const publicConfig = config.public as Record<string, string>;
+ const baseURL = publicConfig.apiBaseUrl;
return $fetch.create({
baseURL,
headers: {
- "X-Client-Version": "web",
+ "X-Client-Version": publicConfig.clientVersion || "dev",
},
onRequest({ options }) {
const headers = (options.headers ||= {}) as Record<string, string>;
diff --git a/web/nuxt.config.ts b/web/nuxt.config.ts
index e50a6019..aca3acf3 100644
--- a/web/nuxt.config.ts
+++ b/web/nuxt.config.ts
@@ -53,6 +53,7 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
apiBaseUrl: process.env.API_BASE_URL || "http://localhost:8000",
+ clientVersion: process.env.GITHUB_SHA || "dev",
appUrl: process.env.APP_URL || "https://httpsms.com",
appName: process.env.APP_NAME || "HTTP SMS",
appGithubUrl: