mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-06-12 21:27:37 +02:00
Initial version of admin panel, list users and reload user list works. No serious auth method yet, password is 'token123'
This commit is contained in:
90
src/api/admin.rs
Normal file
90
src/api/admin.rs
Normal file
@ -0,0 +1,90 @@
|
||||
use rocket_contrib::json::Json;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::db::models::*;
|
||||
use crate::db::DbConn;
|
||||
|
||||
use crate::api::{EmptyResult, JsonResult, JsonUpcase};
|
||||
|
||||
use rocket::{Route, Outcome};
|
||||
use rocket::request::{self, Request, FromRequest};
|
||||
|
||||
pub fn routes() -> Vec<Route> {
|
||||
routes![
|
||||
get_users,
|
||||
invite_user,
|
||||
delete_user,
|
||||
]
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
struct InviteData {
|
||||
Email: String,
|
||||
}
|
||||
|
||||
#[get("/users")]
|
||||
fn get_users(_token: AdminToken, conn: DbConn) -> JsonResult {
|
||||
let users = User::get_all(&conn);
|
||||
let users_json: Vec<Value> = users.iter().map(|u| u.to_json(&conn)).collect();
|
||||
|
||||
Ok(Json(Value::Array(users_json)))
|
||||
}
|
||||
|
||||
#[post("/users", data="<data>")]
|
||||
fn invite_user(data: JsonUpcase<InviteData>, _token: AdminToken, conn: DbConn) -> EmptyResult {
|
||||
let data: InviteData = data.into_inner().data;
|
||||
|
||||
if User::find_by_mail(&data.Email, &conn).is_some() {
|
||||
err!("User already exists")
|
||||
}
|
||||
|
||||
err!("Unimplemented")
|
||||
}
|
||||
|
||||
#[delete("/users/<uuid>")]
|
||||
fn delete_user(uuid: String, _token: AdminToken, conn: DbConn) -> EmptyResult {
|
||||
let _user = match User::find_by_uuid(&uuid, &conn) {
|
||||
Some(user) => user,
|
||||
None => err!("User doesn't exist")
|
||||
};
|
||||
|
||||
// TODO: Enable this once we have a more secure auth method
|
||||
err!("Unimplemented")
|
||||
/*
|
||||
match user.delete(&conn) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => err!("Error deleting user", e)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
pub struct AdminToken {}
|
||||
|
||||
impl<'a, 'r> FromRequest<'a, 'r> for AdminToken {
|
||||
type Error = &'static str;
|
||||
|
||||
fn from_request(request: &'a Request<'r>) -> request::Outcome<Self, Self::Error> {
|
||||
// Get access_token
|
||||
let access_token: &str = match request.headers().get_one("Authorization") {
|
||||
Some(a) => match a.rsplit("Bearer ").next() {
|
||||
Some(split) => split,
|
||||
None => err_handler!("No access token provided"),
|
||||
},
|
||||
None => err_handler!("No access token provided"),
|
||||
};
|
||||
|
||||
// TODO: What authentication to use?
|
||||
// Option 1: Make it a config option
|
||||
// Option 2: Generate random token, and
|
||||
// Option 2a: Send it to admin email, like upstream
|
||||
// Option 2b: Print in console or save to data dir, so admin can check
|
||||
|
||||
if access_token != "token123" {
|
||||
err_handler!("Invalid admin token")
|
||||
}
|
||||
|
||||
Outcome::Success(AdminToken {})
|
||||
}
|
||||
}
|
@ -1,767 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Type": 2,
|
||||
"Domains": [
|
||||
"ameritrade.com",
|
||||
"tdameritrade.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 3,
|
||||
"Domains": [
|
||||
"bankofamerica.com",
|
||||
"bofa.com",
|
||||
"mbna.com",
|
||||
"usecfo.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 4,
|
||||
"Domains": [
|
||||
"sprint.com",
|
||||
"sprintpcs.com",
|
||||
"nextel.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 0,
|
||||
"Domains": [
|
||||
"youtube.com",
|
||||
"google.com",
|
||||
"gmail.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 1,
|
||||
"Domains": [
|
||||
"apple.com",
|
||||
"icloud.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 5,
|
||||
"Domains": [
|
||||
"wellsfargo.com",
|
||||
"wf.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 6,
|
||||
"Domains": [
|
||||
"mymerrill.com",
|
||||
"ml.com",
|
||||
"merrilledge.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 7,
|
||||
"Domains": [
|
||||
"accountonline.com",
|
||||
"citi.com",
|
||||
"citibank.com",
|
||||
"citicards.com",
|
||||
"citibankonline.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 8,
|
||||
"Domains": [
|
||||
"cnet.com",
|
||||
"cnettv.com",
|
||||
"com.com",
|
||||
"download.com",
|
||||
"news.com",
|
||||
"search.com",
|
||||
"upload.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 9,
|
||||
"Domains": [
|
||||
"bananarepublic.com",
|
||||
"gap.com",
|
||||
"oldnavy.com",
|
||||
"piperlime.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 10,
|
||||
"Domains": [
|
||||
"bing.com",
|
||||
"hotmail.com",
|
||||
"live.com",
|
||||
"microsoft.com",
|
||||
"msn.com",
|
||||
"passport.net",
|
||||
"windows.com",
|
||||
"microsoftonline.com",
|
||||
"office365.com",
|
||||
"microsoftstore.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 11,
|
||||
"Domains": [
|
||||
"ua2go.com",
|
||||
"ual.com",
|
||||
"united.com",
|
||||
"unitedwifi.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 12,
|
||||
"Domains": [
|
||||
"overture.com",
|
||||
"yahoo.com",
|
||||
"flickr.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 13,
|
||||
"Domains": [
|
||||
"zonealarm.com",
|
||||
"zonelabs.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 14,
|
||||
"Domains": [
|
||||
"paypal.com",
|
||||
"paypal-search.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 15,
|
||||
"Domains": [
|
||||
"avon.com",
|
||||
"youravon.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 16,
|
||||
"Domains": [
|
||||
"diapers.com",
|
||||
"soap.com",
|
||||
"wag.com",
|
||||
"yoyo.com",
|
||||
"beautybar.com",
|
||||
"casa.com",
|
||||
"afterschool.com",
|
||||
"vine.com",
|
||||
"bookworm.com",
|
||||
"look.com",
|
||||
"vinemarket.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 17,
|
||||
"Domains": [
|
||||
"1800contacts.com",
|
||||
"800contacts.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 18,
|
||||
"Domains": [
|
||||
"amazon.com",
|
||||
"amazon.co.uk",
|
||||
"amazon.ca",
|
||||
"amazon.de",
|
||||
"amazon.fr",
|
||||
"amazon.es",
|
||||
"amazon.it",
|
||||
"amazon.com.au",
|
||||
"amazon.co.nz",
|
||||
"amazon.co.jp",
|
||||
"amazon.in"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 19,
|
||||
"Domains": [
|
||||
"cox.com",
|
||||
"cox.net",
|
||||
"coxbusiness.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 20,
|
||||
"Domains": [
|
||||
"mynortonaccount.com",
|
||||
"norton.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 21,
|
||||
"Domains": [
|
||||
"verizon.com",
|
||||
"verizon.net"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 22,
|
||||
"Domains": [
|
||||
"rakuten.com",
|
||||
"buy.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 23,
|
||||
"Domains": [
|
||||
"siriusxm.com",
|
||||
"sirius.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 24,
|
||||
"Domains": [
|
||||
"ea.com",
|
||||
"origin.com",
|
||||
"play4free.com",
|
||||
"tiberiumalliance.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 25,
|
||||
"Domains": [
|
||||
"37signals.com",
|
||||
"basecamp.com",
|
||||
"basecamphq.com",
|
||||
"highrisehq.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 26,
|
||||
"Domains": [
|
||||
"steampowered.com",
|
||||
"steamcommunity.com",
|
||||
"steamgames.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 27,
|
||||
"Domains": [
|
||||
"chart.io",
|
||||
"chartio.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 28,
|
||||
"Domains": [
|
||||
"gotomeeting.com",
|
||||
"citrixonline.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 29,
|
||||
"Domains": [
|
||||
"gogoair.com",
|
||||
"gogoinflight.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 30,
|
||||
"Domains": [
|
||||
"mysql.com",
|
||||
"oracle.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 31,
|
||||
"Domains": [
|
||||
"discover.com",
|
||||
"discovercard.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 32,
|
||||
"Domains": [
|
||||
"dcu.org",
|
||||
"dcu-online.org"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 33,
|
||||
"Domains": [
|
||||
"healthcare.gov",
|
||||
"cms.gov"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 34,
|
||||
"Domains": [
|
||||
"pepco.com",
|
||||
"pepcoholdings.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 35,
|
||||
"Domains": [
|
||||
"century21.com",
|
||||
"21online.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 36,
|
||||
"Domains": [
|
||||
"comcast.com",
|
||||
"comcast.net",
|
||||
"xfinity.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 37,
|
||||
"Domains": [
|
||||
"cricketwireless.com",
|
||||
"aiowireless.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 38,
|
||||
"Domains": [
|
||||
"mandtbank.com",
|
||||
"mtb.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 39,
|
||||
"Domains": [
|
||||
"dropbox.com",
|
||||
"getdropbox.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 40,
|
||||
"Domains": [
|
||||
"snapfish.com",
|
||||
"snapfish.ca"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 41,
|
||||
"Domains": [
|
||||
"alibaba.com",
|
||||
"aliexpress.com",
|
||||
"aliyun.com",
|
||||
"net.cn",
|
||||
"www.net.cn"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 42,
|
||||
"Domains": [
|
||||
"playstation.com",
|
||||
"sonyentertainmentnetwork.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 43,
|
||||
"Domains": [
|
||||
"mercadolivre.com",
|
||||
"mercadolivre.com.br",
|
||||
"mercadolibre.com",
|
||||
"mercadolibre.com.ar",
|
||||
"mercadolibre.com.mx"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 44,
|
||||
"Domains": [
|
||||
"zendesk.com",
|
||||
"zopim.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 45,
|
||||
"Domains": [
|
||||
"autodesk.com",
|
||||
"tinkercad.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 46,
|
||||
"Domains": [
|
||||
"railnation.ru",
|
||||
"railnation.de",
|
||||
"rail-nation.com",
|
||||
"railnation.gr",
|
||||
"railnation.us",
|
||||
"trucknation.de",
|
||||
"traviangames.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 47,
|
||||
"Domains": [
|
||||
"wpcu.coop",
|
||||
"wpcuonline.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 48,
|
||||
"Domains": [
|
||||
"mathletics.com",
|
||||
"mathletics.com.au",
|
||||
"mathletics.co.uk"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 49,
|
||||
"Domains": [
|
||||
"discountbank.co.il",
|
||||
"telebank.co.il"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 50,
|
||||
"Domains": [
|
||||
"mi.com",
|
||||
"xiaomi.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 52,
|
||||
"Domains": [
|
||||
"postepay.it",
|
||||
"poste.it"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 51,
|
||||
"Domains": [
|
||||
"facebook.com",
|
||||
"messenger.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 53,
|
||||
"Domains": [
|
||||
"skysports.com",
|
||||
"skybet.com",
|
||||
"skyvegas.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 54,
|
||||
"Domains": [
|
||||
"disneymoviesanywhere.com",
|
||||
"go.com",
|
||||
"disney.com",
|
||||
"dadt.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 55,
|
||||
"Domains": [
|
||||
"pokemon-gl.com",
|
||||
"pokemon.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 56,
|
||||
"Domains": [
|
||||
"myuv.com",
|
||||
"uvvu.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 58,
|
||||
"Domains": [
|
||||
"mdsol.com",
|
||||
"imedidata.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 57,
|
||||
"Domains": [
|
||||
"bank-yahav.co.il",
|
||||
"bankhapoalim.co.il"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 59,
|
||||
"Domains": [
|
||||
"sears.com",
|
||||
"shld.net"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 60,
|
||||
"Domains": [
|
||||
"xiami.com",
|
||||
"alipay.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 61,
|
||||
"Domains": [
|
||||
"belkin.com",
|
||||
"seedonk.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 62,
|
||||
"Domains": [
|
||||
"turbotax.com",
|
||||
"intuit.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 63,
|
||||
"Domains": [
|
||||
"shopify.com",
|
||||
"myshopify.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 64,
|
||||
"Domains": [
|
||||
"ebay.com",
|
||||
"ebay.de",
|
||||
"ebay.ca",
|
||||
"ebay.in",
|
||||
"ebay.co.uk",
|
||||
"ebay.com.au"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 65,
|
||||
"Domains": [
|
||||
"techdata.com",
|
||||
"techdata.ch"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 66,
|
||||
"Domains": [
|
||||
"schwab.com",
|
||||
"schwabplan.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 68,
|
||||
"Domains": [
|
||||
"tesla.com",
|
||||
"teslamotors.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 69,
|
||||
"Domains": [
|
||||
"morganstanley.com",
|
||||
"morganstanleyclientserv.com",
|
||||
"stockplanconnect.com",
|
||||
"ms.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 70,
|
||||
"Domains": [
|
||||
"taxact.com",
|
||||
"taxactonline.com"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 71,
|
||||
"Domains": [
|
||||
"mediawiki.org",
|
||||
"wikibooks.org",
|
||||
"wikidata.org",
|
||||
"wikimedia.org",
|
||||
"wikinews.org",
|
||||
"wikipedia.org",
|
||||
"wikiquote.org",
|
||||
"wikisource.org",
|
||||
"wikiversity.org",
|
||||
"wikivoyage.org",
|
||||
"wiktionary.org"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 72,
|
||||
"Domains": [
|
||||
"airbnb.at",
|
||||
"airbnb.be",
|
||||
"airbnb.ca",
|
||||
"airbnb.ch",
|
||||
"airbnb.cl",
|
||||
"airbnb.co.cr",
|
||||
"airbnb.co.id",
|
||||
"airbnb.co.in",
|
||||
"airbnb.co.kr",
|
||||
"airbnb.co.nz",
|
||||
"airbnb.co.uk",
|
||||
"airbnb.co.ve",
|
||||
"airbnb.com",
|
||||
"airbnb.com.ar",
|
||||
"airbnb.com.au",
|
||||
"airbnb.com.bo",
|
||||
"airbnb.com.br",
|
||||
"airbnb.com.bz",
|
||||
"airbnb.com.co",
|
||||
"airbnb.com.ec",
|
||||
"airbnb.com.gt",
|
||||
"airbnb.com.hk",
|
||||
"airbnb.com.hn",
|
||||
"airbnb.com.mt",
|
||||
"airbnb.com.my",
|
||||
"airbnb.com.ni",
|
||||
"airbnb.com.pa",
|
||||
"airbnb.com.pe",
|
||||
"airbnb.com.py",
|
||||
"airbnb.com.sg",
|
||||
"airbnb.com.sv",
|
||||
"airbnb.com.tr",
|
||||
"airbnb.com.tw",
|
||||
"airbnb.cz",
|
||||
"airbnb.de",
|
||||
"airbnb.dk",
|
||||
"airbnb.es",
|
||||
"airbnb.fi",
|
||||
"airbnb.fr",
|
||||
"airbnb.gr",
|
||||
"airbnb.gy",
|
||||
"airbnb.hu",
|
||||
"airbnb.ie",
|
||||
"airbnb.is",
|
||||
"airbnb.it",
|
||||
"airbnb.jp",
|
||||
"airbnb.mx",
|
||||
"airbnb.nl",
|
||||
"airbnb.no",
|
||||
"airbnb.pl",
|
||||
"airbnb.pt",
|
||||
"airbnb.ru",
|
||||
"airbnb.se"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 73,
|
||||
"Domains": [
|
||||
"eventbrite.at",
|
||||
"eventbrite.be",
|
||||
"eventbrite.ca",
|
||||
"eventbrite.ch",
|
||||
"eventbrite.cl",
|
||||
"eventbrite.co.id",
|
||||
"eventbrite.co.in",
|
||||
"eventbrite.co.kr",
|
||||
"eventbrite.co.nz",
|
||||
"eventbrite.co.uk",
|
||||
"eventbrite.co.ve",
|
||||
"eventbrite.com",
|
||||
"eventbrite.com.au",
|
||||
"eventbrite.com.bo",
|
||||
"eventbrite.com.br",
|
||||
"eventbrite.com.co",
|
||||
"eventbrite.com.hk",
|
||||
"eventbrite.com.hn",
|
||||
"eventbrite.com.pe",
|
||||
"eventbrite.com.sg",
|
||||
"eventbrite.com.tr",
|
||||
"eventbrite.com.tw",
|
||||
"eventbrite.cz",
|
||||
"eventbrite.de",
|
||||
"eventbrite.dk",
|
||||
"eventbrite.fi",
|
||||
"eventbrite.fr",
|
||||
"eventbrite.gy",
|
||||
"eventbrite.hu",
|
||||
"eventbrite.ie",
|
||||
"eventbrite.is",
|
||||
"eventbrite.it",
|
||||
"eventbrite.jp",
|
||||
"eventbrite.mx",
|
||||
"eventbrite.nl",
|
||||
"eventbrite.no",
|
||||
"eventbrite.pl",
|
||||
"eventbrite.pt",
|
||||
"eventbrite.ru",
|
||||
"eventbrite.se"
|
||||
],
|
||||
"Excluded": false
|
||||
},
|
||||
{
|
||||
"Type": 74,
|
||||
"Domains": [
|
||||
"stackexchange.com",
|
||||
"superuser.com",
|
||||
"stackoverflow.com",
|
||||
"serverfault.com",
|
||||
"mathoverflow.net"
|
||||
],
|
||||
"Excluded": false
|
||||
}
|
||||
]
|
@ -77,7 +77,7 @@ struct GlobalDomain {
|
||||
Excluded: bool,
|
||||
}
|
||||
|
||||
const GLOBAL_DOMAINS: &str = include_str!("global_domains.json");
|
||||
const GLOBAL_DOMAINS: &str = include_str!("../../static/global_domains.json");
|
||||
|
||||
#[get("/settings/domains")]
|
||||
fn get_eq_domains(headers: Headers) -> JsonResult {
|
||||
|
@ -1,10 +1,12 @@
|
||||
pub(crate) mod core;
|
||||
mod admin;
|
||||
mod icons;
|
||||
mod identity;
|
||||
mod web;
|
||||
mod notifications;
|
||||
|
||||
pub use self::core::routes as core_routes;
|
||||
pub use self::admin::routes as admin_routes;
|
||||
pub use self::icons::routes as icons_routes;
|
||||
pub use self::identity::routes as identity_routes;
|
||||
pub use self::web::routes as web_routes;
|
||||
|
@ -13,7 +13,7 @@ use crate::CONFIG;
|
||||
|
||||
pub fn routes() -> Vec<Route> {
|
||||
if CONFIG.web_vault_enabled {
|
||||
routes![web_index, app_id, web_files, attachments, alive]
|
||||
routes![web_index, app_id, web_files, admin_page, attachments, alive]
|
||||
} else {
|
||||
routes![attachments, alive]
|
||||
}
|
||||
@ -41,6 +41,11 @@ fn app_id() -> WebHeaders<Content<Json<Value>>> {
|
||||
}))))
|
||||
}
|
||||
|
||||
#[get("/admin")]
|
||||
fn admin_page() -> WebHeaders<io::Result<NamedFile>> {
|
||||
WebHeaders(NamedFile::open("src/static/admin.html")) // TODO: Change this to embed the page in the binary
|
||||
}
|
||||
|
||||
#[get("/<p..>", rank = 1)] // Only match this if the other routes don't match
|
||||
fn web_files(p: PathBuf) -> WebHeaders<io::Result<NamedFile>> {
|
||||
WebHeaders(NamedFile::open(Path::new(&CONFIG.web_vault_folder).join(p)))
|
||||
|
Reference in New Issue
Block a user