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 {
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);
}
}

View file

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