remove the workaround introduced in 36acf1a00a
and update the Dockerfile
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
36acf1a00a
commit
46c9a61124
|
@ -1,4 +1,8 @@
|
|||
FROM openjdk:11
|
||||
FROM adoptopenjdk/openjdk11:alpine-jre
|
||||
RUN addgroup -S spring && adduser -S spring -G spring
|
||||
#RUN groupadd -r spring && useradd -r -g spring spring # for openjdk:xx builds
|
||||
USER spring:spring
|
||||
ARG JAR_FILE=build/libs/*.jar
|
||||
COPY ${JAR_FILE} thecitadelofricks.jar
|
||||
ENTRYPOINT ["java","-jar","/thecitadelofricks.jar"]
|
||||
ENTRYPOINT ["java","-Djavax.net.ssl.trustStore=/tcor/cacerts", "-Djavax.net.ssl.trustStorePassword=changeit", "-jar","/thecitadelofricks.jar"]
|
||||
VOLUME /tcor
|
||||
|
|
|
@ -26,17 +26,10 @@ import org.jsoup.Jsoup
|
|||
import org.mosad.thecitadelofricks.Course
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.net.SocketTimeoutException
|
||||
import java.security.KeyManagementException
|
||||
import java.security.cert.CertificateException
|
||||
import java.security.cert.X509Certificate
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.SSLSocketFactory
|
||||
import javax.net.ssl.TrustManager
|
||||
import javax.net.ssl.X509TrustManager
|
||||
|
||||
class CourseListParser {
|
||||
|
||||
private var logger: org.slf4j.Logger = LoggerFactory.getLogger(MensaParser::class.java)
|
||||
private var logger: org.slf4j.Logger = LoggerFactory.getLogger(CourseListParser::class.java)
|
||||
|
||||
/**
|
||||
* return a list of all courses at courseListURL
|
||||
|
@ -46,7 +39,7 @@ class CourseListParser {
|
|||
fun getCourseLinks(courseListURL: String): HashMap<String, Course>? {
|
||||
val courseLinkList = HashMap<String, Course>()
|
||||
try {
|
||||
val courseHTML = Jsoup.connect(courseListURL).sslSocketFactory(socketFactory()).get()
|
||||
val courseHTML = Jsoup.connect(courseListURL).get()
|
||||
|
||||
courseHTML.select("ul.index-group").select("li.Class").select("a[href]").forEachIndexed { _, element ->
|
||||
courseLinkList[element.text()] = Course(
|
||||
|
@ -54,6 +47,7 @@ class CourseListParser {
|
|||
element.attr("href").replace("http", "https")
|
||||
)
|
||||
}
|
||||
logger.info("successfully retrieved course List")
|
||||
} catch (ex: SocketTimeoutException) {
|
||||
logger.warn("timeout from hs-offenburg.de, updating on next attempt!")
|
||||
return null
|
||||
|
@ -64,34 +58,4 @@ class CourseListParser {
|
|||
|
||||
return courseLinkList
|
||||
}
|
||||
|
||||
// Hack to ignore ssl errors while reading
|
||||
private fun socketFactory(): SSLSocketFactory {
|
||||
val trustAllCerts = arrayOf<TrustManager>(object : X509TrustManager {
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkClientTrusted(chain: Array<X509Certificate>, authType: String) {
|
||||
}
|
||||
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkServerTrusted(chain: Array<X509Certificate>, authType: String) {
|
||||
}
|
||||
|
||||
override fun getAcceptedIssuers(): Array<X509Certificate> {
|
||||
return arrayOf()
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
val sslContext = SSLContext.getInstance("TLS")
|
||||
sslContext.init(null, trustAllCerts, java.security.SecureRandom())
|
||||
return sslContext.socketFactory
|
||||
} catch (e: Exception) {
|
||||
when (e) {
|
||||
is RuntimeException, is KeyManagementException -> {
|
||||
throw RuntimeException("Failed to create a SSL socket factory", e)
|
||||
}
|
||||
else -> throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,13 +27,6 @@ import org.jsoup.nodes.Document
|
|||
import org.mosad.thecitadelofricks.Lesson
|
||||
import org.mosad.thecitadelofricks.TimetableWeek
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.security.KeyManagementException
|
||||
import java.security.cert.CertificateException
|
||||
import java.security.cert.X509Certificate
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.SSLSocketFactory
|
||||
import javax.net.ssl.TrustManager
|
||||
import javax.net.ssl.X509TrustManager
|
||||
|
||||
class TimetableParser {
|
||||
private var logger: org.slf4j.Logger = LoggerFactory.getLogger(TimetableParser::class.java)
|
||||
|
@ -47,7 +40,7 @@ class TimetableParser {
|
|||
*/
|
||||
fun getTimeTable(timetableURL: String): TimetableWeek {
|
||||
return try {
|
||||
parseTimeTable(Jsoup.connect(timetableURL).sslSocketFactory(socketFactory()).get())
|
||||
parseTimeTable(Jsoup.connect(timetableURL).get())
|
||||
} catch (gex: Exception) {
|
||||
logger.error("general TimetableParser error", gex)
|
||||
TimetableWeek()
|
||||
|
@ -129,7 +122,7 @@ class TimetableParser {
|
|||
*/
|
||||
fun getWeekNumberYear(timetableURL: String): Int {
|
||||
return try {
|
||||
parseWeekNumberYear(Jsoup.connect(timetableURL).sslSocketFactory(socketFactory()).get())
|
||||
parseWeekNumberYear(Jsoup.connect(timetableURL).get())
|
||||
} catch (gex: Exception) {
|
||||
logger.error("general TimetableParser error", gex)
|
||||
0
|
||||
|
@ -189,33 +182,4 @@ class TimetableParser {
|
|||
println(" \n")
|
||||
}
|
||||
|
||||
// Hack to ignore ssl errors while reading
|
||||
private fun socketFactory(): SSLSocketFactory {
|
||||
val trustAllCerts = arrayOf<TrustManager>(object : X509TrustManager {
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkClientTrusted(chain: Array<X509Certificate>, authType: String) {
|
||||
}
|
||||
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkServerTrusted(chain: Array<X509Certificate>, authType: String) {
|
||||
}
|
||||
|
||||
override fun getAcceptedIssuers(): Array<X509Certificate> {
|
||||
return arrayOf()
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
val sslContext = SSLContext.getInstance("TLS")
|
||||
sslContext.init(null, trustAllCerts, java.security.SecureRandom())
|
||||
return sslContext.socketFactory
|
||||
} catch (e: Exception) {
|
||||
when (e) {
|
||||
is RuntimeException, is KeyManagementException -> {
|
||||
throw RuntimeException("Failed to create a SSL socket factory", e)
|
||||
}
|
||||
else -> throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,5 +11,5 @@ logging.level.org.springframework.web=INFO
|
|||
# ----------------------------------------
|
||||
|
||||
# EMBEDDED SERVER CONFIGURATION (ServerProperties)
|
||||
server.address=127.0.0.1
|
||||
server.address=0.0.0.0
|
||||
server.port=8080
|
Loading…
Reference in New Issue