Managed Software Center.app 5+ and Client Customization

41 views
Skip to first unread message

Gregory Neagle

unread,
Mar 26, 2019, 4:30:19 PM3/26/19
to munk...@googlegroups.com, 'Gregory Neagle' via munki-discuss
Munki 3.6 includes a brand-new version of Managed Software Center, rewritten in Swift. It also swaps out the old (and deprecated) WebKit WebView with the new WebKit WKWebView.

One of the consequences of this change is that all of the JavaScript integration between the (WK)WebView and the rest of the app has changed.

This can affect any HTML template customization you may have done for Managed Software Center.

https://github.com/munki/munki/wiki/Client-Customization hints pretty heavily that you should avoid customizing html templates other than showcase_template.html, sidebar_template.html, and footer_template.html. B

But even if your customizations are limited to those files, you may have to update your showcase_template.html customizations to work with the changes in Managed Software Center version 5.

Specifically there are changes to the javascript embedded in the default showcase_template.html, and even more specifically the "stageClicked()" function has changed:

function stageClicked() {
    var slide = slides()[currentSlide];
    var target = slide.getAttribute('target');
    var link = slide.getAttribute('href')
    if (target == '_blank') {
        if ('AppController' in window) {
            // MSC < version 5 with WebView
            window.AppController.openExternalLink_(link);
        } else {
            // MSC version 5+ with WKWebView
            window.webkit.messageHandlers.openExternalLink.postMessage(link);
        }
    } else {
        window.location.href = link;
    }
}

Note the conditional branching to deal with different object/method calls for MSC 4 and MSC 5.

If you have made customizations to any of the other HTML templates, it's likely you'll find broken button functionality and other undesired behavior.

-Greg
Reply all
Reply to author
Forward
0 new messages