diff --git a/app/src/main/kotlin/de/rpr/githubreleases/Config.kt b/app/src/main/kotlin/de/rpr/githubreleases/Config.kt index d23642d..881ca81 100644 --- a/app/src/main/kotlin/de/rpr/githubreleases/Config.kt +++ b/app/src/main/kotlin/de/rpr/githubreleases/Config.kt @@ -1,19 +1,33 @@ package de.rpr.githubreleases; +import com.google.gson.Gson +import com.google.gson.GsonBuilder import de.rpr.githubreleases.LogLevel.ERROR import de.rpr.githubreleases.model.GithubRepo +import de.rpr.terminenbg.LocalDateAdapter +import de.rpr.terminenbg.LocalDateTimeAdapter +import java.time.LocalDate +import java.time.LocalDateTime class Config { + @Transient + private val gson: Gson = GsonBuilder().setPrettyPrinting().create() + data class PublishingCredentials( val instanceUrl: String?, - val accessToken: String?, - private val instanceUrlEnvName: String, - private val accessTokenEnvName: String + @Transient val accessToken: String?, + @Transient private val instanceUrlEnvName: String, + @Transient private val accessTokenEnvName: String ) { + // Serialization helper + @Suppress("unused") + val token: String? = accessToken?.let { "${it.take(10)}..." } + @Transient var valid: Boolean = true + init { validate() } @@ -74,5 +88,9 @@ class Config { } } + override fun toString(): String { + return "Config: " + gson.toJson(this) + } + } \ No newline at end of file diff --git a/app/src/main/kotlin/de/rpr/githubreleases/model/GithubRepo.kt b/app/src/main/kotlin/de/rpr/githubreleases/model/GithubRepo.kt index ad705e9..9d28da0 100644 --- a/app/src/main/kotlin/de/rpr/githubreleases/model/GithubRepo.kt +++ b/app/src/main/kotlin/de/rpr/githubreleases/model/GithubRepo.kt @@ -1,11 +1,11 @@ package de.rpr.githubreleases.model -data class GithubRepo(private val repositoryPath: String) { +data class GithubRepo(@Transient private val repositoryPath: String) { - private val urlPrefix = "https://github.com/" + @Transient private val urlPrefix = "https://github.com/" - val repoPath: String - val name: String + @Transient val repoPath: String + @Transient val name: String init { repoPath = repoPath(repositoryPath) @@ -14,7 +14,7 @@ data class GithubRepo(private val repositoryPath: String) { name = repoPath.substring(usernameEnd + 1).trimEnd { ch -> ch == '/' } } - val capitalizedName = name.replaceFirstChar { it.uppercase() } + @Transient val capitalizedName = name.replaceFirstChar { it.uppercase() } val url = urlPrefix + repoPath @@ -23,5 +23,4 @@ data class GithubRepo(private val repositoryPath: String) { } else { repositoryPath } - } \ No newline at end of file diff --git a/assets/vaultwarden.png b/assets/vaultwarden.png new file mode 100644 index 0000000..90fe47d Binary files /dev/null and b/assets/vaultwarden.png differ diff --git a/assets/vaultwarden.svg b/assets/vaultwarden.svg new file mode 100644 index 0000000..b62d800 --- /dev/null +++ b/assets/vaultwarden.svg @@ -0,0 +1,270 @@ + + + + + Vaultwarden Icon + + + + + Vaultwarden Icon + + + Mathijs van Veluw + + + Rust Logo + + + +