mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
fix: rust plugin compilation error
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
bfb6476307
commit
f4477fffd4
@ -19,7 +19,7 @@
|
|||||||
//! in configuration files is not secure and may violate Discord's terms of service.
|
//! in configuration files is not secure and may violate Discord's terms of service.
|
||||||
|
|
||||||
use extism_pdk::*;
|
use extism_pdk::*;
|
||||||
use nd_pdk::host::{artwork, scheduler};
|
use nd_pdk::host::{artwork, config, scheduler};
|
||||||
use nd_pdk::scrobbler::{
|
use nd_pdk::scrobbler::{
|
||||||
Error as ScrobblerError, IsAuthorizedRequest, NowPlayingRequest,
|
Error as ScrobblerError, IsAuthorizedRequest, NowPlayingRequest,
|
||||||
ScrobbleRequest, Scrobbler, SCROBBLER_ERROR_NOT_AUTHORIZED, SCROBBLER_ERROR_RETRY_LATER,
|
ScrobbleRequest, Scrobbler, SCROBBLER_ERROR_NOT_AUTHORIZED, SCROBBLER_ERROR_RETRY_LATER,
|
||||||
@ -65,9 +65,10 @@ struct DiscordPlugin;
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
fn get_config() -> Result<(String, std::collections::HashMap<String, String>), Error> {
|
fn get_config() -> Result<(String, std::collections::HashMap<String, String>), Error> {
|
||||||
let client_id = config::get(CLIENT_ID_KEY)?
|
let (client_id, exists) = config::get(CLIENT_ID_KEY)?;
|
||||||
.filter(|s| !s.is_empty())
|
if !exists || client_id.is_empty() {
|
||||||
.ok_or_else(|| Error::msg("missing clientid in configuration"))?;
|
return Err(Error::msg("missing clientid in configuration"));
|
||||||
|
}
|
||||||
|
|
||||||
// Get all user keys with the "user." prefix
|
// Get all user keys with the "user." prefix
|
||||||
let user_keys = config::keys(USER_KEY_PREFIX)?;
|
let user_keys = config::keys(USER_KEY_PREFIX)?;
|
||||||
@ -75,7 +76,8 @@ fn get_config() -> Result<(String, std::collections::HashMap<String, String>), E
|
|||||||
let mut users = std::collections::HashMap::new();
|
let mut users = std::collections::HashMap::new();
|
||||||
for key in user_keys {
|
for key in user_keys {
|
||||||
let username = key.strip_prefix(USER_KEY_PREFIX).unwrap_or(&key);
|
let username = key.strip_prefix(USER_KEY_PREFIX).unwrap_or(&key);
|
||||||
if let Some(token) = config::get(&key)?.filter(|s| !s.is_empty()) {
|
let (token, token_exists) = config::get(&key)?;
|
||||||
|
if token_exists && !token.is_empty() {
|
||||||
users.insert(username.to_string(), token);
|
users.insert(username.to_string(), token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user