Customizing Carbonio CE appearance

Carbonio is pretty and modern but you’ll like to have it into your style, with a different background and your logo. Me too!

I’ll show you how to do it, juts follow the steps below.

This way you can have different wallpapers and logo for each domain hosted on your server.

ALERT: all this changes will not survive a version upgrade. So you’ll have to do it after every upgrade

Files specifications

  • Background wallpaper

Type: JPG
Dimensions: 1920×1080 pixels
Filename: wallpaper.jpg

  • Company Logo on Login screen

Type: PNG
Dimensions: 602×108 pixels
Filename: login.png
Background color: white

  • Company Logo inside webmail

Type: PNG
Dimensions: 602×108 pixels
Filename: inside_logo.png
Background color: transparent

Directories structure

This hack requires you to create a specific directory structure, like this:

/opt/zextras/web/logos/example.com/
/opt/zextras/web/logos/otherdomain.com/

Once each domain hosted on your server have it’s own directory copy it’s files into it

Be aware to make links of all virtualhosts you’re using to the domain on that structure. So let’s say you access it using webmail.example.com create a link for it. Like that:

cd /opt/zextras/web/logos/
ln -s example.com webmail.example.com
ln -s example.com mail.example.com

The very same applies to use multiple domains each with it’s own login and wallpaper images. Just create a folder with the name of each domain and then the links for each virtualhost. Like this:

cd /opt/zextras/web/logos/

mkdir domainflowers.com
ln -s domainflowers.com webmail.domainflowers.com

mkdir domaincars.com
ln -s domaincars.com webmail.domaincars.com

Logo and wallpaper images for each domain goes into respectively domain folder.

Customizing login screen

  • Make a backup
cp -a /opt/zextras/web/login /opt/zextras/web/login.orig
  • Finding the right file make the changes

Run the command below to figure which file has the images on it:

