Add dark mode support
This commit is contained in:
@@ -42,7 +42,7 @@ impl IpBlocking {
|
||||
fn contains<I: Into<u32>>(&self, ip: I) -> bool {
|
||||
let ip: u32 = ip.into();
|
||||
|
||||
let mut prev_index = self.upper_ips.len() - 1;
|
||||
let _prev_index = self.upper_ips.len() - 1;
|
||||
let mut index = self.upper_ips.len() / 2;
|
||||
loop {
|
||||
if self.upper_ips[index] <= ip && self.lower_ips[index] >= ip {
|
||||
|
||||
+3
-7
@@ -63,8 +63,7 @@ use log::{error, info, warn};
|
||||
use oauth2::{basic::BasicClient, AuthUrl, ClientId, ClientSecret, RedirectUrl, TokenUrl};
|
||||
use poise::serenity_prelude::{
|
||||
client::Context,
|
||||
http::CacheHttp,
|
||||
model::id::{GuildId, UserId},
|
||||
model::id::{ChannelId, GuildId, UserId},
|
||||
};
|
||||
use rocket::{
|
||||
catchers,
|
||||
@@ -76,13 +75,10 @@ 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},
|
||||
fairings::metrics::MetricProducer,
|
||||
};
|
||||
use crate::web::consts::{DISCORD_OAUTH_AUTHORIZE, DISCORD_OAUTH_TOKEN};
|
||||
use crate::web::fairings::metrics::MetricProducer;
|
||||
|
||||
type Database = MySql;
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ mod roles;
|
||||
mod templates;
|
||||
pub mod todos;
|
||||
|
||||
use std::env;
|
||||
|
||||
use crate::utils::check_subscription;
|
||||
use crate::web::guards::transaction::Transaction;
|
||||
use crate::web::{check_authorization, routes::JsonResult};
|
||||
@@ -16,10 +14,7 @@ pub use reminders::*;
|
||||
use rocket::{get, http::CookieJar, serde::json::json, State};
|
||||
pub use roles::get_guild_roles;
|
||||
use serenity::all::UserId;
|
||||
use serenity::{
|
||||
client::Context,
|
||||
model::id::{GuildId, RoleId},
|
||||
};
|
||||
use serenity::{client::Context, model::id::GuildId};
|
||||
pub use templates::*;
|
||||
|
||||
#[get("/api/guild/<id>")]
|
||||
|
||||
@@ -267,9 +267,8 @@ pub async fn edit_reminder(
|
||||
}
|
||||
|
||||
if reminder.channel > 0 {
|
||||
let channel_guild = ChannelId::new(reminder.channel)
|
||||
.to_channel_cached(&ctx.cache)
|
||||
.map(|channel| channel.guild_id);
|
||||
let channel_guild =
|
||||
ctx.cache.channel(ChannelId::new(reminder.channel)).map(|channel| channel.guild_id);
|
||||
match channel_guild {
|
||||
Some(channel_guild) => {
|
||||
let channel_matches_guild = channel_guild.get() == id;
|
||||
|
||||
@@ -3,13 +3,10 @@ use crate::web::{
|
||||
check_authorization,
|
||||
guards::transaction::Transaction,
|
||||
routes::{
|
||||
dashboard::{
|
||||
create_reminder, CreateReminder, ImportBody, ReminderCsv, ReminderTemplateCsv, TodoCsv,
|
||||
},
|
||||
dashboard::{ImportBody, ReminderTemplateCsv},
|
||||
JsonResult,
|
||||
},
|
||||
};
|
||||
use crate::Database;
|
||||
use base64::{prelude::BASE64_STANDARD, Engine};
|
||||
use csv::{QuoteStyle, WriterBuilder};
|
||||
use log::warn;
|
||||
@@ -20,10 +17,7 @@ use rocket::{
|
||||
serde::json::{json, Json},
|
||||
State,
|
||||
};
|
||||
use serenity::{
|
||||
client::Context,
|
||||
model::id::{ChannelId, GuildId, UserId},
|
||||
};
|
||||
use serenity::{client::Context, model::id::GuildId};
|
||||
use sqlx::{MySql, Pool};
|
||||
|
||||
#[get("/api/guild/<id>/export/reminder_templates")]
|
||||
|
||||
@@ -2,9 +2,7 @@ use crate::web::{
|
||||
check_authorization,
|
||||
guards::transaction::Transaction,
|
||||
routes::{
|
||||
dashboard::{
|
||||
create_reminder, CreateReminder, ImportBody, ReminderCsv, ReminderTemplateCsv, TodoCsv,
|
||||
},
|
||||
dashboard::{create_reminder, CreateReminder, ImportBody, ReminderCsv},
|
||||
JsonResult,
|
||||
},
|
||||
};
|
||||
@@ -21,7 +19,7 @@ use rocket::{
|
||||
};
|
||||
use serenity::{
|
||||
client::Context,
|
||||
model::id::{ChannelId, GuildId, UserId},
|
||||
model::id::{GuildId, UserId},
|
||||
};
|
||||
use sqlx::{MySql, Pool};
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
use crate::web::{
|
||||
check_authorization,
|
||||
guards::transaction::Transaction,
|
||||
routes::{
|
||||
dashboard::{
|
||||
create_reminder, CreateReminder, ImportBody, ReminderCsv, ReminderTemplateCsv, TodoCsv,
|
||||
},
|
||||
dashboard::{ImportBody, TodoCsv},
|
||||
JsonResult,
|
||||
},
|
||||
};
|
||||
use crate::Database;
|
||||
use base64::{prelude::BASE64_STANDARD, Engine};
|
||||
use csv::{QuoteStyle, WriterBuilder};
|
||||
use log::warn;
|
||||
@@ -21,7 +17,7 @@ use rocket::{
|
||||
};
|
||||
use serenity::{
|
||||
client::Context,
|
||||
model::id::{ChannelId, GuildId, UserId},
|
||||
model::id::{ChannelId, GuildId},
|
||||
};
|
||||
use sqlx::{MySql, Pool};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user