mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 10:30:13 +08:00
use 崔cloud
This commit is contained in:
parent
099e76b188
commit
bb1992988c
@ -24,49 +24,14 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//core && protocol
|
|
||||||
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||||
api(kotlin("serialization", Versions.Kotlin.stdlib))
|
|
||||||
api(kotlin("reflect", Versions.Kotlin.stdlib))
|
api(kotlin("reflect", Versions.Kotlin.stdlib))
|
||||||
|
|
||||||
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||||
api(kotlinx("serialization-runtime-common", serializationVersion))
|
|
||||||
api(kotlinx("serialization-protobuf-common", serializationVersion))
|
|
||||||
api(kotlinx("io", kotlinXIoVersion))
|
|
||||||
api(kotlinx("coroutines-io", coroutinesIoVersion))
|
|
||||||
api(kotlinx("coroutines-core", coroutinesVersion))
|
|
||||||
|
|
||||||
api("org.jetbrains.kotlinx:atomicfu-common:$atomicFuVersion")
|
|
||||||
|
|
||||||
api(ktor("client-cio", ktorVersion))
|
|
||||||
api(ktor("client-core", ktorVersion))
|
|
||||||
api(ktor("network", ktorVersion))
|
|
||||||
api(kotlin("reflect", kotlinVersion))
|
|
||||||
|
|
||||||
api(ktor("client-core-jvm", ktorVersion))
|
|
||||||
api(kotlinx("io-jvm", kotlinXIoVersion))
|
|
||||||
api(kotlinx("serialization-runtime", serializationVersion))
|
|
||||||
api(kotlinx("serialization-protobuf", serializationVersion))
|
|
||||||
api(kotlinx("coroutines-io-jvm", coroutinesIoVersion))
|
|
||||||
api(kotlinx("coroutines-core", coroutinesVersion))
|
|
||||||
|
|
||||||
api("org.bouncycastle:bcprov-jdk15on:1.64")
|
|
||||||
|
|
||||||
api("org.jetbrains.kotlinx:atomicfu:$atomicFuVersion")
|
|
||||||
api(kotlinx("serialization-runtime-common", serializationVersion))
|
|
||||||
api(kotlinx("serialization-protobuf-common", serializationVersion))
|
|
||||||
api(kotlinx("serialization-runtime", serializationVersion))
|
|
||||||
|
|
||||||
//for slf4j[ktor used]
|
|
||||||
// api(group = "org.apache.cassandra", name = "cassandra-all", version = "0.8.1")
|
|
||||||
|
|
||||||
//mirai-console
|
|
||||||
api(group = "com.alibaba", name = "fastjson", version = "1.2.62")
|
|
||||||
api(group = "org.yaml", name = "snakeyaml", version = "1.25")
|
|
||||||
api(group = "com.moandjiezana.toml", name = "toml4j", version = "0.7.2")
|
|
||||||
|
|
||||||
api(group = "com.github.tomas-langer.cli", name="cli-progress", version="1.0.0")
|
|
||||||
|
|
||||||
|
api(ktor("client-cio", Versions.Kotlin.ktor))
|
||||||
|
api(ktor("client-core", Versions.Kotlin.ktor))
|
||||||
|
api(ktor("network", Versions.Kotlin.ktor))
|
||||||
}
|
}
|
||||||
|
|
||||||
version = Versions.Mirai.consoleWrapper
|
version = Versions.Mirai.consoleWrapper
|
||||||
|
@ -51,9 +51,14 @@ internal object ConsoleUpdater {
|
|||||||
if (current != newest) {
|
if (current != newest) {
|
||||||
println("Updating Console-$type from V$current -> V$newest, this is a force update")
|
println("Updating Console-$type from V$current -> V$newest, this is a force update")
|
||||||
this.getFile()?.delete()
|
this.getFile()?.delete()
|
||||||
|
/**
|
||||||
MiraiDownloader.addTask(
|
MiraiDownloader.addTask(
|
||||||
"https://raw.githubusercontent.com/mamoe/mirai-repo/master/shadow/${getProjectName()}/${getProjectName()}-$newest.jar",getContent("${getProjectName()}-$newest.jar")
|
"https://raw.githubusercontent.com/mamoe/mirai-repo/master/shadow/${getProjectName()}/${getProjectName()}-$newest.jar",getContent("${getProjectName()}-$newest.jar")
|
||||||
)
|
)
|
||||||
|
*/
|
||||||
|
MiraiDownloader.addTask(
|
||||||
|
"https://pan.jasonczc.cn/?/mirai/${getProjectName()}/${getProjectName()}-$newest.pdf", getContent("${getProjectName()}-$newest.jar")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,9 @@ internal object CoreUpdater {
|
|||||||
println("Updating shadowed-core from V$current -> V$newest, this is a force update")
|
println("Updating shadowed-core from V$current -> V$newest, this is a force update")
|
||||||
this.getProtocolLib()?.delete()
|
this.getProtocolLib()?.delete()
|
||||||
MiraiDownloader
|
MiraiDownloader
|
||||||
.addTask("https://raw.githubusercontent.com/mamoe/mirai-repo/master/shadow/mirai-core-qqandroid/mirai-core-qqandroid-$newest.jar", getContent("mirai-core-qqandroid-jvm-$newest.jar"))
|
.addTask("https://pan.jasonczc.cn/?/mirai/mirai-core-qqandroid/mirai-core-qqandroid-$newest.pdf",getContent("mirai-core-qqandroid-jvm-$newest.jar"))
|
||||||
|
//.addTask("https://raw.githubusercontent.com/mamoe/mirai-repo/master/shadow/mirai-core-qqandroid/mirai-core-qqandroid-$newest.jar", getContent("mirai-core-qqandroid-jvm-$newest.jar"))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package net.mamoe.mirai.console.wrapper
|
|||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.io.InputStream
|
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
@ -29,7 +28,6 @@ internal object MiraiDownloader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class MiraiDownloaderImpl(
|
private class MiraiDownloaderImpl(
|
||||||
override val coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
override val coroutineContext: CoroutineContext = EmptyCoroutineContext,
|
||||||
tasks: Map<String, File>
|
tasks: Map<String, File>
|
||||||
@ -44,6 +42,7 @@ private class MiraiDownloaderImpl(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
println("Mirai Downloader")
|
println("Mirai Downloader")
|
||||||
|
println("[Mirai国内镜像] 感谢崔Cloud慷慨提供免费的国内储存分发")
|
||||||
isDownloadFinish = this.async {
|
isDownloadFinish = this.async {
|
||||||
tasks.forEach {
|
tasks.forEach {
|
||||||
this.launch {
|
this.launch {
|
||||||
@ -67,17 +66,15 @@ private class MiraiDownloaderImpl(
|
|||||||
private suspend fun downloadTask(fromUrl: String, file: File) {
|
private suspend fun downloadTask(fromUrl: String, file: File) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
val url = URL(fromUrl)
|
val con = URL(fromUrl).openConnection() as HttpURLConnection
|
||||||
val con: HttpURLConnection = url.openConnection() as HttpURLConnection
|
val input= con.inputStream
|
||||||
val input: InputStream = con.inputStream
|
|
||||||
totalSize.addAndGet(con.contentLength)
|
totalSize.addAndGet(con.contentLength)
|
||||||
val outputStream = FileOutputStream(file)
|
val outputStream = FileOutputStream(file)
|
||||||
|
|
||||||
var len = -1
|
var len = -1
|
||||||
val buff = ByteArray(1024)
|
val buff = ByteArray(1024)
|
||||||
while (input.read(buff).also { len = it } != -1) {
|
while (input.read(buff).also { len = it } != -1) {
|
||||||
totalDownload.addAndGet(len)
|
totalDownload.addAndGet(buff.size)
|
||||||
outputStream.write(buff, 0, len);
|
outputStream.write(buff, 0, len)
|
||||||
}
|
}
|
||||||
}catch (e: Exception){
|
}catch (e: Exception){
|
||||||
bar.update(1F,"Failed")
|
bar.update(1F,"Failed")
|
||||||
@ -90,12 +87,9 @@ private class MiraiDownloaderImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MiraiDownloaderProgressBar(){
|
class MiraiDownloaderProgressBar(){
|
||||||
|
|
||||||
private fun reset() {
|
private fun reset() {
|
||||||
|
Loading…
Reference in New Issue
Block a user