2021-05-18 16:57:33 +02:00
|
|
|
@file:Suppress("FunctionName")
|
|
|
|
|
|
|
|
package analytics_html_img
|
|
|
|
|
2021-05-18 21:31:09 +02:00
|
|
|
import io.ktor.client.HttpClient
|
2021-05-20 12:23:08 +02:00
|
|
|
import io.ktor.client.features.HttpTimeout
|
2021-05-18 21:31:09 +02:00
|
|
|
import io.ktor.client.features.json.JsonFeature
|
|
|
|
import io.ktor.client.features.json.serializer.KotlinxSerializer
|
|
|
|
import kotlinx.serialization.json.Json
|
2021-05-18 16:57:33 +02:00
|
|
|
|
|
|
|
internal object Common {
|
|
|
|
const val GITHUB_API = "https://api.github.com"
|
|
|
|
fun START_SECTION(tagName: String = "HTI") = "<!--START_SECTION:$tagName-->"
|
|
|
|
fun END_SECTION(tagName: String = "HTI") = "<!--END_SECTION:$tagName-->"
|
|
|
|
const val USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0"
|
|
|
|
}
|
2021-05-18 21:31:09 +02:00
|
|
|
internal val client = HttpClient {
|
2021-05-20 12:23:08 +02:00
|
|
|
install(HttpTimeout)
|
2021-05-18 21:31:09 +02:00
|
|
|
install(JsonFeature) {
|
|
|
|
serializer = KotlinxSerializer(
|
|
|
|
Json {
|
|
|
|
ignoreUnknownKeys = true
|
|
|
|
isLenient = true
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2021-05-18 16:57:33 +02:00
|
|
|
internal data class GithubFileContent(
|
|
|
|
val decryptedContent: String,
|
|
|
|
val sha: String
|
|
|
|
)
|