html code like font color don't work anymore

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
User avatar
papoo
Posts: 100
Joined: Friday 22 January 2016 23:14
Target OS: Raspberry Pi
Domoticz version: 4.9
Location: France
Contact:

html code like font color don't work anymore

Post by papoo » Thursday 26 April 2018 21:53

Version: 3.9319
Platform: RPi 3 / stretch
Plugin/Hardware: Lua scripts

Description:
beta version3.9220 displayed the HTML tags correctly in lua script
lua code example

Code: Select all

print ("<font color='#f3031d'>".. s .."</font>")
2018-04-26 21_56_17-Domoticz.png
2018-04-26 21_56_17-Domoticz.png (5.22 KiB) Viewed 1173 times
no longer now with 3.9319
Attachments
2018-04-26 21_50_50-Domoticz.png
2018-04-26 21_50_50-Domoticz.png (11.76 KiB) Viewed 1175 times
2018-04-26 21_50_50-Domoticz.png
2018-04-26 21_50_50-Domoticz.png (11.76 KiB) Viewed 1177 times

User avatar
remb0
Posts: 1002
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: html code like font color don't work anymore

Post by remb0 » Thursday 26 April 2018 22:07

true I saw a commit on github that it is disabled indeed.
don't know why, maybe security/stability or performance.

dannybloe
Posts: 1486
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: html code like font color don't work anymore

Post by dannybloe » Friday 27 April 2018 8:16

The reason why this was removed was for one thing because the log should do one thing and that is show exactly what the log message was without processing the message first. There have been several occasions where people have spent hours trying to figure out what was wrong only to find out that they were looking at artefacts and side-effects of the html interpretation in the logs. I know that colors and such are nice for the logs but it is far more important that items like &param=bla are shown just like that and not like ¶m=bla. Or if you want to log the response of a request containing html characters and you don't see those characters because the browser is trying to do something with it.

And the other reason, you can easily inject all kinds of nasty javascript in there as well so, if you know how this works, you can trigger a log message that would be interpreted by the browser and executes a piece of javascript that disables your alarm system.

So, sorry to mess up your christmas tree :lol: in the logs but this was a necessary change.

Oh.. and using <font>?? Really?? Guess we changed this just before the browsers stopped supporting the <font> tag. :ugeek:
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

User avatar
Egregius
Posts: 2747
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: html code like font color don't work anymore

Post by Egregius » Friday 27 April 2018 8:51

