Skip to content

Commit

Permalink
fix(generator/client): Fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
muink authored and 1715173329 committed Jan 16, 2024
1 parent 8c98045 commit 55038ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions htdocs/luci-static/resources/view/homeproxy/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ return view.extend({
delete this.keylist;
delete this.vallist;

this.value('null-rule', _('NULL'));
this.value('', _('-- Please choose --'));
uci.sections(data[0], 'ruleset', (res) => {
if (res.enabled === '1')
this.value(res['.name'], res.label);
Expand Down Expand Up @@ -831,7 +831,7 @@ return view.extend({
delete this.keylist;
delete this.vallist;

this.value('null-rule', _('NULL'));
this.value('', _('-- Please choose --'));
uci.sections(data[0], 'ruleset', (res) => {
if (res.enabled === '1')
this.value(res['.name'], res.label);
Expand Down
14 changes: 4 additions & 10 deletions root/etc/homeproxy/scripts/generate_client.uc
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,10 @@ function get_ruleset(cfg) {
if (isEmpty(cfg))
return null;

if (type(cfg) === 'array') {
if ('null-rule' in cfg)
return null;

let rules = [];
for (let i in cfg)
push(rules, get_ruleset(i));
return rules;
} else
return 'cfg-' + cfg + '-rule';
let rules = [];
for (let i in cfg)
push(rules, isEmpty(i) ? null : 'cfg-' + i + '-rule');
return rules;
}
/* Config helper end */

Expand Down

0 comments on commit 55038ff

Please sign in to comment.