Skip to content

Commit 9f708e6

Browse files
committed
clean-up deprecated rewrite rules and config
1 parent 3425435 commit 9f708e6

3 files changed

Lines changed: 105 additions & 109 deletions

File tree

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ init_diagram: |
112112
"cops:latest" <- Base Images
113113
# changelog
114114
changelogs:
115+
- {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."}
115116
- {date: "16.12.24:", desc: "Rebase to Alpine 3.21."}
116117
- {date: "24.09.24:", desc: "Existing users should verify: site-confs/default.conf - Update rewriting rules default site conf."}
117118
- {date: "14.09.24:", desc: "Ensure user config files have the right permissions."}

root/defaults/config/local.php

Lines changed: 97 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,107 @@
11
<?php
2-
if (!isset($config))
3-
$config = array();
4-
/*
5-
***************************************************
6-
* Please read config_default.php for all possible
7-
* configuration items.
8-
* For changes in config_default.php see CHANGELOG.md
9-
* on the upstream project site.
10-
* https://github.com/mikespub-org/seblucas-cops/blob/main/config_default.php
11-
***************************************************
12-
*/
13-
/*
14-
* The directory containing calibre's metadata.db file, with sub-directories
15-
* containing all the formats.
16-
* BEWARE : it has to end with a /
17-
*/
18-
$config['calibre_directory'] = '/books/';
192

20-
$config['calibre_internal_directory'] = '/books/';
3+
if (!isset($config)) {
4+
$config = [];
5+
}
216

22-
/*
23-
* Catalog's title
24-
*/
25-
$config['cops_title_default'] = "COPS";
7+
/*
8+
***************************************************
9+
* Please read config/default.php for all possible
10+
* configuration items.
11+
* For changes in config/default.php see CHANGELOG.md
12+
* on the upstream project site.
13+
* https://github.com/mikespub-org/seblucas-cops/blob/main/config/default.php
14+
***************************************************
15+
*/
2616

27-
/*
28-
* use URL rewriting for downloading of ebook in HTML catalog
29-
* See README for more information
30-
* 1 : enable
31-
* 0 : disable
32-
*/
33-
$config['cops_use_url_rewriting'] = "0";
17+
/*
18+
* The directory containing calibre's metadata.db file, with sub-directories
19+
* containing all the formats.
20+
* BEWARE : it has to end with a /
21+
*/
22+
$config['calibre_directory'] = '/books/';
3423

35-
/*
36-
* Which header to use when downloading books outside the web directory
37-
* Possible values are :
38-
* X-Accel-Redirect : For Nginx
39-
* X-Sendfile : For Lightttpd or Apache (with mod_xsendfile)
40-
* No value (default) : Let PHP handle the download
41-
*/
24+
/*
25+
* Catalog's title
26+
*/
27+
$config['cops_title_default'] = "COPS";
4228

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

45-
/* Enable cache folder
46-
* especially useful for lower power hosts
47-
*/
48-
$config['cops_thumbnail_handling'] = "";
49-
$config['cops_thumbnail_cache_directory'] = "/config/cache/";
38+
/* Enable cache folder
39+
* especially useful for lower power hosts
40+
*/
41+
$config['cops_thumbnail_handling'] = "";
42+
$config['cops_thumbnail_cache_directory'] = "/config/cache/";
5043

51-
/*
52-
* Enable and configure Send To Kindle (or Email) feature.
53-
*
54-
* Don't forget to authorize the sender email you configured in your Kindle's Approved Personal Document E-mail List.
55-
*
56-
* If you want to use a simple smtp server (provided by your ISP for example), you can configure it like that :
57-
* $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.free.fr",
58-
* "smtp.username" => "",
59-
* "smtp.password" => "",
60-
* "smtp.secure" => "",
61-
* "address.from" => "[email protected]"
62-
* );
63-
*
64-
* For Gmail (ssl is mandatory) :
65-
* $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.gmail.com",
66-
* "smtp.username" => "YOUR GMAIL ADRESS",
67-
* "smtp.password" => "YOUR GMAIL PASSWORD",
68-
* "smtp.secure" => "ssl",
69-
* "address.from" => "[email protected]"
70-
* );
71-
*
72-
* You'll also need to enable Allow Less Secure Apps in you Gmail account.
73-
*/
74-
$config['cops_mail_configuration'] = array( "smtp.host" => "",
75-
"smtp.username" => "",
76-
"smtp.password" => "",
77-
"smtp.secure" => "ssl",
78-
"address.from" => "[email protected]"
79-
);
44+
/*
45+
* Enable and configure Send To Kindle (or Email) feature.
46+
*
47+
* Don't forget to authorize the sender email you configured in your Kindle's Approved Personal Document E-mail List.
48+
*
49+
* If you want to use a simple smtp server (provided by your ISP for example), you can configure it like that :
50+
* $config['cops_mail_configuration'] = [
51+
* "smtp.host" => "smtp.free.fr",
52+
* "smtp.username" => "",
53+
* "smtp.password" => "",
54+
* "smtp.secure" => "",
55+
* "smtp.port" => "", // Not mandatory, if smtp.secure is set then defaults to 465
56+
* "address.from" => "[email protected]",
57+
* "subject" => "Sent by COPS : " // Not mandatory
58+
* ];
59+
*
60+
* For Gmail (ssl is mandatory) :
61+
* $config['cops_mail_configuration'] = [
62+
* "smtp.host" => "smtp.gmail.com",
63+
* "smtp.username" => "YOUR GMAIL ADRESS",
64+
* "smtp.password" => "YOUR GMAIL PASSWORD",
65+
* "smtp.secure" => "ssl",
66+
* "address.from" => "[email protected]"
67+
* ];
68+
*
69+
* For GMX (tls and 587 is mandatory) :
70+
* $config['cops_mail_configuration'] = [
71+
* "smtp.host" => "mail.gmx.com",
72+
* "smtp.username" => "YOUR GMX ADRESS",
73+
* "smtp.password" => "YOUR GMX PASSWORD",
74+
* "smtp.secure" => "tls",
75+
* "smtp.port" => "587",
76+
* "address.from" => "[email protected]"
77+
* ];
78+
*/
79+
$config['cops_mail_configuration'] = [
80+
"smtp.host" => "",
81+
"smtp.username" => "",
82+
"smtp.password" => "",
83+
"smtp.secure" => "ssl",
84+
"address.from" => "[email protected]",
85+
];
8086

81-
/*
82-
* Use external 'kepubify' tool to convert .epub files to .kepub.epub format for Kobo
83-
* Example:
84-
* $config['cops_kepubify_path'] = '/usr/bin/kepubify';
85-
*/
86-
//$config['cops_kepubify_path'] = '';
87-
$config['cops_kepubify_path'] = '/usr/bin/kepubify';
88-
89-
/*
90-
* Set front controller to remove index.php/ from route URLs generated in COPS
91-
*
92-
* Note: this assumes your web server config will rewrite /... to /index.php/...
93-
* - Apache: .htaccess
94-
* - Nginx: nginx.conf
95-
* - PHP built-in: router.php
96-
* - ...
97-
*
98-
* @todo update nginx/site-confs/default.conf.sample to make use of front controller
99-
*/
100-
$config['cops_front_controller'] = '';
101-
//$config['cops_front_controller'] = 'index.php';
87+
/*
88+
* Use external 'kepubify' tool to convert .epub files to .kepub.epub format for Kobo
89+
* Example:
90+
* $config['cops_kepubify_path'] = '/usr/bin/kepubify';
91+
*/
92+
//$config['cops_kepubify_path'] = '';
93+
$config['cops_kepubify_path'] = '/usr/bin/kepubify';
10294

95+
/*
96+
* Set front controller to remove index.php/ from route URLs generated in COPS
97+
*
98+
* Note: this assumes your web server config will rewrite /... to /index.php/...
99+
* - Apache: .htaccess
100+
* - Nginx: nginx.conf
101+
* - PHP built-in: router.php
102+
* - ...
103+
*
104+
* @todo update nginx/site-confs/default.conf.sample to make use of front controller
105+
*/
106+
$config['cops_front_controller'] = '';
107+
//$config['cops_front_controller'] = 'index.php';

root/defaults/nginx/site-confs/default.conf.sample

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2024/09/24 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
1+
## Version 2025/05/14 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
22

33
server {
44
listen 80 default_server;
@@ -13,22 +13,12 @@ server {
1313
root /app/www/public;
1414
index index.html index.htm index.php;
1515

16-
#URL rewriting with COPS - see https://github.com/seblucas/cops/wiki/Url-Rewriting-with-COPS
17-
location /download/ {
18-
#rewrite ^/download/(\d+)/(\d+)/.*\.kepub\.epub$ /index.php/fetch/$2/$1/ignore.epub last;
19-
rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /index.php/fetch/$2/$1/ignore.$3 last;
20-
#rewrite ^/download/(\d+)/.*\.kepub\.epub$ /index.php/fetch/0/$1/ignore.epub last;
21-
rewrite ^/download/(\d+)/.*\.(.*)$ /index.php/fetch/0/$1/ignore.$2 last;
22-
break;
23-
}
24-
25-
location /view/ {
26-
#rewrite ^/view/(\d+)/(\d+)/.*\.kepub\.epub$ /index.php/inline/$2/$1/ignore.epub last;
27-
rewrite ^/view/(\d+)/(\d+)/.*\.(.*)$ /index.php/inline/$2/$1/ignore.$3 last;
28-
#rewrite ^/view/(\d+)/.*\.kepub\.epub$ /index.php/inline/0/$1/ignore.epub last;
29-
rewrite ^/view/(\d+)/.*\.(.*)$ /index.php/inline/0/$1/ignore.$2 last;
30-
break;
31-
}
16+
#URL rewriting with COPS deprecated - see https://github.com/mikespub-org/seblucas-cops/wiki/Url-Rewriting-with-COPS
17+
#location /download/ {
18+
# rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /index.php/fetch/$2/$1/ignore.$3 last;
19+
# rewrite ^/download/(\d+)/.*\.(.*)$ /index.php/fetch/0/$1/ignore.$2 last;
20+
# break;
21+
#}
3222

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

0 commit comments

Comments
 (0)