A lot of changes in /web
* Moved /web endpoint to /app + created a link * Create kernel includer for pages
This commit is contained in:
parent
7e0abcbc17
commit
56bca7e0a0
|
@ -4,7 +4,7 @@ server {
|
|||
server_name _;
|
||||
|
||||
# Web client
|
||||
location ~ ^(/$|/@|/web) {
|
||||
location ~ ^(/$|/@|/app) {
|
||||
proxy_buffering off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../index.php
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
function s($name) {
|
||||
echo $name;
|
||||
}
|
|
@ -1,11 +1,35 @@
|
|||
<?php
|
||||
|
||||
$uri = trim($_SERVER['REQUEST_URI']);
|
||||
chdir( $_SERVER['DOCUMENT_ROOT'] );
|
||||
|
||||
define('PROD', 'prod');
|
||||
define('DEV', 'dev');
|
||||
$env = getenv('ENV');
|
||||
if (!in_array($env, [PROD, DEV]))
|
||||
$env = DEV;
|
||||
putenv('env='.$env);
|
||||
|
||||
|
||||
$uri = rtrim(trim($_SERVER['REQUEST_URI']),'/');
|
||||
$simple_uri = preg_replace('/^\/app\//', '/', $uri);
|
||||
|
||||
function req_pub($name) { require "public/$name.php"; die; }
|
||||
function redirect($url) { header('Location: '.$url); die; }
|
||||
|
||||
|
||||
# Public URLs
|
||||
switch ($simple_uri)
|
||||
{
|
||||
case '/': req_pub('home');
|
||||
case '/login': req_pub('login');
|
||||
}
|
||||
|
||||
|
||||
# Example: /@username
|
||||
if (preg_match('/^\/\@[a-zA-Z0-9\-\_]+/', $uri))
|
||||
{
|
||||
if ($_SERVER['HTTP_ACCEPT'] === 'application/activity+json') {
|
||||
header('Location: /u/'.substr($uri, 2)); die();
|
||||
}
|
||||
if ($_SERVER['HTTP_ACCEPT'] === 'application/activity+json')
|
||||
redirect( substr($uri, 2) );
|
||||
|
||||
req_pub('profile');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?php require 'base.php' ?>
|
||||
<?php
|
||||
|
||||
?>
|
||||
<form id="login">
|
||||
<span>Email</span>
|
||||
<input type="email" name="email" /><br>
|
||||
<span>Password</span>
|
||||
<input type="password" name="password" /><br>
|
||||
<input type="submit" value="<?php s('log_in') ?>" />
|
||||
</form>
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
echo 'PROFILE';
|
Loading…
Reference in New Issue