Compare commits
3 commits
6bd1aed18f
...
2a05564ec3
Author | SHA1 | Date | |
---|---|---|---|
2a05564ec3 | |||
76f78a8688 | |||
137201c3e7 |
26 changed files with 51 additions and 47 deletions
4
.github/workflows/bld.yml
vendored
4
.github/workflows/bld.yml
vendored
|
@ -13,8 +13,8 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [17, 21, 22]
|
java-version: [17, 21, 23]
|
||||||
kotlin-version: [1.9.24, 2.0.20]
|
kotlin-version: [1.9.24, 2.1.0]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[](https://opensource.org/licenses/BSD-3-Clause)
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
||||||
[](https://kotlinlang.org/)
|
[](https://kotlinlang.org/)
|
||||||
[](https://rife2.com/bld)
|
[](https://rife2.com/bld)
|
||||||
[](https://github.com/ethauvin/jokeapi/releases/latest)
|
[](https://github.com/ethauvin/jokeapi/releases/latest)
|
||||||
[](https://central.sonatype.com/artifact/net.thauvin.erik/jokeapi)
|
[](https://central.sonatype.com/artifact/net.thauvin.erik/jokeapi)
|
||||||
|
|
|
@ -2,9 +2,9 @@ bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.7
|
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.7
|
||||||
bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.1
|
bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.2
|
||||||
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.8
|
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.8
|
||||||
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.2
|
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.3
|
||||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.sourceDirectories=
|
bld.sourceDirectories=
|
||||||
bld.version=2.1.0
|
bld.version=2.1.0
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -18,7 +18,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.1.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.thauvin.erik.urlencoder</groupId>
|
<groupId>net.thauvin.erik.urlencoder</groupId>
|
||||||
<artifactId>urlencoder-lib-jvm</artifactId>
|
<artifactId>urlencoder-lib-jvm</artifactId>
|
||||||
<version>1.5.0</version>
|
<version>1.6.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* JokeApiBuild.java
|
* JokeApiBuild.java
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -67,15 +67,15 @@ public class JokeApiBuild extends Project {
|
||||||
autoDownloadPurge = true;
|
autoDownloadPurge = true;
|
||||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
|
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
|
||||||
|
|
||||||
final var kotlin = version(2, 0, 20);
|
final var kotlin = version(2, 1, 0);
|
||||||
scope(compile)
|
scope(compile)
|
||||||
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
|
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
|
||||||
.include(dependency("org.json", "json", "20240303"))
|
.include(dependency("org.json", "json", "20240303"))
|
||||||
.include(dependency("net.thauvin.erik.urlencoder", "urlencoder-lib-jvm", version(1, 5, 0)));
|
.include(dependency("net.thauvin.erik.urlencoder", "urlencoder-lib-jvm", version(1, 6, 0)));
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
|
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 4)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 4)))
|
||||||
.include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1)));
|
.include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1)));
|
||||||
|
|
||||||
publishOperation()
|
publishOperation()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* JokeApi.kt
|
* JokeApi.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* JokeConfig.kt
|
* JokeConfig.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* JokeUtil.kt
|
* JokeUtil.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -51,21 +51,25 @@ internal fun fetchUrl(url: String, auth: String = ""): String {
|
||||||
}
|
}
|
||||||
|
|
||||||
val connection = URL(url).openConnection() as HttpURLConnection
|
val connection = URL(url).openConnection() as HttpURLConnection
|
||||||
connection.setRequestProperty(
|
try {
|
||||||
"User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0"
|
connection.setRequestProperty(
|
||||||
)
|
"User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0"
|
||||||
if (auth.isNotEmpty()) {
|
)
|
||||||
connection.setRequestProperty("Authentication", auth)
|
if (auth.isNotEmpty()) {
|
||||||
}
|
connection.setRequestProperty("Authentication", auth)
|
||||||
|
|
||||||
if (connection.responseCode in 200..399) {
|
|
||||||
val body = connection.inputStream.bufferedReader().use { it.readText() }
|
|
||||||
if (JokeApi.logger.isLoggable(Level.FINE)) {
|
|
||||||
JokeApi.logger.fine(body)
|
|
||||||
}
|
}
|
||||||
return body
|
|
||||||
} else {
|
if (connection.responseCode in 200..399) {
|
||||||
throw httpError(connection.responseCode)
|
val body = connection.inputStream.bufferedReader().use { it.readText() }
|
||||||
|
if (JokeApi.logger.isLoggable(Level.FINE)) {
|
||||||
|
JokeApi.logger.fine(body)
|
||||||
|
}
|
||||||
|
return body
|
||||||
|
} else {
|
||||||
|
throw httpError(connection.responseCode)
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
connection.disconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* HttpErrorException.kt
|
* HttpErrorException.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* JokeException.kt
|
* JokeException.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Category.kt
|
* Category.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Flag.kt
|
* Flag.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Format.kt
|
* Format.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* IdRange.kt
|
* IdRange.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Joke.kt
|
* Joke.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Language.kt
|
* Language.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Parameter.kt
|
* Parameter.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Type.kt
|
* Type.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* ApiCallTest.kt
|
* ApiCallTest.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* BeforeAllTests.kt
|
* BeforeAllTests.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* ExceptionsTest.kt
|
* ExceptionsTest.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* GetJokeTest.kt
|
* GetJokeTest.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* GetJokesTest.kt
|
* GetJokesTest.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* GetRawJokesTest.kt
|
* GetRawJokesTest.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* JokeConfigTest.kt
|
* JokeConfigTest.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* JokeUtilTest.kt
|
* JokeUtilTest.kt
|
||||||
*
|
*
|
||||||
* Copyright 2022-2023 Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2022-2024 Erik C. Thauvin (erik@thauvin.net)
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue