diff --git a/console-app/src/main/java/common/Common.kt b/console-app/src/main/java/common/Common.kt new file mode 100644 index 00000000..0ceb044f --- /dev/null +++ b/console-app/src/main/java/common/Common.kt @@ -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 + } +} diff --git a/console-app/src/main/java/common/Parameters.kt b/console-app/src/main/java/common/Parameters.kt new file mode 100644 index 00000000..1f1f2623 --- /dev/null +++ b/console-app/src/main/java/common/Parameters.kt @@ -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 + ) + } +} diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 994a3e28..07bf0a0d 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -38,8 +38,8 @@ kotlin { implementation(compose.desktop.currentOs) implementation(project(":common:database")) implementation(project(":common:dependency-injection")) - implementation(project(":common:compose")) implementation(project(":common:data-models")) + implementation(project(":common:compose")) implementation(project(":common:root")) // Decompose diff --git a/settings.gradle.kts b/settings.gradle.kts index 0c54a1fa..8cf289b8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,5 +27,6 @@ include( ":android", ":desktop", ":web-app", + ":console-app", ":maintenance-tasks" ) diff --git a/web-app/src/main/kotlin/App.kt b/web-app/src/main/kotlin/App.kt index 4614b56f..03d1ed52 100644 --- a/web-app/src/main/kotlin/App.kt +++ b/web-app/src/main/kotlin/App.kt @@ -42,7 +42,6 @@ fun RBuilder.App(attrs: AppProps.() -> Unit): ReactElement { } } - @Suppress("EXPERIMENTAL_IS_NOT_ENABLED", "NON_EXPORTABLE_TYPE") @OptIn(ExperimentalJsExport::class) @JsExport @@ -52,6 +51,10 @@ class App(props: AppProps): RComponent(props) { private val ctx = DefaultComponentContext(lifecycle = lifecycle) private val dependencies = props.dependencies + override fun RBuilder.render() { + renderableChild(RootR::class, root) + } + private val root = SpotiFlyerRoot(ctx, object : SpotiFlyerRoot.Dependencies { override val storeFactory: StoreFactory = LoggingStoreFactory(DefaultStoreFactory) @@ -107,8 +110,4 @@ class App(props: AppProps): RComponent(props) { override fun componentWillUnmount() { lifecycle.destroy() } - - override fun RBuilder.render() { - renderableChild(RootR::class, root) - } } \ No newline at end of file