Skip to content

Commit

Permalink
Get things out of /frontend, closes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
bojidar-bg committed Aug 9, 2016
1 parent 6b94cbf commit 1a58a48
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,5 +1,5 @@
vendor/**
logs/**
logs/**/*.log
src/settings-local.php

**/bower_components/**
3 changes: 2 additions & 1 deletion frontend/.htaccess → .htaccess
Expand Up @@ -4,7 +4,8 @@ RewriteEngine On
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
RewriteBase /asset-library/frontend

RewriteBase /asset-library

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
2 changes: 2 additions & 0 deletions data/.htaccess
@@ -0,0 +1,2 @@
Order allow,deny
Deny from all
3 changes: 0 additions & 3 deletions frontend/index.php

This file was deleted.

4 changes: 4 additions & 0 deletions index.php
@@ -0,0 +1,4 @@
<?php
$frontend = true;
include(__DIR__ . '/api/index.php');

2 changes: 2 additions & 0 deletions logs/.htaccess
@@ -0,0 +1,2 @@
Order allow,deny
Deny from all

This comment has been minimized.

Copy link
@akien-mga

akien-mga Aug 9, 2016

Member

All your logs are no longer belong to us.

1 change: 0 additions & 1 deletion logs/README.md

This file was deleted.

2 changes: 2 additions & 0 deletions src/.htaccess
@@ -0,0 +1,2 @@
Order allow,deny
Deny from all
6 changes: 3 additions & 3 deletions src/middleware.php
Expand Up @@ -48,7 +48,7 @@

if(isset($result['url'])) {
$response = new \Slim\Http\Response(303);
$response = $response->withHeader('Location', dirname($request->getUri()->getBasePath()) . '/frontend/' . $result['url']);
$response = $response->withHeader('Location', $request->getUri()->getBasePath() . '/' . $result['url']);
} else {
$template_names = [
//'/configure' => 'configure',
Expand Down Expand Up @@ -77,8 +77,8 @@
$errorResponse = new \Slim\Http\Response();
$params = [
'data' => $result,
'basepath' => dirname($request->getUri()->getBasePath()) . '/frontend',
'bowerpath' => dirname($request->getUri()->getBasePath()) . '/bower_components',
'basepath' => $request->getUri()->getBasePath(). '',
'bowerpath' => $request->getUri()->getBasePath() . '/bower_components',
'path' => $path,
'params' => $request->getQueryParams(),
'categories' => [], // Filled later
Expand Down
6 changes: 4 additions & 2 deletions src/routes/auth.php
Expand Up @@ -3,7 +3,7 @@


// Initializes the connection by sending all categories available
$app->get('/configure', function ($request, $response, $args) {
$app->get('/configure', function ($request, $response, $args) { global $frontend;
$params = $request->getQueryParams();

$category_type = $this->constants['category_type']['addon'];
Expand All @@ -28,7 +28,9 @@
return $response->withJson([
'categories' => $query->fetchAll(),
'token' => $token,
'login_url' => $_SERVER['HTTP_HOST'] . dirname($request->getUri()->getBasePath()) . 'frontend/login#' . urlencode($token),
'login_url' => $_SERVER['HTTP_HOST'] .
(isset($frontend) && $frontend ? dirname($request->getUri()->getBasePath()) : $request->getUri()->getBasePath()) .
'/login#' . urlencode($token),
// ^ TODO: Make those routes actually work
], 200);

Expand Down
2 changes: 2 additions & 0 deletions templates/.htaccess
@@ -0,0 +1,2 @@
Order allow,deny
Deny from all
2 changes: 1 addition & 1 deletion templates/_header.phtml
Expand Up @@ -31,7 +31,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/asset-library/frontend">Godot Asset Library</a>
<a class="navbar-brand" href="<?php echo $basepath ?>">Godot Asset Library</a>
</div>

<?php global $gPaths; $gPaths = [$basepath, $path]; function make_nav_link($name, $link='#') { global $gPaths; ?>
Expand Down

0 comments on commit 1a58a48

Please sign in to comment.