mirror of
https://github.com/kenzok8/openwrt-packages.git
synced 2025-01-08 11:37:36 +08:00
update 2024-04-14 15:47:41
This commit is contained in:
parent
92083f2811
commit
e2f776f847
@ -1,12 +1,14 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copyright (C) 2023 ImmortalWrt.org
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI app for FileBrowser
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+filebrowser
|
||||
LUCI_TITLE:=LuCI File Browser module
|
||||
LUCI_DEPENDS:=+luci-base
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=Sergey Ponomarev <stokito@gmail.com>
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
'use strict';
|
||||
'require form';
|
||||
'require poll';
|
||||
'require rpc';
|
||||
'require uci';
|
||||
'require view';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
function getServiceStatus() {
|
||||
return L.resolveDefault(callServiceList('filebrowser'), {}).then(function (res) {
|
||||
var isRunning = false;
|
||||
try {
|
||||
isRunning = res['filebrowser']['instances']['instance1']['running'];
|
||||
} catch (e) { }
|
||||
return isRunning;
|
||||
});
|
||||
}
|
||||
|
||||
function renderStatus(isRunning, port) {
|
||||
var spanTemp = '<span style="color:%s"><strong>%s %s</strong></span>';
|
||||
var renderHTML;
|
||||
if (isRunning) {
|
||||
var 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: function() {
|
||||
return uci.load('filebrowser');
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
var m, s, o;
|
||||
var 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..'));
|
||||
|
||||
s = m.section(form.TypedSection);
|
||||
s.anonymous = true;
|
||||
s.render = function () {
|
||||
poll.add(function () {
|
||||
return L.resolveDefault(getServiceStatus()).then(function (res) {
|
||||
var 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,34 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require ui';
|
||||
'require form';
|
||||
|
||||
var formData = {
|
||||
files: {
|
||||
root: null,
|
||||
}
|
||||
};
|
||||
|
||||
return view.extend({
|
||||
render: function() {
|
||||
var m, s, o;
|
||||
|
||||
m = new form.JSONMap(formData, _('File Browser'), '');
|
||||
|
||||
s = m.section(form.NamedSection, 'files', 'files');
|
||||
|
||||
o = s.option(form.FileUpload, 'root', '');
|
||||
o.root_directory = '/';
|
||||
o.browser = true;
|
||||
o.show_hidden = true;
|
||||
o.enable_upload = true;
|
||||
o.enable_remove = true;
|
||||
o.enable_download = true;
|
||||
|
||||
return m.render();
|
||||
},
|
||||
|
||||
handleSave: null,
|
||||
handleSaveApply: null,
|
||||
handleReset: null
|
||||
})
|
@ -1,51 +1,11 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:62
|
||||
msgid "Collecting data..."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:81
|
||||
msgid "Disable Command Runner feature"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:68
|
||||
msgid "Enable"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:48
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/system/filebrowser.js:16
|
||||
#: applications/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3
|
||||
msgid "FileBrowser"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/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.."
|
||||
msgid "File Browser"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json:3
|
||||
msgid "Grant UCI access for luci-app-filebrowser"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:72
|
||||
msgid "Listen port"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
msgid "NOT RUNNING"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:30
|
||||
msgid "Open Web Interface"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
msgid "RUNNING"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:77
|
||||
msgid "Root directory"
|
||||
msgid "Grant access to File Browser"
|
||||
msgstr ""
|
||||
|
@ -1 +0,0 @@
|
||||
zh_Hans
|
@ -1,60 +0,0 @@
|
||||
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/htdocs/luci-static/resources/view/filebrowser.js:62
|
||||
msgid "Collecting data..."
|
||||
msgstr "收集数据中..."
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:81
|
||||
msgid "Disable Command Runner feature"
|
||||
msgstr "禁用命令执行功能"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:68
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:48
|
||||
#: applications/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3
|
||||
msgid "FileBrowser"
|
||||
msgstr "FileBrowser"
|
||||
|
||||
#: applications/luci-app-filebrowser/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/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/htdocs/luci-static/resources/view/filebrowser.js:72
|
||||
msgid "Listen port"
|
||||
msgstr "监听端口"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:30
|
||||
msgid "Open Web Interface"
|
||||
msgstr "打开 Web 界面"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:77
|
||||
msgid "Root directory"
|
||||
msgstr "根目录"
|
@ -1,14 +1,13 @@
|
||||
{
|
||||
"admin/services/filebrowser": {
|
||||
"title": "FileBrowser",
|
||||
"admin/system/filebrowser": {
|
||||
"title": "File Browser",
|
||||
"order": 80,
|
||||
"action": {
|
||||
"order": 30,
|
||||
"type": "view",
|
||||
"path": "filebrowser"
|
||||
"path": "system/filebrowser"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-filebrowser" ],
|
||||
"uci": { "filebrowser": true }
|
||||
"acl": [ "luci-app-filebrowser" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
{
|
||||
"luci-app-filebrowser": {
|
||||
"description": "Grant UCI access for luci-app-filebrowser",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"service": [ "list" ]
|
||||
},
|
||||
"uci": [ "filebrowser" ]
|
||||
},
|
||||
"description": "Grant access to File Browser",
|
||||
"write": {
|
||||
"uci": [ "filebrowser" ]
|
||||
"cgi-io": [ "upload", "download" ],
|
||||
"ubus": {
|
||||
"file": [ "*" ]
|
||||
},
|
||||
"file": {
|
||||
"/*": [ "list", "read", "write" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user