checkLogin(); if (!Session::get('admin', false)) { throw new UnauthorizedException(); } } protected function humanFilesize($size, $precision = 2): string { for ($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) { } return round($size, $precision) . ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'][$i]; } protected function getStorage(): Filesystem { return new Filesystem(new Local(Flight::get('config')['storage_dir'])); } protected function http2push(string $url, string $as = 'image'): void { if (Flight::request()->scheme === 'HTTP/2.0') { $headers = isset(Flight::response()->headers()['Link']) ? Flight::response()->headers()['Link'] : []; $headers[] = "<${url}>; rel=preload; as=${as}"; Flight::response()->header('Link', $headers); } } }