Add geoip data and 451 handler
This commit is contained in:
@ -4,6 +4,7 @@ mod macros;
|
||||
mod catchers;
|
||||
mod fairings;
|
||||
mod guards;
|
||||
mod ip_blocking;
|
||||
mod routes;
|
||||
|
||||
pub mod string {
|
||||
@ -58,8 +59,6 @@ pub mod string_opt {
|
||||
}
|
||||
}
|
||||
|
||||
use std::{env, path::Path};
|
||||
|
||||
use log::{error, info, warn};
|
||||
use oauth2::{basic::BasicClient, AuthUrl, ClientId, ClientSecret, RedirectUrl, TokenUrl};
|
||||
use poise::serenity_prelude::{
|
||||
@ -77,6 +76,8 @@ use rocket::{
|
||||
};
|
||||
use rocket_dyn_templates::Template;
|
||||
use sqlx::{MySql, Pool};
|
||||
use std::net::Ipv4Addr;
|
||||
use std::{env, path::Path};
|
||||
|
||||
use crate::web::{
|
||||
consts::{CNC_GUILD, DISCORD_OAUTH_AUTHORIZE, DISCORD_OAUTH_TOKEN, SUBSCRIPTION_ROLES},
|
||||
@ -107,6 +108,10 @@ pub async fn initialize(
|
||||
env::var("PATREON_GUILD_ID").expect("`PATREON_GUILD_ID' not supplied");
|
||||
}
|
||||
|
||||
info!("Loading GB IP list");
|
||||
|
||||
info!("Loaded {} IP ranges", lower_bounds.len());
|
||||
|
||||
info!("Done!");
|
||||
|
||||
let oauth2_client = BasicClient::new(
|
||||
@ -131,6 +136,7 @@ pub async fn initialize(
|
||||
catchers::not_authorized,
|
||||
catchers::forbidden,
|
||||
catchers::not_found,
|
||||
catchers::legal_reasons,
|
||||
catchers::internal_server_error,
|
||||
catchers::unprocessable_entity,
|
||||
catchers::payload_too_large,
|
||||
|
Reference in New Issue
Block a user