From cc8a864f5a8b5ad07d81a1cb3747a5b3f3aaa120 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 17 Jun 2015 17:52:53 +0930 Subject: [PATCH] Back to nginx for now, split up index/admin entries --- Vagrantfile | 4 ++-- admin.php | 28 ++++++++++++++++++++++++++++ api.php | 2 +- index.php | 9 +-------- 4 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 admin.php diff --git a/Vagrantfile b/Vagrantfile index 14dc17b..7f4e43c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -193,10 +193,10 @@ Vagrant.configure("2") do |config| ########## # Provision Apache Base - config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] + # config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url] # Provision Nginx Base - # config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url] + config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url] #### diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..e961bb6 --- /dev/null +++ b/admin.php @@ -0,0 +1,28 @@ +register('Flarum\Admin\AdminServiceProvider'); + +$admin = new MiddlewarePipe(); +$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin')); +$admin->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')])); +$admin->pipe(new \Franzl\Middleware\Whoops\Middleware()); + +$server = Server::createServer( + $admin, + $_SERVER, + $_GET, + $_POST, + $_COOKIE, + $_FILES +); + +$server->listen(); diff --git a/api.php b/api.php index f55f7d6..e0df5e7 100644 --- a/api.php +++ b/api.php @@ -16,7 +16,7 @@ $api = new MiddlewarePipe(); $api->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters')); $api->pipe($app->make('Flarum\Api\Middleware\LoginWithHeader')); -$api->pipe('api.php', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.api.routes')])); +$api->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.api.routes')])); $api->pipe(new \Franzl\Middleware\Whoops\Middleware()); $server = Server::createServer( diff --git a/index.php b/index.php index 7574568..29610f7 100644 --- a/index.php +++ b/index.php @@ -10,19 +10,12 @@ $app = require __DIR__.'/system/bootstrap.php'; // Set up everything we need for the frontend $app->register('Flarum\Forum\ForumServiceProvider'); -$app->register('Flarum\Admin\AdminServiceProvider'); // Build a middleware pipeline for Flarum $flarum = new MiddlewarePipe(); $flarum->pipe($app->make('Flarum\Forum\Middleware\LoginWithCookie')); $flarum->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters')); - -$admin = new MiddlewarePipe(); -$admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin')); -$admin->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.admin.routes')])); - -$flarum->pipe('/admin.php', $admin); -$flarum->pipe('/index.php', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.forum.routes')])); +$flarum->pipe($app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.forum.routes')])); $flarum->pipe(new \Franzl\Middleware\Whoops\Middleware()); $server = Server::createServer(