Add optional outbound connectivity probe with three-state status dot
This commit is contained in:
@@ -46,6 +46,32 @@ export default class SingBoxStatusPreferences extends ExtensionPreferences {
|
||||
});
|
||||
settings.bind('refresh-interval', intervalRow, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
dispGroup.add(intervalRow);
|
||||
|
||||
// --- Connectivity ---------------------------------------------
|
||||
const connCheckGroup = new Adw.PreferencesGroup({
|
||||
title: _('Connectivity check'),
|
||||
description: _('Actively probe the active outbound to tell “up but no internet” from “up and reachable”. Adds a third status-dot state.'),
|
||||
});
|
||||
page.add(connCheckGroup);
|
||||
|
||||
const checkRow = this._switchRow(settings, 'check-connectivity',
|
||||
_('Probe active outbound'),
|
||||
_('Periodically measure latency through the current outbound.'));
|
||||
connCheckGroup.add(checkRow);
|
||||
|
||||
const connIntervalRow = new Adw.SpinRow({
|
||||
title: _('Probe interval'),
|
||||
subtitle: _('Seconds between outbound probes.'),
|
||||
adjustment: new Gtk.Adjustment({ lower: 5, upper: 600, step_increment: 5 }),
|
||||
});
|
||||
settings.bind('connectivity-interval', connIntervalRow, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
settings.bind('check-connectivity', connIntervalRow, 'sensitive', Gio.SettingsBindFlags.GET);
|
||||
connCheckGroup.add(connIntervalRow);
|
||||
|
||||
const connUrlRow = this._entryRow(settings, 'connectivity-url', _('Probe URL'),
|
||||
_('Target URL for the latency probe (a 204/no-content endpoint is ideal).'));
|
||||
settings.bind('check-connectivity', connUrlRow, 'sensitive', Gio.SettingsBindFlags.GET);
|
||||
connCheckGroup.add(connUrlRow);
|
||||
}
|
||||
|
||||
_entryRow(settings, key, title, subtitle) {
|
||||
|
||||
Reference in New Issue
Block a user