diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b92b21c30..bab6164fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,6 +16,12 @@ mirai 欢迎一切形式的代码贡献。你可以通过以下几种途径向 m ### 能做什么? +#### 分支 + +- `master`: 最新稳定版 +- `1.x`: 1.x 现有版本的开发 +- `dev`: 2.0 重构版本的开发 + **请基于 `master` 分支进行文档修改; 基于 `dev` 分支进行其他修改 (否则你的修改可能被关闭或不会立即合并)** - 代码优化: 优化任何功能设计或实现, 或是引入一个新的设计(请先通过 issue 与维护者达成共识) diff --git a/build.gradle.kts b/build.gradle.kts index ec482f51e..abc80e711 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -118,6 +118,7 @@ subprojects { } } + /* val shadowJarMd5 = tasks.register("shadowJarMd5") { dependsOn("shadowJvmJar") @@ -140,6 +141,7 @@ subprojects { tasks.getByName("publish").dependsOn(this) tasks.getByName("bintrayUpload").dependsOn(this) }.get() + */ val githubUpload by tasks.creating { group = "mirai" diff --git a/buildSrc/src/main/kotlin/PublishingHelpers.kt b/buildSrc/src/main/kotlin/PublishingHelpers.kt index 884eab575..ed44db5c8 100644 --- a/buildSrc/src/main/kotlin/PublishingHelpers.kt +++ b/buildSrc/src/main/kotlin/PublishingHelpers.kt @@ -73,6 +73,7 @@ inline fun Project.setupPublishing( // afterEvaluate { + /* val shadowJar = tasks.filterIsInstance().firstOrNull() ?: return//@afterEvaluate tasks.register("shadowJarMd5") { @@ -97,6 +98,7 @@ inline fun Project.setupPublishing( tasks.getByName("publish").dependsOn(this) tasks.getByName("bintrayUpload").dependsOn(this) } + */ if (Bintray.isBintrayAvailable(project)) { bintray { @@ -136,11 +138,13 @@ inline fun Project.setupPublishing( publications { register("mavenJava", MavenPublication::class) { from(components["java"]) + /* afterEvaluate { for (file in tasks.getByName("shadowJarMd5").outputs.files) { artifact(provider { file }) } } + */ groupId = rootProject.group.toString() this.artifactId = artifactId diff --git a/gradle/publish.gradle b/gradle/publish.gradle index e062df133..9c9c7b62c 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -123,10 +123,12 @@ afterEvaluate { case 'jvm': it.artifactId = isKotlin137x ? "$variantName" : "$variantName-jvm" + /* def files = tasks.getByName("shadowJarMd5").outputs.files + tasks.getByName("shadowJvmJar").outputs.files for (f in files) { artifact f } + */ break case 'js': diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt index d2a0a9c59..719a09dde 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt @@ -328,9 +328,12 @@ internal object MessageSvcPbGetMsg : OutgoingPacketFactory + if (stat) { + MiraiLogger.info( + """ + Mirai 正在使用桌面环境, + 如果你正在使用SSH, 或无法访问桌面等, + 请将 `mirai.no-desktop` 添加到 JVM 系统属性中 (-Dmirai.no-desktop) + 然后重启 Mirai + """.trimIndent() + ) + MiraiLogger.info( + """ + Mirai using DesktopCaptcha System. + If you are running on SSH, cannot access desktop or more. + Please add `mirai.no-desktop` to JVM properties (-Dmirai.no-desktop) + Then restart mirai + """.trimIndent() + ) + } + } + }.getOrElse { + // Should not happen + MiraiLogger.warning("Exception in checking desktop support.", it) + false + } + } else { false } + } } -internal class WindowInitialzier(private val initializer: WindowInitialzier.(JFrame) -> Unit) { +internal class WindowInitializer(private val initializer: WindowInitializer.(JFrame) -> Unit) { private lateinit var frame0: JFrame val frame: JFrame get() = frame0 fun java.awt.Component.append() { @@ -51,12 +92,20 @@ internal class WindowInitialzier(private val initializer: WindowInitialzier.(JFr } } -internal suspend fun openWindow(title: String = "", initializer: WindowInitialzier.(JFrame) -> Unit = {}): String { - return openWindow(title, WindowInitialzier(initializer)) +internal val windowIcon: BufferedImage? by lazy { + WindowHelperJvm::class.java.getResourceAsStream("project-mirai.png")?.use { + ImageIO.read(it) + } } -internal suspend fun openWindow(title: String = "", initializer: WindowInitialzier = WindowInitialzier {}): String { +internal suspend fun openWindow(title: String = "", initializer: WindowInitializer.(JFrame) -> Unit = {}): String { + return openWindow(title, WindowInitializer(initializer)) +} + +internal suspend fun openWindow(title: String = "", initializer: WindowInitializer = WindowInitializer {}): String { val frame = JFrame() + frame.iconImage = windowIcon + frame.minimumSize = Dimension(228, 62) // From Windows 10 val value = JTextField() val def = CompletableDeferred() value.addKeyListener(object : KeyListener { @@ -89,9 +138,9 @@ internal suspend fun openWindow(title: String = "", initializer: WindowInitialzi frame.title = title frame.isVisible = true - val result = def.await().trim() - SwingUtilities.invokeLater { - frame.dispose() + return def.await().trim().also { + SwingUtilities.invokeLater { + frame.dispose() + } } - return result } diff --git a/mirai-core/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png b/mirai-core/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png new file mode 100644 index 000000000..eeb3a6aba Binary files /dev/null and b/mirai-core/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png differ