mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 01:03:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# provides Web UI to shut down (power off) your device.
|
||||
# Copyright (C) 2022-2025 sirpdboy <herboy2008@gmail.com>
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
NAME:=poweroffdevice
|
||||
PKG_NAME:=luci-app-$(NAME)
|
||||
LUCI_TITLE:=LuCI support for poweroffdevice Router
|
||||
LUCI_DESCRIPTION:=provides Web UI to shut down (power off) your device.
|
||||
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
'use strict';
|
||||
'require view';
|
||||
'require ui';
|
||||
'require fs';
|
||||
|
||||
return view.extend({
|
||||
render: function() {
|
||||
return E([
|
||||
E('h2', _('PowerOff')),
|
||||
E('p', _('Turn off the power to the device you are using')),
|
||||
E('hr'),
|
||||
E('button', {
|
||||
class: 'btn cbi-button cbi-button-negative',
|
||||
click: ui.createHandlerFn(this, 'handlePowerOff')
|
||||
}, _('Perform Power Off')),
|
||||
|
||||
E('div', { 'style': 'text-align: center; padding: 10px; font-style: italic;' }, [
|
||||
E('span', {}, [
|
||||
_('© github '),
|
||||
E('a', {
|
||||
'href': 'https://github.com/sirpdboy/luci-app-poweroffdevice',
|
||||
'target': '_blank',
|
||||
'style': 'text-decoration: none;'
|
||||
}, 'by sirpdboy')
|
||||
])
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
||||
handlePowerOff: function() {
|
||||
return ui.showModal(_('PowerOff Device'), [
|
||||
E('h4', { }, _('Turn off the power to the device you are using')),
|
||||
|
||||
E('div', { class: 'right' }, [
|
||||
|
||||
E('button', {
|
||||
'class': 'btn btn-danger ',
|
||||
'style': 'background: red!important; border-color: red!important',
|
||||
'click': ui.createHandlerFn(this, function() {
|
||||
ui.hideModal();
|
||||
ui.showModal(_('PowerOffing...'), [
|
||||
E('p', {'class': 'spinning' }, _('The device may have powered off. If not, check manually.'))
|
||||
]);
|
||||
return fs.exec('/sbin/poweroff').catch(function(e) {
|
||||
ui.addNotification(null, E('p', e.message));
|
||||
});
|
||||
})
|
||||
}, _('OK')),
|
||||
' ',
|
||||
E('button', {
|
||||
'class': 'btn cbi-button cbi-button-apply',
|
||||
'click': ui.hideModal
|
||||
}, _('Cancel'))
|
||||
])
|
||||
]);
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# provides Web UI to shut down (power off) your device.
|
||||
# routers are listed at https://github.com/sirpdboy/luci-app-poweroffdevice
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
|
||||
msgid "PowerOff"
|
||||
msgstr "关机"
|
||||
|
||||
msgid "PowerOff Device"
|
||||
msgstr "设备关机"
|
||||
|
||||
msgid "Perform Power Off"
|
||||
msgstr "执行关机"
|
||||
|
||||
msgid "Turn off the power to the device you are using"
|
||||
msgstr "关闭您正在使用的设备的电源"
|
||||
|
||||
msgid "WARNING: Power off might result in a reboot on a device which not support power off."
|
||||
msgstr "警告:对于不支持关机的设备,关机可能会导致重新启动."
|
||||
|
||||
msgid "PowerOffing..."
|
||||
msgstr "正在关机..."
|
||||
|
||||
msgid "Device shutdown complete!"
|
||||
msgstr "设备关机完毕!"
|
||||
|
||||
msgid "PowerOff failed"
|
||||
msgstr "关机失败"
|
||||
|
||||
msgid "The device is shutting down..."
|
||||
msgstr "设备正在关闭..."
|
||||
|
||||
msgid "The device may have powered off. If not, check manually."
|
||||
msgstr "设备已断电。如果没有,请手动操作。"
|
||||
|
||||
msgid "Confirm"
|
||||
msgstr "确认"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# provides Web UI to shut down (power off) your device.
|
||||
# routers are listed at https://github.com/sirpdboy/luci-app-poweroffdevice
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
|
||||
msgid "PowerOff"
|
||||
msgstr "关机"
|
||||
|
||||
msgid "PowerOff Device"
|
||||
msgstr "设备关机"
|
||||
|
||||
msgid "Perform Power Off"
|
||||
msgstr "执行关机"
|
||||
|
||||
msgid "Turn off the power to the device you are using"
|
||||
msgstr "关闭您正在使用的设备的电源"
|
||||
|
||||
msgid "WARNING: Power off might result in a reboot on a device which not support power off."
|
||||
msgstr "警告:对于不支持关机的设备,关机可能会导致重新启动."
|
||||
|
||||
msgid "PowerOffing..."
|
||||
msgstr "正在关机..."
|
||||
|
||||
msgid "Device shutdown complete!"
|
||||
msgstr "设备关机完毕!"
|
||||
|
||||
msgid "PowerOff failed"
|
||||
msgstr "关机失败"
|
||||
|
||||
msgid "The device is shutting down..."
|
||||
msgstr "设备正在关闭..."
|
||||
|
||||
msgid "The device may have powered off. If not, check manually."
|
||||
msgstr "设备已断电。如果没有,请手动操作。"
|
||||
|
||||
msgid "Confirm"
|
||||
msgstr "确认"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"admin/system/poweroffdevice": {
|
||||
"title": "PowerOff",
|
||||
"order": 99,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "system/poweroffdevice"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"luci-app-poweroffdevice": {
|
||||
"description": "Grant UCI access for luci-app-poweroffdevice",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"system": [ "info" ],
|
||||
},
|
||||
"file": {
|
||||
"/sbin/poweroff": [ "exec" ],
|
||||
}
|
||||
},
|
||||
|
||||
"write": {
|
||||
"file": {
|
||||
"/sbin/poweroff": [ "exec" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "exec" ],
|
||||
"system": [ "poweroff" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user