• Code contributor | Premium

    Updated Plugins gallery

    Thank you @ivo and @marekd for the opportunity to refactor the plugin gallery.

    This is a description of the new features, and specifically on how to provide data via the URL query string.

    Load and Open buttons

    • Load will load the plugin, but not execute the code. Once loaded, clicking this button will open the message box, with the opportunity to view the debug log.
    • Open will load and open the plugin.
    • Loaded plugin cards get a red border.
    • Once a plugin (or more) has been loaded, the option appears to show only loaded plugins.

    Plugin order

    • The plugins can be rearranged by dragging them up or down. The new order is stored in localStorage.

    Autoloading

    • Approved plugins can be prepared to be loaded from the query string:
      www.windy.com/plugins/windy-plugin-pluginName?QUERY.
    • QUERY is structured like this: param1=x& param2=y (no spaces).
    • Once pluginName is confirmed as an approved plugin, the QUERY part is sent to the loaded plugin as a property: W.plugins["windy-plugin-pluginName"].query. You can reach it with this.query.
    • The user is shown a warning message, with the option to return to windy.com, or open the plugin. The purpose of the warning message is to ensure that the user understands that the plugin was created by an external developer, not by Windy.
    • The query data is displayed below the card.
    • The plugin requested to be autoloaded gets a blue border.
    • There is also an option the show all plugins, the requested plugins will remain at the top.
    • Since the order has now changed, rearranging the cards now will not be stored.

    Setting the query string

    • If you wish to set the URL query string from within your plugin, do this:
    import location from '@windy/location';
    import broadcast from '@windy/broadcast';
    
    this.hasURL = true;  
    
    const setQs = qs => {
        location.url(`plugins/${this.ident}?${qs}`); 
    }  
    
    setQs("param1=123&whatever=xyz");
    
    • However, the query string will be overwritten by other processes. You can then reset it with, for instance:
    broadcast.on("pluginOpened",e => {
        if (e==this.ident) setQs("param1=x&whatever=y") 
    })
    

    Listeners added

    • If a plugin is opened:
      • the property lastOpened is set to true.
      • The function onOtherPluginOpened is called (if it has been defined) in the other plugins, with the opened plugin id as parameter. This will allow the author of the other plugin to deactivate listeners and remove elements when their plugin loses focus.
      • The W.plugins.plugins.lastPluginOpened is set to the id of the last opened plugin.

    Other changes

    • The form for the plugins loaded directly from npm, can now be closed.
    • If an unapproved plugin is opened, from the form, a card is created and added to the top of the list. This can also be dragged around, but the position is not stored.
    • It is impossible to pass a query string to the unapproved plugin.
    • The cards can be collapsed, to be viewed as a list.

    Mobile

    • Unfortunately the plugin gallery is not available in the mobile app, due to security reasons.
    • There is also no link in the mobile version of Windy.com to the plugins.
    • It is possible to open a plugin by pasting the plugin URL in the address bar. (thus www.windy.com/plugins)
    • The problem is that clicking on the plugin link ( www.windy.com/plugins ), triggers the installed app on mobile devices.
    • Hopefully, it will be possible in the future to redirect plugins to the default mobile browser.

    Todo

    • Uninstalling / unloading a plugin is complex. Since it is up to the plugin author to remove all the map elements and listeners and CSS changes. The easiest is still to uninstall all plugins.
    • There are still a few small bugs.
  • | Premium

    Thanks for the update and congrats on becoming a code contributor. Would it be possible to just prefill the form at URL https://www.windy.com/plugins/windy-plugin-unknown? I use some niche plugins which are not worth approving and this would allow loading them more easily.

  • Code contributor | Premium

    Hi @jakubvrana

    Thanks. @ivo and the Windy team do not want URL autoloading for unapproved plugins. That was one of the conditions for having autoloading at all. However, I do not think it is difficult to get approval.

  • | Premium

    @rittels You are right. I didn't want some of my plugins to be listed in the gallery as they are not very useful for others. However, I just learned that it's possible to have an approved but unlisted plugin which is fine with me.

Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
NodeBB & contributors, OSM & contributors, HERE maps
Terms and Conditions     Privacy Policy