diff --git a/current b/current index 3e1ad720b1..ce6a70b9d8 100644 --- a/current +++ b/current @@ -1 +1 @@ -1.5.0 \ No newline at end of file +1.6.0 \ No newline at end of file diff --git a/src/main/kotlin/me/leon/Config.kt b/src/main/kotlin/me/leon/Config.kt index 202dca99af..0c9d5f4287 100644 --- a/src/main/kotlin/me/leon/Config.kt +++ b/src/main/kotlin/me/leon/Config.kt @@ -4,6 +4,7 @@ const val VERSION = "1.6.0" const val REPO_URL = "https://github.com/Leon406/ToolsFx" const val PJ52_URL = "https://www.52pojie.cn/thread-1501153-1-1.html" const val LAN_ZOU_DOWNLOAD_URL = "https://leon.lanzoui.com/b0d9av2kb" -const val CHECK_UPDATE_URL = "https://cdn.staticaly.com/gh/Leon406/ToolsFx/dev/current" +const val CHECK_UPDATE_URL = "https://cdn.staticaly.com/gh/Leon406/ToolsFx/main/current" +const val CHECK_UPDATE_URL2 = "https://gitee.com/LeonShih/ToolsFx/raw/main/current" const val LICENSE = "https://cdn.staticaly.com/gh/Leon406/ToolsFx/main/LICENSE" const val APP_NAME = "密码学工具箱 by Leon406 " diff --git a/src/main/kotlin/me/leon/ext/Net.kt b/src/main/kotlin/me/leon/ext/Net.kt index fdf56a8b9c..6046472541 100644 --- a/src/main/kotlin/me/leon/ext/Net.kt +++ b/src/main/kotlin/me/leon/ext/Net.kt @@ -9,17 +9,15 @@ const val RESPONSE_OK = 200 fun String.readBytesFromNet() = (URL(this).openConnection().apply { - // setRequestProperty("Referer", - // "https://pc.woozooo.com/mydisk.php") - connectTimeout = DEFAULT_CONNECT_TIME_OUT - readTimeout = DEFAULT_READ_TIME_OUT - setRequestProperty("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8") - setRequestProperty( - "user-agent", - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " + + connectTimeout = DEFAULT_CONNECT_TIME_OUT + readTimeout = DEFAULT_READ_TIME_OUT + setRequestProperty("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8") + setRequestProperty( + "user-agent", + "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/86.0.4240.198 Safari/537.36" - ) - } as + ) + } as HttpURLConnection) .takeIf { // println("$this __ ${it.responseCode}") @@ -29,8 +27,8 @@ fun String.readBytesFromNet() = ?.readBytes() ?: byteArrayOf() -fun String.readFromNet() = +fun String.readFromNet(resumeUrl: String = ""): String = runCatching { String(this.readBytesFromNet()) }.getOrElse { - println("read err ${it.message}") - "" + println("read err ${it.stacktrace()} ") + if (resumeUrl.isEmpty()) "" else resumeUrl.readFromNet() } diff --git a/src/main/kotlin/me/leon/view/AboutView.kt b/src/main/kotlin/me/leon/view/AboutView.kt index 03d5aa8c0e..de9e5a54c0 100644 --- a/src/main/kotlin/me/leon/view/AboutView.kt +++ b/src/main/kotlin/me/leon/view/AboutView.kt @@ -35,7 +35,7 @@ class AboutView : View("关于") { private fun checkUpdate(isAuto: Boolean = true) { if (!isAuto) return - runAsync { CHECK_UPDATE_URL.readFromNet() } ui + runAsync { CHECK_UPDATE_URL.readFromNet(CHECK_UPDATE_URL2) } ui { latestVersion.text = if (it.isEmpty()) "未知错误"