Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ init_diagram: |
"cops:latest" <- Base Images
# changelog
changelogs:
- {date: "14.05.25:", desc: "Existing users should verify: site-confs/default.conf and config/local.php - Clean-up default site conf and local.php."}
- {date: "16.12.24:", desc: "Rebase to Alpine 3.21."}
- {date: "24.09.24:", desc: "Existing users should verify: site-confs/default.conf - Update rewriting rules default site conf."}
- {date: "14.09.24:", desc: "Ensure user config files have the right permissions."}
Expand Down
189 changes: 97 additions & 92 deletions root/defaults/config/local.php
Original file line number Diff line number Diff line change
@@ -1,102 +1,107 @@
<?php
if (!isset($config))
$config = array();
/*
***************************************************
* Please read config_default.php for all possible
* configuration items.
* For changes in config_default.php see CHANGELOG.md
* on the upstream project site.
* https://github.com/mikespub-org/seblucas-cops/blob/main/config_default.php
***************************************************
*/
/*
* The directory containing calibre's metadata.db file, with sub-directories
* containing all the formats.
* BEWARE : it has to end with a /
*/
$config['calibre_directory'] = '/books/';

$config['calibre_internal_directory'] = '/books/';
if (!isset($config)) {
$config = [];
}

/*
* Catalog's title
*/
$config['cops_title_default'] = "COPS";
/*
***************************************************
* Please read config/default.php for all possible
* configuration items.
* For changes in config/default.php see CHANGELOG.md
* on the upstream project site.
* https://github.com/mikespub-org/seblucas-cops/blob/main/config/default.php
***************************************************
*/

/*
* use URL rewriting for downloading of ebook in HTML catalog
* See README for more information
* 1 : enable
* 0 : disable
*/
$config['cops_use_url_rewriting'] = "0";
/*
* The directory containing calibre's metadata.db file, with sub-directories
* containing all the formats.
* BEWARE : it has to end with a /
*/
$config['calibre_directory'] = '/books/';

/*
* Which header to use when downloading books outside the web directory
* Possible values are :
* X-Accel-Redirect : For Nginx
* X-Sendfile : For Lightttpd or Apache (with mod_xsendfile)
* No value (default) : Let PHP handle the download
*/
/*
* Catalog's title
*/
$config['cops_title_default'] = "COPS";

$config['cops_x_accel_redirect'] = "X-Accel-Redirect";
/*
* Which header to use when downloading books outside the web directory
* Possible values are :
* X-Accel-Redirect : For Nginx
* X-Sendfile : For Lightttpd or Apache (with mod_xsendfile)
* No value (default) : Let PHP handle the download
*/
$config['cops_x_accel_redirect'] = "X-Accel-Redirect";

/* Enable cache folder
* especially useful for lower power hosts
*/
$config['cops_thumbnail_handling'] = "";
$config['cops_thumbnail_cache_directory'] = "/config/cache/";
/* Enable cache folder
* especially useful for lower power hosts
*/
$config['cops_thumbnail_handling'] = "";
$config['cops_thumbnail_cache_directory'] = "/config/cache/";

/*
* Enable and configure Send To Kindle (or Email) feature.
*
* Don't forget to authorize the sender email you configured in your Kindle's Approved Personal Document E-mail List.
*
* If you want to use a simple smtp server (provided by your ISP for example), you can configure it like that :
* $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.free.fr",
* "smtp.username" => "",
* "smtp.password" => "",
* "smtp.secure" => "",
* "address.from" => "cops@slucas.fr"
* );
*
* For Gmail (ssl is mandatory) :
* $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.gmail.com",
* "smtp.username" => "YOUR GMAIL ADRESS",
* "smtp.password" => "YOUR GMAIL PASSWORD",
* "smtp.secure" => "ssl",
* "address.from" => "cops@slucas.fr"
* );
*
* You'll also need to enable Allow Less Secure Apps in you Gmail account.
*/
$config['cops_mail_configuration'] = array( "smtp.host" => "",
"smtp.username" => "",
"smtp.password" => "",
"smtp.secure" => "ssl",
"address.from" => "cops@ebook.com"
);
/*
* Enable and configure Send To Kindle (or Email) feature.
*
* Don't forget to authorize the sender email you configured in your Kindle's Approved Personal Document E-mail List.
*
* If you want to use a simple smtp server (provided by your ISP for example), you can configure it like that :
* $config['cops_mail_configuration'] = [
* "smtp.host" => "smtp.free.fr",
* "smtp.username" => "",
* "smtp.password" => "",
* "smtp.secure" => "",
* "smtp.port" => "", // Not mandatory, if smtp.secure is set then defaults to 465
* "address.from" => "cops@slucas.fr",
* "subject" => "Sent by COPS : " // Not mandatory
* ];
*
* For Gmail (ssl is mandatory) :
* $config['cops_mail_configuration'] = [
* "smtp.host" => "smtp.gmail.com",
* "smtp.username" => "YOUR GMAIL ADRESS",
* "smtp.password" => "YOUR GMAIL PASSWORD",
* "smtp.secure" => "ssl",
* "address.from" => "cops@slucas.fr"
* ];
*
* For GMX (tls and 587 is mandatory) :
* $config['cops_mail_configuration'] = [
* "smtp.host" => "mail.gmx.com",
* "smtp.username" => "YOUR GMX ADRESS",
* "smtp.password" => "YOUR GMX PASSWORD",
* "smtp.secure" => "tls",
* "smtp.port" => "587",
* "address.from" => "cops@slucas.fr"
* ];
*/
$config['cops_mail_configuration'] = [
"smtp.host" => "",
"smtp.username" => "",
"smtp.password" => "",
"smtp.secure" => "ssl",
"address.from" => "cops@ebook.com",
];

