2018-02-10 00:00:55 +00:00
|
|
|
mod accounts;
|
|
|
|
mod ciphers;
|
|
|
|
mod folders;
|
2018-02-17 21:30:19 +00:00
|
|
|
mod organizations;
|
2018-02-10 00:00:55 +00:00
|
|
|
mod two_factor;
|
|
|
|
|
|
|
|
use self::accounts::*;
|
|
|
|
use self::ciphers::*;
|
|
|
|
use self::folders::*;
|
2018-02-17 21:30:19 +00:00
|
|
|
use self::organizations::*;
|
2018-02-10 00:00:55 +00:00
|
|
|
use self::two_factor::*;
|
|
|
|
|
|
|
|
pub fn routes() -> Vec<Route> {
|
|
|
|
routes![
|
|
|
|
register,
|
|
|
|
profile,
|
|
|
|
post_keys,
|
|
|
|
post_password,
|
|
|
|
post_sstamp,
|
|
|
|
post_email,
|
|
|
|
delete_account,
|
|
|
|
revision_date,
|
|
|
|
|
|
|
|
sync,
|
|
|
|
|
|
|
|
get_ciphers,
|
|
|
|
get_cipher,
|
|
|
|
post_ciphers,
|
|
|
|
post_ciphers_import,
|
|
|
|
post_attachment,
|
2018-02-14 23:40:34 +00:00
|
|
|
delete_attachment_post,
|
2018-02-10 00:00:55 +00:00
|
|
|
delete_attachment,
|
|
|
|
post_cipher,
|
|
|
|
put_cipher,
|
|
|
|
delete_cipher,
|
2018-02-15 23:32:26 +00:00
|
|
|
delete_cipher_post,
|
2018-02-10 00:00:55 +00:00
|
|
|
delete_all,
|
|
|
|
|
|
|
|
get_folders,
|
|
|
|
get_folder,
|
|
|
|
post_folders,
|
|
|
|
post_folder,
|
|
|
|
put_folder,
|
|
|
|
delete_folder_post,
|
|
|
|
delete_folder,
|
|
|
|
|
|
|
|
get_twofactor,
|
|
|
|
get_recover,
|
2018-02-15 18:05:57 +00:00
|
|
|
recover,
|
2018-02-10 00:00:55 +00:00
|
|
|
generate_authenticator,
|
|
|
|
activate_authenticator,
|
|
|
|
disable_authenticator,
|
|
|
|
|
2018-02-17 21:30:19 +00:00
|
|
|
get_user_collections,
|
2018-02-10 00:00:55 +00:00
|
|
|
|
|
|
|
clear_device_token,
|
|
|
|
put_device_token,
|
|
|
|
|
|
|
|
get_eq_domains,
|
|
|
|
post_eq_domains
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Move this somewhere else
|
|
|
|
///
|
|
|
|
|
|
|
|
use rocket::Route;
|
|
|
|
|
2018-02-17 19:47:13 +00:00
|
|
|
use rocket_contrib::{Json, Value};
|
2018-02-10 00:00:55 +00:00
|
|
|
|
|
|
|
use db::DbConn;
|
|
|
|
|
2018-02-17 19:47:13 +00:00
|
|
|
use api::JsonResult;
|
2018-02-10 00:00:55 +00:00
|
|
|
use auth::Headers;
|
|
|
|
|
|
|
|
#[put("/devices/identifier/<uuid>/clear-token")]
|
2018-02-17 19:47:13 +00:00
|
|
|
fn clear_device_token(uuid: String, conn: DbConn) -> JsonResult {
|
|
|
|
err!("Not implemented")
|
|
|
|
}
|
2018-02-10 00:00:55 +00:00
|
|
|
|
|
|
|
#[put("/devices/identifier/<uuid>/token")]
|
2018-02-17 19:47:13 +00:00
|
|
|
fn put_device_token(uuid: String, conn: DbConn) -> JsonResult {
|
|
|
|
err!("Not implemented")
|
|
|
|
}
|
2018-02-10 00:00:55 +00:00
|
|
|
|
|
|
|
|
2018-02-14 23:40:34 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
struct EquivDomainData {
|
|
|
|
ExcludedGlobalEquivalentDomains: Vec<i32>,
|
|
|
|
EquivalentDomains: Vec<Vec<String>>,
|
|
|
|
}
|
|
|
|
|
2018-02-10 00:00:55 +00:00
|
|
|
#[get("/settings/domains")]
|
2018-02-17 19:47:13 +00:00
|
|
|
fn get_eq_domains() -> JsonResult {
|
2018-02-10 00:00:55 +00:00
|
|
|
err!("Not implemented")
|
|
|
|
}
|
|
|
|
|
2018-02-14 23:40:34 +00:00
|
|
|
#[post("/settings/domains", data = "<data>")]
|
2018-02-17 19:47:13 +00:00
|
|
|
fn post_eq_domains(data: Json<EquivDomainData>, headers: Headers, conn: DbConn) -> JsonResult {
|
2018-02-14 23:40:34 +00:00
|
|
|
let excluded_globals = &data.ExcludedGlobalEquivalentDomains;
|
|
|
|
let equivalent_domains = &data.EquivalentDomains;
|
|
|
|
|
2018-02-14 23:53:11 +00:00
|
|
|
let user = headers.user;
|
2018-02-14 23:40:34 +00:00
|
|
|
|
2018-02-15 18:05:57 +00:00
|
|
|
//BODY. "{\"ExcludedGlobalEquivalentDomains\":[2],\"EquivalentDomains\":[[\"example.org\",\"example.net\"]]}"
|
2018-02-14 23:40:34 +00:00
|
|
|
|
2018-02-10 00:00:55 +00:00
|
|
|
err!("Not implemented")
|
|
|
|
}
|