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")
->from("Route")
->where(new CondBool("active"))
->where(new Regex("^$request$", new Column("request")))
->where(new Regex($request, new Column("request")))
->limit(1)
->execute();

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

@ -84,15 +84,15 @@ if(isset($_GET["api"]) && is_string($_GET["api"])) {
$target = trim(explode("\n", $route["target"])[0]);
switch ($route["action"]) {
case "redirect_temporary":
http_send_status(307);
http_response_code(307);
header("Location: $target");
break;
case "redirect_permanently":
http_send_status(308);
http_response_code(308);
header("Location: $target");
break;
case "static":
http_send_status(501);
http_response_code(501);
$response = "Not implemented yet.";
break;
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-type={"info"} data-place={"bottom"}/>
</th>
<th style={{minWidth: "250px"}}>
<th style={{minWidth: "200px"}}>
Action&nbsp;
<Icon icon={"question-circle"} style={{"color": "#17a2b8"}}
data-tip={"The action to be taken"}