Skip to content

Commit

Permalink
Merge Official Source
Browse files Browse the repository at this point in the history
Signed-off-by: Tianling Shen <[email protected]>
  • Loading branch information
1715173329 committed Dec 25, 2024
2 parents 45d2618 + 2da1efb commit 4c9bcbb
Show file tree
Hide file tree
Showing 43 changed files with 2,635 additions and 2,474 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Contributing Guidelines

## Translations

Use [Weblate](https://hosted.weblate.org/engage/openwrt/?utm_source=widget) instead of direct editing of the `*.po` files.

## Patches and Pull requests:

If you want to contribute a change to LuCI, please either send a patch using git send-email
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) file.

## Translation status

Use [Weblate](https://hosted.weblate.org/engage/openwrt/?utm_source=widget) instead of direct editing of the `*.po` files.

[![Translation status](https://hosted.weblate.org/widgets/openwrt/-/multi-auto.svg)](https://hosted.weblate.org/engage/openwrt/?utm_source=widget)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
'require rpc';
'require uci';



const callUpnpGetStatus = rpc.declare({
object: 'luci.upnp',
method: 'get_status',
Expand Down Expand Up @@ -37,14 +35,14 @@ return baseclass.extend({
},

render: function(data) {

var table = E('table', { 'class': 'table', 'id': 'upnp_status_table' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th' }, _('Client Name')),
E('th', { 'class': 'th' }, _('Client Address')),
E('th', { 'class': 'th' }, _('Client Port')),
E('th', { 'class': 'th' }, _('External Port')),
E('th', { 'class': 'th' }, _('Protocol')),
E('th', { 'class': 'th right' }, _('Expires')),
E('th', { 'class': 'th' }, _('Description')),
E('th', { 'class': 'th cbi-section-actions' }, '')
])
Expand All @@ -53,12 +51,24 @@ return baseclass.extend({
var rules = Array.isArray(data[0].rules) ? data[0].rules : [];

var rows = rules.map(function(rule) {
const padnum = (num, length) => num.toString().padStart(length, "0");
const expires_sec = rule?.expires || 0;
const hour = Math.floor(expires_sec / 3600);
const minute = Math.floor((expires_sec % 3600) / 60);
const second = Math.floor(expires_sec % 60);
const expires_str =
hour > 0 ? `${hour}h ${padnum(minute, 2)}m ${padnum(second, 2)}s` :
minute > 0 ? `${minute}m ${padnum(second, 2)}s` :
expires_sec > 0 ? `${second}s` :
'';

return [
rule.host_hint || _('Unknown'),
rule.intaddr,
rule.intport,
rule.extport,
rule.proto,
expires_str,
rule.descr,
E('button', {
'class': 'btn cbi-button-remove',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
'require rpc';
'require form';



const callInitAction = rpc.declare({
object: 'luci',
method: 'setInitAction',
Expand Down Expand Up @@ -49,12 +47,24 @@ return view.extend({
var rules = Array.isArray(data[0].rules) ? data[0].rules : [];

var rows = rules.map(function(rule) {
const padnum = (num, length) => num.toString().padStart(length, "0");
const expires_sec = rule?.expires || 0;
const hour = Math.floor(expires_sec / 3600);
const minute = Math.floor((expires_sec % 3600) / 60);
const second = Math.floor(expires_sec % 60);
const expires_str =
hour > 0 ? `${hour}h ${padnum(minute, 2)}m ${padnum(second, 2)}s` :
minute > 0 ? `${minute}m ${padnum(second, 2)}s` :
expires_sec > 0 ? `${second}s` :
'';

return [
rule.host_hint || _('Unknown'),
rule.intaddr,
rule.intport,
rule.extport,
rule.proto,
expires_str,
rule.descr,
E('button', {
'class': 'btn cbi-button-remove',
Expand All @@ -64,8 +74,6 @@ return view.extend({
});

cbi_update_table(nodes.querySelector('#upnp_status_table'), rows, E('em', _('There are no active port maps.')));

return;
},

render: function(data) {
Expand All @@ -92,6 +100,7 @@ return view.extend({
E('th', { 'class': 'th' }, _('Client Port')),
E('th', { 'class': 'th' }, _('External Port')),
E('th', { 'class': 'th' }, _('Protocol')),
E('th', { 'class': 'th right' }, _('Expires')),
E('th', { 'class': 'th' }, _('Description')),
E('th', { 'class': 'th cbi-section-actions' }, '')
])
Expand Down Expand Up @@ -129,9 +138,11 @@ return view.extend({
_('Start autonomous port mapping service'));
o.rmempty = false;

s.taboption('setup', form.Flag, 'enable_upnp', _('Enable UPnP IGD protocol')).default = '1';
o = s.taboption('setup', form.Flag, 'enable_upnp', _('Enable UPnP IGD protocol'));
o.default = '1';

s.taboption('setup', form.Flag, 'enable_natpmp', _('Enable PCP/NAT-PMP protocols')).default = '1';
o = s.taboption('setup', form.Flag, 'enable_natpmp', _('Enable PCP/NAT-PMP protocols'));
o.default = '1';

o = s.taboption('setup', form.Flag, 'igdv1', _('UPnP IGDv1 compatibility mode'),
_('Advertise as IGDv1 (IPv4 only) device instead of IGDv2'));
Expand Down
Loading

0 comments on commit 4c9bcbb

Please sign in to comment.