From 347ce6854d776005b1198c6b172a67b33974022c Mon Sep 17 00:00:00 2001 From: FooIbar <118464521+FooIbar@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:00:41 +0800 Subject: [PATCH] Fix missing content warning cookie in guest mode --- .../com/hippo/ehviewer/client/EhCookieStore.kt | 18 ++++++++++-------- .../hippo/ehviewer/ui/login/SignInScreen.kt | 4 ++-- .../com/hippo/ehviewer/ui/settings/EhScreen.kt | 6 +++--- app/src/main/res/values-de/strings.xml | 4 ++-- app/src/main/res/values-es/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 4 ++-- app/src/main/res/values-ja/strings.xml | 4 ++-- app/src/main/res/values-ko/strings.xml | 4 ++-- app/src/main/res/values-nb-rNO/strings.xml | 4 ++-- app/src/main/res/values-th/strings.xml | 4 ++-- app/src/main/res/values-tr/strings.xml | 2 +- app/src/main/res/values-zh-rCN/strings.xml | 4 ++-- app/src/main/res/values-zh-rHK/strings.xml | 4 ++-- app/src/main/res/values-zh-rTW/strings.xml | 4 ++-- app/src/main/res/values/strings.xml | 4 ++-- 15 files changed, 37 insertions(+), 35 deletions(-) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/client/EhCookieStore.kt b/app/src/main/kotlin/com/hippo/ehviewer/client/EhCookieStore.kt index e19048569..307be8d8e 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/client/EhCookieStore.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/client/EhCookieStore.kt @@ -65,16 +65,18 @@ object EhCookieStore : CookiesStorage { override fun close() = Unit fun load(url: Url): List { - val cookies = manager.getCookie(url.toString()) ?: return emptyList() + val cookies = manager.getCookie(url.toString()) val checkTips = EhUrl.DOMAIN_E in url.host - return parseClientCookiesHeader(cookies) - .map { Cookie(it.key, it.value, maxAge = Int.MAX_VALUE) } - .filterTo(mutableListOf()) { it.name != KEY_UTMP_NAME }.apply { - if (checkTips) { - removeAll { it.name == KEY_CONTENT_WARNING } - add(sTipsCookie) + return cookies?.let { + parseClientCookiesHeader(cookies) + .map { Cookie(it.key, it.value, maxAge = Int.MAX_VALUE) } + .filterTo(mutableListOf()) { it.name != KEY_UTMP_NAME }.apply { + if (checkTips) { + removeAll { it.name == KEY_CONTENT_WARNING } + add(sTipsCookie) + } } - } + } ?: if (checkTips) listOf(sTipsCookie) else emptyList() } override suspend fun get(requestUrl: Url) = load(requestUrl) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/login/SignInScreen.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/login/SignInScreen.kt index e420b8237..33e771b62 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/ui/login/SignInScreen.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/login/SignInScreen.kt @@ -259,7 +259,7 @@ fun SignInScreen(navigator: DestinationsNavigator) { withStyle( style = SpanStyle(textDecoration = TextDecoration.Underline), ) { - append(stringResource(id = R.string.tourist_mode)) + append(stringResource(id = R.string.guest_mode)) } }, ) @@ -356,7 +356,7 @@ fun SignInScreen(navigator: DestinationsNavigator) { withStyle( style = SpanStyle(textDecoration = TextDecoration.Underline), ) { - append(stringResource(id = R.string.tourist_mode)) + append(stringResource(id = R.string.guest_mode)) } }, ) diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/EhScreen.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/EhScreen.kt index 458a3cf59..5f48dc9fd 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/EhScreen.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/EhScreen.kt @@ -84,12 +84,12 @@ fun EhScreen(navigator: DestinationsNavigator) { }, snackbarHost = { SnackbarHost(snackbarHostState) }, ) { paddingValues -> - val touristMode = stringResource(id = R.string.settings_eh_identity_cookies_tourist) + val guestMode = stringResource(id = R.string.settings_eh_identity_cookies_guest) val copiedToClipboard = stringResource(id = R.string.copied_to_clipboard) Column(modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection).verticalScroll(rememberScrollState()).padding(paddingValues)) { Preference( title = stringResource(id = R.string.account_name), - summary = Settings.displayName ?: touristMode, + summary = Settings.displayName ?: guestMode, ) { val eCookies = EhCookieStore.load(Url(EhUrl.HOST_E)) val exCookies = EhCookieStore.load(Url(EhUrl.HOST_EX)) @@ -114,7 +114,7 @@ fun EhScreen(navigator: DestinationsNavigator) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) launchSnackBar(copiedToClipboard) } } else { - setMessage(touristMode) + setMessage(guestMode) } setPositiveButton(R.string.settings_eh_sign_out) { _, _ -> EhUtils.signOut() diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index bbd7a46ed..53220c1f1 100755 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -305,7 +305,7 @@ Inhalt dieser App kommt aus dem Internet, von dem einige dir körperlichen oder emotionalen Schaden zufügen kann. Du hast es wirklich erfahrt und möchtest immer noch fortsetzen. Gibt den Nutzername ein Gibt das Passwort ein - Anmeldung überspringen + Anmeldung überspringen Anmeldung fehlgeschlagen Ein Link von einen Galerie wurde in Zwischenablage erkennt. Gehen @@ -330,7 +330,7 @@ Lesefortschritte zurücksetzen Lesefortschritte aus allen heruntergeladenen Galerie zurücksetzen? Wenn jemand die folgenden Informationen hat, kann er sich als du anmelden. <br><b>ALSO GEHEIM HALTEN!</b><br><br>%s - Du hast dich noch nicht angemeldet. + Du hast dich noch nicht angemeldet. Kopieren Galerieseitenzahl anzeigen Die Galerieseitenzahle in der Galerieliste anzeigen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 31c47957e..33a37cb6e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -63,7 +63,7 @@ El contenido de esta aplicación es de Internet. Algunas de ellas pueden causarle daño psicológico. Ahora sabes los riesgos anteriormente mencionado y te gustaría asumirlos El usuario no puede estar vacío - Saltar inicio de sesión + Saltar inicio de sesión Inicio de sesión fallido Entendido diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1e7f06aad..5b5f68ff3 100755 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -64,7 +64,7 @@ Le contenu de l\'application provient de l\'Internet, dont quelque chose peut vous causer le dommage physique ou mentale. Vous l\'avez bien compris et voulez continuer quand même. Nom d\'ultilisateur ne doit pas être une chaîne vide Mot de passe ne doit pas être une chaîne vide - Continuer sans se connecter + Continuer sans se connecter Impossible de se connecter Compris @@ -436,7 +436,7 @@ Langue de l\'app (Language) Langue du système (défaut) Tout le monde peut utiliser les cookies de ce compte pour s\'y connecter.<br><b>GARDEZ-LES BIEN !</b><br><br>%s - Vous ne vous êtes pas connecté. + Vous ne vous êtes pas connecté. Copier Montrer les nombres des pages des galeries Montrer le nombre des pages des galerie dans la liste des galeries diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 48534ecc7..2d746ab23 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -62,7 +62,7 @@ このアプリの内容はインターネットから取得したものです。その内容の一部は使用者のお体や心理に傷つける恐れがあります。それでも続行しますか? ユーザー名を入力してください。 パスワードを入力してください。 - ログインをスキップ + ログインをスキップ ログインに失敗しました。 了解 @@ -434,7 +434,7 @@ ダウンロードサービス 下記の情報を持つ誰でもこのアカウントにログインできますので<br><b>絶対に他人に渡さないように!</b><br><br>%s - まだログインしていません + まだログインしていません コピー ギャラリーページ数を表示 リストにギャラリーのページの数量を表示します diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 6a1749d85..357ad20db 100755 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -66,7 +66,7 @@ 이 앱의 내용은 인터넷에서 받아옵니다. 이 앱을 사용하기 위해서는 받아온 내용 중 일부가 사용자에게 가할 수 있는 신체적 또는 정신적 피해를 감수해야 합니다. 사용자 이름은 비워둘 수 없습니다. 비밀번호는 비워둘 수 없습니다. - 로그인 없이 사용 + 로그인 없이 사용 로그인 실패 알겠습니다 @@ -264,7 +264,7 @@ EH 로그아웃 식별용 쿠키를 사용하여 이 계정으로 로그인할 수 있습니다.<br><b>안전하게 보관하세요.</b><br><br>%s - 로그인 상태가 아닙니다. + 로그인 상태가 아닙니다. 복사 E-Hentai 설정 E-Hentai 사이트의 설정 페이지를 엽니다. diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 1a35b90d2..41ff3ae6b 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -30,7 +30,7 @@ Ingen torrenter Språk Kun søk i omslag - Fortsett uten å logge inn + Fortsett uten å logge inn Hvilken galleriside vil du besøke\? ♥ %d Torrent (%d) @@ -90,7 +90,7 @@ Sider Del bilde Logg ut - Turistmodus + Turistmodus Kopier informasjonskapsler Byggversjon Mine etiketter diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 6f7a9b9ff..fd1e6da1c 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -66,7 +66,7 @@ เนื้อหาภายในแอปพลิเคชั่นนี้มาจากอินเทอร์เน็ตทั้งหมด อาจมีเนื้อหาบางอย่างที่มีผลต่อร่างกายหรือจิตใจของคุณ คุณจะต้องยอมรับความเสี่ยงที่ดังกล่าว และดำเนินการต่อไป ชื่อผู้ใช้ห้ามเว้นว่างไว้ รหัสผ่านห้ามเว้นว่างไว้ - ดำเนินการต่อโดยไม่ต้องลงชื่อเข้าระบบ + ดำเนินการต่อโดยไม่ต้องลงชื่อเข้าระบบ การลงชื่อเข้าใช้ล้มเหลว เข้าใจแล้ว ไม่ต้องแสดงอีก @@ -279,7 +279,7 @@ EH ออกจากระบบ คุกกี๊ยืนยันตัวตนสามารถใช้ลงชื่อเข้าสู่ระบบสำหรับบัญชีนี้เท่านั้น<br><b>เก็บ รักษา ให้ ปลอดภัย</b><br><br>%s - ยังไม่ลงชื่อเข้าสู่ระบบ + ยังไม่ลงชื่อเข้าสู่ระบบ คัดลอก การตั้งค่า EHentai การตั้งค่าบนเว็บไซต์ EHentai diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index efffff867..9b6997d0a 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -42,7 +42,7 @@ Geçersiz numara Kullanıcı adı boş bir metin olamaz Şifre boş bir metin olamaz - Giriş yapmaksızın devam et + Giriş yapmaksızın devam et Giriş başarısız Anladım Dünya büyük olmasına rağmen pandacık yalnız oturuyor diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 79a596d2b..2b7dfb301 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -58,7 +58,7 @@ 继续使用即代表您同意上述条款。 用户名不可为空 密码不可为空 - 游客模式 + 游客模式 登录失败 若持续出错,请尝试“通过网页登录”或“通过 Cookie 登录”。 知道了 @@ -295,7 +295,7 @@ EH 退出登录 身份 Cookie 可用于登录该账号。<br><b>注意数据安全</b><br><br>%s - 游客模式 + 游客模式 复制 Cookies EHentai 设置 EHentai 网站上的设置 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 91819bf93..710d76057 100755 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -67,7 +67,7 @@ 本應用中內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。本應用作者不會對由本應用造成的任何後果負責。\n\n未成年人應在監護人指導下使用本應用。 用户名不可為空 密碼不可為空 - 跳過登錄 + 跳過登錄 登錄失敗 若持續出錯,請嘗試“通過網頁登錄”或“通過 Cookie 登錄”。 知道了 @@ -307,7 +307,7 @@ EH 退出登錄 身份 Cookie 可用於登錄該賬號。<br><b>注意數據安全</b><br><br>%s - 未登錄 + 未登錄 複製 EHentai 設置 EHentai 網站上的設置 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 1689da128..9f6c72724 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -58,7 +58,7 @@ 繼續使用即表示您同意上述條款。 使用者名稱欄位不能為空 密碼欄位不能為空 - 略過登入 + 略過登入 登入失敗 若持續出錯,請嘗試“通過網頁登入”或“通過 Cookie 登入”。 知道了 @@ -295,7 +295,7 @@ EH 登出 身份 Cookie 可用於登入該帳號。<br><b>請注意資料安全</b><br><br>%s - 訪客模式 + 訪客模式 複製 Cookies EHentai 設定 EHentai 網站上的設定 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fd33a7430..0154cac8d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -96,7 +96,7 @@ By continuing to use it, you agree to the above terms. Username cannot be an empty string Password cannot be an empty string - Continue without signing in + Continue without signing in Sign in failed If this issue continues, try \"Sign in via WebView\" or \"Sign in via cookies\". Got it @@ -336,7 +336,7 @@ EH Sign out Identity cookies can be used to sign in to this account.<br><b>KEEP IT SAFE</b><br><br>%s - Tourist mode + Guest mode Copy Cookies EHentai settings Settings on EHentai website