🎄 Sync 2026-04-23 03:14:31

This commit is contained in:
github-actions[bot] committed 2026-04-23 03:14:31 +08:00
1 parent 67b877b3d6
commit 7439c23f17
97 files changed
+4710 -1

No files matched your search

@@ -0,0 +1,33 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require tools.widgets as widgets';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('smscontrol', _('Command over SMS'));
m.description = _('You can make a call from the allowed phone number and then the router will execute the command');
s = m.section(form.TableSection, 'call');
s.anonymous = true;
o = s.option(form.Flag, 'enabled', _('Enabled'));
o.rmempty = false;
o.editable = true;
o = s.option(form.Flag, 'ack', _('Reply via SMS'));
o.rmempty = true;
o.editable = true;
o = s.option(form.Value, 'command', _('Linux command'));
o.rmempty =false;
o.optional = false;
o.editable = true;
return m.render();
}
});
@@ -0,0 +1,35 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require tools.widgets as widgets';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('smscontrol', _('Remote SMS Control'));
m.description = _('Here you can send commands to router via a call or SMS');
s = m.section(form.NamedSection, 'common', 'smscontrol');
o = s.option(form.Flag, 'enabled', _('Enabled'));
o = s.option(form.Value, 'pass', _('Password'));
o.rmempty = false;
o.optional = false;
o.datatype = 'and(uciname,maxlength(15))';
o = s.option(form.DynamicList, 'whitelist', _('Allowed phone numbers'), _('The phone number is set in the international format without \'+\''));
o.datatype = 'phonedigit';
o.cast = 'string';
o.rmempty =true;
o.optional = false;
o = s.option(form.Flag, 'smscontrol_log', _('Enable sms and call log'));
o.optional = false;
return m.render();
}
});
@@ -0,0 +1,40 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require tools.widgets as widgets';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('smscontrol_log', _('Event log'));
m.description = _('SMS and call log');
s = m.section(form.TableSection, 'event');
s.anonymous = true;
s.addremove = true;
s.rowcolors = true;
s.addbtntitle = _('Remove all');
s.handleAdd = function(ev) {
var sections;
sections = uci.sections('smscontrol_log');
for (var i = 0; i < sections.length; i++) {
uci.remove('smscontrol_log',sections[i]['.name']);
}
return this.map.save(null, true);
};
o = s.option(form.DummyValue, 'date', _('Date'));
o = s.option(form.DummyValue, 'type', _('Type'));
o = s.option(form.DummyValue, 'from', _('From'));
o.default = "-";
o = s.option(form.DummyValue, 'to', _('To'));
o.default = "-";
o = s.option(form.DummyValue, 'message', _('Message text'));
o.default = "-";
return m.render();
}
});
@@ -0,0 +1,50 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require fs';
'require ui'
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('smscontrol', _('Send SMS'));
s = m.section(form.NamedSection, 'common', 'send');
o = s.option(form.Value, 'to', _('To phone number'), _('The phone number is set in the international format without \'+\''));
o.datatype = 'phonedigit';
o.cast = 'string';
o.rmempty = true;
o.optional = false;
o = s.option(form.Value, 'msgtxt', _('Message text'));
o.rmempty = true;
o.optional = false;
o = s.option(form.Button, 'sendsms',_(' '));
o.inputstyle = 'action important';
o.inputtitle = _('Send');
o.onclick = function(section_id) {
var to = document.getElementById('widget.cbid.smscontrol.common.to').value,
msgtxt = document.getElementById('widget.cbid.smscontrol.common.msgtxt').value;
if (to !== '') {
fs.exec('/usr/bin/sendsms', [String(to), String(msgtxt)]).then(function(res) {
ui.addNotification(null, [
E('p', [ _('SMS to "%s" with message "%s" generated and will be sent').format(to, msgtxt) ])
]);
}).catch(function(err) {
ui.addNotification(null, [
E('p', [ _('Error: '), err ])
]);
});
} else {
ui.addNotification(null, E('p', _('The phone number cannot be empty.')), 'error');
}
}
return m.render();
}
});
@@ -0,0 +1,39 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require tools.widgets as widgets';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('smscontrol', _('Command over SMS'));
m.description = _('For example, if you enter \'1234\' as a password and send an SMS command \'1234;reboot\' to the router, the router will reboot');
s = m.section(form.TableSection, 'remote');
s.anonymous = true;
s.addremove = true;
o = s.option(form.Flag, 'enabled', _('Enabled'));
o.rmempty = false;
o.editable = true;
o = s.option(form.Flag, 'ack', _('Reply via SMS'));
o.rmempty = true;
o.editable = true;
o = s.option(form.Value, 'received', _('Message text'));
o.rmempty =false;
o.optional = false;
o.editable = true;
o = s.option(form.Value, 'command', _('Linux command'));
o.rmempty =false;
o.optional = false;
o.editable = true;
return m.render();
}
});
@@ -0,0 +1,37 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require tools.widgets as widgets';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('smscontrol', _('Command over SMS'));
m.description = _('For example, if you enter \'1234\' as a password and send an SMS command \'1234;CLI$ifconfig br-lan down\' to the router, the router will execute CLI-command ifconfig br-lan down');
s = m.section(form.TableSection, 'cli');
s.anonymous = true;
o = s.option(form.Flag, 'enabled', _('Enabled'));
o.rmempty = false;
o.editable = true;
o = s.option(form.Flag, 'ack', _('Reply via SMS'));
o.rmempty = false;
o.editable = true;
o = s.option(form.DummyValue, 'received', _('Message text'));
o.rmempty =false;
o.value = 'CLI$any_cli_command_here';
o = s.option(form.DummyValue, 'command', _('Linux command'));
o.rmempty =false;
o.optional = false;
o.value = 'any_cli_command_here';
return m.render();
}
});