Information Panel iOS 4.9.3+ Mac 5.7.5+

Surge iOS and Surge Mac let you customize one or more information panels. On iOS, panels are shown in the policy selection view. On Mac, they are available from the Panels submenu in Surge's menu bar menu. A panel can display static text from the profile or dynamic content generated by a script.

On iOS, this feature requires an active subscription that expires after September 22, 2021. If the subscription expires while a [Panel] profile section is still configured, the panel will not be displayed, but this does not affect the normal use of other features.

Example:

[Panel]
PanelA = title="Panel Title",content="Panel Content\nSecondLine",style=info

The supported style values are good, info, alert, and error.

PanelA is the name of the information panel. This name is passed to the script in script mode.

Static Mode

The panel generated by the configuration above is static. It can be used with a managed or enterprise profile to update panel content when the profile updates. See Managed Profile.

Dynamic Mode

The contents of the panel can be updated by a script.

[Panel]
PanelB = title="Panel Title",content="Panel Content\nSecondLine",style=info,script-name=panel

[Script]
panel = script-path=panel.js,type=generic

Generic scripts can update panels. When the user taps the refresh button, the script is evaluated with these parameters:

$input : {
    purpose: "panel",
    position: "policy-selection",
    panelName: "PanelB"
},
$trigger: "button" // or "auto-interval"

The script should return the title, content, and style fields in $done().

Before the script is evaluated for the first time, the panel uses the static content in the definition line. After running, Surge automatically caches the returned result of the last script execution and always displays it until the next refresh.

A sample script:

$httpClient.get("https://api.my-ip.io/ip", function(error, response, data){
    $done({
        title: "External IP Address",
        content: data,
    });
});

You may also use the update-interval parameter to make the panel update automatically.

[Panel]
PanelB = title="Panel Title",content="Panel Content\nSecondLine",style=info,script-name=panel,update-interval=60

Surge checks whether an update is due when the user switches to the policy selection view on iOS or opens the Panels submenu on Mac. You may specify a small value, such as 1, to make the panel update every time.

More Customization

  • When the style field is not passed, the card displays only text and no icon.
  • When the style field is not passed, the icon field can customize the icon with any valid SF Symbol name, such as bolt.horizontal.circle.fill.
  • When using the icon field, pass the icon-color field to control the icon color. The value is a HEX color code.

results matching ""

    No results matching ""