dannybloe wrote:
Friday 27 April 2018 8:16
Oh.. and using <font>?? Really?? Guess we changed this just before the browsers stopped supporting the <font> tag. :ugeek:
<font> is just not a valid HTML5 tag but still valid code and supported by all browsers (wich doesn't mean that one should use it in a website).

User avatar
papoo
Posts: 100
Joined: Friday 22 January 2016 23:14
Target OS: Raspberry Pi
Domoticz version: 4.9
Location: France
Contact:

Re: html code like font color don't work anymore

Post by papoo » Friday 27 April 2018 13:22

dannybloe wrote:
Friday 27 April 2018 8:16


Oh.. and using <font>?? Really?? Guess we changed this just before the browsers stopped supporting the <font> tag. :ugeek:

what else did we have?

what can we replace this feature?

oh great master coding, enlighten us of your knowledge :ugeek:

dannybloe
Posts: 1486
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: html code like font color don't work anymore

Post by dannybloe » Friday 27 April 2018 14:47

Haha. Well html is just not going to work anymore in the logs. Well... at least you can see that your html tags indeed end up in the logs and exactly how :mrgreen:
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

User avatar
papoo
Posts: 100
Joined: Friday 22 January 2016 23:14
Target OS: Raspberry Pi
Domoticz version: 4.9
Location: France
Contact:

Re: html code like font color don't work anymore

Post by papoo » Saturday 28 April 2018 17:09

dannybloe wrote:
Friday 27 April 2018 14:47
Haha. Well html is just not going to work anymore in the logs. Well... :mrgreen:

will this feature can be implemented with a tag that can only be interpreted by the logs (for example)?

User avatar
Brutus
Posts: 326
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Heerlen, The Netherlands
Contact:

Re: html code like font color don't work anymore

Post by Brutus » Sunday 03 June 2018 16:43

I don't see the problem in coloring the log entry's we selve put in the log. It makes it better readable especially when using multiple LUA scripts.
To bad this is removed. Now I can change all my scripts to get rid of the Fonts.
1x Intel NUC D54250WYK (Windows 7 x64)
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
19x Fibaro Modules

dannybloe
Posts: 1486
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: html code like font color don't work anymore

Post by dannybloe » Sunday 03 June 2018 17:50

The problem is not adding the tags in your logs. The problem is that in order to have these tags interpreted by the browser as html the browser is hiding information from the user and does its magic with the log message. It turns the log message into something that wasn't emitted by the initiator. Nice for you to see colors but when shit hits the fan you see something else than the original message. People have complained to spend hours and hours trying to figure out what was wrong with their system only because they didn't see the original log message but something else. You see, it is not just interpreting html code it is also affecting messages as soon as there are special characters in the text like &. And what if you need to show the raw HTML code in the log for instance when a request has failed and the returned request body contains html marking.
Not to mention the security issues you have by injecting script tags that are executed by the browser!

The log should be what it was intended for: showing EXACTLY what the message was that was emitted when things went wrong. If you want colors with your messages then the color setting should not be part of the message but should accompany the message as meta data and Domoticz should interpret this color code and display the RAW message in the desired color.

So, dive into C++, create a lovely pull-request and we can have the most beautiful colors in the log :D
BUT DON"T TOUCH MY MESSAGES :?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

User avatar
Brutus
Posts: 326
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Heerlen, The Netherlands
Contact:

Re: html code like font color don't work anymore

Post by Brutus » Sunday 03 June 2018 18:08

Thnx for the information. I understand the need for the change but... :P

There are now also two colors in use with the log:

- Light blue for "Status" messages and
- Black for everything else.

Isn't it possible to add one extra color for the LUA or Blockly log entry's that we put in? Then you have 3 standard colors and its a little easier to seperate all the log entry's.

Greetings.
1x Intel NUC D54250WYK (Windows 7 x64)
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
19x Fibaro Modules

blauwebuis
Posts: 363
Joined: Wednesday 21 December 2016 10:11
Target OS: Raspberry Pi
Domoticz version: current
Contact:

Re: html code like font color don't work anymore

Post by blauwebuis » Monday 04 June 2018 11:17

Domoticz is full of ancient html.

You could replace <font> with <span style="color:red"> for example.

But then you are still following ancient practices. The whole idea of CSS is that you separate content and styling. So ideally you would do:

<span class="alert">this is an alert</span>

or

<span class="highlighted">this is highlighted<span>

with the style being defined by the theme. So in the css file, add:

.alert {color:red}
.highlighted {color:orange}

This way different themes could create different looks by replacing changing the CSS file.

User avatar
Brutus
Posts: 326
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Heerlen, The Netherlands
Contact:

Re: html code like font color don't work anymore

Post by Brutus » Wednesday 06 June 2018 18:34

blauwebuis wrote:
Monday 04 June 2018 11:17
Domoticz is full of ancient html.

You could replace <font> with <span style="color:red"> for example.

But then you are still following ancient practices. The whole idea of CSS is that you separate content and styling. So ideally you would do:

<span class="alert">this is an alert</span>

or

<span class="highlighted">this is highlighted<span>

with the style being defined by the theme. So in the css file, add:

.alert {color:red}
.highlighted {color:orange}

This way different themes could create different looks by replacing changing the CSS file.
Hi Blauwebuis,

Thnx for your answer. I used your <span> suggestion with this command:

Code: Select all

print ('<span style="color:red">TEST!</span>')
But it doesn't change anything. I think this is also disabled.

You give another option but then you need to edit a css file from the theme that you use.

What file do you need to edit? :roll: "\www\styles\default\..."

- base.css
- custom.css
- extras_and_animations.css
- navigation_main_sidebar.css
- show_version_number.css

*Sidenote to this when you update Domoticz you need to edit the file again.
1x Intel NUC D54250WYK (Windows 7 x64)
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
19x Fibaro Modules

padbol2002
Posts: 1
Joined: Friday 05 October 2018 19:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: html code like font color don't work anymore

Post by padbol2002 » Friday 05 October 2018 19:58

Hello guys


I would like to know if a solution is approaching for the html code in the log ?

it's very useful for debugging...

tx

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests