diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7aa4a784f..a72e2a92b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -61,6 +61,16 @@ android { formatter.format(Instant.now()) } + val repoName by lazy { + val stdout = ByteArrayOutputStream() + exec { + commandLine = "git remote get-url origin".split(' ') + standardOutput = stdout + } + stdout.toString().trim().removePrefix("https://github.com/").removePrefix("git@github.com:") + .removeSuffix(".git") + } + defaultConfig { applicationId = "moe.tarsin.ehviewer" minSdk = 28 @@ -85,6 +95,7 @@ android { ) buildConfigField("String", "COMMIT_SHA", "\"$commitSha\"") buildConfigField("String", "BUILD_TIME", "\"$buildTime\"") + buildConfigField("String", "REPO_NAME", "\"$repoName\"") } externalNativeBuild { diff --git a/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt b/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt index df9dbfffe..5e8ccae47 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt @@ -54,9 +54,10 @@ import tachiyomi.data.release.GithubWorkflowRuns import java.io.File import java.util.zip.ZipInputStream -private const val REPO_URL = "https://github.com/Ehviewer-Overhauled/Ehviewer" -private const val API_URL = "https://api.github.com/repos/Ehviewer-Overhauled/Ehviewer" -private const val RELEASE_URL = "https://github.com/Ehviewer-Overhauled/Ehviewer/releases" +private const val REPO_NAME = BuildConfig.REPO_NAME +private const val REPO_URL = "https://github.com/$REPO_NAME" +private const val API_URL = "https://api.github.com/repos/$REPO_NAME" +private const val RELEASE_URL = "$REPO_URL/releases" @Composable @Stable