Skip to content

Commit 94eab76

Browse files
committed
Fix firebase
1 parent 9ad8605 commit 94eab76

8 files changed

Lines changed: 76 additions & 44 deletions

File tree

.github/workflows/web.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
matrix:
2727
os: [ubuntu-latest]
28-
node: [20]
28+
node: [24]
2929

3030
steps:
3131
- name: Checkout 🛎
@@ -34,7 +34,7 @@ jobs:
3434
- uses: pnpm/action-setup@v6
3535
name: Install pnpm
3636
with:
37-
version: 10
37+
version: 11
3838

3939
- name: Install dependencies 📦
4040
run: pnpm install
@@ -46,7 +46,7 @@ jobs:
4646
run: pnpm test
4747

4848
- name: Build 🏗️
49-
run: pnpm run build
49+
run: mv .env.production .env && echo "GITHUB_SHA=${GITHUB_SHA}" >> .env && pnpm run generate
5050

5151
deploy:
5252
name: Deploy
@@ -61,13 +61,13 @@ jobs:
6161
- uses: pnpm/action-setup@v6
6262
name: Install pnpm
6363
with:
64-
version: 10
64+
version: 11
6565

6666
- name: Install dependencies 📦
6767
run: pnpm install
6868

6969
- name: Build 🏗️
70-
run: pnpm run build
70+
run: mv .env.production .env && echo "GITHUB_SHA=${GITHUB_SHA}" >> .env && pnpm run generate
7171

7272
- name: Cloudflare Deploy 🚀
7373
uses: cloudflare/pages-action@1

web/.env.docker

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
API_BASE_URL=http://localhost:8000
2+
3+
APP_URL=http://localhost:3000
4+
APP_NAME=httpSMS
5+
APP_GITHUB_URL=https://github.com/NdoleStudio/httpsms
6+
APP_DOCUMENTATION_URL=https://docs.httpsms.com
7+
APP_DOWNLOAD_URL=https://github.com/NdoleStudio/httpsms/releases/latest/download/HttpSms.apk
8+
APP_ENV=production
9+
10+
# Firebase credentials
11+
FIREBASE_API_KEY=AIzaSyAKqPvj51igvvNNcRt_gL0A6cgx3ZB-kuQ
12+
FIREBASE_AUTH_DOMAIN=httpsms-docker.firebaseapp.com
13+
FIREBASE_PROJECT_ID=httpsms-docker
14+
FIREBASE_STORAGE_BUCKET=httpsms-docker.appspot.com
15+
FIREBASE_MESSAGING_SENDER_ID=668063041624
16+
FIREBASE_APP_ID=668063041624:web:29b9e3b7027965ba08a22d
17+
FIREBASE_MEASUREMENT_ID=G-18VRYL22PZ
18+
19+
# Cloudflare Turnstile site key for captcha on the search messages page
20+
# Get your site key at https://developers.cloudflare.com/turnstile/get-started/
21+
CLOUDFLARE_TURNSTILE_SITE_KEY=

web/.env.example

Lines changed: 0 additions & 28 deletions
This file was deleted.

web/.env.production

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
API_BASE_URL=https://api.httpsms.com
2+
3+
APP_URL=https://httpsms.com
4+
APP_NAME=httpSMS
5+
APP_GITHUB_URL=https://github.com/NdoleStudio/httpsms
6+
APP_DOCUMENTATION_URL=https://docs.httpsms.com
7+
APP_DOWNLOAD_URL=https://apk.httpsms.com/HttpSms.apk
8+
APP_ENV=production
9+
10+
CHECKOUT_URL=https://httpsms.lemonsqueezy.com/checkout/buy/706c5638-4c8d-40db-a6f2-b6371b7e0af4
11+
ENTERPRISE_CHECKOUT_URL=https://httpsms.lemonsqueezy.com/checkout/buy/d107cf05-4b13-4ebd-a770-c2cc75c69a14
12+
13+
FIREBASE_API_KEY=AIzaSyClL8AX2H_F77_n8yu5FgLzBmJTiSM0NsQ
14+
FIREBASE_AUTH_DOMAIN=httpsms-86c51.firebaseapp.com
15+
FIREBASE_PROJECT_ID=httpsms-86c51
16+
FIREBASE_STORAGE_BUCKET=httpsms-86c51.appspot.com
17+
FIREBASE_MESSAGING_SENDER_ID=877524083399
18+
FIREBASE_APP_ID=1:877524083399:web:430d6a29a0d808946514e2
19+
FIREBASE_MEASUREMENT_ID=G-EZ5W9DVK8T
20+
21+
CLOUDFLARE_TURNSTILE_SITE_KEY=0x4AAAAAAA6Hpp8SDyMMPhWg
22+
23+
PUSHER_KEY=a4809008d8f03aaab022
24+
PUSHER_CLUSTER=mt1

