From 9f708e6f230e5ca0791115889c773f8da876db36 Mon Sep 17 00:00:00 2001 From: mikespub Date: Wed, 14 May 2025 13:02:03 +0200 Subject: [PATCH] clean-up deprecated rewrite rules and config --- readme-vars.yml | 1 + root/defaults/config/local.php | 189 +++++++++--------- .../nginx/site-confs/default.conf.sample | 24 +-- 3 files changed, 105 insertions(+), 109 deletions(-) diff --git a/readme-vars.yml b/readme-vars.yml index c64fdbe..0a25ff6 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -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."} diff --git a/root/defaults/config/local.php b/root/defaults/config/local.php index 70c6b0b..2b7572b 100644 --- a/root/defaults/config/local.php +++ b/root/defaults/config/local.php @@ -1,102 +1,107 @@ "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'; diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 6031005..61c6aef 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -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; @@ -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)$ {