update 04-08 18:57
This commit is contained in:
parent
76fe17ac37
commit
acd1cef001
|
@ -6,9 +6,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
LUCI_TITLE:=LuCI support for Fileassistant
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0-4
|
||||
PKG_RELEASE:=
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
|
|
@ -91,40 +91,6 @@ String.prototype.replaceAll = function(search, replacement) {
|
|||
}
|
||||
}
|
||||
|
||||
function chmodPath(filename, isdir) {
|
||||
var newmod = prompt('请输入新的权限位(支持八进制权限位或者a+x格式):', isdir === "1" ? "0755" : "0644");
|
||||
if (newmod) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/chmod',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newmod: newmod
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function chownPath(filename) {
|
||||
var newown = prompt('请输入新的用户名(支持用户名或用户名:群组格式):', "root");
|
||||
if (newown) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/chown',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newown: newown
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function openpath(filename, dirname) {
|
||||
dirname = dirname || currentPath;
|
||||
window.open('/cgi-bin/luci/admin/nas/fileassistant/open?path='
|
||||
|
@ -164,13 +130,6 @@ String.prototype.replaceAll = function(search, replacement) {
|
|||
else if (targetElem.className.indexOf('cbi-button-edit') > -1) {
|
||||
renamePath(targetElem.parentNode.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-chmod') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
chmodPath(infoElem.dataset['filename'] , infoElem.dataset['isdir']);
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-chown') > -1) {
|
||||
chownPath(targetElem.parentNode.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem = getFileElem(targetElem)) {
|
||||
if (targetElem.className.indexOf('parent-icon') > -1) {
|
||||
update_list(currentPath.replace(/\/[^/]+($|\/$)/, ''));
|
||||
|
@ -197,14 +156,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
|||
}
|
||||
}
|
||||
function refresh_list(filenames, path) {
|
||||
var listHtml = '<table class="cbi-section-table"><thead><tr class="cbi-section-table-row cbi-rowstyle-2">'
|
||||
+'<td class="cbi-value-field">文件</td>'
|
||||
+'<td class="cbi-value-field">所有者</td>'
|
||||
+'<td class="cbi-value-field">修改时间</td>'
|
||||
+'<td class="cbi-value-field">大小</td>'
|
||||
+'<td class="cbi-value-field">权限</td>'
|
||||
+'<td class="cbi-section-table-cell">操作</td>'
|
||||
+'</tr></thead><tbody>';
|
||||
var listHtml = '<table class="cbi-section-table"><tbody>';
|
||||
if (path !== '/') {
|
||||
listHtml += '<tr class="cbi-section-table-row cbi-rowstyle-2"><td class="parent-icon" colspan="6"><strong>..</strong></td></tr>';
|
||||
}
|
||||
|
@ -244,9 +196,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
|||
+ '<td class="cbi-value-field cbi-value-perm">'+o.perms+'</td>'
|
||||
+ '<td class="cbi-section-table-cell">\
|
||||
<button class="cbi-button cbi-button-edit">重命名</button>\
|
||||
<button class="cbi-button cbi-button-remove">删除</button>\
|
||||
<button class="cbi-button cbi-button-apply cbi-button-chmod">改权限</button>\
|
||||
<button class="cbi-button cbi-button-apply cbi-button-chown">改用户</button>'
|
||||
<button class="cbi-button cbi-button-remove">删除</button>'
|
||||
+ install_btn
|
||||
+ '</td>'
|
||||
+ '</tr>';
|
||||
|
@ -320,26 +270,6 @@ String.prototype.replaceAll = function(search, replacement) {
|
|||
}
|
||||
};
|
||||
|
||||
document.getElementById('mkdir-toggle').onclick = function() {
|
||||
var dirname = null;
|
||||
if (dirname = prompt("请输入文件夹名称:")) {
|
||||
var formData = new FormData();
|
||||
formData.append('path', currentPath);
|
||||
formData.append('dirname', dirname);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/nas/fileassistant/mkdir", true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
else {
|
||||
alert('创建失败,请稍后再试...');
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
}
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', function(evt) {
|
||||
var initPath = '/';
|
||||
if (/path=([/\w]+)/.test(location.search)) {
|
||||
|
|
|
@ -1,40 +1,34 @@
|
|||
module("luci.controller.fileassistant", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin", "system"}, firstchild(), _("FileAssistant") , 45).dependent = false
|
||||
|
||||
entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false
|
||||
entry({"admin", "system"}, firstchild(), "FileAssistant", 44).dependent = false
|
||||
|
||||
local page
|
||||
page = entry({"admin", "nas", "fileassistant"}, template("fileassistant"), _("文件助手"), 1)
|
||||
page = entry({"admin", "system", "fileassistant"}, template("fileassistant"), _("文件助手"), 1)
|
||||
page.i18n = "base"
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-fileassistant" }
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page = entry({"admin", "system", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "open"}, call("fileassistant_open"), nil)
|
||||
page = entry({"admin", "system", "fileassistant", "open"}, call("fileassistant_open"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
|
||||
page = entry({"admin", "system", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
|
||||
page = entry({"admin", "system", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
|
||||
page = entry({"admin", "system", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page = entry({"admin", "system", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "mkdir"}, call("fileassistant_mkdir"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "chmod"}, call("fileassistant_chmod"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "chown"}, call("fileassistant_chown"), nil)
|
||||
page.leaf = true
|
||||
end
|
||||
|
||||
function list_response(path, success)
|
||||
|
@ -141,27 +135,6 @@ function fileassistant_upload()
|
|||
list_response(uploaddir, true)
|
||||
end
|
||||
|
||||
function fileassistant_mkdir()
|
||||
local path = luci.http.formvalue("path")
|
||||
local dirname = luci.http.formvalue("dirname")
|
||||
local success = os.execute('sh -c \'cd "'..path..'" && mkdir -p "'..dirname..'"\'')
|
||||
list_response(path, success)
|
||||
end
|
||||
|
||||
function fileassistant_chmod()
|
||||
local path = luci.http.formvalue("filepath")
|
||||
local newmod = luci.http.formvalue("newmod")
|
||||
local success = os.execute('chmod '..newmod..' "'..path..'"')
|
||||
list_response(nixio.fs.dirname(path), success)
|
||||
end
|
||||
|
||||
function fileassistant_chown()
|
||||
local path = luci.http.formvalue("filepath")
|
||||
local newown = luci.http.formvalue("newown")
|
||||
local success = os.execute('chown '..newown..' "'..path..'"')
|
||||
list_response(nixio.fs.dirname(path), success)
|
||||
end
|
||||
|
||||
function scandir(directory)
|
||||
local i, t, popen = 0, {}, io.popen
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<%+header%>
|
||||
|
||||
<link rel="stylesheet" href="/luci-static/resources/fileassistant/fb.css<%# ?v=PKG_VERSION %>">
|
||||
<link rel="stylesheet" href="/luci-static/resources/fileassistant/fb.css?v=@ver">
|
||||
<h2 name="content">文件助手</h2>
|
||||
<fieldset class="cbi-section fb-container">
|
||||
<input id="current-path" type="text" class="current-path cbi-input-text" value="/"/>
|
||||
<div class="panel-container">
|
||||
<div class="panel-title">文件列表</div>
|
||||
<button id="upload-toggle" class="upload-toggle cbi-button cbi-button-edit">上传</button>
|
||||
<button id="mkdir-toggle" class="upload-toggle cbi-button cbi-button-edit">新建文件夹… </button>
|
||||
</div>
|
||||
<div class="upload-container" id="upload-container">
|
||||
<input id="upload-file" name="upload-file" class="upload-file" type="file">
|
||||
|
@ -16,6 +15,6 @@
|
|||
<div id="list-content"></div>
|
||||
</fieldset>
|
||||
|
||||
<script src="/luci-static/resources/fileassistant/fb.js<%# ?v=PKG_VERSION %>"></script>
|
||||
<script src="/luci-static/resources/fileassistant/fb.js?v=@ver"></script>
|
||||
|
||||
<%+footer%>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"luci-app-fileassistant": {
|
||||
"description": "Grant UCI access for luci-app-fileassistant",
|
||||
"read": {
|
||||
"uci": [ "fileassistant" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "fileassistant" ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mosdns
|
||||
PKG_VERSION:=35745ff
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/IrineSistiana/mosdns/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_MOSDNS_COMPRESS_GOPROXY \
|
||||
CONFIG_MOSDNS_COMPRESS_UPX
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/IrineSistiana/mosdns
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
GO_PKG_LDFLAGS_X:=main.version=$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/mosdns/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=A plug-in DNS forwarder/splitter
|
||||
URL:=https://github.com/IrineSistiana/mosdns
|
||||
endef
|
||||
|
||||
define Package/mosdns
|
||||
$(call Package/mosdns/Default)
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/mosdns/config
|
||||
config MOSDNS_COMPRESS_GOPROXY
|
||||
bool "Compiling with GOPROXY proxy"
|
||||
default n
|
||||
|
||||
config MOSDNS_COMPRESS_UPX
|
||||
bool "Compress executable files with UPX"
|
||||
default y
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_MOSDNS_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://mirrors.aliyun.com/goproxy/
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
endef
|
||||
|
||||
GO_PKG_TARGET_VARS:=$(filter-out CGO_ENABLED=%,$(GO_PKG_TARGET_VARS)) CGO_ENABLED=0
|
||||
|
||||
define Build/Compile
|
||||
$(call GoPackage/Build/Compile)
|
||||
ifneq ($(CONFIG_MOSDNS_COMPRESS_UPX),)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/mosdns
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/mosdns/install
|
||||
$(call GoPackage/Package/Install/Bin,$(1))
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,mosdns))
|
||||
$(eval $(call BuildPackage,mosdns))
|
Loading…
Reference in New Issue