From ac20426689cd50718aa35689ad78cc7a8c27ba8d Mon Sep 17 00:00:00 2001 From: Sadwhy <99601717+Sadwhy@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:02:53 +0600 Subject: [PATCH 001/254] Added proper padding to offline text/buttons --- .../main/res/layout/fragment_offline_page.xml | 66 ++++++++++--------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/app/src/main/res/layout/fragment_offline_page.xml b/app/src/main/res/layout/fragment_offline_page.xml index 92ae097e..e9f7e843 100644 --- a/app/src/main/res/layout/fragment_offline_page.xml +++ b/app/src/main/res/layout/fragment_offline_page.xml @@ -82,42 +82,46 @@ - + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingRight="32dp" + android:paddingLeft="32dp"> - + - + - + From e319aeb342ea1066b57c2a419683452c7db677d8 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Sat, 10 Feb 2024 23:08:13 +0530 Subject: [PATCH 002/254] feat: monet icon for alpha --- app/src/main/res/mipmap-anydpi-v26/ic_launcher_alpha_round.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_alpha_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_alpha_round.xml index c841f28b..2ef1656e 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_alpha_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_alpha_round.xml @@ -2,4 +2,5 @@ + \ No newline at end of file From 915c6c1dfe9c4067c7936f45d9afb49d043e7dea Mon Sep 17 00:00:00 2001 From: aayush262 Date: Sat, 10 Feb 2024 23:11:20 +0530 Subject: [PATCH 003/254] feat: better format for change logs --- .github/workflows/beta.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 21e1f14b..21287826 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -39,7 +39,7 @@ jobs: fi echo "Commits since $LAST_SHA:" # Accumulate commit logs in a shell variable - COMMIT_LOGS=$(git log $LAST_SHA..HEAD --pretty=format:"%h - %s") + COMMIT_LOGS=$(git log $LAST_SHA..HEAD --pretty=format:"· %s") # URL-encode the newline characters for GitHub Actions COMMIT_LOGS="${COMMIT_LOGS//'%'/'%25'}" COMMIT_LOGS="${COMMIT_LOGS//$'\n'/'%0A'}" @@ -104,7 +104,7 @@ jobs: #Telegram curl -F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID }}" \ -F "document=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \ - -F "caption=[Alpha-Build: ${VERSION}] Change logs :${commit_messages}" \ + -F "caption=Alpha-Build: **${VERSION}** Change logs :${commit_messages}" \ https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument env: From 0afad1d9ae5c20174ea0f1bb7c234746a72ce2b6 Mon Sep 17 00:00:00 2001 From: rebelonion <87634197+rebelonion@users.noreply.github.com> Date: Sun, 11 Feb 2024 04:16:22 -0600 Subject: [PATCH 004/254] feat: comment authorization --- .gitignore | 3 + app/build.gradle | 8 +- .../dantotsu/connections/comments/Comments.kt | 116 ++++++++++++++++++ 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/ani/dantotsu/connections/comments/Comments.kt diff --git a/.gitignore b/.gitignore index c81d22db..6cc9cdea 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ local.properties # Log/OS Files *.log +# Secrets +apikey.properties + # Android Studio generated files and folders captures/ .externalNativeBuild/ diff --git a/app/build.gradle b/app/build.gradle index 89eafa1b..39229933 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,6 +10,10 @@ def gitCommitHash = providers.exec { commandLine("git", "rev-parse", "--verify", "--short", "HEAD") }.standardOutput.asText.get().trim() +def apikeyPropertiesFile = rootProject.file("apikey.properties") +def apikeyProperties = new Properties() +apikeyProperties.load(new FileInputStream(apikeyPropertiesFile)) + android { compileSdk 34 @@ -21,6 +25,8 @@ android { versionName "2.2.0" versionCode 220000000 signingConfig signingConfigs.debug + buildConfigField("String", "APP_SECRET", apikeyProperties['APP_SECRET']) + buildConfigField("String", "USER_ID_ENCRYPT_KEY", apikeyProperties['USER_ID_ENCRYPT_KEY']) } flavorDimensions "store" @@ -49,7 +55,7 @@ android { } debug { applicationIdSuffix ".beta" - versionNameSuffix "-beta01" + versionNameSuffix "-beta02" manifestPlaceholders = [icon_placeholder: "@mipmap/ic_launcher_beta", icon_placeholder_round: "@mipmap/ic_launcher_beta_round"] debuggable false } diff --git a/app/src/main/java/ani/dantotsu/connections/comments/Comments.kt b/app/src/main/java/ani/dantotsu/connections/comments/Comments.kt new file mode 100644 index 00000000..86e8b9ad --- /dev/null +++ b/app/src/main/java/ani/dantotsu/connections/comments/Comments.kt @@ -0,0 +1,116 @@ +package ani.dantotsu.connections.comments + +import android.security.keystore.KeyProperties +import android.util.Base64 +import ani.dantotsu.BuildConfig +import ani.dantotsu.settings.saving.PrefManager +import ani.dantotsu.settings.saving.PrefName +import com.lagradost.nicehttp.Requests +import eu.kanade.tachiyomi.network.NetworkHelper +import kotlinx.coroutines.runBlocking +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.Json +import okhttp3.FormBody +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get +import java.security.MessageDigest +import javax.crypto.Cipher +import javax.crypto.spec.SecretKeySpec + +class Comments { + val address: String = "http://10.0.2.2:8081" + val appSecret = BuildConfig.APP_SECRET + val requestClient = Injekt.get().client + var authToken: String? = null + fun run() { + runBlocking { + val request = Requests( + requestClient, + headerBuilder() + ) + .get(address) + println("comments: $request") + } + } + + fun getCommentsForId(id: Int) { + val url = "$address/comments/$id" + runBlocking { + val request = Requests( + requestClient, + headerBuilder() + ) + .get(url) + println("comments: $request") + } + } + + fun fetchAuthToken() { + val url = "$address/authenticate" + //test user id = asdf + //test username = test + val user = User(generateUserId() ?: return, "rebel onion") + val body: FormBody = FormBody.Builder() + .add("user_id", user.id) + .add("username", user.username) + .build() + runBlocking { + val request = Requests( + requestClient, + headerBuilder() + ) + val json = request.post(url, requestBody = body) + if (!json.text.startsWith("{")) return@runBlocking + val parsed = try { + Json.decodeFromString(json.text) + } catch (e: Exception) { + return@runBlocking + } + authToken = parsed.authToken + + println("comments: $json") + println("comments: $authToken") + } + } + + private fun headerBuilder(): Map { + return if (authToken != null) { + mapOf( + "appauth" to appSecret, + "Authorization" to authToken!! + ) + } else { + mapOf( + "appauth" to appSecret, + ) + } + } + + private fun generateUserId(): String? { + val anilistId = PrefManager.getVal(PrefName.AnilistToken, null as String?) ?: return null + val userIdEncryptKey = BuildConfig.USER_ID_ENCRYPT_KEY + val keySpec = SecretKeySpec(userIdEncryptKey.toByteArray(), KeyProperties.KEY_ALGORITHM_AES) + val cipher = Cipher.getInstance("${KeyProperties.KEY_ALGORITHM_AES}/${KeyProperties.BLOCK_MODE_CBC}/${KeyProperties.ENCRYPTION_PADDING_PKCS7}") + cipher.init(Cipher.ENCRYPT_MODE, keySpec) + val encrypted = cipher.doFinal(anilistId.toByteArray()) + val base = Base64.encodeToString(encrypted, Base64.NO_WRAP) + val bytes = MessageDigest.getInstance("SHA-256").digest(base.toByteArray()) + return bytes.joinToString("") { "%02x".format(it) } + + } +} + +@Serializable +data class Auth( + @SerialName("authToken") + val authToken: String +) + +@Serializable +data class User( + @SerialName("user_id") + val id: String, + @SerialName("username") + val username: String +) \ No newline at end of file From 7af71ba217dfef1fbdd31d63100b0db210e3a380 Mon Sep 17 00:00:00 2001 From: Sadwhy Date: Sun, 11 Feb 2024 16:59:48 +0600 Subject: [PATCH 005/254] Faq Rewrite P.1 --- .../dantotsu/media/anime/AnimeWatchAdapter.kt | 16 ++++++++++-- .../dantotsu/media/manga/MangaReadAdapter.kt | 18 +++++++++++-- .../res/drawable/ic_round_help_outline.xml | 11 ++++++++ app/src/main/res/layout/item_anime_watch.xml | 26 +++++++++++++++++-- app/src/main/res/values/strings.xml | 25 +++++++++--------- 5 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 app/src/main/res/drawable/ic_round_help_outline.xml diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt index 1d7a8497..5c81a2c3 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt @@ -5,6 +5,8 @@ import android.content.Intent import android.net.Uri import android.view.LayoutInflater import android.view.View +import android.os.Bundle +import ani.dantotsu.settings.FAQActivity import android.view.ViewGroup import android.widget.ArrayAdapter import android.widget.ImageButton @@ -68,6 +70,12 @@ class AnimeWatchAdapter( } } + //Fuck u launch + binding.faqbutton.setOnClickListener { + val intent = Intent(fragment.requireContext(), FAQActivity::class.java) + startActivity(fragment.requireContext(), intent, null) + } + binding.animeSourceDubbed.isChecked = media.selected!!.preferDub binding.animeSourceDubbedText.text = if (media.selected!!.preferDub) currActivity()!!.getString(R.string.dubbed) else currActivity()!!.getString( @@ -421,13 +429,17 @@ class AnimeWatchAdapter( } binding.animeSourceProgressBar.visibility = View.GONE - if (media.anime.episodes!!.isNotEmpty()) + if (media.anime.episodes!!.isNotEmpty()) { binding.animeSourceNotFound.visibility = View.GONE - else + binding.faqbutton.visibility = View.GONE} + else { binding.animeSourceNotFound.visibility = View.VISIBLE + binding.faqbutton.visibility = View.VISIBLE + } } else { binding.animeSourceContinue.visibility = View.GONE binding.animeSourceNotFound.visibility = View.GONE + binding.faqbutton.visibility = View.GONE clearChips() binding.animeSourceProgressBar.visibility = View.VISIBLE } diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt index e990f94e..4cc73ea4 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt @@ -5,6 +5,9 @@ import android.app.AlertDialog import android.content.Intent import android.view.LayoutInflater import android.view.View +import android.os.Bundle +import ani.dantotsu.settings.FAQActivity +import androidx.core.content.ContextCompat.startActivity import android.view.ViewGroup import android.widget.ArrayAdapter import android.widget.CheckBox @@ -63,6 +66,12 @@ class MangaReadAdapter( _binding = binding binding.sourceTitle.setText(R.string.chaps) + //Fuck u launch + binding.faqbutton.setOnClickListener { + val intent = Intent(fragment.requireContext(), FAQActivity::class.java) + startActivity(fragment.requireContext(), intent, null) + } + //Wrong Title binding.animeSourceSearch.setOnClickListener { SourceSearchDialogFragment().show( @@ -435,13 +444,18 @@ class MangaReadAdapter( binding.animeSourceContinue.visibility = View.GONE } binding.animeSourceProgressBar.visibility = View.GONE - if (media.manga.chapters!!.isNotEmpty()) + if (media.manga.chapters!!.isNotEmpty()) { binding.animeSourceNotFound.visibility = View.GONE - else + binding.faqbutton.visibility = View.GONE + } + else { binding.animeSourceNotFound.visibility = View.VISIBLE + binding.faqbutton.visibility = View.VISIBLE + } } else { binding.animeSourceContinue.visibility = View.GONE binding.animeSourceNotFound.visibility = View.GONE + binding.faqbutton.visibility = View.GONE clearChips() binding.animeSourceProgressBar.visibility = View.VISIBLE } diff --git a/app/src/main/res/drawable/ic_round_help_outline.xml b/app/src/main/res/drawable/ic_round_help_outline.xml new file mode 100644 index 00000000..7f116ea4 --- /dev/null +++ b/app/src/main/res/drawable/ic_round_help_outline.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/layout/item_anime_watch.xml b/app/src/main/res/layout/item_anime_watch.xml index 14d42cfe..a401e363 100644 --- a/app/src/main/res/layout/item_anime_watch.xml +++ b/app/src/main/res/layout/item_anime_watch.xml @@ -338,7 +338,13 @@ android:layout_marginBottom="8dp" tools:visibility="gone" /> - + + + android:visibility="gone"/> + +