internal data sources (clock, static text), connection indicator, rendering fixes
DataSourceConfig refactored to enum: External/Clock/StaticText. Clock generates formatted time via chrono, static text emits configured string. ESP32: connection status indicator (green/red dot bottom-right), per-widget clear before redraw, RenderEvent enum for local + server messages. Polling uses DataUpdate instead of ScreenUpdate to avoid wiping widget state. Empty mappings passthrough raw source data for internal sources.
This commit is contained in:
@@ -38,11 +38,19 @@ impl DataSourcePort for MediaAdapter {
|
||||
type Error = MediaError;
|
||||
|
||||
async fn poll(&self, source: &DataSource) -> Result<Value, Self::Error> {
|
||||
let base_url = source.config.url.as_ref().ok_or(MediaError::NoUrl)?;
|
||||
let username = find_header(&source.config.headers, "username")
|
||||
.ok_or(MediaError::MissingField("username"))?;
|
||||
let password = find_header(&source.config.headers, "password")
|
||||
.ok_or(MediaError::MissingField("password"))?;
|
||||
let domain::DataSourceConfig::External {
|
||||
ref url,
|
||||
ref headers,
|
||||
..
|
||||
} = source.config
|
||||
else {
|
||||
return Err(MediaError::NoUrl);
|
||||
};
|
||||
let base_url = url.as_ref().ok_or(MediaError::NoUrl)?;
|
||||
let username =
|
||||
find_header(headers, "username").ok_or(MediaError::MissingField("username"))?;
|
||||
let password =
|
||||
find_header(headers, "password").ok_or(MediaError::MissingField("password"))?;
|
||||
|
||||
let salt: String = (0..12).map(|_| fastrand::alphanumeric()).collect();
|
||||
let token = subsonic_token(password, &salt);
|
||||
|
||||
@@ -45,7 +45,7 @@ fn make_source(url: String) -> DataSource {
|
||||
name: "navidrome".into(),
|
||||
source_type: DataSourceType::Media,
|
||||
poll_interval: Duration::from_secs(5),
|
||||
config: DataSourceConfig {
|
||||
config: DataSourceConfig::External {
|
||||
url: Some(url),
|
||||
headers: vec![
|
||||
("username".into(), "test".into()),
|
||||
|
||||
Reference in New Issue
Block a user