Newbie dashboard

Zero design skills :smile:

Cannot figure out how to embed a weather widget, and a clock for my local time

any tips on doing that will be appreciated

Hello @Ashipa

Nice dashboard! Emoncms dashboards havent had much work in terms of ongoing development for a long time, so it can be a bit limited in terms of what is possible.

Can you copy the html embed code for the weather widget in place of the text > paragraph widget?

I’ve tried that but it won’t save

It appears that it doesn’t accept any embed that has code running inside it

see for example:

<div id="id4007442894b4f" a='{"t":"s","v":"1.2","lang":"en","locs":[1453],"ssot":"c","sics":"ds","cbkg":"#FFFFFF","cfnt":"#000000","slgp":"5","sdr":"tb"}'>Weather Data Source: <a href="https://sharpweather.com/weather_london/30_days/">30 days London weather</a></div><script async src="https://static1.sharpweather.com/widgetjs/?id=id4007442894b4f"></script>

Ah ok, sorry it is a bit limited in what can be done. Is this on emoncms.org or on self install?
If it’s a self install you could always try disabling AntiXSS here https://github.com/emoncms/dashboard/blob/master/dashboard_model.php#L94 which filters this kind of thing for security.

How exactly do i do that?

tried editing the AntiXSS.php file, and also tried moving it, but it doesn’t appear to have had an effect

Hello @Ashipa just tried this here and it did seem to work ok with your example above, though there seems to be a configuration issue with the widget code you shared?

public function set_content($userid, $id, $_content, $height)
{
    $userid = (int) $userid;
    $id = (int) $id;
    $height = (int) $height;
    /*
    // sudo apt-get install php-mbstring
    if (function_exists("mb_convert_encoding")) {
        $axdir = "Modules/dashboard/AntiXSS/php5";
        require_once "$axdir/Bootup.php";
        require_once "$axdir/UTF8.php";
        require_once "$axdir/AntiXSS.php";
        $antiXss = new AntiXSS();
        $nbsp_placeholder = "<!-- START-NON-BREAKING-SPACE --> <!-- END-NON-BREAKING-SPACE -->";
        $_content = str_replace('&nbsp;',$nbsp_placeholder,$_content);
        $content = htmlspecialchars_decode($antiXss->xss_clean($_content));
        $_content = htmlspecialchars_decode($_content);
        if ($content!=$_content) return array('success'=>false, 'message'=>'Error: Invalid dashboard content, content not saved');
        // re-instate the &nbsp; character once all XSS tests are complete
        $content = str_replace($nbsp_placeholder,'&nbsp;',$content);
    } else {
    */
    $content = $_content;
    //}

That worked.

Thank you very much. just made my day brighter

1 Like