From 1cef5fa1e814b6c59eac129613aba5e5033c8942 Mon Sep 17 00:00:00 2001 From: Marek Lenczewski Date: Wed, 15 Apr 2026 21:53:37 +0200 Subject: [PATCH] update --- app/build.gradle.kts | 6 +- .../reports/problems/problems-report.html | 2 +- app/frontend/build.gradle.kts | 74 ++++++++++--------- app/frontend/proguard-rules.pro | 1 + app/frontend/src/main/AndroidManifest.xml | 1 + .../java/com/youtubeapp/data/ApiClient.kt | 17 ++++- .../main/java/com/youtubeapp/data/VideoApi.kt | 2 +- .../com/youtubeapp/data/VideoRepository.kt | 7 +- .../youtubeapp/ui/viewmodel/VideoViewModel.kt | 10 ++- .../main/res/xml/network_security_config.xml | 4 + app/gradle/libs.versions.toml | 34 +++++++++ backend/.gitignore | 1 + backend/api/video_controller.py | 8 +- backend/download/download_service.py | 11 ++- backend/stream/stream_service.py | 15 ++-- browser_extension/config/popup.js | 2 +- browser_extension/manifest.json | 2 +- systems.md | 28 +++++-- 18 files changed, 154 insertions(+), 71 deletions(-) create mode 100644 app/frontend/proguard-rules.pro create mode 100644 app/frontend/src/main/res/xml/network_security_config.xml create mode 100644 app/gradle/libs.versions.toml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index cfd711d..9deb573 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.android.application") version "8.7.3" apply false - id("org.jetbrains.kotlin.android") version "2.1.0" apply false - id("org.jetbrains.kotlin.plugin.compose") version "2.1.0" apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.compose) apply false } diff --git a/app/build/reports/problems/problems-report.html b/app/build/reports/problems/problems-report.html index c91dc01..fb849a6 100644 --- a/app/build/reports/problems/problems-report.html +++ b/app/build/reports/problems/problems-report.html @@ -650,7 +650,7 @@ code + .copy-button { diff --git a/app/frontend/build.gradle.kts b/app/frontend/build.gradle.kts index 1433da0..ac5f693 100644 --- a/app/frontend/build.gradle.kts +++ b/app/frontend/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") - id("org.jetbrains.kotlin.plugin.compose") + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.compose) } android { @@ -24,50 +24,54 @@ android { keyPassword = "youtubeapp" enableV1Signing = true enableV2Signing = true + enableV3Signing = true } } buildTypes { - getByName("release") { - signingConfig = signingConfigs.getByName("release") + debug { + buildConfigField("String", "BASE_URL", "\"http://192.168.178.34:8000/\"") + } + release { + signingConfig = signingConfigs.getByName("release") + buildConfigField("String", "BASE_URL", "\"https://youtube.marha.de/\"") + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) } - } - - buildFeatures { - compose = true - } - - kotlinOptions { - jvmTarget = "17" } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + compose = true + buildConfig = true + } } dependencies { - implementation(platform("androidx.compose:compose-bom:2024.12.01")) - implementation("androidx.compose.ui:ui") - implementation("androidx.compose.material3:material3") - implementation("androidx.compose.material:material-icons-extended") - implementation("androidx.activity:activity-compose:1.9.3") - implementation("androidx.navigation:navigation-compose:2.8.5") - - // Networking - implementation("com.squareup.retrofit2:retrofit:2.11.0") - implementation("com.squareup.retrofit2:converter-gson:2.11.0") - implementation("com.squareup.okhttp3:okhttp:4.12.0") - - // Image Loading - implementation("io.coil-kt:coil-compose:2.7.0") - - // Video Player - implementation("androidx.media3:media3-exoplayer:1.5.1") - implementation("androidx.media3:media3-ui:1.5.1") - - // ViewModel - implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7") - implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.7") + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.ui) + implementation(libs.androidx.material3) + implementation(libs.androidx.compose.material.icons.extended) + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.navigation.compose) + implementation(libs.androidx.lifecycle.viewmodel.compose) + implementation(libs.androidx.lifecycle.runtime.compose) + implementation(libs.retrofit) + implementation(libs.retrofit.converter.gson) + implementation(libs.okhttp) + implementation(libs.okhttp.logging.interceptor) + implementation(libs.coil.compose) + implementation(libs.media3.exoplayer) + implementation(libs.media3.ui) } diff --git a/app/frontend/proguard-rules.pro b/app/frontend/proguard-rules.pro new file mode 100644 index 0000000..e374e3e --- /dev/null +++ b/app/frontend/proguard-rules.pro @@ -0,0 +1 @@ +# Add project-specific ProGuard rules here. diff --git a/app/frontend/src/main/AndroidManifest.xml b/app/frontend/src/main/AndroidManifest.xml index c15933d..667c94c 100644 --- a/app/frontend/src/main/AndroidManifest.xml +++ b/app/frontend/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ android:banner="@drawable/tv_banner" android:allowBackup="true" android:label="YouTube App" + android:networkSecurityConfig="@xml/network_security_config" android:usesCleartextTraffic="true" android:theme="@android:style/Theme.Material.Light.NoActionBar"> diff --git a/app/frontend/src/main/java/com/youtubeapp/data/ApiClient.kt b/app/frontend/src/main/java/com/youtubeapp/data/ApiClient.kt index c51d4ec..98c7098 100644 --- a/app/frontend/src/main/java/com/youtubeapp/data/ApiClient.kt +++ b/app/frontend/src/main/java/com/youtubeapp/data/ApiClient.kt @@ -1,18 +1,27 @@ package com.youtubeapp.data import android.os.Build +import com.youtubeapp.BuildConfig +import okhttp3.OkHttpClient +import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory object ApiClient { - val BASE_URL: String = if (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("sdk")) - "http://10.0.2.2:8000/" - else - "http://192.168.178.34:8000/" + val BASE_URL: String = + if (BuildConfig.DEBUG && (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("sdk"))) + "http://10.0.2.2:8000/" + else + BuildConfig.BASE_URL + + private val okHttp: OkHttpClient = OkHttpClient.Builder() + .addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BASIC }) + .build() val api: VideoApi by lazy { Retrofit.Builder() .baseUrl(BASE_URL) + .client(okHttp) .addConverterFactory(GsonConverterFactory.create()) .build() .create(VideoApi::class.java) diff --git a/app/frontend/src/main/java/com/youtubeapp/data/VideoApi.kt b/app/frontend/src/main/java/com/youtubeapp/data/VideoApi.kt index 7811750..e885f6e 100644 --- a/app/frontend/src/main/java/com/youtubeapp/data/VideoApi.kt +++ b/app/frontend/src/main/java/com/youtubeapp/data/VideoApi.kt @@ -9,7 +9,7 @@ interface VideoApi { suspend fun getAllVideos(@Path("profileId") profileId: Int): List