pixelfed/app/Util/Lexer/RestrictedNames.php

202 lines
3.1 KiB
PHP
Raw Normal View History

2018-04-29 16:27:15 +00:00
<?php
namespace App\Util\Lexer;
2018-08-28 03:07:36 +00:00
class RestrictedNames
{
public static $blacklist = [
'about',
'abuse',
'administrator',
'app',
'autoconfig',
'blog',
'broadcasthost',
'community',
'contact',
'contact-us',
'contact_us',
'copyright',
'd',
'dashboard',
'dev',
'developer',
'developers',
'discover',
'discovers',
'doc',
'docs',
'download',
'domainadmin',
'domainadministrator',
'email',
'errors',
'events',
'example',
'faq',
'faqs',
'features',
'ftp',
'guest',
'guests',
'hostmaster',
'hostmaster',
'image',
'images',
'imap',
'img',
'info',
'info',
'is',
'isatap',
'it',
'localdomain',
'localhost',
'mail',
'mailer-daemon',
'mailerdaemon',
'marketing',
'me',
'media',
'mis',
'mx',
'new',
'news',
'news',
'no-reply',
'nobody',
'noc',
'noreply',
'ns0',
'ns1',
'ns2',
'ns3',
'ns4',
'ns5',
'ns6',
'ns7',
'ns8',
'ns9',
'owner',
'pop',
'pop3',
'postmaster',
'pricing',
'privacy',
'root',
'sales',
'security',
'signin',
'signout',
'smtp',
'src',
'ssladmin',
'ssladministrator',
'sslwebmaster',
'sys',
'sysadmin',
'system',
'terms',
'tutorial',
'tutorials',
'usenet',
'uucp',
'webmaster',
'wpad',
2018-04-29 16:27:15 +00:00
];
2018-08-28 03:07:36 +00:00
public static $reserved = [
2018-05-23 00:45:13 +00:00
// Reserved for instance admin
2018-08-28 03:07:36 +00:00
'admin',
2018-09-16 05:15:45 +00:00
'administrator',
2018-05-23 00:45:13 +00:00
// Static Assets
2018-08-28 03:07:36 +00:00
'assets',
'storage',
2018-05-23 00:45:13 +00:00
// Laravel Horizon
2018-08-28 03:07:36 +00:00
'horizon',
2018-05-23 00:45:13 +00:00
// Reserved routes
2018-08-28 03:07:36 +00:00
'account',
'api',
'auth',
2018-12-29 03:39:16 +00:00
'broadcast',
'broadcaster',
2018-08-28 03:07:36 +00:00
'css',
2018-09-16 05:15:45 +00:00
'checkpoint',
2018-12-29 03:39:16 +00:00
'collection',
'collections',
2018-08-28 03:07:36 +00:00
'c',
2018-12-29 03:39:16 +00:00
'cdn',
2018-08-28 03:07:36 +00:00
'dashboard',
'deck',
'discover',
'docs',
2018-12-29 03:39:16 +00:00
'error',
'explore',
2018-08-28 03:07:36 +00:00
'fonts',
'home',
2018-12-29 03:39:16 +00:00
'help',
'helpcenter',
'i',
2018-08-28 03:07:36 +00:00
'img',
'js',
2018-12-29 03:39:16 +00:00
'live',
2018-08-28 03:07:36 +00:00
'login',
'logout',
'media',
2018-12-29 03:39:16 +00:00
'official',
2018-08-28 03:07:36 +00:00
'p',
'password',
2018-12-29 03:39:16 +00:00
'reset',
2018-08-28 03:07:36 +00:00
'report',
'reports',
2018-12-29 03:39:16 +00:00
'robot',
'robots',
2018-08-28 03:07:36 +00:00
'search',
2018-12-29 03:39:16 +00:00
'send',
2018-08-28 03:07:36 +00:00
'settings',
2018-12-29 03:39:16 +00:00
'status',
2018-08-28 03:07:36 +00:00
'statuses',
'site',
'sites',
2018-12-29 03:39:16 +00:00
'static',
'story',
'stories',
'support',
'telescope',
2018-08-28 03:07:36 +00:00
'timeline',
'timelines',
'tour',
'user',
'users',
'vendor',
2018-12-29 03:39:16 +00:00
'ws',
'wss',
'www',
2018-08-28 03:07:36 +00:00
'400',
'401',
'403',
'404',
'500',
'503',
'504',
2018-05-23 00:45:13 +00:00
];
2018-08-28 03:07:36 +00:00
public static function get()
{
$reserved = $blacklist = [];
2018-05-23 00:45:13 +00:00
2018-08-28 03:07:36 +00:00
if (true == config('pixelfed.restricted_names.use_blacklist')) {
$blacklist = self::$blacklist;
}
2018-05-23 00:45:13 +00:00
2018-08-28 03:07:36 +00:00
if (true == config('pixelfed.restricted_names.reserved_routes')) {
$reserved = self::$reserved;
}
2018-04-29 16:27:15 +00:00
2018-08-28 03:07:36 +00:00
return array_merge($blacklist, $reserved);
}
}