|
101 | 101 | ->where('id', '([A-z:0-9]+)'); |
102 | 102 | }); |
103 | 103 |
|
104 | | -Route::group(['prefix' => 'twitch', 'as' => 'twitch.', 'middleware' => 'ratelimit:' . env('THROTTLE_RATE_LIMIT', '100,1')], function() { |
105 | | - // Include some extra characters that are used in examples quite often. |
106 | | - // The error returned should hopefully clear up any confusion as to why it doesn't work. |
107 | | - $channelRegex = '([$:{}A-z0-9]{1,50})'; |
| 104 | +Route::group(['prefix' => 'twitch', 'as' => 'twitch.', 'middleware' => ['ratelimit:' . env('THROTTLE_RATE_LIMIT', '100,1'), 'twitch.remove_at_signs']], function() { |
| 105 | + |
| 106 | + /** |
| 107 | + * Include some extra characters that are used in examples quite often. |
| 108 | + * The error returned should hopefully clear up any confusion as to why it doesn't work. |
| 109 | + * |
| 110 | + * `@` is included for when people use `@username` to mention users in bot commands. |
| 111 | + * Normally these would 404, but we're modifying parameters to support it. |
| 112 | + * |
| 113 | + * The prefixed `@` characters are removed in RouteServiceProvider before being passed to the controller method. |
| 114 | + */ |
| 115 | + $channelRegex = '([@$:{}A-z0-9]{1,50})'; |
108 | 116 |
|
109 | 117 | Route::get('/', 'TwitchController@base'); |
110 | 118 |
|
|
215 | 223 |
|
216 | 224 | Route::get('{uptime}/{channel?}', 'TwitchController@uptime') |
217 | 225 | ->where('uptime', '(uptime(\.php)?)') |
218 | | - ->where('channel', '([A-z0-9]){1,25}'); |
| 226 | + ->where('channel', $channelRegex); |
219 | 227 |
|
220 | 228 | Route::get('viewercount/{channel?}', 'TwitchController@viewercount') |
221 | 229 | ->where('channel', $channelRegex); |
|
0 commit comments