From d2d639dcd51ab4a851bbe68799a78ffb1cffebd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sun, 20 Jan 2013 13:49:08 +0100 Subject: [PATCH] Fix default config to reduce the minimum things to change. Removed Nginx limitations which are not true anymore. --- config_default.php | 7 +++---- fetch.php | 9 +++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config_default.php b/config_default.php index 4cb57ee..513ed1b 100644 --- a/config_default.php +++ b/config_default.php @@ -12,17 +12,16 @@ /* * The directory containing calibre's metadata.db file, with sub-directories * containing all the formats. - * If this directory starts with a / EPUB download will only work with Nginx - * and the calibre_internal_directory has to be set properly * BEWARE : it has to end with a / */ $config['calibre_directory'] = './'; /* + * SPECIFIC TO NGINX * The internal directory set in nginx config file - * or the same directory as calibre_directory with X-Sendfile + * Leave empty if you don't know what you're doing */ - $config['calibre_internal_directory'] = '/Calibre/'; + $config['calibre_internal_directory'] = ''; /* * Full URL prefix (with trailing /) diff --git a/fetch.php b/fetch.php index e3cefcb..bbde6fd 100644 --- a/fetch.php +++ b/fetch.php @@ -98,13 +98,18 @@ header('Content-Disposition: attachment; filename="' . basename ($file) . '"'); } + $dir = $config['calibre_internal_directory']; + if (empty ($config['calibre_internal_directory'])) { + $dir = $config['calibre_directory']; + } + if (empty ($config['cops_x_accel_redirect'])) { - $filename = $config['calibre_internal_directory'] . $file; + $filename = $dir . $file; $fp = fopen($filename, 'rb'); header("Content-Length: " . filesize($filename)); fpassthru($fp); } else { - header ($config['cops_x_accel_redirect'] . ": " . $config['calibre_internal_directory'] . $file); + header ($config['cops_x_accel_redirect'] . ": " . $dir . $file); } ?> \ No newline at end of file