Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72937cdd42 | ||
|
|
9c878f5e44 |
@@ -19,7 +19,7 @@ android {
|
|||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 70
|
versionCode = 70
|
||||||
versionName = "5.3.19"
|
versionName = "5.3.21"
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -12,7 +12,7 @@
|
|||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 70,
|
"versionCode": 70,
|
||||||
"versionName": "5.3.19",
|
"versionName": "5.3.21",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -218,30 +218,38 @@ object gg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun subdomainFromURL(url: String, base: String? = null): String {
|
suspend fun subdomainFromURL(url: String, base: String? = null, dir: String? = null): String {
|
||||||
var retval = "b"
|
var retval = ""
|
||||||
|
|
||||||
if (!base.isNullOrBlank())
|
if (!base.isNullOrBlank()) {
|
||||||
retval = base
|
when {
|
||||||
|
dir == "webp" -> retval = "w"
|
||||||
|
dir == "avif" -> retval = "a"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val b = 16
|
val b = 16
|
||||||
|
|
||||||
val r = Regex("""/[0-9a-f]{61}([0-9a-f]{2})([0-9a-f])""")
|
val r = Regex("""/[0-9a-f]{61}([0-9a-f]{2})([0-9a-f])""")
|
||||||
val m = r.find(url) ?: return "a"
|
val m = r.find(url) ?: return ""
|
||||||
|
|
||||||
val g = m.groupValues.let { it[2] + it[1] }.toIntOrNull(b)
|
val g = m.groupValues.let { it[2] + it[1] }.toIntOrNull(b)
|
||||||
|
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
retval = (97 + gg.m(g)).toChar().toString() + retval
|
retval = if (base.isNullOrEmpty()) {
|
||||||
|
retval + (1 + gg.m(g)).toString()
|
||||||
|
} else {
|
||||||
|
(97 + gg.m(g)).toChar().toString() + base
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun urlFromUrl(url: String, base: String? = null): String {
|
suspend fun urlFromUrl(url: String, base: String? = null, dir: String? = null): String {
|
||||||
return url.replace(
|
return url.replace(
|
||||||
Regex("""//..?\.(?:gold-usergeneratedcontent\.net|hitomi\.la)/"""),
|
Regex("""//..?\.(?:gold-usergeneratedcontent\.net|hitomi\.la)/"""),
|
||||||
"//${subdomainFromURL(url, base)}.gold-usergeneratedcontent.net/"
|
"//${subdomainFromURL(url, base, dir)}.gold-usergeneratedcontent.net/"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,8 +266,16 @@ suspend fun urlFromHash(
|
|||||||
ext: String? = null,
|
ext: String? = null,
|
||||||
): String {
|
): String {
|
||||||
val ext = ext ?: dir ?: image.name.takeLastWhile { it != '.' }
|
val ext = ext ?: dir ?: image.name.takeLastWhile { it != '.' }
|
||||||
val dir = dir ?: "images"
|
return buildString {
|
||||||
return "https://a.gold-usergeneratedcontent.net/$dir/${fullPathFromHash(image.hash)}.$ext"
|
append("https://a.gold-usergeneratedcontent.net/")
|
||||||
|
if (dir != "webp" && dir != "avif") {
|
||||||
|
append(dir)
|
||||||
|
append("/")
|
||||||
|
}
|
||||||
|
append(fullPathFromHash(image.hash))
|
||||||
|
append(".")
|
||||||
|
append(ext)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun urlFromUrlFromHash(
|
suspend fun urlFromUrlFromHash(
|
||||||
@@ -272,10 +288,10 @@ suspend fun urlFromUrlFromHash(
|
|||||||
if (base == "tn")
|
if (base == "tn")
|
||||||
urlFromUrl(
|
urlFromUrl(
|
||||||
"https://a.gold-usergeneratedcontent.net/$dir/${realFullPathFromHash(image.hash)}.$ext",
|
"https://a.gold-usergeneratedcontent.net/$dir/${realFullPathFromHash(image.hash)}.$ext",
|
||||||
base
|
base,
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
urlFromUrl(urlFromHash(galleryID, image, dir, ext), base)
|
urlFromUrl(urlFromHash(galleryID, image, dir, ext), base, dir)
|
||||||
|
|
||||||
suspend fun imageUrlFromImage(galleryID: Int, image: GalleryFiles, noWebp: Boolean): String {
|
suspend fun imageUrlFromImage(galleryID: Int, image: GalleryFiles, noWebp: Boolean): String {
|
||||||
return urlFromUrlFromHash(galleryID, image, "webp", null, "a")
|
return urlFromUrlFromHash(galleryID, image, "webp", null, "a")
|
||||||
|
|||||||
Reference in New Issue
Block a user