rt4-client/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabConfig.kt
2025-11-23 05:15:19 -08:00

26 lines
1.1 KiB
Kotlin

package KondoKit.pluginmanager
object GitLabConfig {
const val GITLAB_PROJECT_ID = "38297322"
const val GITLAB_PROJECT_PATH = "2009scape/tools/client-plugins"
const val GITLAB_BRANCH = "master"
const val DEBUG = false // Spams pretty hard
fun getGitLabApiBaseUrl(): String = "https://gitlab.com/api/v4/projects/$GITLAB_PROJECT_ID"
fun getRepositoryTreeUrl(): String =
"${getGitLabApiBaseUrl()}/repository/tree?ref=${GITLAB_BRANCH}&per_page=100"
fun getRawFileUrl(filePath: String): String =
"${getGitLabApiBaseUrl()}/repository/files/${filePath.replace("/", "%2F")}/raw?ref=${GITLAB_BRANCH}"
fun getArchiveBaseUrl(): String =
"https://gitlab.com/$GITLAB_PROJECT_PATH/-/archive/$GITLAB_BRANCH/${GITLAB_PROJECT_PATH.replace("/", "-")}-$GITLAB_BRANCH.zip"
fun getArchiveUrl(pluginPath: String): String =
"${getArchiveBaseUrl()}?path=$pluginPath"
fun getArchiveUrlWithRefType(pluginPath: String): String =
"${getArchiveBaseUrl()}?path=$pluginPath&ref_type=heads"
}