mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-01-06 08:38:52 +03:00
feat: add get_proxy_label function to podkop init script
This commit is contained in:
@@ -35,6 +35,20 @@ function createConfigSection(section, map, network) {
|
||||
o.depends('proxy_config_type', 'url');
|
||||
o.rows = 5;
|
||||
o.ucisection = s.section;
|
||||
o.load = function (section_id) {
|
||||
return fs.exec('/etc/init.d/podkop', ['get_proxy_label', section_id]).then(res => {
|
||||
if (res.stdout) {
|
||||
try {
|
||||
const decodedLabel = decodeURIComponent(res.stdout.trim());
|
||||
this.description = _('Current config: ') + decodedLabel;
|
||||
} catch (e) {
|
||||
console.error('Error decoding label:', e);
|
||||
this.description = _('Current config: ') + res.stdout.trim();
|
||||
}
|
||||
}
|
||||
return this.super('load', section_id);
|
||||
});
|
||||
};
|
||||
o.validate = function (section_id, value) {
|
||||
if (!value || value.length === 0) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user