Fix default config to reduce the minimum things to change.
Removed Nginx limitations which are not true anymore.
This commit is contained in:
parent
11645b2155
commit
d2d639dcd5
|
@ -12,17 +12,16 @@
|
||||||
/*
|
/*
|
||||||
* The directory containing calibre's metadata.db file, with sub-directories
|
* The directory containing calibre's metadata.db file, with sub-directories
|
||||||
* containing all the formats.
|
* 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 /
|
* BEWARE : it has to end with a /
|
||||||
*/
|
*/
|
||||||
$config['calibre_directory'] = './';
|
$config['calibre_directory'] = './';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* SPECIFIC TO NGINX
|
||||||
* The internal directory set in nginx config file
|
* 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 /)
|
* Full URL prefix (with trailing /)
|
||||||
|
|
|
@ -98,13 +98,18 @@
|
||||||
header('Content-Disposition: attachment; filename="' . basename ($file) . '"');
|
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'])) {
|
if (empty ($config['cops_x_accel_redirect'])) {
|
||||||
$filename = $config['calibre_internal_directory'] . $file;
|
$filename = $dir . $file;
|
||||||
$fp = fopen($filename, 'rb');
|
$fp = fopen($filename, 'rb');
|
||||||
header("Content-Length: " . filesize($filename));
|
header("Content-Length: " . filesize($filename));
|
||||||
fpassthru($fp);
|
fpassthru($fp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
header ($config['cops_x_accel_redirect'] . ": " . $config['calibre_internal_directory'] . $file);
|
header ($config['cops_x_accel_redirect'] . ": " . $dir . $file);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Reference in a new issue