mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Fix broken favorites sync
Release v6.8.2
This commit is contained in:
		| @@ -133,7 +133,9 @@ object PreferenceKeys { | ||||
|  | ||||
|     const val eh_settingsKey = "eh_settingsKey" | ||||
|  | ||||
|     const val eh_sessionCookie = "eh_sessionCookie" | ||||
|  | ||||
|     const val eh_enableExHentai = "enable_exhentai" | ||||
|  | ||||
|     const val eh_showSettingsUploadWarning = "eh_showSettingsUploadWarning" | ||||
|     const val eh_showSettingsUploadWarning = "eh_showSettingsUploadWarning1" | ||||
| } | ||||
|   | ||||
| @@ -200,6 +200,7 @@ class PreferencesHelper(val context: Context) { | ||||
|     fun eh_ehSettingsProfile() = rxPrefs.getInteger(Keys.eh_ehSettingsProfile, -1) | ||||
|     fun eh_exhSettingsProfile() = rxPrefs.getInteger(Keys.eh_exhSettingsProfile, -1) | ||||
|     fun eh_settingsKey() = rxPrefs.getString(Keys.eh_settingsKey, "") | ||||
|     fun eh_sessionCookie() = rxPrefs.getString(Keys.eh_sessionCookie, "") | ||||
|  | ||||
|     //Lock | ||||
|     fun lockHash() = rxPrefs.getString("lock_hash", null) | ||||
|   | ||||
| @@ -68,7 +68,7 @@ class EHentai(override val id: Long, | ||||
|                         //Get title | ||||
|                         it.select(".itd .it5 a").first()?.apply { | ||||
|                             title = text() | ||||
|                             setUrlWithoutDomain(ExGalleryMetadata.normalizeUrl(attr("href"))) | ||||
|                             url = ExGalleryMetadata.normalizeUrl(attr("href")) | ||||
|                         } | ||||
|                         //Get image | ||||
|                         it.select(".itd .it2").first()?.apply { | ||||
| @@ -345,6 +345,10 @@ class EHentai(override val id: Long, | ||||
|             val sessionKey = prefs.eh_settingsKey().getOrDefault() | ||||
|             if(sessionKey != null) | ||||
|                 cookies["sk"] = sessionKey | ||||
|  | ||||
|             val sessionCookie = prefs.eh_sessionCookie().getOrDefault() | ||||
|             if(sessionCookie != null) | ||||
|                 cookies["s"] = sessionCookie | ||||
|         } | ||||
|  | ||||
|         //Session-less list display mode (for users without ExHentai) | ||||
|   | ||||
| @@ -549,6 +549,7 @@ class LibraryController( | ||||
|         cleanupSyncState() | ||||
|         favoritesSyncSubscription = | ||||
|                 presenter.favoritesSync.status | ||||
|                         .sample(100, TimeUnit.MILLISECONDS) | ||||
|                         .observeOn(AndroidSchedulers.mainThread()) | ||||
|                         .subscribe { | ||||
|                     updateSyncStatus(it) | ||||
|   | ||||
| @@ -168,10 +168,10 @@ open class ExGalleryMetadata : RealmObject(), SearchableGalleryMetadata { | ||||
|             pathSegments.filterNot(String::isNullOrBlank) | ||||
|         } | ||||
|  | ||||
|         fun galleryId(url: String) = splitGalleryUrl(url).let { it[it.size - 2] } | ||||
|         fun galleryId(url: String) = splitGalleryUrl(url)[1] | ||||
|  | ||||
|         fun galleryToken(url: String) = | ||||
|                 splitGalleryUrl(url).last() | ||||
|                 splitGalleryUrl(url)[2] | ||||
|  | ||||
|         fun normalizeUrl(id: String, token: String) | ||||
|                 = "/g/$id/$token/?nw=always" | ||||
|   | ||||
| @@ -117,9 +117,14 @@ class EHConfigurator { | ||||
|         val keyCookie = response.headers().toMultimap()["Set-Cookie"]?.find { | ||||
|             it.startsWith("sk=") | ||||
|         }?.removePrefix("sk=")?.substringBefore(';') | ||||
|         val sessionCookie = response.headers().toMultimap()["Set-Cookie"]?.find { | ||||
|             it.startsWith("s=") | ||||
|         }?.removePrefix("s=")?.substringBefore(';') | ||||
|  | ||||
|         if(keyCookie != null) | ||||
|             prefs.eh_settingsKey().set(keyCookie) | ||||
|         if(sessionCookie != null) | ||||
|             prefs.eh_sessionCookie().set(sessionCookie) | ||||
|     } | ||||
|  | ||||
|     companion object { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user