From 829a698ece7840a9df7928d40f07ead8764e9385 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 19 Feb 2025 23:49:15 +0100 Subject: [PATCH] auth: use native sign in with Apple on iOS & i18n for auth page (#411) --- Cargo.lock | 13 ++ .../public/locales/de/translation.json | 35 +++++- .../public/locales/el/translation.json | 35 +++++- .../public/locales/es/translation.json | 35 +++++- .../public/locales/fr/translation.json | 35 +++++- .../public/locales/hi/translation.json | 35 +++++- .../public/locales/id/translation.json | 35 +++++- .../public/locales/it/translation.json | 35 +++++- .../public/locales/ja/translation.json | 35 +++++- .../public/locales/ko/translation.json | 35 +++++- .../public/locales/pl/translation.json | 35 +++++- .../public/locales/pt/translation.json | 35 +++++- .../public/locales/ru/translation.json | 35 +++++- .../public/locales/tr/translation.json | 35 +++++- .../public/locales/uk/translation.json | 35 +++++- .../public/locales/vi/translation.json | 35 +++++- .../public/locales/zh-CN/translation.json | 35 +++++- .../public/locales/zh-TW/translation.json | 35 +++++- apps/readest-app/src-tauri/Cargo.toml | 1 + .../src-tauri/capabilities/default.json | 1 + apps/readest-app/src-tauri/src/lib.rs | 3 + apps/readest-app/src/app/auth/page.tsx | 113 ++++++++++++++++-- .../src/app/auth/utils/appleIdAuth.ts | 34 ++++++ 23 files changed, 735 insertions(+), 25 deletions(-) create mode 100644 apps/readest-app/src/app/auth/utils/appleIdAuth.ts diff --git a/Cargo.lock b/Cargo.lock index 233b5d18..8e7e4cf8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,6 +30,7 @@ dependencies = [ "tauri-plugin-os", "tauri-plugin-process", "tauri-plugin-shell", + "tauri-plugin-sign-in-with-apple", "tauri-plugin-single-instance", "tauri-plugin-updater", "tauri-plugin-window-state", @@ -5336,6 +5337,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "tauri-plugin-sign-in-with-apple" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9402eb8a70fdff5127fccc1f1666ebb06b5efc10e0eb656d8a70c798e26142e" +dependencies = [ + "serde", + "tauri", + "tauri-plugin", + "thiserror 2.0.11", +] + [[package]] name = "tauri-plugin-single-instance" version = "2.2.1" diff --git a/apps/readest-app/public/locales/de/translation.json b/apps/readest-app/public/locales/de/translation.json index 8b95af9c..69c17b5f 100644 --- a/apps/readest-app/public/locales/de/translation.json +++ b/apps/readest-app/public/locales/de/translation.json @@ -165,5 +165,38 @@ "Download Book": "Buch herunterladen", "Deselect Group": "Gruppe abwählen", "Select Group": "Gruppe auswählen", - "Keep Screen Awake": "Bildschirm aktiv halten" + "Keep Screen Awake": "Bildschirm aktiv halten", + "Email address": "E-Mail-Adresse", + "Your Password": "Ihr Passwort", + "Your email address": "Ihre E-Mail-Adresse", + "Your password": "Ihr Passwort", + "Sign in": "Anmelden", + "Signing in...": "Anmeldung...", + "Sign in with {{provider}}": "Mit {{provider}} anmelden", + "Already have an account? Sign in": "Haben Sie bereits ein Konto? Anmelden", + "Create a Password": "Passwort erstellen", + "Sign up": "Registrieren", + "Signing up...": "Registrierung...", + "Don’t have an account? Sign up": "Kein Konto? Registrieren", + "Check your email for the confirmation link": "Überprüfen Sie Ihre E-Mails auf den Bestätigungslink", + "Signing in ...": "Anmeldung ...", + "Send a magic link email": "Magic-Link-E-Mail senden", + "Check your email for the magic link": "Überprüfen Sie Ihre E-Mails auf den Magic-Link", + "Send reset password instructions": "Anweisungen zum Zurücksetzen des Passworts senden", + "Sending reset instructions ...": "Sende Anweisungen zum Zurücksetzen ...", + "Forgot your password?": "Passwort vergessen?", + "Check your email for the password reset link": "Überprüfen Sie Ihre E-Mails auf den Link zum Zurücksetzen des Passworts", + "New Password": "Neues Passwort", + "Your new password": "Ihr neues Passwort", + "Update password": "Passwort aktualisieren", + "Updating password ...": "Passwort wird aktualisiert ...", + "Your password has been updated": "Ihr Passwort wurde aktualisiert", + "Phone number": "Telefonnummer", + "Your phone number": "Ihre Telefonnummer", + "Token": "Token", + "Your OTP token": "Ihr OTP-Token", + "Verify token": "Token überprüfen", + "Sign in with Google": "Mit Google anmelden", + "Sign in with Apple": "Mit Apple anmelden", + "Sign in with GitHub": "Mit GitHub anmelden" } diff --git a/apps/readest-app/public/locales/el/translation.json b/apps/readest-app/public/locales/el/translation.json index 67034cc3..51b4225d 100644 --- a/apps/readest-app/public/locales/el/translation.json +++ b/apps/readest-app/public/locales/el/translation.json @@ -165,5 +165,38 @@ "Download Book": "Λήψη βιβλίου", "Deselect Group": "Αποεπιλογή ομάδας", "Select Group": "Επιλογή ομάδας", - "Keep Screen Awake": "Διατήρηση ενεργού οθόνης" + "Keep Screen Awake": "Διατήρηση ενεργού οθόνης", + "Email address": "Διεύθυνση email", + "Your Password": "Ο κωδικός σας", + "Your email address": "Η διεύθυνση email σας", + "Your password": "Ο κωδικός πρόσβασής σας", + "Sign in": "Σύνδεση", + "Signing in...": "Σύνδεση...", + "Sign in with {{provider}}": "Σύνδεση με {{provider}}", + "Already have an account? Sign in": "Έχετε ήδη λογαριασμό; Συνδεθείτε", + "Create a Password": "Δημιουργία κωδικού πρόσβασης", + "Sign up": "Εγγραφή", + "Signing up...": "Εγγραφή...", + "Don’t have an account? Sign up": "Δεν έχετε λογαριασμό; Εγγραφείτε", + "Check your email for the confirmation link": "Ελέγξτε το email σας για τον σύνδεσμο επιβεβαίωσης", + "Signing in ...": "Σύνδεση ...", + "Send a magic link email": "Αποστολή email με μαγικό σύνδεσμο", + "Check your email for the magic link": "Ελέγξτε το email σας για τον μαγικό σύνδεσμο", + "Send reset password instructions": "Αποστολή οδηγιών επαναφοράς κωδικού πρόσβασης", + "Sending reset instructions ...": "Αποστολή οδηγιών επαναφοράς ...", + "Forgot your password?": "Ξεχάσατε τον κωδικό σας;", + "Check your email for the password reset link": "Ελέγξτε το email σας για τον σύνδεσμο επαναφοράς κωδικού", + "New Password": "Νέος κωδικός πρόσβασης", + "Your new password": "Ο νέος σας κωδικός", + "Update password": "Ενημέρωση κωδικού πρόσβασης", + "Updating password ...": "Ενημέρωση κωδικού ...", + "Your password has been updated": "Ο κωδικός πρόσβασής σας ενημερώθηκε", + "Phone number": "Αριθμός τηλεφώνου", + "Your phone number": "Ο αριθμός τηλεφώνου σας", + "Token": "Κωδικός επαλήθευσης", + "Your OTP token": "Ο κωδικός OTP σας", + "Verify token": "Επαλήθευση κωδικού", + "Sign in with Google": "Σύνδεση με Google", + "Sign in with Apple": "Σύνδεση με Apple", + "Sign in with GitHub": "Σύνδεση με GitHub" } diff --git a/apps/readest-app/public/locales/es/translation.json b/apps/readest-app/public/locales/es/translation.json index 68b86046..a7e3818f 100644 --- a/apps/readest-app/public/locales/es/translation.json +++ b/apps/readest-app/public/locales/es/translation.json @@ -165,5 +165,38 @@ "Download Book": "Descargar libro", "Deselect Group": "Deseleccionar grupo", "Select Group": "Seleccionar grupo", - "Keep Screen Awake": "Mantener pantalla activa" + "Keep Screen Awake": "Mantener pantalla activa", + "Email address": "Dirección de correo electrónico", + "Your Password": "Tu contraseña", + "Your email address": "Tu dirección de correo electrónico", + "Your password": "Tu contraseña", + "Sign in": "Iniciar sesión", + "Signing in...": "Iniciando sesión...", + "Sign in with {{provider}}": "Iniciar sesión con {{provider}}", + "Already have an account? Sign in": "¿Ya tienes una cuenta? Inicia sesión", + "Create a Password": "Crear una contraseña", + "Sign up": "Registrarse", + "Signing up...": "Registrándose...", + "Don’t have an account? Sign up": "¿No tienes una cuenta? Regístrate", + "Check your email for the confirmation link": "Revisa tu correo electrónico para el enlace de confirmación", + "Signing in ...": "Iniciando sesión ...", + "Send a magic link email": "Enviar un enlace mágico por correo", + "Check your email for the magic link": "Revisa tu correo electrónico para el enlace mágico", + "Send reset password instructions": "Enviar instrucciones para restablecer la contraseña", + "Sending reset instructions ...": "Enviando instrucciones de restablecimiento ...", + "Forgot your password?": "¿Olvidaste tu contraseña?", + "Check your email for the password reset link": "Revisa tu correo electrónico para el enlace de restablecimiento de contraseña", + "New Password": "Nueva contraseña", + "Your new password": "Tu nueva contraseña", + "Update password": "Actualizar contraseña", + "Updating password ...": "Actualizando contraseña ...", + "Your password has been updated": "Tu contraseña ha sido actualizada", + "Phone number": "Número de teléfono", + "Your phone number": "Tu número de teléfono", + "Token": "Código de verificación", + "Your OTP token": "Tu código OTP", + "Verify token": "Verificar código", + "Sign in with Google": "Iniciar sesión con Google", + "Sign in with Apple": "Iniciar sesión con Apple", + "Sign in with GitHub": "Iniciar sesión con GitHub" } diff --git a/apps/readest-app/public/locales/fr/translation.json b/apps/readest-app/public/locales/fr/translation.json index 5cbec8f7..0f9ca2be 100644 --- a/apps/readest-app/public/locales/fr/translation.json +++ b/apps/readest-app/public/locales/fr/translation.json @@ -165,5 +165,38 @@ "Download Book": "Télécharger le livre", "Deselect Group": "Désélectionner le groupe", "Select Group": "Sélectionner le groupe", - "Keep Screen Awake": "Maintenir l'écran allumé" + "Keep Screen Awake": "Maintenir l'écran allumé", + "Email address": "Adresse e-mail", + "Your Password": "Votre mot de passe", + "Your email address": "Votre adresse e-mail", + "Your password": "Votre mot de passe", + "Sign in": "Se connecter", + "Signing in...": "Connexion en cours...", + "Sign in with {{provider}}": "Se connecter avec {{provider}}", + "Already have an account? Sign in": "Vous avez déjà un compte ? Connectez-vous", + "Create a Password": "Créer un mot de passe", + "Sign up": "S'inscrire", + "Signing up...": "Inscription en cours...", + "Don’t have an account? Sign up": "Vous n'avez pas de compte ? Inscrivez-vous", + "Check your email for the confirmation link": "Vérifiez votre e-mail pour le lien de confirmation", + "Signing in ...": "Connexion en cours ...", + "Send a magic link email": "Envoyer un e-mail avec un lien magique", + "Check your email for the magic link": "Vérifiez votre e-mail pour le lien magique", + "Send reset password instructions": "Envoyer les instructions de réinitialisation du mot de passe", + "Sending reset instructions ...": "Envoi des instructions de réinitialisation ...", + "Forgot your password?": "Mot de passe oublié ?", + "Check your email for the password reset link": "Vérifiez votre e-mail pour le lien de réinitialisation du mot de passe", + "New Password": "Nouveau mot de passe", + "Your new password": "Votre nouveau mot de passe", + "Update password": "Mettre à jour le mot de passe", + "Updating password ...": "Mise à jour du mot de passe ...", + "Your password has been updated": "Votre mot de passe a été mis à jour", + "Phone number": "Numéro de téléphone", + "Your phone number": "Votre numéro de téléphone", + "Token": "Code de vérification", + "Your OTP token": "Votre code OTP", + "Verify token": "Vérifier le code", + "Sign in with Google": "Se connecter avec Google", + "Sign in with Apple": "Se connecter avec Apple", + "Sign in with GitHub": "Se connecter avec GitHub" } diff --git a/apps/readest-app/public/locales/hi/translation.json b/apps/readest-app/public/locales/hi/translation.json index 936626d1..52d06da1 100644 --- a/apps/readest-app/public/locales/hi/translation.json +++ b/apps/readest-app/public/locales/hi/translation.json @@ -165,5 +165,38 @@ "Download Book": "पुस्तक डाउनलोड करें", "Deselect Group": "समूह का चयन रद्द करें", "Select Group": "समूह चुनें", - "Keep Screen Awake": "स्क्रीन जागरूक रखें" + "Keep Screen Awake": "स्क्रीन जागरूक रखें", + "Email address": "ईमेल पता", + "Your Password": "आपका पासवर्ड", + "Your email address": "आपका ईमेल पता", + "Your password": "आपका पासवर्ड", + "Sign in": "साइन इन करें", + "Signing in...": "साइन इन हो रहा है...", + "Sign in with {{provider}}": "{{provider}} के साथ साइन इन करें", + "Already have an account? Sign in": "पहले से ही एक खाता है? साइन इन करें", + "Create a Password": "पासवर्ड बनाएं", + "Sign up": "साइन अप करें", + "Signing up...": "साइन अप हो रहा है...", + "Don’t have an account? Sign up": "कोई खाता नहीं है? साइन अप करें", + "Check your email for the confirmation link": "पुष्टि लिंक के लिए अपना ईमेल जांचें", + "Signing in ...": "साइन इन हो रहा है ...", + "Send a magic link email": "जादू लिंक ईमेल भेजें", + "Check your email for the magic link": "जादू लिंक के लिए अपना ईमेल जांचें", + "Send reset password instructions": "पासवर्ड रीसेट निर्देश भेजें", + "Sending reset instructions ...": "रीसेट निर्देश भेजे जा रहे हैं ...", + "Forgot your password?": "पासवर्ड भूल गए?", + "Check your email for the password reset link": "पासवर्ड रीसेट लिंक के लिए अपना ईमेल जांचें", + "New Password": "नया पासवर्ड", + "Your new password": "आपका नया पासवर्ड", + "Update password": "पासवर्ड अपडेट करें", + "Updating password ...": "पासवर्ड अपडेट किया जा रहा है ...", + "Your password has been updated": "आपका पासवर्ड अपडेट कर दिया गया है", + "Phone number": "फोन नंबर", + "Your phone number": "आपका फोन नंबर", + "Token": "टोकन", + "Your OTP token": "आपका ओटीपी टोकन", + "Verify token": "टोकन सत्यापित करें", + "Sign in with Google": "Google के साथ साइन इन करें", + "Sign in with Apple": "Apple के साथ साइन इन करें", + "Sign in with GitHub": "GitHub के साथ साइन इन करें" } diff --git a/apps/readest-app/public/locales/id/translation.json b/apps/readest-app/public/locales/id/translation.json index 8b9a79fb..9b1e7168 100644 --- a/apps/readest-app/public/locales/id/translation.json +++ b/apps/readest-app/public/locales/id/translation.json @@ -165,5 +165,38 @@ "Download Book": "Unduh Buku", "Deselect Group": "Batalkan Pilihan Grup", "Select Group": "Pilih Grup", - "Keep Screen Awake": "Biarkan Layar Tetap Hidup" + "Keep Screen Awake": "Biarkan Layar Tetap Hidup", + "Email address": "Alamat email", + "Your Password": "Kata sandi Anda", + "Your email address": "Alamat email Anda", + "Your password": "Kata sandi Anda", + "Sign in": "Masuk", + "Signing in...": "Sedang masuk...", + "Sign in with {{provider}}": "Masuk dengan {{provider}}", + "Already have an account? Sign in": "Sudah punya akun? Masuk", + "Create a Password": "Buat kata sandi", + "Sign up": "Daftar", + "Signing up...": "Sedang mendaftar...", + "Don’t have an account? Sign up": "Belum punya akun? Daftar", + "Check your email for the confirmation link": "Periksa email Anda untuk tautan konfirmasi", + "Signing in ...": "Sedang masuk ...", + "Send a magic link email": "Kirim email tautan ajaib", + "Check your email for the magic link": "Periksa email Anda untuk tautan ajaib", + "Send reset password instructions": "Kirim instruksi reset kata sandi", + "Sending reset instructions ...": "Mengirim instruksi reset ...", + "Forgot your password?": "Lupa kata sandi Anda?", + "Check your email for the password reset link": "Periksa email Anda untuk tautan reset kata sandi", + "New Password": "Kata sandi baru", + "Your new password": "Kata sandi baru Anda", + "Update password": "Perbarui kata sandi", + "Updating password ...": "Memperbarui kata sandi ...", + "Your password has been updated": "Kata sandi Anda telah diperbarui", + "Phone number": "Nomor telepon", + "Your phone number": "Nomor telepon Anda", + "Token": "Token", + "Your OTP token": "Token OTP Anda", + "Verify token": "Verifikasi token", + "Sign in with Google": "Masuk dengan Google", + "Sign in with Apple": "Masuk dengan Apple", + "Sign in with GitHub": "Masuk dengan GitHub" } diff --git a/apps/readest-app/public/locales/it/translation.json b/apps/readest-app/public/locales/it/translation.json index 424594cf..3b78cd2b 100644 --- a/apps/readest-app/public/locales/it/translation.json +++ b/apps/readest-app/public/locales/it/translation.json @@ -165,5 +165,38 @@ "Download Book": "Scarica libro", "Deselect Group": "Deseleziona gruppo", "Select Group": "Seleziona gruppo", - "Keep Screen Awake": "Mantieni schermo attivo" + "Keep Screen Awake": "Mantieni schermo attivo", + "Email address": "Indirizzo email", + "Your Password": "La tua password", + "Your email address": "Il tuo indirizzo email", + "Your password": "La tua password", + "Sign in": "Accedi", + "Signing in...": "Accesso in corso...", + "Sign in with {{provider}}": "Accedi con {{provider}}", + "Already have an account? Sign in": "Hai già un account? Accedi", + "Create a Password": "Crea una password", + "Sign up": "Registrati", + "Signing up...": "Registrazione in corso...", + "Don’t have an account? Sign up": "Non hai un account? Registrati", + "Check your email for the confirmation link": "Controlla la tua email per il link di conferma", + "Signing in ...": "Accesso in corso ...", + "Send a magic link email": "Invia un'email con link magico", + "Check your email for the magic link": "Controlla la tua email per il link magico", + "Send reset password instructions": "Invia istruzioni per reimpostare la password", + "Sending reset instructions ...": "Invio istruzioni di reimpostazione ...", + "Forgot your password?": "Hai dimenticato la password?", + "Check your email for the password reset link": "Controlla la tua email per il link di reimpostazione della password", + "New Password": "Nuova password", + "Your new password": "La tua nuova password", + "Update password": "Aggiorna password", + "Updating password ...": "Aggiornamento password ...", + "Your password has been updated": "La tua password è stata aggiornata", + "Phone number": "Numero di telefono", + "Your phone number": "Il tuo numero di telefono", + "Token": "Token", + "Your OTP token": "Il tuo token OTP", + "Verify token": "Verifica token", + "Sign in with Google": "Accedi con Google", + "Sign in with Apple": "Accedi con Apple", + "Sign in with GitHub": "Accedi con GitHub" } diff --git a/apps/readest-app/public/locales/ja/translation.json b/apps/readest-app/public/locales/ja/translation.json index e60b73b9..2c8e9a95 100644 --- a/apps/readest-app/public/locales/ja/translation.json +++ b/apps/readest-app/public/locales/ja/translation.json @@ -165,5 +165,38 @@ "Download Book": "書籍をダウンロード", "Deselect Group": "グループの選択を解除", "Select Group": "グループを選択", - "Keep Screen Awake": "画面をオンのままにする" + "Keep Screen Awake": "画面をオンのままにする", + "Email address": "メールアドレス", + "Your Password": "あなたのパスワード", + "Your email address": "あなたのメールアドレス", + "Your password": "あなたのパスワード", + "Sign in": "サインイン", + "Signing in...": "サインイン中...", + "Sign in with {{provider}}": "{{provider}}でサインイン", + "Already have an account? Sign in": "すでにアカウントがありますか? サインイン", + "Create a Password": "パスワードを作成", + "Sign up": "サインアップ", + "Signing up...": "サインアップ中...", + "Don’t have an account? Sign up": "アカウントをお持ちでないですか? サインアップ", + "Check your email for the confirmation link": "確認リンクのためにメールを確認してください", + "Signing in ...": "サインイン中 ...", + "Send a magic link email": "マジックリンクメールを送信", + "Check your email for the magic link": "マジックリンクのためにメールを確認してください", + "Send reset password instructions": "パスワードリセットの指示を送信", + "Sending reset instructions ...": "リセット指示を送信中 ...", + "Forgot your password?": "パスワードを忘れましたか?", + "Check your email for the password reset link": "パスワードリセットリンクのためにメールを確認してください", + "New Password": "新しいパスワード", + "Your new password": "あなたの新しいパスワード", + "Update password": "パスワードを更新", + "Updating password ...": "パスワード更新中 ...", + "Your password has been updated": "あなたのパスワードは更新されました", + "Phone number": "電話番号", + "Your phone number": "あなたの電話番号", + "Token": "トークン", + "Your OTP token": "あなたのOTPトークン", + "Verify token": "トークンを確認", + "Sign in with Google": "Googleでサインイン", + "Sign in with Apple": "Appleでサインイン", + "Sign in with GitHub": "GitHubでサインイン" } diff --git a/apps/readest-app/public/locales/ko/translation.json b/apps/readest-app/public/locales/ko/translation.json index ddcac0fb..3d489821 100644 --- a/apps/readest-app/public/locales/ko/translation.json +++ b/apps/readest-app/public/locales/ko/translation.json @@ -165,5 +165,38 @@ "Download Book": "책 다운로드", "Deselect Group": "그룹 선택 해제", "Select Group": "그룹 선택", - "Keep Screen Awake": "화면 켜짐 유지" + "Keep Screen Awake": "화면 켜짐 유지", + "Email address": "이메일 주소", + "Your Password": "비밀번호", + "Your email address": "당신의 이메일 주소", + "Your password": "당신의 비밀번호", + "Sign in": "로그인", + "Signing in...": "로그인 중...", + "Sign in with {{provider}}": "{{provider}}로 로그인", + "Already have an account? Sign in": "이미 계정이 있습니까? 로그인", + "Create a Password": "비밀번호 만들기", + "Sign up": "회원가입", + "Signing up...": "회원가입 중...", + "Don’t have an account? Sign up": "계정이 없습니까? 회원가입", + "Check your email for the confirmation link": "확인 링크를 위해 이메일을 확인하세요", + "Signing in ...": "로그인 중 ...", + "Send a magic link email": "마법의 링크 이메일 보내기", + "Check your email for the magic link": "마법의 링크를 위해 이메일을 확인하세요", + "Send reset password instructions": "비밀번호 재설정 지침 보내기", + "Sending reset instructions ...": "재설정 지침 보내는 중 ...", + "Forgot your password?": "비밀번호를 잊으셨나요?", + "Check your email for the password reset link": "비밀번호 재설정 링크를 위해 이메일을 확인하세요", + "New Password": "새로운 비밀번호", + "Your new password": "당신의 새로운 비밀번호", + "Update password": "비밀번호 업데이트", + "Updating password ...": "비밀번호 업데이트 중 ...", + "Your password has been updated": "비밀번호가 업데이트되었습니다", + "Phone number": "전화번호", + "Your phone number": "당신의 전화번호", + "Token": "토큰", + "Your OTP token": "당신의 OTP 토큰", + "Verify token": "토큰 확인", + "Sign in with Google": "Google로 로그인", + "Sign in with Apple": "Apple로 로그인", + "Sign in with GitHub": "GitHub로 로그인" } diff --git a/apps/readest-app/public/locales/pl/translation.json b/apps/readest-app/public/locales/pl/translation.json index 7b3f2aff..4e45481d 100644 --- a/apps/readest-app/public/locales/pl/translation.json +++ b/apps/readest-app/public/locales/pl/translation.json @@ -165,5 +165,38 @@ "Download Book": "Pobierz książkę", "Deselect Group": "Odznacz grupę", "Select Group": "Wybierz grupę", - "Keep Screen Awake": "Nie wygaszaj ekranu" + "Keep Screen Awake": "Nie wygaszaj ekranu", + "Email address": "Adres email", + "Your Password": "Twoje hasło", + "Your email address": "Twój adres email", + "Your password": "Twoje hasło", + "Sign in": "Zaloguj się", + "Signing in...": "Logowanie...", + "Sign in with {{provider}}": "Zaloguj się za pomocą {{provider}}", + "Already have an account? Sign in": "Masz już konto? Zaloguj się", + "Create a Password": "Utwórz hasło", + "Sign up": "Zarejestruj się", + "Signing up...": "Rejestracja...", + "Don’t have an account? Sign up": "Nie masz konta? Zarejestruj się", + "Check your email for the confirmation link": "Sprawdź swój email, aby uzyskać link potwierdzający", + "Signing in ...": "Logowanie ...", + "Send a magic link email": "Wyślij link magiczny na email", + "Check your email for the magic link": "Sprawdź swój email, aby uzyskać link magiczny", + "Send reset password instructions": "Wyślij instrukcje resetowania hasła", + "Sending reset instructions ...": "Wysyłanie instrukcji resetowania hasła ...", + "Forgot your password?": "Zapomniałeś hasła?", + "Check your email for the password reset link": "Sprawdź swój email, aby uzyskać link resetujący hasło", + "New Password": "Nowe hasło", + "Your new password": "Twoje nowe hasło", + "Update password": "Zaktualizuj hasło", + "Updating password ...": "Aktualizacja hasła ...", + "Your password has been updated": "Twoje hasło zostało zaktualizowane", + "Phone number": "Numer telefonu", + "Your phone number": "Twój numer telefonu", + "Token": "Token", + "Your OTP token": "Twój OTP token", + "Verify token": "Weryfikacja tokena", + "Sign in with Google": "Zaloguj się za pomocą Google", + "Sign in with Apple": "Zaloguj się za pomocą Apple", + "Sign in with GitHub": "Zaloguj się za pomocą GitHub" } diff --git a/apps/readest-app/public/locales/pt/translation.json b/apps/readest-app/public/locales/pt/translation.json index e08782aa..3dbb9e72 100644 --- a/apps/readest-app/public/locales/pt/translation.json +++ b/apps/readest-app/public/locales/pt/translation.json @@ -165,5 +165,38 @@ "Download Book": "Baixar Livro", "Deselect Group": "Desmarcar Grupo", "Select Group": "Selecionar Grupo", - "Keep Screen Awake": "Manter a Tela Ativa" + "Keep Screen Awake": "Manter a Tela Ativa", + "Email address": "Endereço de e-mail", + "Your Password": "Sua senha", + "Your email address": "Seu endereço de e-mail", + "Your password": "Sua senha", + "Sign in": "Entrar", + "Signing in...": "Entrando...", + "Sign in with {{provider}}": "Entrar com {{provider}}", + "Already have an account? Sign in": "Já tem uma conta? Entrar", + "Create a Password": "Criar uma senha", + "Sign up": "Cadastrar-se", + "Signing up...": "Cadastrando...", + "Don’t have an account? Sign up": "Não tem uma conta? Cadastre-se", + "Check your email for the confirmation link": "Verifique seu e-mail para o link de confirmação", + "Signing in ...": "Entrando ...", + "Send a magic link email": "Enviar um link mágico por e-mail", + "Check your email for the magic link": "Verifique seu e-mail para o link mágico", + "Send reset password instructions": "Enviar instruções para redefinir a senha", + "Sending reset instructions ...": "Enviando instruções para redefinir a senha ...", + "Forgot your password?": "Esqueceu sua senha?", + "Check your email for the password reset link": "Verifique seu e-mail para o link de redefinição de senha", + "New Password": "Nova senha", + "Your new password": "Sua nova senha", + "Update password": "Atualizar senha", + "Updating password ...": "Atualizando senha ...", + "Your password has been updated": "Sua senha foi atualizada", + "Phone number": "Número de telefone", + "Your phone number": "Seu número de telefone", + "Token": "Token", + "Your OTP token": "Seu token OTP", + "Verify token": "Verificar token", + "Sign in with Google": "Entrar com o Google", + "Sign in with Apple": "Entrar com o Apple", + "Sign in with GitHub": "Entrar com o GitHub" } diff --git a/apps/readest-app/public/locales/ru/translation.json b/apps/readest-app/public/locales/ru/translation.json index 40b794c7..1d2e1c86 100644 --- a/apps/readest-app/public/locales/ru/translation.json +++ b/apps/readest-app/public/locales/ru/translation.json @@ -165,5 +165,38 @@ "Download Book": "Скачать книгу", "Deselect Group": "Отменить выбор группы", "Select Group": "Выбрать группу", - "Keep Screen Awake": "Не выключать экран" + "Keep Screen Awake": "Не выключать экран", + "Email address": "Адрес электронной почты", + "Your Password": "Ваш пароль", + "Your email address": "Ваш адрес электронной почты", + "Your password": "Ваш пароль", + "Sign in": "Войти", + "Signing in...": "Вход...", + "Sign in with {{provider}}": "Войти с помощью {{provider}}", + "Already have an account? Sign in": "Уже есть аккаунт? Войдите", + "Create a Password": "Создать пароль", + "Sign up": "Зарегистрироваться", + "Signing up...": "Регистрация...", + "Don’t have an account? Sign up": "Нет аккаунта? Зарегистрируйтесь", + "Check your email for the confirmation link": "Проверьте свою почту для подтверждающей ссылки", + "Signing in ...": "Вход ...", + "Send a magic link email": "Отправить магическую ссылку по электронной почте", + "Check your email for the magic link": "Проверьте свою почту для магической ссылки", + "Send reset password instructions": "Отправить инструкции по сбросу пароля", + "Sending reset instructions ...": "Отправка инструкций по сбросу пароля ...", + "Forgot your password?": "Забыли пароль?", + "Check your email for the password reset link": "Проверьте свою почту для ссылки для сброса пароля", + "New Password": "Новый пароль", + "Your new password": "Ваш новый пароль", + "Update password": "Обновить пароль", + "Updating password ...": "Обновление пароля ...", + "Your password has been updated": "Ваш пароль был обновлен", + "Phone number": "Номер телефона", + "Your phone number": "Ваш номер телефона", + "Token": "Токен", + "Your OTP token": "Ваш OTP токен", + "Verify token": "Проверить токен", + "Sign in with Google": "Войти через Google", + "Sign in with Apple": "Войти через Apple", + "Sign in with GitHub": "Войти через GitHub" } diff --git a/apps/readest-app/public/locales/tr/translation.json b/apps/readest-app/public/locales/tr/translation.json index 18ef5255..2dbbfada 100644 --- a/apps/readest-app/public/locales/tr/translation.json +++ b/apps/readest-app/public/locales/tr/translation.json @@ -165,5 +165,38 @@ "Download Book": "Kitabı İndir", "Deselect Group": "Grubu Seçme", "Select Group": "Grup Seç", - "Keep Screen Awake": "Ekranı Açık Tut" + "Keep Screen Awake": "Ekranı Açık Tut", + "Email address": "E-posta adresi", + "Your Password": "Şifreniz", + "Your email address": "E-posta adresiniz", + "Your password": "Şifreniz", + "Sign in": "Giriş yap", + "Signing in...": "Giriş yapılıyor...", + "Sign in with {{provider}}": "{{provider}} ile giriş yap", + "Already have an account? Sign in": "Hesabınız var mı? Giriş yapın", + "Create a Password": "Şifre oluştur", + "Sign up": "Kaydol", + "Signing up...": "Kaydolunuyor...", + "Don’t have an account? Sign up": "Hesabınız yok mu? Kaydolun", + "Check your email for the confirmation link": "Onay bağlantısı için e-posta adresinizi kontrol edin", + "Signing in ...": "Giriş yapılıyor...", + "Send a magic link email": "Sihirli bağlantı e-postası gönder", + "Check your email for the magic link": "Sihirli bağlantı için e-posta adresinizi kontrol edin", + "Send reset password instructions": "Şifre sıfırlama talimatları gönder", + "Sending reset instructions ...": "Şifre sıfırlama talimatları gönderiliyor...", + "Forgot your password?": "Şifrenizi mi unuttunuz?", + "Check your email for the password reset link": "Şifre sıfırlama bağlantısı için e-posta adresinizi kontrol edin", + "New Password": "Yeni şifre", + "Your new password": "Yeni şifreniz", + "Update password": "Şifreyi güncelle", + "Updating password ...": "Şifre güncelleniyor...", + "Your password has been updated": "Şifreniz güncellendi", + "Phone number": "Telefon numarası", + "Your phone number": "Telefon numaranız", + "Token": "Token", + "Your OTP token": "OTP token'ınız", + "Verify token": "Token'ı doğrula", + "Sign in with Google": "Google ile giriş yap", + "Sign in with Apple": "Apple ile giriş yap", + "Sign in with GitHub": "GitHub ile giriş yap" } diff --git a/apps/readest-app/public/locales/uk/translation.json b/apps/readest-app/public/locales/uk/translation.json index 968a9085..1fe58227 100644 --- a/apps/readest-app/public/locales/uk/translation.json +++ b/apps/readest-app/public/locales/uk/translation.json @@ -165,5 +165,38 @@ "Download Book": "Завантажити книгу", "Deselect Group": "Скасувати вибір групи", "Select Group": "Вибрати групу", - "Keep Screen Awake": "Не вимикати екран" + "Keep Screen Awake": "Не вимикати екран", + "Email address": "Адреса електронної пошти", + "Your Password": "Ваш пароль", + "Your email address": "Ваша електронна адреса", + "Your password": "Ваш пароль", + "Sign in": "Увійти", + "Signing in...": "Вхід...", + "Sign in with {{provider}}": "Увійти через {{provider}}", + "Already have an account? Sign in": "Уже є акаунт? Увійти", + "Create a Password": "Створити пароль", + "Sign up": "Зареєструватися", + "Signing up...": "Реєстрація...", + "Don’t have an account? Sign up": "Немає акаунту? Зареєструйтеся", + "Check your email for the confirmation link": "Перевірте свою електронну пошту для підтвердження посилання", + "Signing in ...": "Увійти...", + "Send a magic link email": "Відправити магічне посилання на електронну пошту", + "Check your email for the magic link": "Перевірте свою електронну пошту для магічного посилання", + "Send reset password instructions": "Надіслати інструкції для скидання пароля", + "Sending reset instructions ...": "Надсилаються інструкції для скидання пароля...", + "Forgot your password?": "Забули пароль?", + "Check your email for the password reset link": "Перевірте свою електронну пошту для посилання на скидання пароля", + "New Password": "Новий пароль", + "Your new password": "Ваш новий пароль", + "Update password": "Оновити пароль", + "Updating password ...": "Оновлення пароля...", + "Your password has been updated": "Ваш пароль оновлено", + "Phone number": "Номер телефону", + "Your phone number": "Ваш номер телефону", + "Token": "Токен", + "Your OTP token": "Ваш OTP токен", + "Verify token": "Перевірити токен", + "Sign in with Google": "Увійти через Google", + "Sign in with Apple": "Увійти через Apple", + "Sign in with GitHub": "Увійти через GitHub" } diff --git a/apps/readest-app/public/locales/vi/translation.json b/apps/readest-app/public/locales/vi/translation.json index 7e1d71ae..3072c70d 100644 --- a/apps/readest-app/public/locales/vi/translation.json +++ b/apps/readest-app/public/locales/vi/translation.json @@ -165,5 +165,38 @@ "Download Book": "Tải sách", "Deselect Group": "Bỏ chọn nhóm", "Select Group": "Chọn nhóm", - "Keep Screen Awake": "Giữ màn hình luôn bật" + "Keep Screen Awake": "Giữ màn hình luôn bật", + "Email address": "Địa chỉ email", + "Your Password": "Mật khẩu của bạn", + "Your email address": "Địa chỉ email của bạn", + "Your password": "Mật khẩu của bạn", + "Sign in": "Đăng nhập", + "Signing in...": "Đang đăng nhập...", + "Sign in with {{provider}}": "Đăng nhập với {{provider}}", + "Already have an account? Sign in": "Đã có tài khoản? Đăng nhập", + "Create a Password": "Tạo mật khẩu", + "Sign up": "Đăng ký", + "Signing up...": "Đang đăng ký...", + "Don’t have an account? Sign up": "Chưa có tài khoản? Đăng ký", + "Check your email for the confirmation link": "Kiểm tra email của bạn để nhận liên kết xác nhận", + "Signing in ...": "Đang đăng nhập ...", + "Send a magic link email": "Gửi email liên kết ma thuật", + "Check your email for the magic link": "Kiểm tra email của bạn để nhận liên kết ma thuật", + "Send reset password instructions": "Gửi hướng dẫn đặt lại mật khẩu", + "Sending reset instructions ...": "Đang gửi hướng dẫn đặt lại mật khẩu ...", + "Forgot your password?": "Quên mật khẩu?", + "Check your email for the password reset link": "Kiểm tra email của bạn để nhận liên kết đặt lại mật khẩu", + "New Password": "Mật khẩu mới", + "Your new password": "Mật khẩu mới của bạn", + "Update password": "Cập nhật mật khẩu", + "Updating password ...": "Đang cập nhật mật khẩu ...", + "Your password has been updated": "Mật khẩu của bạn đã được cập nhật", + "Phone number": "Số điện thoại", + "Your phone number": "Số điện thoại của bạn", + "Token": "Mã token", + "Your OTP token": "Mã OTP của bạn", + "Verify token": "Xác minh mã token", + "Sign in with Google": "Đăng nhập với Google", + "Sign in with Apple": "Đăng nhập với Apple", + "Sign in with GitHub": "Đăng nhập với GitHub" } diff --git a/apps/readest-app/public/locales/zh-CN/translation.json b/apps/readest-app/public/locales/zh-CN/translation.json index 451be432..eddae359 100644 --- a/apps/readest-app/public/locales/zh-CN/translation.json +++ b/apps/readest-app/public/locales/zh-CN/translation.json @@ -165,5 +165,38 @@ "Download Book": "下载书籍", "Deselect Group": "取消选择分组", "Select Group": "选择分组", - "Keep Screen Awake": "保持屏幕常亮" + "Keep Screen Awake": "保持屏幕常亮", + "Email address": "电子邮件地址", + "Your Password": "您的密码", + "Your email address": "您的电子邮件地址", + "Your password": "您的密码", + "Sign in": "登录", + "Signing in...": "正在登录...", + "Sign in with {{provider}}": "使用 {{provider}} 登录", + "Already have an account? Sign in": "已经有账号?登录", + "Create a Password": "创建密码", + "Sign up": "注册", + "Signing up...": "正在注册...", + "Don’t have an account? Sign up": "没有账号?注册", + "Check your email for the confirmation link": "检查您的电子邮件以获取确认链接", + "Signing in ...": "正在登录...", + "Send a magic link email": "发送魔法链接邮件", + "Check your email for the magic link": "检查您的电子邮件以获取魔法链接", + "Send reset password instructions": "发送重置密码说明", + "Sending reset instructions ...": "正在发送重置密码说明...", + "Forgot your password?": "忘记密码?", + "Check your email for the password reset link": "检查您的电子邮件以获取密码重置链接", + "New Password": "新密码", + "Your new password": "您的新密码", + "Update password": "更新密码", + "Updating password ...": "正在更新密码...", + "Your password has been updated": "您的密码已更新", + "Phone number": "电话号码", + "Your phone number": "您的电话号码", + "Token": "令牌", + "Your OTP token": "您的 OTP 令牌", + "Verify token": "验证令牌", + "Sign in with Google": "使用 Google 登录", + "Sign in with Apple": "使用 Apple 登录", + "Sign in with GitHub": "使用 GitHub 登录" } diff --git a/apps/readest-app/public/locales/zh-TW/translation.json b/apps/readest-app/public/locales/zh-TW/translation.json index b7d89075..bb3eca47 100644 --- a/apps/readest-app/public/locales/zh-TW/translation.json +++ b/apps/readest-app/public/locales/zh-TW/translation.json @@ -165,5 +165,38 @@ "Download Book": "下載書籍", "Deselect Group": "取消選擇組", "Select Group": "選擇組", - "Keep Screen Awake": "保持屏幕常亮" + "Keep Screen Awake": "保持屏幕常亮", + "Email address": "電子郵件地址", + "Your Password": "您的密碼", + "Your email address": "您的電子郵件地址", + "Your password": "您的密碼", + "Sign in": "登入", + "Signing in...": "正在登入...", + "Sign in with {{provider}}": "使用 {{provider}} 登入", + "Already have an account? Sign in": "已經有帳號?登入", + "Create a Password": "創建密碼", + "Sign up": "註冊", + "Signing up...": "正在註冊...", + "Don’t have an account? Sign up": "沒有帳號?註冊", + "Check your email for the confirmation link": "檢查您的電子郵件以獲取確認連結", + "Signing in ...": "正在登入...", + "Send a magic link email": "發送魔法連結郵件", + "Check your email for the magic link": "檢查您的電子郵件以獲取魔法連結", + "Send reset password instructions": "發送重設密碼指示", + "Sending reset instructions ...": "正在發送重設密碼指示...", + "Forgot your password?": "忘記密碼?", + "Check your email for the password reset link": "檢查您的電子郵件以獲取密碼重設連結", + "New Password": "新密碼", + "Your new password": "您的新密碼", + "Update password": "更新密碼", + "Updating password ...": "正在更新密碼...", + "Your password has been updated": "您的密碼已更新", + "Phone number": "電話號碼", + "Your phone number": "您的電話號碼", + "Token": "令牌", + "Your OTP token": "您的 OTP 令牌", + "Verify token": "驗證令牌", + "Sign in with Google": "使用 Google 登入", + "Sign in with Apple": "使用 Apple 登入", + "Sign in with GitHub": "使用 GitHub 登入" } diff --git a/apps/readest-app/src-tauri/Cargo.toml b/apps/readest-app/src-tauri/Cargo.toml index 623c411d..a5357bf5 100644 --- a/apps/readest-app/src-tauri/Cargo.toml +++ b/apps/readest-app/src-tauri/Cargo.toml @@ -44,6 +44,7 @@ tauri-plugin-process = "2" tauri-plugin-oauth = "2" tauri-plugin-opener = "2.2.2" tauri-plugin-deep-link = "2" +tauri-plugin-sign-in-with-apple = "1.0.2" [patch.crates-io] tauri = { path = "../../../packages/tauri/crates/tauri" } diff --git a/apps/readest-app/src-tauri/capabilities/default.json b/apps/readest-app/src-tauri/capabilities/default.json index 52154dc2..464d15a1 100644 --- a/apps/readest-app/src-tauri/capabilities/default.json +++ b/apps/readest-app/src-tauri/capabilities/default.json @@ -68,6 +68,7 @@ "process:allow-restart", "oauth:allow-start", "oauth:allow-cancel", + "sign-in-with-apple:default", "opener:default", "deep-link:default" ] diff --git a/apps/readest-app/src-tauri/src/lib.rs b/apps/readest-app/src-tauri/src/lib.rs index a48a2bff..a37aabf6 100644 --- a/apps/readest-app/src-tauri/src/lib.rs +++ b/apps/readest-app/src-tauri/src/lib.rs @@ -129,6 +129,9 @@ pub fn run() { #[cfg(target_os = "macos")] let builder = builder.plugin(traffic_light_plugin::init()); + #[cfg(target_os = "ios")] + let builder = builder.plugin(tauri_plugin_sign_in_with_apple::init()); + builder .setup(|#[allow(unused_variables)] app| { #[cfg(desktop)] diff --git a/apps/readest-app/src/app/auth/page.tsx b/apps/readest-app/src/app/auth/page.tsx index 7ccfa3e2..b85b4705 100644 --- a/apps/readest-app/src/app/auth/page.tsx +++ b/apps/readest-app/src/app/auth/page.tsx @@ -15,12 +15,14 @@ import { supabase } from '@/utils/supabase'; import { useTheme } from '@/hooks/useTheme'; import { useEnv } from '@/context/EnvContext'; import { useSettingsStore } from '@/store/settingsStore'; +import { useTranslation } from '@/hooks/useTranslation'; import { isTauriAppPlatform } from '@/services/environment'; import { onOpenUrl } from '@tauri-apps/plugin-deep-link'; import { start, cancel, onUrl, onInvalidUrl } from '@fabianlars/tauri-plugin-oauth'; import { openUrl } from '@tauri-apps/plugin-opener'; import { handleAuthCallback } from '@/helpers/auth'; import { getOSPlatform } from '@/utils/misc'; +import { getAppleIdAuth, Scope } from './utils/appleIdAuth'; type OAuthProvider = 'google' | 'apple' | 'azure' | 'github'; @@ -55,9 +57,10 @@ const ProviderLogin: React.FC = ({ provider, handleSignIn, Ic }; export default function AuthPage() { + const _ = useTranslation(); const router = useRouter(); const { login } = useAuth(); - const { envConfig } = useEnv(); + const { envConfig, appService } = useEnv(); const { isDarkMode } = useTheme(); const { settings, setSettings, saveSettings } = useSettingsStore(); const [port, setPort] = useState(null); @@ -73,6 +76,26 @@ export default function AuthPage() { : `http://localhost:${port}`; }; + const tauriSignInApple = async () => { + if (!supabase) { + throw new Error('No backend connected'); + } + supabase.auth.signOut(); + const request = { + scope: ['fullName', 'email'] as Scope[], + }; + const appleAuthResponse = await getAppleIdAuth(request); + if (appleAuthResponse.identityToken) { + const { error } = await supabase.auth.signInWithIdToken({ + provider: 'apple', + token: appleAuthResponse.identityToken, + }); + if (error) { + console.error('Authentication error:', error); + } + } + }; + const tauriSignIn = async (provider: OAuthProvider) => { if (!supabase) { throw new Error('No backend connected'); @@ -159,6 +182,68 @@ export default function AuthPage() { router.back(); }; + const getAuthLocalization = () => { + return { + variables: { + sign_in: { + email_label: _('Email address'), + password_label: _('Your Password'), + email_input_placeholder: _('Your email address'), + password_input_placeholder: _('Your password'), + button_label: _('Sign in'), + loading_button_label: _('Signing in...'), + social_provider_text: _('Sign in with {{provider}}'), + link_text: _('Already have an account? Sign in'), + }, + sign_up: { + email_label: _('Email address'), + password_label: _('Create a Password'), + email_input_placeholder: _('Your email address'), + password_input_placeholder: _('Your password'), + button_label: _('Sign up'), + loading_button_label: _('Signing up...'), + social_provider_text: _('Sign in with {{provider}}'), + link_text: _('Don’t have an account? Sign up'), + confirmation_text: _('Check your email for the confirmation link'), + }, + magic_link: { + email_input_label: _('Email address'), + email_input_placeholder: _('Your email address'), + button_label: _('Sign in'), + loading_button_label: _('Signing in ...'), + link_text: _('Send a magic link email'), + confirmation_text: _('Check your email for the magic link'), + }, + forgotten_password: { + email_label: _('Email address'), + password_label: _('Your Password'), + email_input_placeholder: _('Your email address'), + button_label: _('Send reset password instructions'), + loading_button_label: _('Sending reset instructions ...'), + link_text: _('Forgot your password?'), + confirmation_text: _('Check your email for the password reset link'), + }, + update_password: { + password_label: _('New Password'), + password_input_placeholder: _('Your new password'), + button_label: _('Update password'), + loading_button_label: _('Updating password ...'), + confirmation_text: _('Your password has been updated'), + }, + verify_otp: { + email_input_label: _('Email address'), + email_input_placeholder: _('Your email address'), + phone_input_label: _('Phone number'), + phone_input_placeholder: _('Your phone number'), + token_input_label: _('Token'), + token_input_placeholder: _('Your OTP token'), + button_label: _('Verify token'), + loading_button_label: _('Signing in ...'), + }, + }, + }; + }; + useEffect(() => { if (!isTauriAppPlatform()) return; if (isOAuthServerRunning.current) return; @@ -199,10 +284,20 @@ export default function AuthPage() { // For tauri app production, use deeplink to handle the OAuth callback // For web app, use the built-in OAuth callback page /auth/callback return isTauriAppPlatform() ? ( -
+
@@ -211,19 +306,19 @@ export default function AuthPage() { provider='google' handleSignIn={tauriSignIn} Icon={FcGoogle} - label='Sign in with Google' + label={_('Sign in with Google')} />
@@ -240,7 +336,7 @@ export default function AuthPage() {
@@ -251,6 +347,7 @@ export default function AuthPage() { magicLink={true} providers={['google', 'apple', 'github']} redirectTo='/auth/callback' + localization={getAuthLocalization()} />
); diff --git a/apps/readest-app/src/app/auth/utils/appleIdAuth.ts b/apps/readest-app/src/app/auth/utils/appleIdAuth.ts new file mode 100644 index 00000000..2f3ad1ba --- /dev/null +++ b/apps/readest-app/src/app/auth/utils/appleIdAuth.ts @@ -0,0 +1,34 @@ +import { invoke } from '@tauri-apps/api/core'; + +export type Scope = 'fullName' | 'email'; +export interface AppleIDAuthorizationRequest { + scope: Scope[]; + nonce?: string; + state?: string; +} + +export interface AppleIDAuthorizationResponse { + // usually not null + userIdentifier: string | null; + + givenName: string | null; + familyName: string | null; + email: string | null; + + authorizationCode: string; + identityToken: string | null; + state: string | null; +} + +export async function getAppleIdAuth( + request: AppleIDAuthorizationRequest, +): Promise { + const result = await invoke( + 'plugin:sign-in-with-apple|get_apple_id_credential', + { + payload: request, + }, + ); + + return result; +}