1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-06-28 10:15:41 +02:00

Remove unnecessary fields from send access

Dieser Commit ist enthalten in:
Daniel García 2021-03-16 18:10:23 +01:00
Ursprung a71359f647
Commit 84810f2bb2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A
2 geänderte Dateien mit 19 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -231,7 +231,7 @@ fn post_access(access_id: String, data: JsonUpcase<SendAccessData>, conn: DbConn
send.save(&conn)?;
Ok(Json(send.to_json()))
Ok(Json(send.to_json_access()))
}
#[post("/sends/<send_id>/access/file/<file_id>", data = "<data>")]

Datei anzeigen

@ -130,6 +130,24 @@ impl Send {
"Object": "send",
})
}
pub fn to_json_access(&self) -> Value {
use crate::util::format_date;
let data: Value = serde_json::from_str(&self.data).unwrap_or_default();
json!({
"Id": self.uuid,
"Type": self.atype,
"Name": self.name,
"Text": if self.atype == SendType::Text as i32 { Some(&data) } else { None },
"File": if self.atype == SendType::File as i32 { Some(&data) } else { None },
"ExpirationDate": self.expiration_date.as_ref().map(format_date),
"Object": "send-access",
})
}
}
use crate::db::DbConn;