Update RestrictedNames

This commit is contained in:
Daniel Supernault 2018-05-22 18:45:13 -06:00
parent ff3925dd1d
commit b6dc212b4d
2 changed files with 40 additions and 11 deletions

View file

@ -4,10 +4,9 @@ namespace App\Util\Lexer;
class RestrictedNames { class RestrictedNames {
static $restricted = [ static $blacklist = [
"about", "about",
"abuse", "abuse",
"admin",
"administrator", "administrator",
"app", "app",
"autoconfig", "autoconfig",
@ -38,16 +37,12 @@ class RestrictedNames {
"faq", "faq",
"faqs", "faqs",
"features", "features",
"federation",
"fediverse",
"ftp", "ftp",
"guest", "guest",
"guests", "guests",
"help", "help",
"horizon",
"hostmaster", "hostmaster",
"hostmaster", "hostmaster",
"i",
"image", "image",
"images", "images",
"imap", "imap",
@ -58,7 +53,6 @@ class RestrictedNames {
"isatap", "isatap",
"it", "it",
"js", "js",
"liltay",
"localdomain", "localdomain",
"localhost", "localhost",
"login", "login",
@ -89,9 +83,6 @@ class RestrictedNames {
"ns8", "ns8",
"ns9", "ns9",
"owner", "owner",
"pixelfed",
"pixelfed-support",
"pixelfed_support",
"pop", "pop",
"pop3", "pop3",
"postmaster", "postmaster",
@ -125,9 +116,38 @@ class RestrictedNames {
"www" "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() 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);
} }
} }

View file

@ -1,9 +1,18 @@
<?php <?php
return [ return [
'version' => '0.1.0', 'version' => '0.1.0',
'nodeinfo' => [ 'nodeinfo' => [
'url' => config('app.url') . '/' . 'api/nodeinfo/2.0.json' 'url' => config('app.url') . '/' . 'api/nodeinfo/2.0.json'
], ],
'memory_limit' => '1024M', 'memory_limit' => '1024M',
'restricted_names' => [
'reserved_routes' => true,
'use_blacklist' => false
],
]; ];