web/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ logs
2222
.env
2323
.env.*
2424
!.env.example
25+
!.env.docker
26+
!.env.production

web/app/components/FirebaseAuth.vue

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function signInWithGoogle() {
3535
const result = await signInWithPopup(auth, new GoogleAuthProvider());
3636
onSuccess(result.user);
3737
} catch (error: unknown) {
38-
handleError(error);
38+
handleError(error, true);
3939
} finally {
4040
loading.value = false;
4141
}
@@ -48,7 +48,7 @@ async function signInWithGithub() {
4848
const result = await signInWithPopup(auth, new GithubAuthProvider());
4949
onSuccess(result.user);
5050
} catch (error: unknown) {
51-
handleError(error);
51+
handleError(error, true);
5252
} finally {
5353
loading.value = false;
5454
}
@@ -90,19 +90,30 @@ function onSuccess(user: unknown) {
9090
router.push({ path: props.to });
9191
}
9292
93-
function handleError(error: unknown) {
93+
function handleError(error: unknown, isSocial = false) {
9494
const firebaseError = error as { code?: string; message?: string };
9595
const code = firebaseError.code || "";
96+
let message = "";
9697
if (code === "auth/user-not-found" || code === "auth/invalid-credential") {
97-
emailError.value = "Invalid email or password";
98+
message = "Invalid email or password";
9899
} else if (code === "auth/email-already-in-use") {
99-
emailError.value = "An account with this email already exists";
100+
message = "An account with this email already exists";
100101
} else if (code === "auth/weak-password") {
101-
emailError.value = "Password must be at least 6 characters";
102-
} else if (code === "auth/popup-closed-by-user") {
103-
// User closed popup, no error to show
102+
message = "Password must be at least 6 characters";
103+
} else if (
104+
code === "auth/popup-closed-by-user" ||
105+
code === "auth/cancelled-popup-request"
106+
) {
107+
// User closed the popup, no error to show
108+
return;
109+
} else {
110+
message = firebaseError.message || "An error occurred";
111+
}
112+
113+
if (isSocial) {
114+
notificationsStore.addNotification({ message, type: "error" });
104115
} else {
105-
emailError.value = firebaseError.message || "An error occurred";
116+
emailError.value = message;
106117
}
107118
}
108119
</script>

web/app/composables/useApi.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ export function setApiKey(key: string | null) {
1313

1414
function createApiFetch(): $Fetch {
1515
const config = useRuntimeConfig();
16-
const baseURL = (config.public as Record<string, string>).apiBaseUrl;
16+
const publicConfig = config.public as Record<string, string>;
17+
const baseURL = publicConfig.apiBaseUrl;
1718

1819
return $fetch.create({
1920
baseURL,
2021
headers: {
21-
"X-Client-Version": "web",
22+
"X-Client-Version": publicConfig.clientVersion || "dev",
2223
},
2324
onRequest({ options }) {
2425
const headers = (options.headers ||= {}) as Record<string, string>;

web/nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default defineNuxtConfig({
5353
runtimeConfig: {
5454
public: {
5555
apiBaseUrl: process.env.API_BASE_URL || "http://localhost:8000",
56+
clientVersion: process.env.GITHUB_SHA || "dev",
5657
appUrl: process.env.APP_URL || "https://httpsms.com",
5758
appName: process.env.APP_NAME || "HTTP SMS",
5859
appGithubUrl:

0 commit comments

Comments
 (0)