Information Panel

Surge iOS 4.9.3 adds an experimental feature that allows users to customize one or more information panels for displaying related information.

This feature requires a feature subscription expiration date after September 22, 2021. When the subscription has expired but there is a Panel profile section in the configuration, the panel will not be displayed, but it will not affect the normal use of other features.

Example:

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

The supported style parameters are good, info, alert, error.

PanelA is the name of the info panel, this parameter will be passed to the script in script mode.

Static mode

The panel generated by the above configuration is static, which can be used with the managed profile or enterprise profile to update the panel content when updating the profile and provide the end-user with operational guidelines.

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

The new version also introduces generic type scripts. When the user tap the refresh button, the script will be evaluated with the 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 will automatically cache the returned results of the last script and always display the results of the last script before executing a refresh.

A sample script:

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

Also, you may designate the 'update-interval' parameter to make the panel updating automatically.

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

The auto-updating only occurs when the user switching to the policy selection view. So you may specify a small time here (such as 1) to make the panel auto-updating every time.

More customization

  • When the style field is not passed, the card will not display an icon, only text
  • When the style field is not passed in, the icon field can be passed in to customize the icon with any valid SF Symbol Name, such as bolt.horizontal.circle.fill
  • When using the icon field, pass in the icon-color field to control the color of the icon, the value is the HEX code of the color.

results matching ""

    No results matching ""