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

@ -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"

View File

@ -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 {