From ea8846154f31f27692a80377dab8cd43b28fbdfe Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 20 Apr 2021 00:53:22 -0400 Subject: [PATCH] favicon: Redo favicon customization --- CHANGELOG.md | 9 +++++ settings.json.docker | 8 ++-- settings.json.template | 8 ++-- src/node/hooks/express/specialpages.js | 1 + src/node/utils/Settings.js | 9 +++-- src/templates/index.html | 2 +- src/templates/pad.html | 2 +- src/templates/timeslider.html | 2 +- .../backend/specs/favicon-test-custom.png | Bin 0 -> 635 bytes src/tests/backend/specs/favicon.js | 36 ++++++++++++++++++ 10 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 src/tests/backend/specs/favicon-test-custom.png diff --git a/CHANGELOG.md b/CHANGELOG.md index d5441ac48..d28dd816d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# Next release + +### Compatibility changes + +* The `favicon` setting is now interpreted as a pathname to a favicon file, not + a URL. Please see the documentation comment in `settings.json.template`. +* The undocumented `faviconPad` and `faviconTimeslider` settings have been + removed. + # 1.8.13 ### Notable fixes diff --git a/settings.json.docker b/settings.json.docker index 228c70d2a..030ab88f1 100644 --- a/settings.json.docker +++ b/settings.json.docker @@ -80,10 +80,12 @@ "title": "${TITLE:Etherpad}", /* - * favicon default name - * alternatively, set up a fully specified Url to your own favicon + * Pathname of the favicon you want to use. If null, the skin's favicon is + * used if one is provided by the skin, otherwise the default Etherpad favicon + * is used. If this is a relative path it is interpreted as relative to the + * Etherpad root directory. */ - "favicon": "${FAVICON:favicon.ico}", + "favicon": "${FAVICON}", /* * Skin name. diff --git a/settings.json.template b/settings.json.template index 8a676b56d..90a89970c 100644 --- a/settings.json.template +++ b/settings.json.template @@ -71,10 +71,12 @@ "title": "Etherpad", /* - * favicon default name - * alternatively, set up a fully specified Url to your own favicon + * Pathname of the favicon you want to use. If null, the skin's favicon is + * used if one is provided by the skin, otherwise the default Etherpad favicon + * is used. If this is a relative path it is interpreted as relative to the + * Etherpad root directory. */ - "favicon": "favicon.ico", + "favicon": null, /* * Skin name. diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index 725139c09..66ee0221e 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -80,6 +80,7 @@ exports.expressCreateServer = (hookName, args, cb) => { args.app.get('/favicon.ico', (req, res, next) => { (async () => { const fns = [ + ...(settings.favicon ? [path.resolve(settings.root, settings.favicon)] : []), path.join(settings.root, 'src', 'static', 'skins', settings.skinName, 'favicon.ico'), path.join(settings.root, 'src', 'static', 'favicon.ico'), ]; diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 60f4e6442..b31cf16b4 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -50,11 +50,12 @@ console.log('All relative paths will be interpreted relative to the identified ' exports.title = 'Etherpad'; /** - * The app favicon fully specified url, visible e.g. in the browser window + * Pathname of the favicon you want to use. If null, the skin's favicon is + * used if one is provided by the skin, otherwise the default Etherpad favicon + * is used. If this is a relative path it is interpreted as relative to the + * Etherpad root directory. */ -exports.favicon = 'favicon.ico'; -exports.faviconPad = `../${exports.favicon}`; -exports.faviconTimeslider = `../../${exports.favicon}`; +exports.favicon = null; /* * Skin name. diff --git a/src/templates/index.html b/src/templates/index.html index 8f20c08da..4d08312f9 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -8,7 +8,7 @@ - + diff --git a/src/templates/pad.html b/src/templates/pad.html index 7bf2346f9..d7c3c0823 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -39,7 +39,7 @@ - + <% e.begin_block("styles"); %> diff --git a/src/templates/timeslider.html b/src/templates/timeslider.html index b3fd3d006..fe43668c8 100644 --- a/src/templates/timeslider.html +++ b/src/templates/timeslider.html @@ -33,7 +33,7 @@ - + <% e.begin_block("timesliderStyles"); %> diff --git a/src/tests/backend/specs/favicon-test-custom.png b/src/tests/backend/specs/favicon-test-custom.png new file mode 100644 index 0000000000000000000000000000000000000000..9c6532c9610ab912675719e1a896618b7ae6fc65 GIT binary patch literal 635 zcmV->0)+jEP)0M5-E^;aMpPHM>C%wOREX)$uV_IK5nYHG-E@%}Ni>};3$kL7I)|7QY7-+A z6wTS6mCf^uVSzYMD-bQ|V%16)Y)=={%}t{^@ZKE0_u>2Ab3UCe?l5N3BSiz6GL0qz zVJXu{(ZGaBA739ej%FsHi6%59h^Fud1(CwRXl6pJ`F-{lq*KV*d)AMwxs#$3CCm>N1$0OeSPuwE!P3CtNc#5rbF_3kX6W5Ky^{;vYVYHUt(>ew z`}p=eKd@nhc>VGe(9>EG4hYbCDcGJd`)BsV7=pPKL85aPcoHz%FXgQms}&$yrBd94x z<6;C5g$T!Amq`mR({6p*hZsNvG@*poSqd+j5