Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jason5ng32 committed Jan 27, 2025
1 parent f06a1ff commit f1589a4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion frontend/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@
"maskedInfoTitle": "All infos masked",
"maskedInfoMessage": "All information has been masked, you can now safely take screenshots.",
"unmaskedInfoTitle": "Infos Unmasked",
"unmaskedInfoMessage": "Information has been unmasked, please be careful when taking screenshots."
"unmaskedInfoMessage": "Information has been unmasked, please be careful when taking screenshots.",
"SignInFailed": "Sign In Failed",
"SignInFailedReason": "Reason"
},
"shortcutKeys": {
"id": "shortcutKeys",
Expand Down
4 changes: 3 additions & 1 deletion frontend/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@
"maskedInfoTitle": "Toutes les infos masquées",
"maskedInfoMessage": "Toutes les informations ont été masquées, vous pouvez maintenant prendre des captures d'écran en toute sécurité.",
"unmaskedInfoTitle": "Infos démasquées",
"unmaskedInfoMessage": "Les informations ont été démasquées, veuillez faire attention lorsque vous prenez des captures d'écran."
"unmaskedInfoMessage": "Les informations ont été démasquées, veuillez faire attention lorsque vous prenez des captures d'écran.",
"SignInFailed": "Echec de connexion",
"SignInFailedReason": "Raison"
},
"shortcutKeys": {
"id": "shortcutKeys",
Expand Down
4 changes: 3 additions & 1 deletion frontend/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@
"maskedInfoTitle": "全部隐藏成功",
"maskedInfoMessage": "所有信息已隐藏,现在可以安心截图了。",
"unmaskedInfoTitle": "取消隐藏",
"unmaskedInfoMessage": "信息已显示,截图时请注意隐私。"
"unmaskedInfoMessage": "信息已显示,截图时请注意隐私。",
"SignInFailed": "登录失败",
"SignInFailedReason": "原因"
},
"shortcutKeys": {
"id": "shortcutKeys",
Expand Down
6 changes: 5 additions & 1 deletion frontend/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { defineStore } from 'pinia';
import { getAuth, GoogleAuthProvider, GithubAuthProvider, signInWithPopup, signOut as firebaseSignOut, onAuthStateChanged } from "firebase/auth";
import { auth } from './firebase-init.js';
import i18n from './locales/i18n';
const { t } = i18n.global;

export const useMainStore = defineStore('main', {

Expand Down Expand Up @@ -172,7 +174,7 @@ export const useMainStore = defineStore('main', {
key: import.meta.env.VITE_FIREBASE_API_KEY,
domain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
project: import.meta.env.VITE_FIREBASE_PROJECT_ID,
}
}
this.isFireBaseSet = !!envConfigs.key && !!envConfigs.domain && !!envConfigs.project;
},
// 通过 Google 登录
Expand All @@ -185,6 +187,7 @@ export const useMainStore = defineStore('main', {
// 登录成功后刷新浏览器
window.location.reload();
} catch (error) {
this.alert = { alertToShow: true, alertStyle: "text-danger", alertMessage: t('alert.SignInFailedReason') + ':' + error, alertTitle: t('alert.SignInFailed') };
console.error("Google sign-in failed:", error);
}
},
Expand All @@ -198,6 +201,7 @@ export const useMainStore = defineStore('main', {
// 登录成功后刷新浏览器
window.location.reload();
} catch (error) {
this.alert = { alertToShow: true, alertStyle: "text-danger", alertMessage: t('alert.SignInFailedReason') + ':' + error, alertTitle: t('alert.SignInFailed') };
console.error("GitHub sign-in failed:", error);
}
},
Expand Down

0 comments on commit f1589a4

Please sign in to comment.