diff --git a/mirai-console-graphical/build.gradle.kts b/mirai-console-graphical/build.gradle.kts index 485d44608..8863f725c 100644 --- a/mirai-console-graphical/build.gradle.kts +++ b/mirai-console-graphical/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("kotlinx-serialization") -// id("org.openjfx.javafxplugin") version "0.0.8" + id("org.openjfx.javafxplugin") version "0.0.8" id("kotlin") id("java") } diff --git a/mirai-console-wrapper/build.gradle.kts b/mirai-console-wrapper/build.gradle.kts index 98f62ce91..b94373975 100644 --- a/mirai-console-wrapper/build.gradle.kts +++ b/mirai-console-wrapper/build.gradle.kts @@ -24,49 +24,14 @@ kotlin { } dependencies { - //core && protocol api(kotlin("stdlib", Versions.Kotlin.stdlib)) - api(kotlin("serialization", Versions.Kotlin.stdlib)) api(kotlin("reflect", Versions.Kotlin.stdlib)) 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 diff --git a/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/ConsoleUpdater.kt b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/ConsoleUpdater.kt index ba3e63877..02ea6ba60 100644 --- a/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/ConsoleUpdater.kt +++ b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/ConsoleUpdater.kt @@ -51,9 +51,14 @@ internal object ConsoleUpdater { if (current != newest) { println("Updating Console-$type from V$current -> V$newest, this is a force update") this.getFile()?.delete() + /** MiraiDownloader.addTask( "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") + ) } } diff --git a/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/CoreUpdater.kt b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/CoreUpdater.kt index e76a3e584..136e11d93 100644 --- a/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/CoreUpdater.kt +++ b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/CoreUpdater.kt @@ -38,7 +38,9 @@ internal object CoreUpdater { println("Updating shadowed-core from V$current -> V$newest, this is a force update") this.getProtocolLib()?.delete() 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")) + } } diff --git a/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/MiraiDownloader.kt b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/MiraiDownloader.kt index 0947514c8..2502cc3da 100644 --- a/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/MiraiDownloader.kt +++ b/mirai-console-wrapper/src/main/kotlin/net/mamoe/mirai/console/wrapper/MiraiDownloader.kt @@ -3,7 +3,6 @@ package net.mamoe.mirai.console.wrapper import kotlinx.coroutines.* import java.io.File import java.io.FileOutputStream -import java.io.InputStream import java.net.HttpURLConnection import java.net.URL import java.util.concurrent.atomic.AtomicInteger @@ -29,7 +28,6 @@ internal object MiraiDownloader{ } } - private class MiraiDownloaderImpl( override val coroutineContext: CoroutineContext = EmptyCoroutineContext, tasks: Map @@ -44,6 +42,7 @@ private class MiraiDownloaderImpl( init { println("Mirai Downloader") + println("[Mirai国内镜像] 感谢崔Cloud慷慨提供免费的国内储存分发") isDownloadFinish = this.async { tasks.forEach { this.launch { @@ -67,17 +66,15 @@ private class MiraiDownloaderImpl( private suspend fun downloadTask(fromUrl: String, file: File) { withContext(Dispatchers.IO) { try { - val url = URL(fromUrl) - val con: HttpURLConnection = url.openConnection() as HttpURLConnection - val input: InputStream = con.inputStream + val con = URL(fromUrl).openConnection() as HttpURLConnection + val input= con.inputStream totalSize.addAndGet(con.contentLength) val outputStream = FileOutputStream(file) - var len = -1 val buff = ByteArray(1024) while (input.read(buff).also { len = it } != -1) { - totalDownload.addAndGet(len) - outputStream.write(buff, 0, len); + totalDownload.addAndGet(buff.size) + outputStream.write(buff, 0, len) } }catch (e: Exception){ bar.update(1F,"Failed") @@ -90,12 +87,9 @@ private class MiraiDownloaderImpl( } } } - } - - class MiraiDownloaderProgressBar(){ private fun reset() { diff --git a/mirai-console/build.gradle.kts b/mirai-console/build.gradle.kts index 4f3f39be9..d91241bda 100644 --- a/mirai-console/build.gradle.kts +++ b/mirai-console/build.gradle.kts @@ -25,28 +25,9 @@ dependencies { compileOnly("net.mamoe:mirai-core-qqandroid-jvm:${Versions.Mirai.core}") - compileOnly(group = "com.alibaba", name = "fastjson", version = "1.2.62") - compileOnly(group = "org.yaml", name = "snakeyaml", version = "1.25") - compileOnly(group = "com.moandjiezana.toml", name = "toml4j", version = "0.7.2") - - - compileOnly(kotlin("stdlib", Versions.Kotlin.stdlib)) - compileOnly(kotlin("serialization", Versions.Kotlin.stdlib)) - compileOnly(kotlin("reflect", Versions.Kotlin.stdlib)) - - compileOnly(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo)) - compileOnly(kotlinx("coroutines-core", Versions.Kotlin.coroutines)) - compileOnly(kotlinx("serialization-runtime", Versions.Kotlin.serialization)) - compileOnly("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}") - - compileOnly("org.bouncycastle:bcprov-jdk15on:1.64") - - compileOnly(ktor("http-cio")) - compileOnly(ktor("http-jvm")) - compileOnly(ktor("io-jvm")) - compileOnly(ktor("client-core-jvm")) - compileOnly(ktor("client-cio")) - compileOnly(ktor("network")) + implementation(group = "com.alibaba", name = "fastjson", version = "1.2.62") + implementation(group = "org.yaml", name = "snakeyaml", version = "1.25") + implementation(group = "com.moandjiezana.toml", name = "toml4j", version = "0.7.2") } val miraiConsoleVersion: String by project.ext