mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-31 11:50:09 +08:00
Fix cross images downloading url; fix #1600
This commit is contained in:
parent
07d5a6ca7d
commit
ace32caa28
@ -58,10 +58,7 @@ internal class OnlineGroupImageImpl(
|
|||||||
|
|
||||||
override val originUrl: String
|
override val originUrl: String
|
||||||
get() = if (delegate.origUrl.isBlank()) {
|
get() = if (delegate.origUrl.isBlank()) {
|
||||||
"http://gchat.qpic.cn/gchatpic_new/0/0-0-${
|
gchatImageUrlByImageId(imageId)
|
||||||
imageId.substring(1..36)
|
|
||||||
.replace("-", "")
|
|
||||||
}/0?term=2"
|
|
||||||
} else "http://gchat.qpic.cn" + delegate.origUrl
|
} else "http://gchat.qpic.cn" + delegate.origUrl
|
||||||
|
|
||||||
override val isEmoji: Boolean by lazy {
|
override val isEmoji: Boolean by lazy {
|
||||||
@ -78,6 +75,13 @@ private fun <T : ImgExtPbResvAttrCommon> ByteArray.pbImageResv_checkIsEmoji(seri
|
|||||||
}.getOrNull() ?: false
|
}.getOrNull() ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun gchatImageUrlByImageId(imageId: String) =
|
||||||
|
"http://gchat.qpic.cn/gchatpic_new/0/0-0-${
|
||||||
|
imageId.substring(1..36)
|
||||||
|
.replace("-", "")
|
||||||
|
}/0?term=2"
|
||||||
|
|
||||||
|
|
||||||
private val imageLogger: MiraiLogger by lazy { MiraiLogger.Factory.create(Image::class) }
|
private val imageLogger: MiraiLogger by lazy { MiraiLogger.Factory.create(Image::class) }
|
||||||
internal val Image.Key.logger get() = imageLogger
|
internal val Image.Key.logger get() = imageLogger
|
||||||
|
|
||||||
@ -117,6 +121,9 @@ OnlineFriendImage() {
|
|||||||
override val originUrl: String
|
override val originUrl: String
|
||||||
get() = if (delegate.origUrl.isNotBlank()) {
|
get() = if (delegate.origUrl.isNotBlank()) {
|
||||||
"http://c2cpicdw.qpic.cn" + this.delegate.origUrl
|
"http://c2cpicdw.qpic.cn" + this.delegate.origUrl
|
||||||
|
} else if (delegate.resId.isNotEmpty() && delegate.resId[0] == '{') {
|
||||||
|
// https://github.com/mamoe/mirai/issues/1600
|
||||||
|
gchatImageUrlByImageId(imageId)
|
||||||
} else {
|
} else {
|
||||||
"http://c2cpicdw.qpic.cn/offpic_new/0/" + delegate.resId + "/0?term=2"
|
"http://c2cpicdw.qpic.cn/offpic_new/0/" + delegate.resId + "/0?term=2"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user