get('/about', mkiRedirect('/')); $router->get('/about.html', mkiRedirect('/')); $router->get('/about.php', mkiRedirect('/')); $router->get('/index.php', mkiRedirect('/')); $router->get('/index.html', mkiRedirect('/')); $router->get('/365', mkiRedirect('/?fw365')); $router->get('/donate', mkiRedirect('https://paypal.me/flashwave')); $router->get('/header-bgs.json', function() { return json_encode(FM_BGS); }); $router->get('/now-listening', function() { $offset = (int)filter_input(INPUT_GET, 'offset', FILTER_SANITIZE_NUMBER_INT); $body = fm_component('header', [ 'title' => 'flash.moe / now listening', 'do_fullscreen_header' => true, 'is_now_playing' => true, 'offset' => $offset, ]); $body .= fm_component('footer', [ 'hide' => true, 'onload' => [ ['fm.initIndex', 10], ], ]); return $body; }); $router->get('/now-listening.json', function() { $lfmInfo = cache_output('lastfm', 10, function() { return json_decode(file_get_contents('https://now.flash.moe/get.php?u=flashwave_')); }); if(empty($lfmInfo[0]->name)) return []; $lfmInfo = $lfmInfo[0]; return [ 'name' => strval($lfmInfo->name), 'now_playing' => !empty($lfmInfo->nowplaying), 'url' => strval($lfmInfo->url), 'cover' => !empty($lfmInfo->images->large) ? strval($lfmInfo->images->large) : '', 'artist' => [ 'name' => !empty($lfmInfo->artist->name) ? strval($lfmInfo->artist->name) : '', 'url' => explode('/_/', strval($lfmInfo->url))[0], ], ]; }); $router->get('/np.php', function() { header('Content-Type: text/xml'); return cache_output('lastfm-xml', 10, function() { return file_get_contents('https://now.flash.moe/get.php?u=flashwave_&f=xml'); }); }); $router->get('/home', function() { $body = fm_component('header', [ 'title' => 'flash.moe / homepage', 'do_fullscreen_header' => true, ]); $body .= <<