grep -l "8b90fe7b942c6f389f1ddd01103d3b0e.jpg" /opt/zextras/web/login/*.js

The result will be something like:

/opt/zextras/web/login/137.js

This is the file you need to use on the commands below, so fix it accordingly.

  • Fixing login javascript file
sed -i '2 i const multidomain = window.location.hostname.toString();' /opt/zextras/web/login/137.js
sed -i s@assets/8b90fe7b942c6f389f1ddd01103d3b0e.jpg@'../logos/"+multidomain+"/wallpaper.jpg'@g /opt/zextras/web/login/137.js
sed -i s@assets/a2ca34c391de073172d480fe7977954a.jpg@'../logos/"+multidomain+"/wallpaper.jpg'@g /opt/zextras/web/login/137.js
sed -i s@assets/c469e23959fd19cc40fbb5e56c083c86.png@'../logos/"+multidomain+"/login.png'@g /opt/zextras/web/login/137.js
  • Fixing in webmail javascript file

Carbonio webmail theme is called Iris and it has many parts. We want to fix a javascript file in there, but we don’t know which one because that “CARBONIO” logo is a svg code inside some file. Run the command below to figure which one needs to be fixed:

grep "M306.721 72.44c-2.884-5.599" /opt/zextras/web/iris/carbonio-shell-ui/* -rl

This will reveal two files: one “js.map” and one “.js“. We want the one that’s just “.js and it will have a name like “index.415ef93c.js”. This number in the file name and it’s path changes accordingly with Carbonio version. In this example I’ll use this file:

/opt/zextras/web/iris/carbonio-shell-ui/bbb2a6e88fd7f7507ae3a6dfad2c8be9c16651d8/752.348ccb23.chunk.js

Do not forget to make a copy of it, so you can restore it if needed.

  • Replacing “svg” entry by “img” entry

To fix that file to replace Carbonio logo by the one you are using on the login page run the command below, replacing the file name by yours.

sed -i '2 i const multidomain = window.location.hostname.toString();' /opt/zextras/web/iris/carbonio-shell-ui/bbb2a6e88fd7f7507ae3a6dfad2c8be9c16651d8/752.348ccb23.chunk.js

sed -i s@createElement\(\"svg\".*402-35.626\"@'createElement("img",(({src:"/static/logos/" + multidomain + "/inside_logo.png",height:"30"'@g /opt/zextras/web/iris/carbonio-shell-ui/bbb2a6e88fd7f7507ae3a6dfad2c8be9c16651d8/752.348ccb23.chunk.js
  • Fixing browser tab title

Run the command below to figure which file has the title on it:

grep "Carbonio Client" /opt/zextras/web/iris/carbonio-shell-ui/* -rl

This will reveal two files: one “js.map” and one “.js“. We want the one that’s just “.js” and it will have a name like “251.e224b936.chunk.js”. This number in the file name and it’s path changes accordingly with Carbonio version. In this example I’ll use this file:

/opt/zextras/web/iris/carbonio-shell-ui/529d97b7f2ac385f0036766b233969818688426f/251.e224b936.chunk.js

Do not forget to make a copy of it, so you can restore it if needed.

Now that we know what file needs to be fixed and we have a copy of it, run te command below replacing “YourSiteName” by the name you want to see on that tab:

sed -i s/"Carbonio Client"/"YourSiteName"/g /opt/zextras/web/iris/carbonio-shell-ui/529d97b7f2ac385f0036766b233969818688426f/251.e224b936.chunk.js

Reload and enjoy!

Contributions

Below you’ll find a quite nice contribution from Maicon Radeschi who decided to automate the thing and make it easier to implement. Thank you very much Maicon!

wget https://www.anahuac.eu/carbonio_customLogo.sh.gz

11 comentários em “Customizing Carbonio CE appearance”

  1. Hola Anáhuac !!!

    Tengo un Escenario de 3 dominios en un Carbonio CE he seguido los pasos de tu manual sin embargo, no se hace referencia a como se direcciona wallpaper_dominio1.jpg, Wallpaper_dominio2.jpg, etc. sin embargo continuando con el proceso al finalizar no ha funcionado.

    Estoy usando la version 24.3

    Un abrazo

    MAX,

  2. Hello ANAHUAC,
    where exactly multidomain word in above commands needs to be replaced with actual domain (id example.com)?
    Or “multidomain” should be used in all of them?

    Thank you!

  3. In multi domain environment, to fix browser tab title

    I want to distinguish “YourSiteName01” and “YourSiteName02” and so on.

    What should I do?

    1. Hello I just change “Carbonio Client” tu multidomain and Woks like a charm
      sed -i s/”Carbonio Client”/”YourSiteName”/g /opt/zextras/web/iris/carbonio-shell-ui/529d97b7f2ac385f0036766b233969818688426f/251.e224b936.chunk.js

      sed -i s/”Carbonio Client”/multidomain/g /opt/zextras/web/iris/carbonio-shell-ui/529d97b7f2ac385f0036766b233969818688426f/251.e224b936.chunk.js <– Chech your correct file

  4. Can anybody tell me how to change login wallpaper.jpg would change at random?
    for example, making photo-stock folder and wallpaper01.jpg , wallpaper02.jpg…and so on.put there.
    and for example, wallpaper015.jpg —–>/opt/zextas/web/logos/wallpaper.jpg (ln -s command?)

    How do I do?I have no idea.
    Tell me that or share info.

    1. Hi, ANAHUAC

      I am FUNIFUNI from Japan. I am sorry for poor English.
      It is self-solving for Former Question of myself.

      In short, I wanted to do like this
      https://github.com/Zimbra-Community/unsplash

      But, “https://source.unsplash.com/random/featured/?nature”
      does not work currently. It returns 404 error and the article above is only for Zimbra.

      Then, I decided to make ‘photo stock’ folder and re-link and resist command to cron.

      (1) mkdir /opt/zextras/web/photostock
      I put some photos in this directory(wallpaper01.jpg/wallpaper02.jpg/and so on)
      (2)find /opt/zextras/web/photostock/*.jpg | sort -R | tail -n 1 | xargs -n 1 sh -c ‘ln -fs $0 /opt/zextras/web/logos/domainflowers.com/wallpaper.jpg’
      This command is to select one photo at random and replace forcibly the link of domainflowres.com’s wallpaper.jpg
      (e.g. wallpaper04.jpg behaves as domainflowers.com’s wallpaper.jpg)
      (3)crontab -e
      */5 * * * * find /opt/zextras/web/photostock/*.jpg | sort -R | tail -n 1 | xargs -n 1 sh -c ‘ln -fs $0 /opt/zextras/web/logos/domainflowers.com/wallpaper.jpg’
      This enable to change login page every 5 minutes.

      Finally I have realized what I wanted. But,
      I don’t have any knowledge of javascript or programing,
      It there are any other ways more smart, please tell me.

      Regars.

  5. Sorry, one more question, please.

    In webmail page, left-upper logos which I change original one.
    I want its logo(inside_logo.png) clickable.
    For example, it can jump to organization’s Official Home Page like zimbra9 OSE.

    Please tell me how to configure?

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *