🎄 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 a011aeb96f
commit 263d407c11
97 files changed
+4710 -1

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
# Custom configurator
#
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-smscontrol
LUCI_DEPENDS:=
# Version: <major>.<minor>.<patch>
PKG_VERSION:=0.2.0
PKG_RELEASE:=1
LUCI_TITLE:=LuCI utility to remote control via SMS
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -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();
}
});
+55
View File
@@ -0,0 +1,55 @@
msgid "Allowed phone numbers"
msgstr "Allowed phone numbers"
msgid "Command over SMS"
msgstr "Command over SMS"
msgid "Command over call"
msgstr "Command over call"
msgid ""
"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"
msgstr ""
"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"
msgid ""
"For example, if you enter '1234' as a password and send an SMS command '1234;"
"reboot' to the router, the router will reboot"
msgstr ""
"For example, if you enter '1234' as a password and send an SMS command '1234;"
"reboot' to the router, the router will reboot"
msgid "Here you can send commands to router via a call or SMS"
msgstr "Here you can send commands to router via a call or SMS"
msgid "Linux command"
msgstr "Linux command"
msgid "Message text"
msgstr "Message text"
msgid "Reply via SMS"
msgstr "Reply via SMS"
msgid "Send"
msgstr "Send"
msgid "Send SMS"
msgstr "Send SMS"
msgid "To phone number"
msgstr "To phone number"
msgid "Universal command over SMS"
msgstr "Universal command over SMS"
msgid ""
"You can make a call from the allowed phone number and then the router will "
"execute the command"
msgstr ""
"You can make a call from the allowed phone number and then the router will "
"execute the command"
+75
View File
@@ -0,0 +1,75 @@
msgid "Allowed phone numbers"
msgstr "Разрешенные телефонные номера"
msgid "Command over SMS"
msgstr "Команда по SMS"
msgid "Command over call"
msgstr "Команда по звонку"
msgid ""
"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"
msgstr "Например, если задать пароль '1234' и отправить SMS с текстом '1234;CLI$ifconfig br-lan down' на роутер, то роутер выполнит консольную команду ifconfig br-lan down"
msgid ""
"For example, if you enter '1234' as a password and send an SMS command '1234;"
"reboot' to the router, the router will reboot"
msgstr "Например, если задать пароль '1234' и отправить SMS с текстом '1234;reboot' на роутер, то роутер перезагрузится"
msgid "Here you can send commands to router via a call or SMS"
msgstr "Здесь осуществляется управление роутером посредством звонков или SMS"
msgid "Linux command"
msgstr "Linux-команда"
msgid "Message text"
msgstr "Текст сообщения"
msgid "Reply via SMS"
msgstr "Ответ по SMS"
msgid "Send"
msgstr "Отправить"
msgid "Send SMS"
msgstr "Отправить SMS"
msgid "To phone number"
msgstr "На телефонный номер"
msgid "Universal command over SMS"
msgstr "Универсальная команда по SMS"
msgid ""
"You can make a call from the allowed phone number and then the router will "
"execute the command"
msgstr "Если совершить звонок с разрешенного телефонного номера, роутер выполнит указанную команду"
msgid "Remote SMS Control"
msgstr "Управление по SMS"
msgid "Enable sms and call log"
msgstr "Включить логирование сообщений и звонков"
msgid "From"
msgstr "От"
msgid "To"
msgstr "Кому"
msgid "Date"
msgstr "Дата"
msgid "SMS and call log"
msgstr "Журнал сообщений и звонков"
msgid "Event log"
msgstr "Журнал событий"
msgid "Remove all"
msgstr "Удалить все"
msgid "The phone number is set in the international format without '+'"
msgstr "Номер телефона задается в международном формате без символа '+'"
@@ -0,0 +1,19 @@
#!/bin/sh
[ ! -f "/usr/share/ucitrack/luci-app-smscontrol.json" ] && {
cat > /usr/share/ucitrack/luci-app-smscontrol.json << EEOF
{
"config": "smscontrol",
"init": "smscontrol"
}
EEOF
}
uci -q batch <<-EOF >/dev/null
delete ucitrack.@smscontrol[-1]
add ucitrack smscontrol
set ucitrack.@smscontrol[-1].init=smscontrol
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0
@@ -0,0 +1,68 @@
{
"admin/services/smscontrol": {
"title": "Remote SMS Control",
"order": 10,
"action": {
"type": "alias",
"path": "admin/services/smscontrol/general"
},
"depends": {
"acl": [ "luci-app-smscontrol" ],
"uci": { "smscontrol": true }
}
},
"admin/services/smscontrol/general": {
"title": "General Settings",
"order": 10,
"action": {
"type": "view",
"path": "smscontrol/general"
}
},
"admin/services/smscontrol/sms2cli": {
"title": "Command over SMS",
"order": 20,
"action": {
"type": "view",
"path": "smscontrol/sms2cli"
}
},
"admin/services/smscontrol/sms2ucli": {
"title": "Universal command over SMS",
"order": 30,
"action": {
"type": "view",
"path": "smscontrol/sms2ucli"
}
},
"admin/services/smscontrol/call2cli": {
"title": "Command over call",
"order": 40,
"action": {
"type": "view",
"path": "smscontrol/call2cli"
}
},
"admin/services/smscontrol/log": {
"title": "Event log",
"order": 50,
"action": {
"type": "view",
"path": "smscontrol/log"
}
},
"admin/services/smscontrol/sendsms": {
"title": "Send SMS",
"order": 60,
"action": {
"type": "view",
"path": "smscontrol/sendsms"
}
}
}
@@ -0,0 +1,14 @@
{
"luci-app-smscontrol": {
"description": "Grant UCI access for luci-app-smscontrol",
"read": {
"uci": [ "smscontrol" ]
},
"write": {
"uci": [ "smscontrol" ],
"file": {
"/usr/bin/sendsms": [ "exec" ]
}
}
}
}