mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-26 19:17:51 +02:00
Fix broken favorites sync
Release v6.8.2
This commit is contained in:
@ -40,8 +40,8 @@ android {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 26
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
versionCode 6801
|
||||
versionName "v6.8.1-EH"
|
||||
versionCode 6802
|
||||
versionName "v6.8.2-EH"
|
||||
|
||||
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
||||
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
|
||||
|
@ -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 {
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog bulletedList="true">
|
||||
<changelogversion versionName="v6.8.2-EH" changeDate="">
|
||||
<changelogtext>Fix broken favorites sync in previous release</changelogtext>
|
||||
</changelogversion>
|
||||
<changelogversion versionName="v6.8.1-EH" changeDate="">
|
||||
<changelogtext>Various performance improvements</changelogtext>
|
||||
<changelogtext>Fix app not working at all for some users</changelogtext>
|
||||
|
Reference in New Issue
Block a user