Skip to content

Commit

Permalink
Merge pull request #72 from Stremio/feat/ctx-delete-account-action
Browse files Browse the repository at this point in the history
feat: delete user account
  • Loading branch information
tymmesyde authored Jan 3, 2025
2 parents 2332e59 + 298af3b commit 136d75d
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 48 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 21 additions & 20 deletions stremio-core-protobuf/proto/stremio/core/runtime/action_ctx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ message ActionCtx {
oneof args {
stremio.core.types.AuthRequest authenticate = 1;
google.protobuf.Empty logout = 2;
stremio.core.types.AddonDescriptor install_addon = 3;
google.protobuf.Empty install_trakt_addon = 4;
google.protobuf.Empty logout_trakt = 5;
stremio.core.types.AddonDescriptor upgrade_addon = 6;
stremio.core.types.AddonDescriptor uninstall_addon = 7;
stremio.core.types.Profile.Settings update_settings = 8;
stremio.core.types.MetaItemPreview add_to_library = 9;
string remove_from_library = 10;
string rewind_library_item = 11;
LibraryItemMarkAsWatched library_item_mark_as_watched = 12;
LibraryItemToggle toggle_library_item_notifications = 13;
string dismiss_notification_item = 14;
google.protobuf.Empty push_user_to_api = 15;
google.protobuf.Empty pull_user_from_api = 16;
google.protobuf.Empty push_addons_to_api = 17;
google.protobuf.Empty pull_addons_from_api = 18;
google.protobuf.Empty sync_library_with_api = 19;
google.protobuf.Empty pull_notifications = 20;
google.protobuf.Empty get_events = 21;
string dismiss_event = 22;
string delete_account = 3;
stremio.core.types.AddonDescriptor install_addon = 4;
google.protobuf.Empty install_trakt_addon = 5;
google.protobuf.Empty logout_trakt = 6;
stremio.core.types.AddonDescriptor upgrade_addon = 7;
stremio.core.types.AddonDescriptor uninstall_addon = 8;
stremio.core.types.Profile.Settings update_settings = 9;
stremio.core.types.MetaItemPreview add_to_library = 10;
string remove_from_library = 11;
string rewind_library_item = 12;
LibraryItemMarkAsWatched library_item_mark_as_watched = 13;
LibraryItemToggle toggle_library_item_notifications = 14;
string dismiss_notification_item = 15;
google.protobuf.Empty push_user_to_api = 16;
google.protobuf.Empty pull_user_from_api = 17;
google.protobuf.Empty push_addons_to_api = 18;
google.protobuf.Empty pull_addons_from_api = 19;
google.protobuf.Empty sync_library_with_api = 20;
google.protobuf.Empty pull_notifications = 21;
google.protobuf.Empty get_events = 22;
string dismiss_event = 23;
}

message LibraryItemToggle {
Expand Down
52 changes: 28 additions & 24 deletions stremio-core-protobuf/proto/stremio/core/runtime/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,31 @@ message Event {
UserAddonsLocked user_addons_locked = 15;
UserLibraryMissing user_library_missing = 16;
UserLoggedOut user_logged_out = 17;
SessionDeleted session_deleted = 18;
TraktAddonFetched trakt_addon_fetched = 19;
TraktLoggedOut trakt_logged_out = 20;
AddonInstalled addon_installed = 21;
AddonUpgraded addon_upgraded = 22;
AddonUninstalled addon_uninstalled = 23;
SettingsUpdated settings_updated = 24;
LibraryItemAdded library_item_added = 25;
LibraryItemRemoved library_item_removed = 26;
LibraryItemRewinded library_item_rewinded = 27;
LibraryItemNotificationsToggled library_item_notifications_toggled = 28;
LibraryItemMarkedAsWatched library_item_marked_as_watched = 29;
NotificationsDismissed notifications_dismissed = 30;
PlayerPlaying player_playing = 31;
PlayerStopped player_stopped = 32;
PlayerNextVideo player_next_video = 33;
PlayerEnded player_ended = 34;
TraktPlaying trakt_playing = 35;
TraktPaused trakt_paused = 36;
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;
UserAccountDeleted user_account_deleted = 18;
SessionDeleted session_deleted = 19;
TraktAddonFetched trakt_addon_fetched = 20;
TraktLoggedOut trakt_logged_out = 21;
AddonInstalled addon_installed = 22;
AddonUpgraded addon_upgraded = 23;
AddonUninstalled addon_uninstalled = 24;
SettingsUpdated settings_updated = 25;
LibraryItemAdded library_item_added = 26;
LibraryItemRemoved library_item_removed = 27;
LibraryItemRewinded library_item_rewinded = 28;
LibraryItemNotificationsToggled library_item_notifications_toggled = 29;
LibraryItemMarkedAsWatched library_item_marked_as_watched = 30;
NotificationsDismissed notifications_dismissed = 31;
PlayerPlaying player_playing = 32;
PlayerStopped player_stopped = 33;
PlayerNextVideo player_next_video = 34;
PlayerEnded player_ended = 35;
TraktPlaying trakt_playing = 36;
TraktPaused trakt_paused = 37;
MagnetParsed magnet_parsed = 38;
TorrentParsed torrent_parsed = 39;
PlayingOnDevice playing_on_device = 40;
StreamingServerUrlsBucketChanged streaming_server_urls_bucket_changed = 41;
StreamingServerUrlsPushedToStorage streaming_server_urls_pushed_to_storage = 42;
Error error = 100;
}

Expand Down Expand Up @@ -105,6 +106,9 @@ message Event {
message UserLoggedOut {
optional string uid = 1;
}
message UserAccountDeleted {
optional string uid = 1;
}
message SessionDeleted {
required string auth_key = 1;
}
Expand Down
3 changes: 3 additions & 0 deletions stremio-core-protobuf/src/bridge/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ impl FromProtobuf<Action> for runtime::Action {
Action::Ctx(ActionCtx::Authenticate(auth_request.from_protobuf()))
}
Some(action_ctx::Args::Logout(_args)) => Action::Ctx(ActionCtx::Logout),
Some(action_ctx::Args::DeleteAccount(password)) => {
Action::Ctx(ActionCtx::DeleteAccount(password.from_protobuf()))
}
Some(action_ctx::Args::InstallAddon(descriptor)) => {
Action::Ctx(ActionCtx::InstallAddon(descriptor.from_protobuf()))
}
Expand Down
5 changes: 5 additions & 0 deletions stremio-core-protobuf/src/bridge/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ impl ToProtobuf<runtime::Event, ()> for Event {
uid: uid.clone(),
})
}
Event::UserAccountDeleted { uid } => {
runtime::event::Type::UserAccountDeleted(runtime::event::UserAccountDeleted {
uid: uid.clone(),
})
}
Event::SessionDeleted { auth_key } => {
runtime::event::Type::SessionDeleted(runtime::event::SessionDeleted {
auth_key: auth_key.0.to_owned(),
Expand Down
7 changes: 7 additions & 0 deletions stremio-core-protobuf/src/bridge/string.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::bridge::{FromProtobuf, ToProtobuf};
use stremio_core::types::profile::Password;
use url::Url;

impl FromProtobuf<Url> for String {
Expand All @@ -7,6 +8,12 @@ impl FromProtobuf<Url> for String {
}
}

impl FromProtobuf<Password> for String {
fn from_protobuf(&self) -> Password {
Password(self.to_owned())
}
}

impl ToProtobuf<String, ()> for Url {
fn to_protobuf<E: stremio_core::runtime::Env + 'static>(&self, _args: &()) -> String {
self.to_string()
Expand Down
3 changes: 2 additions & 1 deletion stremio-core-protobuf/src/model/fields/addon_detail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use crate::bridge::{FromProtobuf, ToProtobuf};
use crate::protobuf::stremio::core::models;
use stremio_core::models::addon_details::{AddonDetails, Selected};
use stremio_core::models::ctx::Ctx;
use url::Url;

impl FromProtobuf<Selected> for models::addon_details::Selected {
fn from_protobuf(&self) -> Selected {
let transport_url = self.transport_url.from_protobuf();
let transport_url: Url = self.transport_url.from_protobuf();

Selected {
transport_url: if transport_url.scheme() == "stremio" {
Expand Down

0 comments on commit 136d75d

Please sign in to comment.