Skip to content

Commit

Permalink
ikigaimangas baseurl getter
Browse files Browse the repository at this point in the history
  • Loading branch information
LefanHu committed Nov 6, 2024
1 parent 5ca6328 commit ff9fa74
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ import kotlin.concurrent.thread

class IkigaiMangas : HttpSource(), ConfigurableSource {

override val baseUrl = "https://lectorikigai.acamu.net"
private val isCi = System.getenv("CI") == "true"

override val baseUrl get() = when {
isCi -> defaultBaseUrl
else -> preferences.getPrefBaseUrl()
}

private val defaultBaseUrl: String = "https://lectorikigai.acamu.net"

Expand All @@ -42,10 +47,10 @@ class IkigaiMangas : HttpSource(), ConfigurableSource {
try {
val initClient = network.cloudflareClient
val headers = super.headersBuilder().build()
val document = initClient.newCall(GET(baseUrl, headers)).execute().asJsoup()
val document = initClient.newCall(GET("https://ikigaimangas.com", headers)).execute().asJsoup()
val scriptUrl = document.selectFirst("div[on:click]:containsOwn(Nuevo dominio)")?.attr("on:click")
?: preferences.getPrefBaseUrl()
val script = initClient.newCall(GET("$baseUrl/build/$scriptUrl", headers)).execute().body.string()
val script = initClient.newCall(GET("https://ikigaimangas.com/build/$scriptUrl", headers)).execute().body.string()
val domain = script.substringAfter("window.open(\"").substringBefore("\"")
val host = initClient.newCall(GET(domain, headers)).execute().request.url.host
val newDomain = "https://$host"
Expand Down

0 comments on commit ff9fa74

Please sign in to comment.