Merge tag '0.7.2-beta' into develop
Add an uglyUrls option that disables URL rewriting (fixes #88) youtube-dl update
This commit is contained in:
commit
764110ac49
6 changed files with 21 additions and 17 deletions
|
@ -77,7 +77,8 @@ class Config
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable URL rewriting.
|
* Disable URL rewriting.
|
||||||
* @var boolean
|
*
|
||||||
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $uglyUrls = false;
|
public $uglyUrls = false;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
/**
|
/**
|
||||||
* UglyRouter class.
|
* UglyRouter class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Alltube;
|
namespace Alltube;
|
||||||
|
|
||||||
use Slim\Router;
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Slim\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend Slim's router class in order to disable URL rewriting.
|
* Extend Slim's router class in order to disable URL rewriting.
|
||||||
|
@ -13,9 +14,9 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||||
class UglyRouter extends Router
|
class UglyRouter extends Router
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Dispatch router for HTTP request
|
* Dispatch router for HTTP request.
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request The current HTTP request object
|
* @param ServerRequestInterface $request The current HTTP request object
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
|
@ -36,23 +37,23 @@ class UglyRouter extends Router
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the path for a named route including the base path
|
* Build the path for a named route including the base path.
|
||||||
*
|
*
|
||||||
* @param string $name Route name
|
* @param string $name Route name
|
||||||
* @param array $data Named argument replacement data
|
* @param array $data Named argument replacement data
|
||||||
* @param array $queryParams Optional query string parameters
|
* @param array $queryParams Optional query string parameters
|
||||||
*
|
*
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @throws \RuntimeException If named route does not exist
|
* @throws \RuntimeException If named route does not exist
|
||||||
* @throws \InvalidArgumentException If required data not provided
|
* @throws \InvalidArgumentException If required data not provided
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function pathFor($name, array $data = [], array $queryParams = [])
|
public function pathFor($name, array $data = [], array $queryParams = [])
|
||||||
{
|
{
|
||||||
$url = str_replace('/', '/?page=', $this->relativePathFor($name, $data, $queryParams));
|
$url = str_replace('/', '/?page=', $this->relativePathFor($name, $data, $queryParams));
|
||||||
|
|
||||||
if ($this->basePath) {
|
if ($this->basePath) {
|
||||||
$url = $this->basePath . $url;
|
$url = $this->basePath.$url;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
|
|
|
@ -84,10 +84,10 @@ class FrontController
|
||||||
$response,
|
$response,
|
||||||
'index.tpl',
|
'index.tpl',
|
||||||
[
|
[
|
||||||
'convert' => $this->config->convert,
|
'convert' => $this->config->convert,
|
||||||
'uglyUrls' => $this->config->uglyUrls,
|
'uglyUrls' => $this->config->uglyUrls,
|
||||||
'class' => 'index',
|
'class' => 'index',
|
||||||
'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
|
'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once __DIR__.'/vendor/autoload.php';
|
require_once __DIR__.'/vendor/autoload.php';
|
||||||
use Alltube\Controller\FrontController;
|
|
||||||
use Alltube\Config;
|
use Alltube\Config;
|
||||||
|
use Alltube\Controller\FrontController;
|
||||||
use Alltube\UglyRouter;
|
use Alltube\UglyRouter;
|
||||||
|
|
||||||
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) {
|
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "alltube",
|
"name": "alltube",
|
||||||
"description": "HTML GUI for youtube-dl",
|
"description": "HTML GUI for youtube-dl",
|
||||||
"version": "0.7.1",
|
"version": "0.7.2-beta",
|
||||||
"author": "Pierre Rudloff",
|
"author": "Pierre Rudloff",
|
||||||
"bugs": "https://github.com/Rudloff/alltube/issues",
|
"bugs": "https://github.com/Rudloff/alltube/issues",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
namespace Alltube\Test;
|
namespace Alltube\Test;
|
||||||
|
|
||||||
use Alltube\UglyRouter;
|
use Alltube\UglyRouter;
|
||||||
use Slim\Http\Request;
|
|
||||||
use Slim\Http\Uri;
|
|
||||||
use Slim\Http\Headers;
|
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
|
use Slim\Http\Headers;
|
||||||
|
use Slim\Http\Request;
|
||||||
use Slim\Http\Stream;
|
use Slim\Http\Stream;
|
||||||
|
use Slim\Http\Uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the UglyRouter class.
|
* Unit tests for the UglyRouter class.
|
||||||
|
@ -35,6 +35,7 @@ class UglyRouterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the dispatch() function.
|
* Test the dispatch() function.
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDispatch()
|
public function testDispatch()
|
||||||
|
@ -56,6 +57,7 @@ class UglyRouterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the pathFor() function.
|
* Test the pathFor() function.
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testPathFor()
|
public function testPathFor()
|
||||||
|
@ -68,11 +70,11 @@ class UglyRouterTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the pathFor() function with a base path.
|
* Test the pathFor() function with a base path.
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testPathForWithBasePath()
|
public function testPathForWithBasePath()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->router->setBasePath('/bar');
|
$this->router->setBasePath('/bar');
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'/bar/?page=foo',
|
'/bar/?page=foo',
|
||||||
|
|
Loading…
Reference in a new issue