/*
* Use external 'kepubify' tool to convert .epub files to .kepub.epub format for Kobo
* Example:
* $config['cops_kepubify_path'] = '/usr/bin/kepubify';
*/
//$config['cops_kepubify_path'] = '';
$config['cops_kepubify_path'] = '/usr/bin/kepubify';

/*
* Set front controller to remove index.php/ from route URLs generated in COPS
*
* Note: this assumes your web server config will rewrite /... to /index.php/...
* - Apache: .htaccess
* - Nginx: nginx.conf
* - PHP built-in: router.php
* - ...
*
* @todo update nginx/site-confs/default.conf.sample to make use of front controller
*/
$config['cops_front_controller'] = '';
//$config['cops_front_controller'] = 'index.php';
/*
* Use external 'kepubify' tool to convert .epub files to .kepub.epub format for Kobo
* Example:
* $config['cops_kepubify_path'] = '/usr/bin/kepubify';
*/
//$config['cops_kepubify_path'] = '';
$config['cops_kepubify_path'] = '/usr/bin/kepubify';

/*
* Set front controller to remove index.php/ from route URLs generated in COPS
*
* Note: this assumes your web server config will rewrite /... to /index.php/...
* - Apache: .htaccess
* - Nginx: nginx.conf
* - PHP built-in: router.php
* - ...
*
* @todo update nginx/site-confs/default.conf.sample to make use of front controller
*/
$config['cops_front_controller'] = '';
//$config['cops_front_controller'] = 'index.php';
24 changes: 7 additions & 17 deletions root/defaults/nginx/site-confs/default.conf.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Version 2024/09/24 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
## Version 2025/05/14 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample

server {
listen 80 default_server;
Expand All @@ -13,22 +13,12 @@ server {
root /app/www/public;
index index.html index.htm index.php;

#URL rewriting with COPS - see https://github.com/seblucas/cops/wiki/Url-Rewriting-with-COPS
location /download/ {
#rewrite ^/download/(\d+)/(\d+)/.*\.kepub\.epub$ /index.php/fetch/$2/$1/ignore.epub last;
rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /index.php/fetch/$2/$1/ignore.$3 last;
#rewrite ^/download/(\d+)/.*\.kepub\.epub$ /index.php/fetch/0/$1/ignore.epub last;
rewrite ^/download/(\d+)/.*\.(.*)$ /index.php/fetch/0/$1/ignore.$2 last;
break;
}

location /view/ {
#rewrite ^/view/(\d+)/(\d+)/.*\.kepub\.epub$ /index.php/inline/$2/$1/ignore.epub last;
rewrite ^/view/(\d+)/(\d+)/.*\.(.*)$ /index.php/inline/$2/$1/ignore.$3 last;
#rewrite ^/view/(\d+)/.*\.kepub\.epub$ /index.php/inline/0/$1/ignore.epub last;
rewrite ^/view/(\d+)/.*\.(.*)$ /index.php/inline/0/$1/ignore.$2 last;
break;
}
#URL rewriting with COPS deprecated - see https://github.com/mikespub-org/seblucas-cops/wiki/Url-Rewriting-with-COPS
#location /download/ {
# rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /index.php/fetch/$2/$1/ignore.$3 last;
# rewrite ^/download/(\d+)/.*\.(.*)$ /index.php/fetch/0/$1/ignore.$2 last;
# break;
#}

#Can break loading the images - if you don't see anything, comment
location ~ ^/images.*\.(gif|png|ico|jpg)$ {
Expand Down