mirror of
https://github.com/HMCore/Orbot.git
synced 2026-01-03 08:12:51 +00:00
add fat jar compile mode
This commit is contained in:
37
src/main/kotlin/de/wulkanat/web/SiteWatcher.kt
Normal file
37
src/main/kotlin/de/wulkanat/web/SiteWatcher.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package de.wulkanat.web
|
||||
|
||||
import de.wulkanat.Admin
|
||||
import de.wulkanat.model.BlogPostPreview
|
||||
import org.jsoup.Jsoup
|
||||
import java.io.IOException
|
||||
|
||||
object SiteWatcher {
|
||||
private const val BLOG_INDEX_URL = "https://www.hytale.com/news"
|
||||
var newestBlog: BlogPostPreview? = null
|
||||
|
||||
fun hasNewBlogPost(): Boolean {
|
||||
Admin.silent("Updating...")
|
||||
|
||||
try {
|
||||
val doc = Jsoup.connect(BLOG_INDEX_URL).get()
|
||||
val newBlog = BlogPostParser.getFistBlog(doc)
|
||||
|
||||
if (newestBlog == newBlog) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (newestBlog == null) {
|
||||
newestBlog = newBlog
|
||||
return false
|
||||
} else {
|
||||
newestBlog = newBlog
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Admin.error("Connection to Hytale Server failed", e)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user