Skip to content

Commit

Permalink
feat(app): Misc githubMirror support raw.github.com
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon406 committed Oct 7, 2023
1 parent 575ca61 commit bf5aaaf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/kotlin/me/leon/misc/net/GithubMirror.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package me.leon.misc.net
* @email deadogone@gmail.com
*/
private const val RAW = "https://raw.githubusercontent.com"
private const val RAW2 = "https://raw.github.com"
private const val GITHUB = "https://github.com"
private val RAW_MIRRORS =
listOf(
Expand Down Expand Up @@ -44,7 +45,7 @@ private val RELEASE_MIRRORS =

/** 支持release, raw, 预览路径 */
fun String.githubMirror() =
with(substringAfter(RAW)) {
with(substringAfter(RAW).substringAfter(RAW2)) {
val path = this.substringAfter(GITHUB).replace("/blob/", "/")
val mirrors =
if (contains(RELEASE_RESOURCE_KEY)) {
Expand Down

0 comments on commit bf5aaaf

Please sign in to comment.