Visual cleanup of routes.rs since it was basically just... awful, more cleanup one day

This commit is contained in:
shockrah 2020-11-16 23:12:32 -08:00
parent 75fcd5aef5
commit 474696eb4b

View File

@ -1,26 +1,30 @@
// TODO: this whole ass module bro i mean c'mon.... just just clean it
pub const INVITE_CREATE: &'static str = "/invite/create"; // requires none
type rstr = &'static str;
pub const CHANNELS_LIST: &'static str = "/channels/list"; // requires none
pub const CHANNELS_CREATE: &'static str = "/channels/create"; // requires @name @kind
pub const CHANNELS_DELETE: &'static str = "/channels/delete"; // requires @name
pub const INVITE_CREATE: tstr = "/invite/create"; // @ perms::CREATE_INVITE
pub const MESSAGE_SEND: &'static str = "/message/send"; // requires @content
pub const CHANNELS_LIST: tstr = "/channels/list"; // requires none
pub const CHANNELS_CREATE: tstr = "/channels/create"; // requires @name @kind perms::CREATE_CHANNEl
pub const CHANNELS_DELETE: tstr = "/channels/delete"; // requires @name perms::DELETE_CHANNEL
pub const SERVER_META: &'static str = "/meta"; // open
pub const MESSAGE_SEND: tstr = "/message/send"; // requires @content perms::MESSAGE_SEND
pub const GET_ONLINE_MEMBERS: &'static str = "/members/get_online";
// @requires: admin permissions
//
pub const SET_PERMS_BY_ADMIN: &'static str = "/admin/setpermisions";
pub const SET_NEW_ADMIN: &'static str = "/owner/newadmin"; // @requiers: owner perms
pub const GET_ONLINE_MEMBERS: tstr = "/members/get_online";
// ADMIN ROUTES
pub const SET_PERMS_BY_ADMIN: tstr = "/admin/setpermisions"; // @requires perms::ADMIN
pub const SET_NEW_ADMIN: tstr = "/owner/newadmin"; // @requiers: owner perms
// TODO: here be dragons...
// potentially adding more bases later
pub const DYNAMIC_ROUTE_BASES: [(&'static str, bool);3] = [
pub const DYNAMIC_ROUTE_BASES: [(tstr, bool);3] = [
("/join", true), // open
("/public", true), // open : valid sections := neighbors|rules|description
("/user", false), // TODO: valid sections := /meta/<name>|/dm/<name>
];
pub const DYN_JOIN: &'static str = DYNAMIC_ROUTE_BASES[0].0;
pub const DYN_JOIN: tstr = DYNAMIC_ROUTE_BASES[0].0;
pub struct DynRoute {
pub base: String,