ExpiresActive On
@@ -21,7 +23,6 @@ RewriteRule ^(.*)$ https://www.alltubedownload.net/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
-Redirect permanent /api.php /video
-Redirect permanent /extractors.php /extractors
-
-AddOutputFilterByType DEFLATE text/css text/html application/javascript font/truetype
+
+ AddOutputFilterByType DEFLATE text/css text/html application/javascript font/truetype
+
diff --git a/classes/Config.php b/classes/Config.php
index c57c848..a4ff93d 100644
--- a/classes/Config.php
+++ b/classes/Config.php
@@ -75,6 +75,13 @@ class Config
*/
public $curl_params = [];
+ /**
+ * Disable URL rewriting.
+ *
+ * @var bool
+ */
+ public $uglyUrls = false;
+
/**
* YAML config file path.
*
diff --git a/classes/UglyRouter.php b/classes/UglyRouter.php
new file mode 100644
index 0000000..c574480
--- /dev/null
+++ b/classes/UglyRouter.php
@@ -0,0 +1,61 @@
+getUri()->getQuery(), $args);
+ $uri = '/';
+ if (isset($args['page'])) {
+ $uri .= $args['page'];
+ }
+
+ return $this->createDispatcher()->dispatch(
+ $request->getMethod(),
+ $uri
+ );
+ }
+
+ /**
+ * Build the path for a named route including the base path.
+ *
+ * @param string $name Route name
+ * @param array $data Named argument replacement data
+ * @param array $queryParams Optional query string parameters
+ *
+ * @throws \RuntimeException If named route does not exist
+ * @throws \InvalidArgumentException If required data not provided
+ *
+ * @return string
+ */
+ public function pathFor($name, array $data = [], array $queryParams = [])
+ {
+ $url = str_replace('/', '/?page=', $this->relativePathFor($name, $data, $queryParams));
+
+ if ($this->basePath) {
+ $url = $this->basePath.$url;
+ }
+
+ return $url;
+ }
+}
diff --git a/composer.json b/composer.json
index eb602b7..3d91719 100644
--- a/composer.json
+++ b/composer.json
@@ -19,7 +19,7 @@
"squizlabs/php_codesniffer": "~2.7.0",
"phpunit/phpunit": "~5.7.2",
"ffmpeg/ffmpeg": "dev-release",
- "rg3/youtube-dl": "~2016.12.22",
+ "rg3/youtube-dl": "~2017.01.10",
"rudloff/rtmpdump-bin": "~2.3",
"heroku/heroku-buildpack-php": "*"
},
@@ -35,10 +35,10 @@
"type": "package",
"package": {
"name": "rg3/youtube-dl",
- "version": "2016.12.22",
+ "version": "2017.01.10",
"dist": {
"type": "zip",
- "url": "https://github.com/rg3/youtube-dl/archive/2016.12.22.zip"
+ "url": "https://github.com/rg3/youtube-dl/archive/2017.01.10.zip"
}
}
},
diff --git a/composer.lock b/composer.lock
index 660f855..f9f96e3 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "91e14c843bc92c4d5af1ec7abcddf15a",
+ "content-hash": "16268cc5135ed42aedf75446f4e39bd7",
"packages": [
{
"name": "aura/session",
@@ -1466,10 +1466,10 @@
},
{
"name": "rg3/youtube-dl",
- "version": "2016.12.22",
+ "version": "2017.01.10",
"dist": {
"type": "zip",
- "url": "https://github.com/rg3/youtube-dl/archive/2016.12.22.zip",
+ "url": "https://github.com/rg3/youtube-dl/archive/2017.01.10.zip",
"reference": null,
"shasum": null
},
diff --git a/config.example.yml b/config.example.yml
index ca03f0b..7fb80ef 100644
--- a/config.example.yml
+++ b/config.example.yml
@@ -11,3 +11,4 @@ convert: false
avconv: vendor/bin/ffmpeg
rtmpdump: vendor/bin/rtmpdump
curl: /usr/bin/curl
+uglyUrls: false
diff --git a/controllers/FrontController.php b/controllers/FrontController.php
index d42aebc..04734da 100644
--- a/controllers/FrontController.php
+++ b/controllers/FrontController.php
@@ -84,9 +84,10 @@ class FrontController
$response,
'index.tpl',
[
- 'convert' => $this->config->convert,
- 'class' => 'index',
- 'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
+ 'convert' => $this->config->convert,
+ 'uglyUrls' => $this->config->uglyUrls,
+ 'class' => 'index',
+ 'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
]
);
}
diff --git a/index.php b/index.php
index 6db8190..fad0bb0 100644
--- a/index.php
+++ b/index.php
@@ -1,7 +1,9 @@
getContainer();
+$config = Config::getInstance();
+if ($config->uglyUrls) {
+ $container['router'] = new UglyRouter();
+}
$container['view'] = function ($c) {
$view = new \Slim\Views\Smarty(__DIR__.'/templates/');
diff --git a/package.json b/package.json
index ea7dba8..50a9ff1 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "alltube",
"description": "HTML GUI for youtube-dl",
- "version": "0.7.1",
+ "version": "0.7.2-beta",
"author": "Pierre Rudloff",
"bugs": "https://github.com/Rudloff/alltube/issues",
"dependencies": {
diff --git a/templates/index.tpl b/templates/index.tpl
index 93f44eb..66eb1ab 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -12,6 +12,9 @@
+ {if uglyUrls}
+
+ {/if}
{if $convert}
diff --git a/templates/video.tpl b/templates/video.tpl
index 6f11251..678ffbd 100644
--- a/templates/video.tpl
+++ b/templates/video.tpl
@@ -24,6 +24,9 @@