From 2732180ce21a98d3690fa770fb76eca08601d797 Mon Sep 17 00:00:00 2001 From: mikespub Date: Sun, 1 Sep 2024 13:32:34 +0200 Subject: [PATCH 1/4] update default config_local.php with kepubify path --- readme-vars.yml | 1 + root/defaults/config_local.php | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/readme-vars.yml b/readme-vars.yml index 52c1a7c..446c14e 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -66,6 +66,7 @@ app_setup_block: | # changelog changelogs: + - { date: "01.09.24:", desc: "Existing users should verify: config_local.php - define $config['cops_kepubify_path'] if you want to use it" } - { date: "28.08.24:", desc: "Add kepubify tool to update metadata for Kobo - see mikespub-org/seblucas-cops#77" } - { date: "24.06.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings." } - { date: "07.05.24:", desc: "Existing users should verify: site-confs/default.conf - Fix rewriting rules default site conf." } diff --git a/root/defaults/config_local.php b/root/defaults/config_local.php index 932a9fb..482e1b8 100644 --- a/root/defaults/config_local.php +++ b/root/defaults/config_local.php @@ -32,7 +32,7 @@ */ $config['cops_use_url_rewriting'] = "0"; - /* + /* * Which header to use when downloading books outside the web directory * Possible values are : * X-Accel-Redirect : For Nginx @@ -40,12 +40,14 @@ * No value (default) : Let PHP handle the download */ - $config['cops_x_accel_redirect'] = "X-Accel-Redirect"; + $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/"; + $config['cops_thumbnail_handling'] = ""; + $config['cops_thumbnail_cache_directory'] = "/config/cache/"; + /* * Enable and configure Send To Kindle (or Email) feature. * @@ -69,10 +71,18 @@ * * 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" + ); + + /* + * 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'; - $config['cops_mail_configuration'] = array( "smtp.host" => "", - "smtp.username" => "", - "smtp.password" => "", - "smtp.secure" => "ssl", - "address.from" => "cops@ebook.com" -); From c40c2e4db473136242fcf10544c3e72919de9957 Mon Sep 17 00:00:00 2001 From: mikespub Date: Mon, 9 Sep 2024 15:49:52 +0200 Subject: [PATCH 2/4] update config, run and readme for COPS 3.x --- readme-vars.yml | 11 ++++++----- .../{config_local.php => config/local.php} | 14 ++++++++++++++ .../s6-overlay/s6-rc.d/init-cops-config/run | 19 ++++++++++++++----- 3 files changed, 34 insertions(+), 10 deletions(-) rename root/defaults/{config_local.php => config/local.php} (87%) diff --git a/readme-vars.yml b/readme-vars.yml index 446c14e..b7a518d 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -2,7 +2,7 @@ # project information project_name: cops -project_url: "http://blog.slucas.fr/en/oss/calibre-opds-php-server" +project_url: "https://github.com/mikespub-org/seblucas-cops" project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/cops-icon.png" project_blurb: | [{{ project_name|capitalize }}]({{ project_url }}) by Sébastien Lucas, now maintained by MikesPub, stands for Calibre OPDS (and HTML) Php Server. @@ -13,7 +13,7 @@ project_blurb: | See : [COPS's home]({{ project_url }}) for more details. - Don't forget to check the [Wiki](https://github.com/seblucas/cops/wiki). + Don't forget to check the [Wiki](https://github.com/mikespub-org/seblucas-cops/wiki). ## Why? (taken from the author's site) @@ -36,7 +36,7 @@ project_blurb: | * With Dropbox / owncloud it's very easy to have an up to date OPDS server. * It was fun to code. - If you want to use the OPDS feed don't forget to specify feed.php at the end of your URL. + If you want to use the OPDS feed don't forget to specify /feed at the end of your URL. project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}" @@ -60,12 +60,13 @@ param_ports: # application setup block app_setup_block_enabled: true app_setup_block: | - Access the webui at `http://:80`. For connecting via OPDS on a mobile device use `http://:80/feed.php`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above). + Access the webui at `http://:80`. For connecting via OPDS on a mobile device use `http://:80/index.php/feed`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above). - The linuxserver version gives you access to `config_local.php` in `/config` to customise your install to suit your needs, it also includes the dependencies required to directly view epub books in your browser. + The linuxserver version gives you access to `config/local.php` in `/config` to customise your install to suit your needs, it also includes the dependencies required to directly view epub books in your browser. # changelog changelogs: + - { date: "09.09.24:", desc: "Existing users should move: config_local.php to config/local.php - for COPS 3.x release" } - { date: "01.09.24:", desc: "Existing users should verify: config_local.php - define $config['cops_kepubify_path'] if you want to use it" } - { date: "28.08.24:", desc: "Add kepubify tool to update metadata for Kobo - see mikespub-org/seblucas-cops#77" } - { date: "24.06.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings." } diff --git a/root/defaults/config_local.php b/root/defaults/config/local.php similarity index 87% rename from root/defaults/config_local.php rename to root/defaults/config/local.php index 482e1b8..70c6b0b 100644 --- a/root/defaults/config_local.php +++ b/root/defaults/config/local.php @@ -86,3 +86,17 @@ //$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/etc/s6-overlay/s6-rc.d/init-cops-config/run b/root/etc/s6-overlay/s6-rc.d/init-cops-config/run index 7ac7e35..0ba1e5c 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-cops-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-cops-config/run @@ -4,22 +4,31 @@ # create folders mkdir -p \ /config/cache +# create folders (COPS 3.x) +mkdir -p \ + /config/config -# clear previous config +# clear previous config (COPS 1.x and 2.x) for f in /app/www/public/config_local.*.php; do if [ -f "$f" ]; then rm "$f" fi done +# clear previous config (COPS 3.x) +for f in /app/www/public/config/local.*.php; do + if [ -f "$f" ]; then + rm "$f" + fi +done # copy config -if [[ ! -e /config/config_local.php ]]; then - cp /defaults/config_local.php /config/config_local.php +if [[ ! -e /config/config/local.php ]]; then + cp /defaults/config/local.php /config/config/local.php fi # copy extra user-profiles -for f in /config/config_local*.php; do - cp "$f" /app/www/public/ +for f in /config/config/local*.php; do + cp "$f" /app/www/public/config/ done # permissions From ef086a724ddc7f4e1f66539c2e517bd40596ee13 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:08:08 -0400 Subject: [PATCH 3/4] migrate config to v3 but leave old one in place just in case --- root/etc/s6-overlay/s6-rc.d/init-cops-config/run | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-cops-config/run b/root/etc/s6-overlay/s6-rc.d/init-cops-config/run index 0ba1e5c..f1c98e0 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-cops-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-cops-config/run @@ -23,7 +23,13 @@ done # copy config if [[ ! -e /config/config/local.php ]]; then - cp /defaults/config/local.php /config/config/local.php + if [[ -e /config/config_local.php ]]; then + echo "**** Existing config found, migrating for v3. Please check the contents of /config/config/local.php which will be the active config in v3 ****" + cp /config/config_local.php /config/config/local.php + else + echo "**** New instance detected, generating default config at /config/config/local.php ****" + cp /defaults/config/local.php /config/config/local.php + fi fi # copy extra user-profiles From 2b2ae21f4288458738e09b816c4bd9dc63b5cf85 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:13:58 -0400 Subject: [PATCH 4/4] Update readme-vars.yml --- readme-vars.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme-vars.yml b/readme-vars.yml index b7a518d..1726347 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -66,8 +66,7 @@ app_setup_block: | # changelog changelogs: - - { date: "09.09.24:", desc: "Existing users should move: config_local.php to config/local.php - for COPS 3.x release" } - - { date: "01.09.24:", desc: "Existing users should verify: config_local.php - define $config['cops_kepubify_path'] if you want to use it" } + - { date: "09.09.24:", desc: "In COPS 3.x, the config_local.php is being moved over to config/local.php and this container will automatically migrate it. Existing users should verify: config_local.php and/or config/local.php - define $config['cops_kepubify_path'] if they want to use it" } - { date: "28.08.24:", desc: "Add kepubify tool to update metadata for Kobo - see mikespub-org/seblucas-cops#77" } - { date: "24.06.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings." } - { date: "07.05.24:", desc: "Existing users should verify: site-confs/default.conf - Fix rewriting rules default site conf." }