mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-24 18:04:33 +01:00
Console App
This commit is contained in:
parent
f057e53994
commit
581f4d0104
29
console-app/src/main/java/common/Common.kt
Normal file
29
console-app/src/main/java/common/Common.kt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
@file:Suppress("FunctionName")
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import io.ktor.client.HttpClient
|
||||||
|
import io.ktor.client.features.HttpTimeout
|
||||||
|
import io.ktor.client.features.json.JsonFeature
|
||||||
|
import io.ktor.client.features.json.serializer.KotlinxSerializer
|
||||||
|
import io.ktor.client.features.logging.DEFAULT
|
||||||
|
import io.ktor.client.features.logging.LogLevel
|
||||||
|
import io.ktor.client.features.logging.Logger
|
||||||
|
import io.ktor.client.features.logging.Logging
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
internal val client = HttpClient {
|
||||||
|
install(HttpTimeout)
|
||||||
|
install(JsonFeature) {
|
||||||
|
serializer = KotlinxSerializer(
|
||||||
|
Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
isLenient = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
install(Logging) {
|
||||||
|
logger = Logger.DEFAULT
|
||||||
|
level = LogLevel.INFO
|
||||||
|
}
|
||||||
|
}
|
29
console-app/src/main/java/common/Parameters.kt
Normal file
29
console-app/src/main/java/common/Parameters.kt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package common
|
||||||
|
|
||||||
|
import utils.byOptionalProperty
|
||||||
|
import utils.byProperty
|
||||||
|
|
||||||
|
internal data class Parameters(
|
||||||
|
val githubToken: String,
|
||||||
|
val ownerName: String,
|
||||||
|
val repoName: String,
|
||||||
|
val branchName: String,
|
||||||
|
val filePath: String,
|
||||||
|
val imageDescription: String,
|
||||||
|
val commitMessage: String,
|
||||||
|
val tagName: String
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun initParameters() = Parameters(
|
||||||
|
githubToken = "GH_TOKEN".byProperty,
|
||||||
|
ownerName = "OWNER_NAME".byProperty,
|
||||||
|
repoName = "REPO_NAME".byProperty,
|
||||||
|
branchName = "BRANCH_NAME".byOptionalProperty ?: "main",
|
||||||
|
filePath = "FILE_PATH".byOptionalProperty ?: "README.md",
|
||||||
|
imageDescription = "IMAGE_DESCRIPTION".byOptionalProperty ?: "IMAGE",
|
||||||
|
commitMessage = "COMMIT_MESSAGE".byOptionalProperty ?: "HTML-TO-IMAGE Update",
|
||||||
|
tagName = "TAG_NAME".byOptionalProperty ?: "HTI"
|
||||||
|
// hctiKey = "HCTI_KEY".analytics_html_img.getByProperty
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -38,8 +38,8 @@ kotlin {
|
|||||||
implementation(compose.desktop.currentOs)
|
implementation(compose.desktop.currentOs)
|
||||||
implementation(project(":common:database"))
|
implementation(project(":common:database"))
|
||||||
implementation(project(":common:dependency-injection"))
|
implementation(project(":common:dependency-injection"))
|
||||||
implementation(project(":common:compose"))
|
|
||||||
implementation(project(":common:data-models"))
|
implementation(project(":common:data-models"))
|
||||||
|
implementation(project(":common:compose"))
|
||||||
implementation(project(":common:root"))
|
implementation(project(":common:root"))
|
||||||
|
|
||||||
// Decompose
|
// Decompose
|
||||||
|
@ -27,5 +27,6 @@ include(
|
|||||||
":android",
|
":android",
|
||||||
":desktop",
|
":desktop",
|
||||||
":web-app",
|
":web-app",
|
||||||
|
":console-app",
|
||||||
":maintenance-tasks"
|
":maintenance-tasks"
|
||||||
)
|
)
|
||||||
|
@ -42,7 +42,6 @@ fun RBuilder.App(attrs: AppProps.() -> Unit): ReactElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Suppress("EXPERIMENTAL_IS_NOT_ENABLED", "NON_EXPORTABLE_TYPE")
|
@Suppress("EXPERIMENTAL_IS_NOT_ENABLED", "NON_EXPORTABLE_TYPE")
|
||||||
@OptIn(ExperimentalJsExport::class)
|
@OptIn(ExperimentalJsExport::class)
|
||||||
@JsExport
|
@JsExport
|
||||||
@ -52,6 +51,10 @@ class App(props: AppProps): RComponent<AppProps, RState>(props) {
|
|||||||
private val ctx = DefaultComponentContext(lifecycle = lifecycle)
|
private val ctx = DefaultComponentContext(lifecycle = lifecycle)
|
||||||
private val dependencies = props.dependencies
|
private val dependencies = props.dependencies
|
||||||
|
|
||||||
|
override fun RBuilder.render() {
|
||||||
|
renderableChild(RootR::class, root)
|
||||||
|
}
|
||||||
|
|
||||||
private val root = SpotiFlyerRoot(ctx,
|
private val root = SpotiFlyerRoot(ctx,
|
||||||
object : SpotiFlyerRoot.Dependencies {
|
object : SpotiFlyerRoot.Dependencies {
|
||||||
override val storeFactory: StoreFactory = LoggingStoreFactory(DefaultStoreFactory)
|
override val storeFactory: StoreFactory = LoggingStoreFactory(DefaultStoreFactory)
|
||||||
@ -107,8 +110,4 @@ class App(props: AppProps): RComponent<AppProps, RState>(props) {
|
|||||||
override fun componentWillUnmount() {
|
override fun componentWillUnmount() {
|
||||||
lifecycle.destroy()
|
lifecycle.destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun RBuilder.render() {
|
|
||||||
renderableChild(RootR::class, root)
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user