mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
add GetCustomColours rpc method
This commit is contained in:
parent
3890e12c9e
commit
fb0a3e4a3b
4 changed files with 18 additions and 0 deletions
|
@ -20,6 +20,7 @@ service CollectionService {
|
||||||
rpc LatestProgress(generic.Empty) returns (Progress);
|
rpc LatestProgress(generic.Empty) returns (Progress);
|
||||||
rpc SetWantsAbort(generic.Empty) returns (generic.Empty);
|
rpc SetWantsAbort(generic.Empty) returns (generic.Empty);
|
||||||
rpc SetLoadBalancerEnabled(generic.Bool) returns (OpChanges);
|
rpc SetLoadBalancerEnabled(generic.Bool) returns (OpChanges);
|
||||||
|
rpc GetCustomColours(generic.Empty) returns (GetCustomColoursResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implicitly includes any of the above methods that are not listed in the
|
// Implicitly includes any of the above methods that are not listed in the
|
||||||
|
@ -163,3 +164,7 @@ message CreateBackupRequest {
|
||||||
bool force = 2;
|
bool force = 2;
|
||||||
bool wait_for_completion = 3;
|
bool wait_for_completion = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetCustomColoursResponse {
|
||||||
|
repeated string colours = 1;
|
||||||
|
}
|
||||||
|
|
|
@ -630,6 +630,7 @@ post_handler_list = [
|
||||||
exposed_backend_list = [
|
exposed_backend_list = [
|
||||||
# CollectionService
|
# CollectionService
|
||||||
"latest_progress",
|
"latest_progress",
|
||||||
|
"get_custom_colours",
|
||||||
# DeckService
|
# DeckService
|
||||||
"get_deck_names",
|
"get_deck_names",
|
||||||
# I18nService
|
# I18nService
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
use anki_proto::collection::GetCustomColoursResponse;
|
||||||
use anki_proto::generic;
|
use anki_proto::generic;
|
||||||
|
|
||||||
use crate::collection::Collection;
|
use crate::collection::Collection;
|
||||||
|
use crate::config::ConfigKey;
|
||||||
use crate::error;
|
use crate::error;
|
||||||
use crate::prelude::BoolKey;
|
use crate::prelude::BoolKey;
|
||||||
use crate::prelude::Op;
|
use crate::prelude::Op;
|
||||||
|
@ -62,4 +64,13 @@ impl crate::services::CollectionService for Collection {
|
||||||
})
|
})
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_custom_colours(
|
||||||
|
&mut self,
|
||||||
|
) -> error::Result<anki_proto::collection::GetCustomColoursResponse> {
|
||||||
|
let colours = self
|
||||||
|
.get_config_optional(ConfigKey::CustomColorPickerPalette)
|
||||||
|
.unwrap_or_default();
|
||||||
|
Ok(GetCustomColoursResponse { colours })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ pub(crate) enum ConfigKey {
|
||||||
NextNewCardPosition,
|
NextNewCardPosition,
|
||||||
#[strum(to_string = "schedVer")]
|
#[strum(to_string = "schedVer")]
|
||||||
SchedulerVersion,
|
SchedulerVersion,
|
||||||
|
CustomColorPickerPalette,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Serialize_repr, Deserialize_repr, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Serialize_repr, Deserialize_repr, Clone, Copy, Debug)]
|
||||||
|
|
Loading…
Reference in a new issue