Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: patch for version 100051 #271

Merged
merged 4 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'org.jetbrains.dokka' version '1.8.20'
id 'org.jetbrains.kotlin.jvm' version '1.9.10'
id 'org.jetbrains.dokka' version '1.9.0'
id 'maven-publish'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id 'signing'
id 'com.google.protobuf' version '0.9.3'
id 'com.google.protobuf' version '0.9.4'
}

boolean isDev = false
Expand Down Expand Up @@ -84,20 +84,20 @@ dependencies {
implementation group: 'com.vladsch.flexmark', name: 'flexmark-ext-gfm-tasklist', version: '0.62.2'

// Protobuf
implementation group: 'com.google.protobuf', name: 'protobuf-kotlin-lite', version: '3.23.3'
implementation group: 'com.google.protobuf', name: 'protobuf-kotlin-lite', version: '3.24.3'

// Use the Kotlin JDK standard library.
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.8.22'
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.9.10'
// Use the Kotlin coroutines library.
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.7.3'
// Use the Kotlin test library.
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: '1.8.22'
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: '1.9.10'
// Use the Kotlin JUnit integration.
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit5', version: '1.8.22'
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit5', version: '1.9.10'

implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '5.0.0-alpha.11'

testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.9.3'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.10.0'
}

tasks.test {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 6 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/be/zvz/kotlininside/security/Auth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class Auth {
HttpInterface.Option()
.addHeader("X-Android-Package", Const.Installations.X_ANDROID_PACKAGE)
.addHeader("X-Android-Cert", Const.Installations.X_ANDROID_CERT)
.addHeader("X-firebase-client", Const.Firebase.FIREBASE_CLIENT)
.addHeader("x-goog-api-key", Const.Installations.X_GOOG_API_KEY)
.setContentTypeAndBody(
"application/json",
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/be/zvz/kotlininside/value/ApiUrl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object ApiUrl {
object Auth {
const val LOGIN = AUTH_API + "api/login"
const val APP_ID = AUTH_API + "auth/mobile_app_verification"
const val APP_CHECK = MAIN_API + "json0/app_check_A_rina_one.php"
const val APP_CHECK = MAIN_API + "json0/app_check_A_rina_one_new.php"
}

object User {
Expand All @@ -89,6 +89,7 @@ object ApiUrl {
}

object MainInfo {
const val NOTICE = MAIN_API + "json3/app_dc_notice_one_new.php"
const val APP_MAIN = MAIN_API + "json3/main_content.php"
const val GALLERY_RANKING = MAIN_API + "json3/ranking_gallery.php"
const val MINOR_GALLERY_RANKING = MAIN_API + "json1/mgallmain/mgallery_ranking.php"
Expand Down
11 changes: 6 additions & 5 deletions src/main/kotlin/be/zvz/kotlininside/value/Const.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package be.zvz.kotlininside.value
object Const {
const val DC_APP_SIGNATURE = "ReOo4u96nnv8Njd7707KpYiIVYQ3FlcKHDJE046Pg6s="
const val DC_APP_PACKAGE = "com.dcinside.app.android"
const val DC_APP_VERSION_CODE = "100034"
const val DC_APP_VERSION_NAME = "4.7.8"
const val DC_APP_VERSION_CODE = "100051"
const val DC_APP_VERSION_NAME = "4.8.1"
const val USER_AGENT = "dcinside.app"

object Firebase {
const val APP_ID = "1:477369754343:android:1f4e2da7c458e2a7"
const val APP_ID = "1:477369754343:android:d2ffdd960120a207727842"
const val AUTH_VERSION = "FIS_v2"
const val SDK_VERSION = "a:16.3.5"
const val FIREBASE_CLIENT = "H4sIAAAAAAAAAKtWykhNLCpJSk0sKVayio7VUSpLLSrOzM9TslIyUqoFAFyivEQfAAAA"
const val SDK_VERSION = "a:17.1.0"
const val CERT = "E6DA04787492CDBD34C77F31B890A3FAA3682D44"
}

Expand All @@ -28,7 +29,7 @@ object Const {
const val X_FIREBASE_APP_NAME_HASH = "R1dAH9Ui7M-ynoznwBdw01tLxhI"
const val USER_AGENT = "Android-GCM/1.5"
const val APP = DC_APP_PACKAGE
const val GCM_VERSION = "221215022"
const val GCM_VERSION = "232512022"
const val CERT = Firebase.CERT
}
}
35 changes: 32 additions & 3 deletions src/test/kotlin/be/zvz/kotlininside/KotlinInsideTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
*/
package be.zvz.kotlininside

import be.zvz.kotlininside.api.article.*
import be.zvz.kotlininside.api.article.ArticleDelete
import be.zvz.kotlininside.api.article.ArticleList
import be.zvz.kotlininside.api.article.ArticleRead
import be.zvz.kotlininside.api.article.ArticleVote
import be.zvz.kotlininside.api.article.ArticleWrite
import be.zvz.kotlininside.api.generic.GalleryRanking
import be.zvz.kotlininside.api.generic.MiniGalleryRanking
import be.zvz.kotlininside.api.generic.MinorGalleryRanking
Expand All @@ -14,19 +18,44 @@
import be.zvz.kotlininside.api.type.content.StringContent
import be.zvz.kotlininside.http.DefaultHttpClient
import be.zvz.kotlininside.session.user.Anonymous
import okhttp3.OkHttpClient
import org.junit.jupiter.api.MethodOrderer
import org.junit.jupiter.api.Order
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.TestMethodOrder
import java.security.SecureRandom
import java.security.cert.X509Certificate
import java.time.ZoneId
import java.util.*
import java.util.Calendar
import java.util.Locale
import java.util.TimeZone
import java.util.logging.Logger
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import kotlin.test.Test
import kotlin.test.assertNotNull

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.OrderAnnotation::class)
class KotlinInsideTest {
private fun OkHttpClient.Builder.ignoreAllSSLErrors(): OkHttpClient.Builder {
val naiveTrustManager = object : X509TrustManager {
override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
override fun checkClientTrusted(certs: Array<X509Certificate>, authType: String) = Unit
override fun checkServerTrusted(certs: Array<X509Certificate>, authType: String) = Unit
}

val insecureSocketFactory = SSLContext.getInstance("TLSv1.2").apply {
val trustAllCerts = arrayOf<TrustManager>(naiveTrustManager)
init(null, trustAllCerts, SecureRandom())

Check failure

Code scanning / CodeQL

`TrustManager` that accepts all certificates High test

This uses
TrustManager
, which is defined in
KotlinInsideTest$
and trusts any certificate.
}.socketFactory

sslSocketFactory(insecureSocketFactory, naiveTrustManager)
hostnameVerifier { _, _ -> true }
return this
}

private var log = Logger.getLogger(KotlinInsideTest::class.java.name)
private var articleId = 0

Expand All @@ -35,7 +64,7 @@
fun initKotlinInside() {
KotlinInside.createInstance(
Anonymous("ㅇㅇ", "1234"),
DefaultHttpClient()
DefaultHttpClient(okHttpClient = OkHttpClient.Builder().ignoreAllSSLErrors().build())
)
}

Expand Down
Loading