Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay

This commit is contained in:
Koen J 2025-05-01 09:56:25 +02:00
commit cf11c4283e
29 changed files with 61 additions and 33 deletions

View file

@ -14,7 +14,6 @@ import java.text.DecimalFormat
import java.time.OffsetDateTime
import java.time.temporal.ChronoUnit
import kotlin.math.abs
import kotlin.math.roundToInt
import kotlin.math.roundToLong
@ -376,14 +375,19 @@ private val slds = hashSetOf(".com.ac", ".net.ac", ".gov.ac", ".org.ac", ".mil.a
fun String.matchesDomain(queryDomain: String): Boolean {
if(queryDomain.startsWith(".")) {
val parts = queryDomain.lowercase().split(".");
if(parts.size < 3)
val parts = this.lowercase().split(".");
val queryParts = queryDomain.lowercase().trimStart("."[0]).split(".");
if(queryParts.size < 2)
throw IllegalStateException("Illegal use of wildcards on First-Level-Domain (" + queryDomain + ")");
if(parts.size >= 3){
val isSLD = slds.contains("." + parts[parts.size - 2] + "." + parts[parts.size - 1]);
if(isSLD && parts.size <= 3)
else {
val possibleDomain = "." + queryParts.joinToString(".");
if(slds.contains(possibleDomain))
throw IllegalStateException("Illegal use of wildcards on Second-Level-Domain (" + queryDomain + ")");
/*
val isSLD = slds.contains("." + queryParts[queryParts.size - 2] + "." + queryParts[queryParts.size - 1]);
if(isSLD && queryParts.size <= 3)
throw IllegalStateException("Illegal use of wildcards on Second-Level-Domain (" + queryDomain + ")");
*/
}
//TODO: Should be safe, but double verify if can't be exploited

View file

@ -684,6 +684,10 @@ class UISlideOverlays {
}
}
}
if(!Settings.instance.downloads.shouldDownload()) {
UIDialogs.appToast("Download will start when you're back on wifi.\n" +
"(You can change this in settings)", true);
}
}
};
return menu.apply { show() };

View file

