API: use global variable for device name

This commit is contained in:
Alejandro Domínguez 2019-02-05 19:01:17 +01:00 committed by Julian Sparber
parent dc924b1be0
commit 2d8e9764e3
2 changed files with 7 additions and 1 deletions

View file

@ -55,7 +55,12 @@ pub fn login(bk: &Backend, user: String, password: String, server: &str) -> Resu
bk.data.lock().unwrap().server_url = Url::parse(server)?; bk.data.lock().unwrap().server_url = Url::parse(server)?;
let url = bk.url("login", vec![])?; let url = bk.url("login", vec![])?;
let attrs = LoginRequest::new(user.clone(), password, Some(String::from("Fractal")), None); let attrs = LoginRequest::new(
user.clone(),
password,
Some(globals::DEVICE_NAME.into()),
None,
);
let attrs_json = serde_json::to_value(attrs).expect("Failed to serialize login request"); let attrs_json = serde_json::to_value(attrs).expect("Failed to serialize login request");
let data = bk.data.clone(); let data = bk.data.clone();

View file

@ -5,6 +5,7 @@ pub static TIMEOUT: u64 = 80;
pub static PAGE_LIMIT: i32 = 40; pub static PAGE_LIMIT: i32 = 40;
pub static ROOM_DIRECTORY_LIMIT: i32 = 20; pub static ROOM_DIRECTORY_LIMIT: i32 = 20;
pub static THUMBNAIL_SIZE: i32 = 128; pub static THUMBNAIL_SIZE: i32 = 128;
pub static DEVICE_NAME: &str = "Fractal";
lazy_static! { lazy_static! {
pub static ref MATRIX_RE: Regex = Regex::new(r"mxc://(?P<server>[^/]+)/(?P<media>.+)").unwrap(); pub static ref MATRIX_RE: Regex = Regex::new(r"mxc://(?P<server>[^/]+)/(?P<media>.+)").unwrap();