diff --git a/.github/workflows/build-kotlin.yml b/.github/workflows/build-kotlin.yml index 02fe0e8..9181d4c 100644 --- a/.github/workflows/build-kotlin.yml +++ b/.github/workflows/build-kotlin.yml @@ -32,8 +32,8 @@ jobs: with: version: "${{ env.PROTOC_VERSION }}" - - name: Rust setup (1.70.0) - uses: dtolnay/rust-toolchain@1.70.0 + - name: Rust setup (1.71.1) + uses: dtolnay/rust-toolchain@1.71.1 with: components: rustfmt, clippy @@ -48,3 +48,6 @@ jobs: - name: Lint code run: cargo clippy --all -- -D warnings + + - name: Test code + run: cargo test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f5802d2..5babd87 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,8 +33,8 @@ jobs: run: yes | sdkmanager "ndk;${{ env.NDK_VERSION }}" >/dev/null # use MSRV - - name: Set Rust version to MSRV 1.70 - uses: dtolnay/rust-toolchain@1.70 + - name: Set Rust version to MSRV 1.71.1 + uses: dtolnay/rust-toolchain@1.71.1 with: # Add armv7, aarch64, i686, x86_64 targets targets: armv7-linux-androideabi, aarch64-linux-android, i686-linux-android, x86_64-linux-android diff --git a/Cargo.lock b/Cargo.lock index 005e82f..272c87c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1235,15 +1235,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -1343,32 +1334,33 @@ dependencies = [ [[package]] name = "logos" -version = "0.13.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" +checksum = "1c6b6e02facda28ca5fb8dbe4b152496ba3b1bd5a4b40bb2b1b2d8ad74e0f39b" dependencies = [ "logos-derive", ] [[package]] name = "logos-codegen" -version = "0.13.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" +checksum = "b32eb6b5f26efacd015b000bfc562186472cd9b34bdba3f6b264e2a052676d10" dependencies = [ "beef", "fnv", + "lazy_static", "proc-macro2", "quote", - "regex-syntax 0.6.29", + "regex-syntax", "syn 2.0.85", ] [[package]] name = "logos-derive" -version = "0.13.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" +checksum = "3e5d0c5463c911ef55624739fc353238b4e310f0144be1f875dc42fec6bfd5ec" dependencies = [ "logos-codegen", ] @@ -1418,12 +1410,12 @@ dependencies = [ [[package]] name = "miette" -version = "5.10.0" +version = "7.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" +checksum = "317f146e2eb7021892722af37cf1b971f0a70c8406f487e24952667616192c64" dependencies = [ - "miette-derive 5.10.0", - "once_cell", + "cfg-if 1.0.0", + "miette-derive 7.4.0", "thiserror", "unicode-width", ] @@ -1441,9 +1433,9 @@ dependencies = [ [[package]] name = "miette-derive" -version = "5.10.0" +version = "7.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" +checksum = "23c9b935fbe1d6cbd1dac857b54a688145e2d93f48db36010514d0f612d0ad67" dependencies = [ "proc-macro2", "quote", @@ -1802,9 +1794,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.6" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" dependencies = [ "bytes", "prost-derive", @@ -1812,13 +1804,13 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.6" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.12.1", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -1826,6 +1818,8 @@ dependencies = [ "prettyplease", "prost", "prost-types", + "pulldown-cmark", + "pulldown-cmark-to-cmark", "regex", "syn 2.0.85", "tempfile", @@ -1833,12 +1827,12 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.6" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.85", @@ -1846,12 +1840,12 @@ dependencies = [ [[package]] name = "prost-reflect" -version = "0.12.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057237efdb71cf4b3f9396302a3d6599a92fa94063ba537b66130980ea9909f3" +checksum = "20ae544fca2892fd4b7e9ff26cba1090cedf1d4d95c2aded1af15d2f93f270b8" dependencies = [ "logos", - "miette 5.10.0", + "miette 7.4.0", "once_cell", "prost", "prost-types", @@ -1859,21 +1853,21 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" dependencies = [ "prost", ] [[package]] name = "protox" -version = "0.5.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00bb76c5f6221de491fe2c8f39b106330bbd9762c6511119c07940e10eb9ff11" +checksum = "873f359bdecdfe6e353752f97cb9ee69368df55b16363ed2216da85e03232a58" dependencies = [ "bytes", - "miette 5.10.0", + "miette 7.4.0", "prost", "prost-reflect", "prost-types", @@ -1883,16 +1877,36 @@ dependencies = [ [[package]] name = "protox-parse" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4581f441c58863525a3e6bec7b8de98188cf75239a56c725a3e7288450a33f" +checksum = "a3a462d115462c080ae000c29a47f0b3985737e5d3a995fcdbcaa5c782068dde" dependencies = [ "logos", - "miette 5.10.0", + "miette 7.4.0", "prost-types", "thiserror", ] +[[package]] +name = "pulldown-cmark" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" +dependencies = [ + "bitflags 2.6.0", + "memchr", + "unicase", +] + +[[package]] +name = "pulldown-cmark-to-cmark" +version = "17.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b27c0d365d60ff3e085007911d73419e5664de48155d558ebfa84d117a5109" +dependencies = [ + "pulldown-cmark", +] + [[package]] name = "quote" version = "1.0.37" @@ -1911,7 +1925,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.5", + "regex-syntax", ] [[package]] @@ -1922,15 +1936,9 @@ checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -2396,7 +2404,7 @@ dependencies = [ [[package]] name = "stremio-core" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#37cedbc6febb103d881038f28c98891f4635fe27" +source = "git+https://github.com/Stremio/stremio-core?branch=development#196b655fca466352e8e1fae2aa190d316207dd76" dependencies = [ "anyhow", "base64 0.21.7", @@ -2488,6 +2496,9 @@ dependencies = [ "glob", "hex 0.4.3", "itertools 0.13.0", + "logos", + "logos-codegen", + "logos-derive", "prost", "prost-build", "prost-types", @@ -2500,7 +2511,7 @@ dependencies = [ [[package]] name = "stremio-derive" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#37cedbc6febb103d881038f28c98891f4635fe27" +source = "git+https://github.com/Stremio/stremio-core?branch=development#196b655fca466352e8e1fae2aa190d316207dd76" dependencies = [ "case", "proc-macro-crate", @@ -2534,7 +2545,7 @@ dependencies = [ [[package]] name = "stremio-watched-bitfield" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#37cedbc6febb103d881038f28c98891f4635fe27" +source = "git+https://github.com/Stremio/stremio-core?branch=development#196b655fca466352e8e1fae2aa190d316207dd76" dependencies = [ "base64 0.13.1", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 4a1bd47..90c4944 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,13 @@ stremio-core-web = { version = "0.47", git = "https://github.com/Stremio/stremio stremio-core-protobuf = { version = "0.1", path = "stremio-core-protobuf", default-features = false } # Protobuf -prost = "0.12" -prost-types = "0.12" +prost = "0.13" +prost-types = "0.13" # Protobuf for codegen, e.g. build.rs -prost-build = "0.12" -protox = "0.5" +# Enable the `cleanup-markdown` feature to clean any non-rust markdown examples +prost-build = { version = "0.13", features = ["cleanup-markdown"] } +protox = "0.7" glob = "0.3.0" # Http Request handling diff --git a/stremio-core-kotlin/Cargo.toml b/stremio-core-kotlin/Cargo.toml index 1c766bb..795e63b 100644 --- a/stremio-core-kotlin/Cargo.toml +++ b/stremio-core-kotlin/Cargo.toml @@ -4,7 +4,7 @@ version = "1.4.2" authors = ["Smart Code OOD"] edition = "2021" -rust-version = "1.70.0" +rust-version = "1.71.1" [features] default = ["kotlin"] diff --git a/stremio-core-kotlin/src/commonMain/rust/model/model.rs b/stremio-core-kotlin/src/commonMain/rust/model/model.rs index 855a49e..88163f3 100644 --- a/stremio-core-kotlin/src/commonMain/rust/model/model.rs +++ b/stremio-core-kotlin/src/commonMain/rust/model/model.rs @@ -20,7 +20,7 @@ use stremio_core::{ types::{ api::LinkAuthKey, events::DismissedEventsBucket, library::LibraryBucket, notifications::NotificationsBucket, profile::Profile, resource::MetaItemPreview, - search_history::SearchHistoryBucket, streams::StreamsBucket, + search_history::SearchHistoryBucket, server_urls::ServerUrlsBucket, streams::StreamsBucket, }, Model, }; @@ -56,6 +56,7 @@ impl AndroidModel { profile: Profile, library: LibraryBucket, streams: StreamsBucket, + server_urls: ServerUrlsBucket, notifications: NotificationsBucket, search_history: SearchHistoryBucket, dismissed_events: DismissedEventsBucket, @@ -79,6 +80,7 @@ impl AndroidModel { profile, library, streams, + server_urls, notifications, search_history, dismissed_events, diff --git a/stremio-core-kotlin/src/commonMain/rust/stremio_core_kotlin.rs b/stremio-core-kotlin/src/commonMain/rust/stremio_core_kotlin.rs index 9c48764..bc74bfa 100644 --- a/stremio-core-kotlin/src/commonMain/rust/stremio_core_kotlin.rs +++ b/stremio-core-kotlin/src/commonMain/rust/stremio_core_kotlin.rs @@ -20,14 +20,14 @@ use stremio_core::{ constants::{ DISMISSED_EVENTS_STORAGE_KEY, LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, NOTIFICATIONS_STORAGE_KEY, PROFILE_STORAGE_KEY, SEARCH_HISTORY_STORAGE_KEY, - STREAMS_STORAGE_KEY, + STREAMING_SERVER_URLS_STORAGE_KEY, STREAMS_STORAGE_KEY, }, models::common::Loadable, runtime::{Env, EnvError, Runtime, RuntimeEvent}, types::{ events::DismissedEventsBucket, library::LibraryBucket, notifications::NotificationsBucket, profile::Profile, resource::Stream, search_history::SearchHistoryBucket, - streams::StreamsBucket, + server_urls::ServerUrlsBucket, streams::StreamsBucket, }, }; use stremio_core_protobuf::{FromProtobuf, ToProtobuf}; @@ -67,20 +67,22 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_initializeNative( let init_result = AndroidEnv::exec_sync(AndroidEnv::init(&env, storage)); match init_result { Ok(_) => { - let storage_result = AndroidEnv::exec_sync(future::try_join3( + let storage_result = AndroidEnv::exec_sync(future::try_join4( future::try_join5( AndroidEnv::get_storage::(PROFILE_STORAGE_KEY), AndroidEnv::get_storage::(LIBRARY_RECENT_STORAGE_KEY), AndroidEnv::get_storage::(LIBRARY_STORAGE_KEY), AndroidEnv::get_storage::(STREAMS_STORAGE_KEY), - AndroidEnv::get_storage::(NOTIFICATIONS_STORAGE_KEY), + AndroidEnv::get_storage::(STREAMING_SERVER_URLS_STORAGE_KEY), ), + AndroidEnv::get_storage::(NOTIFICATIONS_STORAGE_KEY), AndroidEnv::get_storage::(SEARCH_HISTORY_STORAGE_KEY), AndroidEnv::get_storage::(DISMISSED_EVENTS_STORAGE_KEY), )); match storage_result { Ok(( - (profile, recent_bucket, other_bucket, streams, notifications), + (profile, recent_bucket, other_bucket, streams, server_urls_bucket), + notifications, search_history, dismissed_events, )) => { @@ -93,6 +95,9 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_initializeNative( library.merge_bucket(other_bucket); }; let streams = streams.unwrap_or(StreamsBucket::new(profile.uid())); + let server_urls_bucket = + server_urls_bucket + .unwrap_or(ServerUrlsBucket::new::(profile.uid())); let notifications = notifications.unwrap_or(NotificationsBucket::new::< AndroidEnv, >( @@ -106,6 +111,7 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_initializeNative( profile, library, streams, + server_urls_bucket, notifications, search_history, dismissed_events, diff --git a/stremio-core-protobuf/Cargo.toml b/stremio-core-protobuf/Cargo.toml index 6a9de84..51135fd 100644 --- a/stremio-core-protobuf/Cargo.toml +++ b/stremio-core-protobuf/Cargo.toml @@ -31,4 +31,9 @@ url = { version = "2.4", features = ["serde"] } [build-dependencies] prost-build.workspace = true protox.workspace = true -glob.workspace = true \ No newline at end of file +glob.workspace = true + +# 0.14.3 bumped MSRV to 1.75 and it's used in protox-parse +logos = "=0.14.2" +logos-codegen = "=0.14.2" +logos-derive = "=0.14.2" \ No newline at end of file diff --git a/stremio-core-protobuf/proto/stremio/core/runtime/action_player.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_player.proto index 4525ee2..057c2d2 100644 --- a/stremio-core-protobuf/proto/stremio/core/runtime/action_player.proto +++ b/stremio-core-protobuf/proto/stremio/core/runtime/action_player.proto @@ -11,10 +11,11 @@ message ActionPlayer { oneof args { stremio.core.models.Player.VideoParams video_params_changed = 1; stremio.core.models.Player.StreamState stream_state_changed = 2; - PlayerItemState time_changed = 3; - bool paused_changed = 4; - google.protobuf.Empty next_video = 5; - google.protobuf.Empty ended = 6; + PlayerItemState seek_action = 3; + PlayerItemState time_changed = 4; + bool paused_changed = 5; + google.protobuf.Empty next_video = 6; + google.protobuf.Empty ended = 7; } message PlayerItemState { diff --git a/stremio-core-protobuf/proto/stremio/core/runtime/event.proto b/stremio-core-protobuf/proto/stremio/core/runtime/event.proto index 06053c2..0349d51 100644 --- a/stremio-core-protobuf/proto/stremio/core/runtime/event.proto +++ b/stremio-core-protobuf/proto/stremio/core/runtime/event.proto @@ -48,6 +48,8 @@ message Event { MagnetParsed magnet_parsed = 37; TorrentParsed torrent_parsed = 38; PlayingOnDevice playing_on_device = 39; + StreamingServerUrlsBucketChanged streaming_server_urls_bucket_changed = 40; + StreamingServerUrlsPushedToStorage streaming_server_urls_pushed_to_storage = 41; Error error = 100; } @@ -173,6 +175,12 @@ message Event { message PlayingOnDevice { required string device = 1; } + message StreamingServerUrlsBucketChanged { + optional string uid = 1; + } + message StreamingServerUrlsPushedToStorage { + optional string uid = 1; + } message Error { required string error = 1; required Event source = 2; diff --git a/stremio-core-protobuf/proto/stremio/core/types/profile.proto b/stremio-core-protobuf/proto/stremio/core/types/profile.proto index 35dd8bb..58e8ce8 100644 --- a/stremio-core-protobuf/proto/stremio/core/types/profile.proto +++ b/stremio-core-protobuf/proto/stremio/core/types/profile.proto @@ -38,6 +38,8 @@ message Profile { required FrameRateMatchingStrategy frame_rate_matching_strategy = 26; required int64 next_video_notification_duration = 27; required bool surround_sound = 28; + required bool send_crash_reports = 29; + required bool server_in_foreground = 30; } enum FrameRateMatchingStrategy { diff --git a/stremio-core-protobuf/proto/stremio/core/types/subtitle.proto b/stremio-core-protobuf/proto/stremio/core/types/subtitle.proto index 594684c..ecc25b2 100644 --- a/stremio-core-protobuf/proto/stremio/core/types/subtitle.proto +++ b/stremio-core-protobuf/proto/stremio/core/types/subtitle.proto @@ -5,7 +5,8 @@ package stremio.core.types; option java_package = "com.stremio.core.types.subtitle"; message Subtitle { - required string lang = 1; - required string url = 2; - optional string name = 3; + required string id = 1; + required string lang = 2; + required string url = 3; + optional string name = 4; } diff --git a/stremio-core-protobuf/src/bridge/action.rs b/stremio-core-protobuf/src/bridge/action.rs index ba154f5..9971264 100644 --- a/stremio-core-protobuf/src/bridge/action.rs +++ b/stremio-core-protobuf/src/bridge/action.rs @@ -198,6 +198,13 @@ impl FromProtobuf for runtime::Action { state: stream_state.from_protobuf(), }) } + Some(action_player::Args::SeekAction(seek_state)) => { + Action::Player(ActionPlayer::Seek { + time: seek_state.time, + duration: seek_state.duration, + device: seek_state.device.to_owned(), + }) + } Some(action_player::Args::TimeChanged(item_state)) => { Action::Player(ActionPlayer::TimeChanged { time: item_state.time, diff --git a/stremio-core-protobuf/src/bridge/event.rs b/stremio-core-protobuf/src/bridge/event.rs index 6f55c87..48f8480 100644 --- a/stremio-core-protobuf/src/bridge/event.rs +++ b/stremio-core-protobuf/src/bridge/event.rs @@ -197,6 +197,20 @@ impl ToProtobuf for Event { device: device.to_owned(), }) } + Event::StreamingServerUrlsBucketChanged { uid } => { + runtime::event::Type::StreamingServerUrlsBucketChanged( + runtime::event::StreamingServerUrlsBucketChanged { + uid: uid.to_owned(), + }, + ) + } + Event::StreamingServerUrlsPushedToStorage { uid } => { + runtime::event::Type::StreamingServerUrlsPushedToStorage( + runtime::event::StreamingServerUrlsPushedToStorage { + uid: uid.to_owned(), + }, + ) + } Event::Error { error, source } => { let error = match error { CtxError::API(error) => error.message.to_owned(), diff --git a/stremio-core-protobuf/src/bridge/profile.rs b/stremio-core-protobuf/src/bridge/profile.rs index 8b015f6..2fd7bfe 100644 --- a/stremio-core-protobuf/src/bridge/profile.rs +++ b/stremio-core-protobuf/src/bridge/profile.rs @@ -96,6 +96,8 @@ impl FromProtobuf for types::profile::Settings { pause_on_minimize: self.pause_on_minimize, surround_sound: self.surround_sound, streaming_server_warning_dismissed: None, + server_in_foreground: self.server_in_foreground, + send_crash_reports: self.send_crash_reports, } } } @@ -206,6 +208,8 @@ impl ToProtobuf for Settings { as i32, next_video_notification_duration: self.next_video_notification_duration as i64, surround_sound: self.surround_sound, + server_in_foreground: self.server_in_foreground, + send_crash_reports: self.send_crash_reports, } } } diff --git a/stremio-core-protobuf/src/bridge/subtitle.rs b/stremio-core-protobuf/src/bridge/subtitle.rs index f422621..c641e58 100644 --- a/stremio-core-protobuf/src/bridge/subtitle.rs +++ b/stremio-core-protobuf/src/bridge/subtitle.rs @@ -6,6 +6,7 @@ use crate::protobuf::stremio::core::types; impl FromProtobuf for types::Subtitle { fn from_protobuf(&self) -> Subtitles { Subtitles { + id: self.id.clone(), lang: self.lang.to_string(), url: self.url.from_protobuf(), } @@ -18,6 +19,7 @@ impl ToProtobuf> for Subtitles { addon_name: &Option<&String>, ) -> types::Subtitle { types::Subtitle { + id: self.id.clone(), lang: self.lang.to_string(), url: self.url.to_string(), name: addon_name.cloned(),