Fix broken favorites sync

Release v6.8.2
This commit is contained in:
NerdNumber9
2018-02-15 17:21:33 -05:00
parent 5447bd098b
commit c54d26d6ba
8 changed files with 22 additions and 6 deletions

View File

@ -40,8 +40,8 @@ android {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 26 targetSdkVersion 26
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 6801 versionCode 6802
versionName "v6.8.1-EH" versionName "v6.8.2-EH"
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\"" buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\"" buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""

View File

@ -133,7 +133,9 @@ object PreferenceKeys {
const val eh_settingsKey = "eh_settingsKey" const val eh_settingsKey = "eh_settingsKey"
const val eh_sessionCookie = "eh_sessionCookie"
const val eh_enableExHentai = "enable_exhentai" const val eh_enableExHentai = "enable_exhentai"
const val eh_showSettingsUploadWarning = "eh_showSettingsUploadWarning" const val eh_showSettingsUploadWarning = "eh_showSettingsUploadWarning1"
} }

View File

@ -200,6 +200,7 @@ class PreferencesHelper(val context: Context) {
fun eh_ehSettingsProfile() = rxPrefs.getInteger(Keys.eh_ehSettingsProfile, -1) fun eh_ehSettingsProfile() = rxPrefs.getInteger(Keys.eh_ehSettingsProfile, -1)
fun eh_exhSettingsProfile() = rxPrefs.getInteger(Keys.eh_exhSettingsProfile, -1) fun eh_exhSettingsProfile() = rxPrefs.getInteger(Keys.eh_exhSettingsProfile, -1)
fun eh_settingsKey() = rxPrefs.getString(Keys.eh_settingsKey, "") fun eh_settingsKey() = rxPrefs.getString(Keys.eh_settingsKey, "")
fun eh_sessionCookie() = rxPrefs.getString(Keys.eh_sessionCookie, "")
//Lock //Lock
fun lockHash() = rxPrefs.getString("lock_hash", null) fun lockHash() = rxPrefs.getString("lock_hash", null)

View File

@ -68,7 +68,7 @@ class EHentai(override val id: Long,
//Get title //Get title
it.select(".itd .it5 a").first()?.apply { it.select(".itd .it5 a").first()?.apply {
title = text() title = text()
setUrlWithoutDomain(ExGalleryMetadata.normalizeUrl(attr("href"))) url = ExGalleryMetadata.normalizeUrl(attr("href"))
} }
//Get image //Get image
it.select(".itd .it2").first()?.apply { it.select(".itd .it2").first()?.apply {
@ -345,6 +345,10 @@ class EHentai(override val id: Long,
val sessionKey = prefs.eh_settingsKey().getOrDefault() val sessionKey = prefs.eh_settingsKey().getOrDefault()
if(sessionKey != null) if(sessionKey != null)
cookies["sk"] = sessionKey cookies["sk"] = sessionKey
val sessionCookie = prefs.eh_sessionCookie().getOrDefault()
if(sessionCookie != null)
cookies["s"] = sessionCookie
} }
//Session-less list display mode (for users without ExHentai) //Session-less list display mode (for users without ExHentai)

View File

@ -549,6 +549,7 @@ class LibraryController(
cleanupSyncState() cleanupSyncState()
favoritesSyncSubscription = favoritesSyncSubscription =
presenter.favoritesSync.status presenter.favoritesSync.status
.sample(100, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
updateSyncStatus(it) updateSyncStatus(it)

View File

@ -168,10 +168,10 @@ open class ExGalleryMetadata : RealmObject(), SearchableGalleryMetadata {
pathSegments.filterNot(String::isNullOrBlank) 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) = fun galleryToken(url: String) =
splitGalleryUrl(url).last() splitGalleryUrl(url)[2]
fun normalizeUrl(id: String, token: String) fun normalizeUrl(id: String, token: String)
= "/g/$id/$token/?nw=always" = "/g/$id/$token/?nw=always"

View File

@ -117,9 +117,14 @@ class EHConfigurator {
val keyCookie = response.headers().toMultimap()["Set-Cookie"]?.find { val keyCookie = response.headers().toMultimap()["Set-Cookie"]?.find {
it.startsWith("sk=") it.startsWith("sk=")
}?.removePrefix("sk=")?.substringBefore(';') }?.removePrefix("sk=")?.substringBefore(';')
val sessionCookie = response.headers().toMultimap()["Set-Cookie"]?.find {
it.startsWith("s=")
}?.removePrefix("s=")?.substringBefore(';')
if(keyCookie != null) if(keyCookie != null)
prefs.eh_settingsKey().set(keyCookie) prefs.eh_settingsKey().set(keyCookie)
if(sessionCookie != null)
prefs.eh_sessionCookie().set(sessionCookie)
} }
companion object { companion object {

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<changelog bulletedList="true"> <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=""> <changelogversion versionName="v6.8.1-EH" changeDate="">
<changelogtext>Various performance improvements</changelogtext> <changelogtext>Various performance improvements</changelogtext>
<changelogtext>Fix app not working at all for some users</changelogtext> <changelogtext>Fix app not working at all for some users</changelogtext>