@ -14,10 +14,14 @@ import androidx.core.widget.addTextChangedListener
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.RecyclerView
import com.futo.platformplayer.R
import com.futo.platformplayer.Settings
import com.futo.platformplayer.UIDialogs
import com.futo.platformplayer.downloads.VideoDownload
import com.futo.platformplayer.downloads.VideoLocal
import com.futo.platformplayer.logging.Logger
import com.futo.platformplayer.models.Playlist
import com.futo.platformplayer.services.DownloadService
import com.futo.platformplayer.states.StateApp
import com.futo.platformplayer.states.StateDownloads
import com.futo.platformplayer.states.StatePlayer
import com.futo.platformplayer.states.StatePlaylists
@ -54,6 +58,15 @@ class DownloadsFragment : MainFragment() {
super.onResume()
_view?.reloadUI();
if(StateDownloads.instance.getDownloading().any { it.state == VideoDownload.State.QUEUED } &&
!StateDownloads.instance.getDownloading().any { it.state == VideoDownload.State.DOWNLOADING } &&
Settings.instance.downloads.shouldDownload()) {
Logger.w(TAG, "Detected queued download, while not downloading, attempt recreating service");
StateApp.withContext {
DownloadService.getOrCreateService(it);
}
}
StateDownloads.instance.onDownloadsChanged.subscribe(this) {
lifecycleScope.launch(Dispatchers.Main) {
try {

View file

@ -194,7 +194,10 @@ class StateSync {
addOrUpdate(service.serviceName, if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
service.hostAddresses.toTypedArray()
} else {
arrayOf(service.host)
if(service.host != null)
arrayOf(service.host);
else
arrayOf();
}, service.port, service.attributes)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {

View file

@ -5,7 +5,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_1d">
android:background="#101010">
<LinearLayout
android:layout_width="match_parent"

View file

@ -339,7 +339,7 @@
<string name="configure_if_background_download_should_be_used">Configure if background download should be used</string>
<string name="configure_the_auto_updater">Configure the auto updater</string>
<string name="configure_when_updates_should_be_downloaded">Configure when updates should be downloaded</string>
<string name="configure_when_videos_should_be_downloaded">Configure when videos should be downloaded</string>
<string name="configure_when_videos_should_be_downloaded">Configure when videos should be downloaded, if they should only be downloaded on unmetered networks (wifi/ethernet)</string>
<string name="creates_a_zip_file_with_your_data_which_can_be_imported_by_opening_it_with_grayjay">Creates a zip file with your data which can be imported by opening it with Grayjay</string>
<string name="default_audio_quality">Default Audio Quality</string>
<string name="default_playback_speed">Default Playback Speed</string>

@ -1 +1 @@
Subproject commit 07e39f9df71b1937adf5bfb718a115fc232aa6f8
Subproject commit 9aa31c5e87c7957a6e7ef07b6a8f38b775c88d9a

@ -1 +1 @@
Subproject commit ce0571bdeaed4e341351ef477ef4b6599aa4d0fb
Subproject commit 0830668d3bdac18fafae6bb49aa1ff97b717f3b5

@ -1 +1 @@
Subproject commit 3fbd872ad8bd7df62c5fbec7437e1200d82b74e1
Subproject commit b31ced36b9faaa535fb13a5873cdeb1c89d55859

@ -1 +1 @@
Subproject commit b34134ca2dbb1662b060b4a67f14e7c5d077889d
Subproject commit ffd40f2006b9048690944e55688951a849f5a13a

@ -1 +1 @@
Subproject commit 3a0efd1fc4db63c15334a190ab69a8fb4498ae23
Subproject commit edb526a9a0543517cd9e5e1fe0fe99673e173db2

@ -1 +1 @@
Subproject commit f30a3bfc0f6a894d816ab7fa732b8f63eb54b84e
Subproject commit 97a5ad5a37c40ed68cccbab05ba16926a0aaee41

@ -1 +1 @@
Subproject commit 2bcab14d01a564aa8ab9218de54042fc68b9ee76
Subproject commit 6e7f943b0ba56181ee503e1f2cb8349db1351553

@ -1 +1 @@
Subproject commit a32dbb626aacfc6264e505cd5c7f34dd8a60edfc
Subproject commit 932fdf78dec23a132bedc8838185af9911452af5

@ -1 +1 @@
Subproject commit b61095ec200284a686edb8f3b2a595599ad8b5ed
Subproject commit 47e76a96e5edcb265b99e2e30f178ba6234a6d2f

@ -1 +1 @@
Subproject commit a75e846045a7882002dd7a6bfa83550f52d9dbab
Subproject commit 08346f917753694e14bc1caa784aa87066a2ab84

@ -1 +1 @@
Subproject commit 6f1266a038d11998fef429ae0eac0798b3280d75
Subproject commit a297a0a7884ea2cf1aa4c9798d72ee11d0038dce

View file

@ -1,5 +1,6 @@
package com.futo.platformplayer
/*
import com.futo.platformplayer.mdns.DnsOpcode
import com.futo.platformplayer.mdns.DnsPacket
import com.futo.platformplayer.mdns.DnsPacketHeader
@ -12,6 +13,7 @@ import com.futo.platformplayer.mdns.QuestionClass
import com.futo.platformplayer.mdns.QuestionType
import com.futo.platformplayer.mdns.ResourceRecordClass
import com.futo.platformplayer.mdns.ResourceRecordType
*/
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertTrue
import java.io.ByteArrayOutputStream
@ -20,8 +22,9 @@ import kotlin.test.Test
import kotlin.test.assertContentEquals
//TODO: Update tests.
class MdnsTests {
/*
@Test
fun `BasicOperation`() {
val expectedData = byteArrayOf(
@ -391,4 +394,5 @@ class MdnsTests {
assertContentEquals(data, writer.toByteArray())
}
*/
}

@ -1 +1 @@
Subproject commit 07e39f9df71b1937adf5bfb718a115fc232aa6f8
Subproject commit 9aa31c5e87c7957a6e7ef07b6a8f38b775c88d9a

@ -1 +1 @@
Subproject commit ce0571bdeaed4e341351ef477ef4b6599aa4d0fb
Subproject commit 0830668d3bdac18fafae6bb49aa1ff97b717f3b5

@ -1 +1 @@
Subproject commit 3fbd872ad8bd7df62c5fbec7437e1200d82b74e1
Subproject commit b31ced36b9faaa535fb13a5873cdeb1c89d55859

@ -1 +1 @@
Subproject commit b34134ca2dbb1662b060b4a67f14e7c5d077889d
Subproject commit ffd40f2006b9048690944e55688951a849f5a13a

@ -1 +1 @@
Subproject commit 3a0efd1fc4db63c15334a190ab69a8fb4498ae23
Subproject commit edb526a9a0543517cd9e5e1fe0fe99673e173db2

@ -1 +1 @@
Subproject commit f30a3bfc0f6a894d816ab7fa732b8f63eb54b84e
Subproject commit 97a5ad5a37c40ed68cccbab05ba16926a0aaee41

@ -1 +1 @@
Subproject commit 2bcab14d01a564aa8ab9218de54042fc68b9ee76
Subproject commit 6e7f943b0ba56181ee503e1f2cb8349db1351553

@ -1 +1 @@
Subproject commit a32dbb626aacfc6264e505cd5c7f34dd8a60edfc
Subproject commit 932fdf78dec23a132bedc8838185af9911452af5

@ -1 +1 @@
Subproject commit b61095ec200284a686edb8f3b2a595599ad8b5ed
Subproject commit 47e76a96e5edcb265b99e2e30f178ba6234a6d2f

@ -1 +1 @@
Subproject commit a75e846045a7882002dd7a6bfa83550f52d9dbab
Subproject commit 08346f917753694e14bc1caa784aa87066a2ab84

@ -1 +1 @@
Subproject commit 6f1266a038d11998fef429ae0eac0798b3280d75
Subproject commit a297a0a7884ea2cf1aa4c9798d72ee11d0038dce