73 lines
2.7 KiB
Rust
73 lines
2.7 KiB
Rust
use std::fmt::Error;
|
|
use askama::shared::parser::Expr::Range;
|
|
|
|
use spaceapi::{Contact, Feed, Feeds, Icon, IssueReportChannel, Location, PowerConsumptionSensor, Sensors, SensorTemplate, State, Status, StatusBuilder};
|
|
use spaceapi::sensors::PowerConsumptionSensorTemplate;
|
|
use crate::SharedInfo;
|
|
|
|
pub fn build_status_v13(info: SharedInfo) -> Result<Status, String> {
|
|
build_status(StatusBuilder::v0_13, info)
|
|
.add_issue_report_channel(IssueReportChannel::Ml)
|
|
.add_issue_report_channel(IssueReportChannel::IssueMail)
|
|
.build()
|
|
}
|
|
|
|
pub fn build_status_v14(info: SharedInfo) -> Result<Status, String> {
|
|
build_status(StatusBuilder::v14, info)
|
|
.build()
|
|
}
|
|
|
|
fn build_status(builder: fn(String) -> StatusBuilder, info: SharedInfo) -> StatusBuilder {
|
|
builder("Chaostreff Dortmund".into())
|
|
.logo("https://www.chaostreff-dortmund.de/presse/logo/logo_ctdo.png")
|
|
.url("https://www.chaostreff-dortmund.de/")
|
|
.state(State {
|
|
open: Some(info.open),
|
|
icon: Some(Icon {
|
|
open: "https://status.ctdo.de/img/green.png".into(),
|
|
close: "https://status.ctdo.de/img/red.png".into(),
|
|
}),
|
|
..State::default()
|
|
})
|
|
.location(
|
|
Location {
|
|
address: Some("Braunschweiger Str 22, 44145 Dortmund, Germany".into()),
|
|
lat: 51.527611,
|
|
lon: 7.4649449,
|
|
})
|
|
|
|
.sensors(Sensors {
|
|
power_consumption: vec![PowerConsumptionSensor{
|
|
unit: "W".to_string(),
|
|
location: "Cellar".to_string(),
|
|
value: info.power_usage as f64,
|
|
..PowerConsumptionSensor::default()
|
|
}],
|
|
..Sensors::default()
|
|
})
|
|
.contact(
|
|
Contact {
|
|
phone: Some("+49 231 8 404 777".into()),
|
|
irc: Some("irc://irc.hackint.eu/#ccc.do".into()),
|
|
ml: Some("discuss@lists.chaostreff-dortmund.de".into()),
|
|
twitter: Some("@ctdo".into()),
|
|
issue_mail: Some("vorstand@chaostreff-dortmund.de".into()),
|
|
matrix: Some("#ccc.do:hackint.org".into()),
|
|
..Default::default()
|
|
})
|
|
.feeds(Feeds {
|
|
blog: Some(Feed {
|
|
url: "https://www.chaostreff-dortmund.de".into(),
|
|
..Feed::default()
|
|
}),
|
|
calendar: Some(Feed {
|
|
url: "https://www.chaostreff-dortmund.de/kalender/".into(),
|
|
..Feed::default()
|
|
}),
|
|
wiki: Some(Feed {
|
|
url: "https://wiki.chaostreff-dortmund.de".into(),
|
|
..Feed::default()
|
|
}),
|
|
..Feeds::default()
|
|
})
|
|
} |