mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 20:53:56 +08:00
🔥 Sync 2026-09-05 21:18:46
This commit is contained in:
1 parent
e88d0b9fed
commit
b05ff8a1b6
45 files changed
+506
-272
No files matched your search
@@ -0,0 +1,12 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copyright (C) 2023 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI app for FileBrowser
|
||||
LUCI_DEPENDS:=+filebrowser
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
'require form';
|
||||
'require poll';
|
||||
'require rpc';
|
||||
'require uci';
|
||||
'require view';
|
||||
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
function getServiceStatus() {
|
||||
return L.resolveDefault(callServiceList('filebrowser'), {}).then(function(res) {
|
||||
let isRunning = false;
|
||||
try {
|
||||
isRunning = res['filebrowser']['instances']['instance1']['running'];
|
||||
} catch (e) { }
|
||||
return isRunning;
|
||||
});
|
||||
}
|
||||
|
||||
function renderStatus(isRunning, port) {
|
||||
let spanTemp = '<span style="color:%s"><strong>%s %s</strong></span>';
|
||||
let renderHTML;
|
||||
if (isRunning) {
|
||||
let button = String.format(' <a class="btn cbi-button" href="http://%s:%s" target="_blank" rel="noreferrer noopener">%s</a>',
|
||||
window.location.hostname, port, _('Open Web Interface'));
|
||||
renderHTML = spanTemp.format('green', _('FileBrowser'), _('RUNNING')) + button;
|
||||
} else {
|
||||
renderHTML = spanTemp.format('red', _('FileBrowser'), _('NOT RUNNING'));
|
||||
}
|
||||
|
||||
return renderHTML;
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
load() {
|
||||
return uci.load('filebrowser');
|
||||
},
|
||||
|
||||
render(data) {
|
||||
let m, s, o;
|
||||
let webport = (uci.get(data, 'config', 'listen_port') || '8989');
|
||||
|
||||
m = new form.Map('filebrowser', _('FileBrowser'),
|
||||
_('FileBrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files..') + '<br />'+
|
||||
_('Default login username is %s and password is %s.').format('<code>admin</code>', '<code>admin</code>'));
|
||||
|
||||
s = m.section(form.TypedSection);
|
||||
s.anonymous = true;
|
||||
s.render = function() {
|
||||
poll.add(function() {
|
||||
return L.resolveDefault(getServiceStatus()).then(function(res) {
|
||||
let view = document.getElementById('service_status');
|
||||
view.innerHTML = renderStatus(res, webport);
|
||||
});
|
||||
});
|
||||
|
||||
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
|
||||
E('p', { id: 'service_status' }, _('Collecting data...'))
|
||||
]);
|
||||
}
|
||||
|
||||
s = m.section(form.NamedSection, 'config', 'filebrowser');
|
||||
|
||||
o = s.option(form.Flag, 'enabled', _('Enable'));
|
||||
o.default = o.disabled;
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'listen_port', _('Listen port'));
|
||||
o.datatype = 'port';
|
||||
o.default = '8989';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'root_path', _('Root directory'));
|
||||
o.default = '/mnt';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Flag, 'disable_exec', _('Disable Command Runner feature'));
|
||||
o.default = o.enabled;
|
||||
o.rmempty = false;
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:63
|
||||
msgid "Collecting data..."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:50
|
||||
msgid "Default login username is %s and password is %s."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:82
|
||||
msgid "Disable Command Runner feature"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:69
|
||||
msgid "Enable"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:48
|
||||
#: applications/luci-app-filebrowser-go/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3
|
||||
msgid "FileBrowser"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:49
|
||||
msgid ""
|
||||
"FileBrowser provides a file managing interface within a specified directory "
|
||||
"and it can be used to upload, delete, preview, rename and edit your files.."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json:3
|
||||
msgid "Grant UCI access for luci-app-filebrowser"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:73
|
||||
msgid "Listen port"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
msgid "NOT RUNNING"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:30
|
||||
msgid "Open Web Interface"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
msgid "RUNNING"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:78
|
||||
msgid "Root directory"
|
||||
msgstr ""
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
zh_Hans
|
||||
@@ -0,0 +1,64 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: zh-Hans\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:63
|
||||
msgid "Collecting data..."
|
||||
msgstr "正在收集数据中..."
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:50
|
||||
msgid "Default login username is %s and password is %s."
|
||||
msgstr "默认登录用户名为 %s,密码为 %s。"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:82
|
||||
msgid "Disable Command Runner feature"
|
||||
msgstr "禁用命令执行功能"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:69
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:48
|
||||
#: applications/luci-app-filebrowser-go/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3
|
||||
msgid "FileBrowser"
|
||||
msgstr "FileBrowser"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:49
|
||||
msgid ""
|
||||
"FileBrowser provides a file managing interface within a specified directory "
|
||||
"and it can be used to upload, delete, preview, rename and edit your files.."
|
||||
msgstr ""
|
||||
"FileBrowser 提供指定目录下的文件管理界面,可用于上传、删除、预览、重命名和编"
|
||||
"辑文件。"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json:3
|
||||
msgid "Grant UCI access for luci-app-filebrowser"
|
||||
msgstr "授予 luci-app-filebrowser 访问 UCI 配置的权限"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:73
|
||||
msgid "Listen port"
|
||||
msgstr "监听端口"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:30
|
||||
msgid "Open Web Interface"
|
||||
msgstr "打开 Web 界面"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
#: applications/luci-app-filebrowser-go/htdocs/luci-static/resources/view/filebrowser.js:78
|
||||
msgid "Root directory"
|
||||
msgstr "根目录"
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"admin/services/filebrowser": {
|
||||
"title": "FileBrowser",
|
||||
"action": {
|
||||
"order": 30,
|
||||
"type": "view",
|
||||
"path": "filebrowser"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-filebrowser" ],
|
||||
"uci": { "filebrowser": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"luci-app-filebrowser": {
|
||||
"description": "Grant UCI access for luci-app-filebrowser",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"service": [ "list" ]
|
||||
},
|
||||
"uci": [ "filebrowser" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "filebrowser" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user