diff --git a/app/Util/Lexer/RestrictedNames.php b/app/Util/Lexer/RestrictedNames.php index 60cb619be..eb820d40d 100644 --- a/app/Util/Lexer/RestrictedNames.php +++ b/app/Util/Lexer/RestrictedNames.php @@ -4,10 +4,9 @@ namespace App\Util\Lexer; class RestrictedNames { - static $restricted = [ + static $blacklist = [ "about", "abuse", - "admin", "administrator", "app", "autoconfig", @@ -38,16 +37,12 @@ class RestrictedNames { "faq", "faqs", "features", - "federation", - "fediverse", "ftp", "guest", "guests", "help", - "horizon", "hostmaster", "hostmaster", - "i", "image", "images", "imap", @@ -58,7 +53,6 @@ class RestrictedNames { "isatap", "it", "js", - "liltay", "localdomain", "localhost", "login", @@ -89,9 +83,6 @@ class RestrictedNames { "ns8", "ns9", "owner", - "pixelfed", - "pixelfed-support", - "pixelfed_support", "pop", "pop3", "postmaster", @@ -125,9 +116,38 @@ class RestrictedNames { "www" ]; + static $reserved = [ + // Reserved for instance admin + "admin", + + // Static Assets + "assets", + + // Laravel Horizon + "horizon", + + // Reserved route + "i", + + // Official accounts + "pixelfed", + "pixelfed-support", + "pixelfed_support", + ]; + public static function get() { - return self::$restricted; + + $reserved = $blacklist = []; + + if(true == config('pixelfed.restricted_names.use_blacklist')) { + $blacklist = self::$blacklist; + } + + if(true == config('pixelfed.restricted_names.reserved_routes')) { + $reserved = self::$reserved; + } + return array_merge($blacklist, $reserved); } } \ No newline at end of file diff --git a/config/pixelfed.php b/config/pixelfed.php index 90e4ded13..0887ca15f 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -1,9 +1,18 @@ '0.1.0', + 'nodeinfo' => [ 'url' => config('app.url') . '/' . 'api/nodeinfo/2.0.json' ], + 'memory_limit' => '1024M', + + 'restricted_names' => [ + 'reserved_routes' => true, + 'use_blacklist' => false + ], + ]; \ No newline at end of file