From 13ca93f4238f521b267df7e4fc50a7a18efd19f0 Mon Sep 17 00:00:00 2001 From: Banana Date: Sun, 10 Dec 2023 19:10:02 +0100 Subject: [PATCH] central user-agent and browser info in config. Remove from tools --- CHANGELOG | 2 +- TODO | 1 - upgrade/from-version-1.5.txt | 16 +++++++++++++--- webclient/config/config-googlebooks.php.default | 6 +++--- webclient/config/config-imdbweb.php.default | 6 +++--- webclient/config/config-musicbrainz.php.default | 6 +++--- webclient/config/config.php.default | 5 +++++ 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3bc373b..360c593 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,5 @@ 1.x - Chizra - * Config change. Added new entry. See upgrade/from-version-1.5.txt. It won't work if it is missing. + * Config change. Added new entries. See upgrade/from-version-1.5.txt. It won't work if it is missing. * Licence change to GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 * Cleanups * Fixed: #21 Debug? string in error log diff --git a/TODO b/TODO index 2dd355a..ec684d7 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ ** https://watercss.kognise.dev/ * create a real fallback theme, which does not depend on any styling/css ** change the css and js lookup too in main file -* central user-agent and browser info in config. Remove from tools * i18n support * Automatic upgrades of DB * drop in updates diff --git a/upgrade/from-version-1.5.txt b/upgrade/from-version-1.5.txt index 2a1fe5d..007e8a8 100644 --- a/upgrade/from-version-1.5.txt +++ b/upgrade/from-version-1.5.txt @@ -1,3 +1,13 @@ -# Added new const to config.php file. -Use config.php.default as a help. The new line is: -const LOGFILE = PATH_SYSTEMOUT.'/bibliotheca.log'; \ No newline at end of file +## Added new constants to config.php file. +Use config.php.default as a help. The new lines are: +const LOGFILE = PATH_SYSTEMOUT.'/bibliotheca.log'; + +# CURL browser settings +const BROWSER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0'; +const BROWSER_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; +const BROWSER_ACCEPT_LANG = 'en-US,en;q=0.5'; + + +## Updated tools configs +Please compare the default config files for googlebooks, imdbweb and musicbrainz and make the required +changes. diff --git a/webclient/config/config-googlebooks.php.default b/webclient/config/config-googlebooks.php.default index 15506c1..f4bccbf 100644 --- a/webclient/config/config-googlebooks.php.default +++ b/webclient/config/config-googlebooks.php.default @@ -30,9 +30,9 @@ * TOOL_GOOGLEBOOKS_BROWSER_ACCEPT_LANG should define in which language the content returns */ -const TOOL_GOOGLEBOOKS_BROWSER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0'; -const TOOL_GOOGLEBOOKS_BROWSER_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; -const TOOL_GOOGLEBOOKS_BROWSER_ACCEPT_LANG = 'en-US,en;q=0.5'; +const TOOL_GOOGLEBOOKS_BROWSER_AGENT = BROWSER_AGENT; +const TOOL_GOOGLEBOOKS_BROWSER_ACCEPT = BROWSER_ACCEPT; +const TOOL_GOOGLEBOOKS_BROWSER_ACCEPT_LANG = BROWSER_ACCEPT_LANG; const TOOL_GOOGLEBOOKS_FIELDS_TO = array( 'title' => 'title', diff --git a/webclient/config/config-imdbweb.php.default b/webclient/config/config-imdbweb.php.default index 5471b77..6523918 100644 --- a/webclient/config/config-imdbweb.php.default +++ b/webclient/config/config-imdbweb.php.default @@ -51,6 +51,6 @@ const TOOL_IMDBWEB_FIELDS_TO = array( ); */ -const TOOL_IMDBWEB_BROWSER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0'; -const TOOL_IMDBWEB_BROWSER_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; -const TOOL_IMDBWEB_BROWSER_ACCEPT_LANG = 'en-US,en;q=0.5'; +const TOOL_IMDBWEB_BROWSER_AGENT = BROWSER_AGENT; +const TOOL_IMDBWEB_BROWSER_ACCEPT = BROWSER_ACCEPT; +const TOOL_IMDBWEB_BROWSER_ACCEPT_LANG = BROWSER_ACCEPT_LANG; diff --git a/webclient/config/config-musicbrainz.php.default b/webclient/config/config-musicbrainz.php.default index d24d920..589b132 100644 --- a/webclient/config/config-musicbrainz.php.default +++ b/webclient/config/config-musicbrainz.php.default @@ -31,9 +31,9 @@ * TOOL_BRAINZ_RESULT_LIMIT How many entries the search will display */ -const TOOL_BRAINZ_BROWSER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0'; -const TOOL_BRAINZ_BROWSER_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; -const TOOL_BRAINZ_BROWSER_ACCEPT_LANG = 'en-US,en;q=0.5'; +const TOOL_BRAINZ_BROWSER_AGENT = BROWSER_AGENT; +const TOOL_BRAINZ_BROWSER_ACCEPT = BROWSER_ACCEPT; +const TOOL_BRAINZ_BROWSER_ACCEPT_LANG = BROWSER_ACCEPT_LANG; const TOOL_BRAINZ_RESULT_LIMIT = 10; diff --git a/webclient/config/config.php.default b/webclient/config/config.php.default index 17b878b..127c2c9 100644 --- a/webclient/config/config.php.default +++ b/webclient/config/config.php.default @@ -57,3 +57,8 @@ const ANON_GROUP_ID = '3'; # view options const RESULTS_PER_PAGE = 24; + +# CURL browser settings +const BROWSER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0'; +const BROWSER_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'; +const BROWSER_ACCEPT_LANG = 'en-US,en;q=0.5'; -- 2.39.5