diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index d9cf56ae7..e9a0dd62e 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -9,10 +9,13 @@ class WebApplication protected $workflowDir = ""; protected $requestUri = ""; + const RUNNING_DEFAULT = "default.running"; + const RUNNING_INDEX = "index.running"; const RUNNING_WORKFLOW = "workflow.running"; const RUNNING_API = "api.running"; - const SERVICE_API = "service.api"; + const SERVICE_API = "service.api"; + const REDIRECT_DEFAULT = "redirect.default"; public function __construct() { @@ -54,7 +57,13 @@ class WebApplication public function route() { - if (substr($this->requestUri, 1, 3) == "api") { + if ($this->requestUri === "/") { + if (file_exists("index.html")) { + return self::RUNNING_INDEX; + } else { + return self::RUNNING_DEFAULT; + } + } elseif (substr($this->requestUri, 1, 3) === "api") { return self::RUNNING_API; } else { return self::RUNNING_WORKFLOW; @@ -64,6 +73,10 @@ class WebApplication public function run($type = "") { switch ($type) { + case self::REDIRECT_DEFAULT: + //TODO we can set a configurable redirect url + header("location: /sys/en/neoclassic/login/login"); + break; case self::SERVICE_API: $request = $this->parseApiRequestUri(); $this->loadEnvironment($request["workspace"]); diff --git a/workflow/public_html/app.php b/workflow/public_html/app.php index 0d6af0c40..2fe4b6161 100644 --- a/workflow/public_html/app.php +++ b/workflow/public_html/app.php @@ -57,6 +57,15 @@ try { case Maveriks\WebApplication::RUNNING_API: $app->run(Maveriks\WebApplication::SERVICE_API); break; + + case Maveriks\WebApplication::RUNNING_INDEX: + $response = new Maveriks\Http\Response(file_get_contents("index.html"), 302); + $response->send(); + break; + + case Maveriks\WebApplication::RUNNING_DEFAULT: + $app->run(Maveriks\WebApplication::REDIRECT_DEFAULT); + break; } } catch (Exception $e) {