Routes fix

This commit is contained in:
Roman Hergenreder 2020-06-19 18:36:30 +02:00
parent 2d786b425d
commit abb8b07a02
5 changed files with 7 additions and 7 deletions

@ -34,7 +34,7 @@ class Find extends Request {
->select("uid", "request", "action", "target", "extra") ->select("uid", "request", "action", "target", "extra")
->from("Route") ->from("Route")
->where(new CondBool("active")) ->where(new CondBool("active"))
->where(new Regex("^$request$", new Column("request"))) ->where(new Regex($request, new Column("request")))
->limit(1) ->limit(1)
->execute(); ->execute();

@ -129,7 +129,7 @@ class CreateDatabase {
->primaryKey("uid"); ->primaryKey("uid");
$queries[] = $sql->insert("Route", array("request", "action", "target")) $queries[] = $sql->insert("Route", array("request", "action", "target"))
->addRow("/admin(/.*)?", "dynamic", "\\Documents\\AdminDashboard"); ->addRow("^/admin(/.*)?$", "dynamic", "\\Documents\\AdminDashboard");
return $queries; return $queries;
} }

@ -84,15 +84,15 @@ if(isset($_GET["api"]) && is_string($_GET["api"])) {
$target = trim(explode("\n", $route["target"])[0]); $target = trim(explode("\n", $route["target"])[0]);
switch ($route["action"]) { switch ($route["action"]) {
case "redirect_temporary": case "redirect_temporary":
http_send_status(307); http_response_code(307);
header("Location: $target"); header("Location: $target");
break; break;
case "redirect_permanently": case "redirect_permanently":
http_send_status(308); http_response_code(308);
header("Location: $target"); header("Location: $target");
break; break;
case "static": case "static":
http_send_status(501); http_response_code(501);
$response = "Not implemented yet."; $response = "Not implemented yet.";
break; break;
case "dynamic": case "dynamic":

2
js/admin.min.js vendored

File diff suppressed because one or more lines are too long

@ -133,7 +133,7 @@ export default class PageOverview extends React.Component {
data-tip={"The request, the user is making. Can also be interpreted as a regular expression."} data-tip={"The request, the user is making. Can also be interpreted as a regular expression."}
data-type={"info"} data-place={"bottom"}/> data-type={"info"} data-place={"bottom"}/>
</th> </th>
<th style={{minWidth: "250px"}}> <th style={{minWidth: "200px"}}>
Action&nbsp; Action&nbsp;
<Icon icon={"question-circle"} style={{"color": "#17a2b8"}} <Icon icon={"question-circle"} style={{"color": "#17a2b8"}}
data-tip={"The action to be taken"} data-tip={"The action to be taken"}