mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 13:27:36 +08:00
add patches
This commit is contained in:
parent
4063bbd159
commit
72e32692c2
68
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/fb.css
vendored
Normal file
68
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/fb.css
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
.fb-container {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.fb-container .cbi-button {
|
||||
height: 2.6rem;
|
||||
}
|
||||
.fb-container .cbi-input-text {
|
||||
margin-bottom: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
.fb-container .panel-title {
|
||||
padding-bottom: 0;
|
||||
width: 50%;
|
||||
border-bottom: none;
|
||||
}
|
||||
.fb-container .panel-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 1rem;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
.fb-container .upload-container {
|
||||
display: none;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
.fb-container .upload-file {
|
||||
margin-right: 2rem;
|
||||
}
|
||||
.fb-container .cbi-value-field {
|
||||
text-align: left;
|
||||
}
|
||||
.fb-container .parent-icon strong {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.fb-container td[class$="-icon"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
.fb-container .file-icon, .fb-container .folder-icon, .fb-container .link-icon {
|
||||
position: relative;
|
||||
}
|
||||
.fb-container .file-icon:before, .fb-container .folder-icon:before, .fb-container .link-icon:before {
|
||||
display: inline-block;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
content: '';
|
||||
background-size: contain;
|
||||
margin: 0 0.5rem 0 1rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.fb-container .file-icon:before {
|
||||
background-image: url(file-icon.png);
|
||||
}
|
||||
.fb-container .folder-icon:before {
|
||||
background-image: url(folder-icon.png);
|
||||
}
|
||||
.fb-container .link-icon:before {
|
||||
background-image: url(link-icon.png);
|
||||
}
|
||||
@media screen and (max-width: 480px) {
|
||||
.fb-container .upload-file {
|
||||
width: 14.6rem;
|
||||
}
|
||||
.fb-container .cbi-value-owner,
|
||||
.fb-container .cbi-value-perm {
|
||||
display: none;
|
||||
}
|
||||
}
|
288
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/fb.js
vendored
Normal file
288
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/fb.js
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
String.prototype.replaceAll = function(search, replacement) {
|
||||
var target = this;
|
||||
return target.replace(new RegExp(search, 'g'), replacement);
|
||||
};
|
||||
(function () {
|
||||
var iwxhr = new XHR();
|
||||
var listElem = document.getElementById("list-content");
|
||||
listElem.onclick = handleClick;
|
||||
var currentPath;
|
||||
var pathElem = document.getElementById("current-path");
|
||||
pathElem.onblur = function () {
|
||||
update_list(this.value.trim());
|
||||
};
|
||||
pathElem.onkeyup = function (evt) {
|
||||
if (evt.keyCode == 13) {
|
||||
this.blur();
|
||||
}
|
||||
};
|
||||
function removePath(filename, isdir) {
|
||||
var c = confirm('你确定要删除 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/delete',
|
||||
{
|
||||
path: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function installPath(filename, isdir) {
|
||||
if (isdir === "1") {
|
||||
alert('这是一个目录,请选择 ipk 文件进行安装!');
|
||||
return;
|
||||
}
|
||||
var isipk = isIPK(filename);
|
||||
if (isipk === 0) {
|
||||
alert('只允许安装 ipk 格式的文件!');
|
||||
return;
|
||||
}
|
||||
var c = confirm('你确定要安装 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/install',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
location.reload();
|
||||
alert('安装成功!');
|
||||
} else {
|
||||
alert('安装失败,请检查文件格式!');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isIPK(filename) {
|
||||
var index= filename.lastIndexOf(".");
|
||||
var ext = filename.substr(index+1);
|
||||
if (ext === 'ipk') {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function renamePath(filename) {
|
||||
var newname = prompt('请输入新的文件名:', filename);
|
||||
if (newname) {
|
||||
newname = newname.trim();
|
||||
if (newname != filename) {
|
||||
var newpath = concatPath(currentPath, newname);
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/rename',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newpath: newpath
|
||||
},
|
||||
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/system/fileassistant/open?path='
|
||||
+ encodeURIComponent(dirname) + '&filename='
|
||||
+ encodeURIComponent(filename));
|
||||
}
|
||||
|
||||
function getFileElem(elem) {
|
||||
if (elem.className.indexOf('-icon') > -1) {
|
||||
return elem;
|
||||
}
|
||||
else if (elem.parentNode.className.indexOf('-icon') > -1) {
|
||||
return elem.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
function concatPath(path, filename) {
|
||||
if (path === '/') {
|
||||
return path + filename;
|
||||
}
|
||||
else {
|
||||
return path.replace(/\/$/, '') + '/' + filename;
|
||||
}
|
||||
}
|
||||
|
||||
function handleClick(evt) {
|
||||
var targetElem = evt.target;
|
||||
var infoElem;
|
||||
if (targetElem.className.indexOf('cbi-button-remove') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
removePath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-install') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
installPath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-edit') > -1) {
|
||||
renamePath(targetElem.parentNode.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem = getFileElem(targetElem)) {
|
||||
if (targetElem.className.indexOf('parent-icon') > -1) {
|
||||
update_list(currentPath.replace(/\/[^/]+($|\/$)/, ''));
|
||||
}
|
||||
else if (targetElem.className.indexOf('file-icon') > -1) {
|
||||
openpath(targetElem.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem.className.indexOf('link-icon') > -1) {
|
||||
infoElem = targetElem.parentNode;
|
||||
var filepath = infoElem.dataset['linktarget'];
|
||||
if (filepath) {
|
||||
if (infoElem.dataset['isdir'] === "1") {
|
||||
update_list(filepath);
|
||||
}
|
||||
else {
|
||||
var lastSlash = filepath.lastIndexOf('/');
|
||||
openpath(filepath.substring(lastSlash + 1), filepath.substring(0, lastSlash));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (targetElem.className.indexOf('folder-icon') > -1) {
|
||||
update_list(concatPath(currentPath, targetElem.parentNode.dataset['filename']))
|
||||
}
|
||||
}
|
||||
}
|
||||
function refresh_list(filenames, path) {
|
||||
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>';
|
||||
}
|
||||
if (filenames) {
|
||||
for (var i = 0; i < filenames.length; i++) {
|
||||
var line = filenames[i];
|
||||
if (line) {
|
||||
var f = line.match(/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+([\S\s]+)/);
|
||||
var isLink = f[1][0] === 'z' || f[1][0] === 'l' || f[1][0] === 'x';
|
||||
var o = {
|
||||
displayname: f[9],
|
||||
filename: isLink ? f[9].split(' -> ')[0] : f[9],
|
||||
perms: f[1],
|
||||
date: f[7] + ' ' + f[6] + ' ' + f[8],
|
||||
size: f[5],
|
||||
owner: f[3],
|
||||
icon: (f[1][0] === 'd') ? "folder-icon" : (isLink ? "link-icon" : "file-icon")
|
||||
};
|
||||
|
||||
var install_btn = ' <button class="cbi-button cbi-button-install" style="visibility: hidden;">安装</button>';
|
||||
var index= o.filename.lastIndexOf(".");
|
||||
var ext = o.filename.substr(index+1);
|
||||
if (ext === 'ipk') {
|
||||
install_btn = ' <button class="cbi-button cbi-button-install">安装</button>';
|
||||
}
|
||||
|
||||
listHtml += '<tr class="cbi-section-table-row cbi-rowstyle-' + (1 + i%2)
|
||||
+ '" data-filename="' + o.filename + '" data-isdir="' + Number(f[1][0] === 'd' || f[1][0] === 'z') + '"'
|
||||
+ ((f[1][0] === 'z' || f[1][0] === 'l') ? (' data-linktarget="' + f[9].split(' -> ')[1]) : '')
|
||||
+ '">'
|
||||
+ '<td class="cbi-value-field ' + o.icon + '">'
|
||||
+ '<strong>' + o.displayname + '</strong>'
|
||||
+ '</td>'
|
||||
|
||||
+ '<td class="cbi-value-field cbi-value-date">'+o.date+'</td>'
|
||||
+ '<td class="cbi-value-field cbi-value-size">'+o.size+'</td>'
|
||||
+ '<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>'
|
||||
+ install_btn
|
||||
+ '</td>'
|
||||
+ '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
listHtml += "</table>";
|
||||
listElem.innerHTML = listHtml;
|
||||
}
|
||||
function update_list(path, opt) {
|
||||
opt = opt || {};
|
||||
path = concatPath(path, '');
|
||||
if (currentPath != path) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/list',
|
||||
{path: path},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, path);
|
||||
}
|
||||
else {
|
||||
refresh_list([], path);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (!opt.popState) {
|
||||
history.pushState({path: path}, null, '?path=' + path);
|
||||
}
|
||||
currentPath = path;
|
||||
pathElem.value = currentPath;
|
||||
}
|
||||
};
|
||||
|
||||
var uploadToggle = document.getElementById('upload-toggle');
|
||||
var uploadContainer = document.getElementById('upload-container');
|
||||
var isUploadHide = true;
|
||||
uploadToggle.onclick = function() {
|
||||
if (isUploadHide) {
|
||||
uploadContainer.style.display = 'inline-flex';
|
||||
}
|
||||
else {
|
||||
uploadContainer.style.display = 'none';
|
||||
}
|
||||
isUploadHide = !isUploadHide;
|
||||
};
|
||||
var uploadBtn = uploadContainer.getElementsByClassName('cbi-input-apply')[0];
|
||||
uploadBtn.onclick = function (evt) {
|
||||
var uploadinput = document.getElementById('upload-file');
|
||||
var fullPath = uploadinput.value;
|
||||
if (!fullPath) {
|
||||
evt.preventDefault();
|
||||
}
|
||||
else {
|
||||
var formData = new FormData();
|
||||
var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
|
||||
formData.append('upload-filename', fullPath.substring(startIndex + 1));
|
||||
formData.append('upload-dir', concatPath(currentPath, ''));
|
||||
formData.append('upload-file', uploadinput.files[0]);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/system/fileassistant/upload", true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
refresh_list(res.data, currentPath);
|
||||
uploadinput.value = '';
|
||||
}
|
||||
else {
|
||||
alert('上传失败,请稍后再试...');
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(evt) {
|
||||
var initPath = '/';
|
||||
if (/path=([/\w]+)/.test(location.search)) {
|
||||
initPath = RegExp.$1;
|
||||
}
|
||||
update_list(initPath, {popState: true});
|
||||
});
|
||||
window.addEventListener('popstate', function (evt) {
|
||||
var path = '/';
|
||||
if (evt.state && evt.state.path) {
|
||||
path = evt.state.path;
|
||||
}
|
||||
update_list(path, {popState: true});
|
||||
});
|
||||
|
||||
})();
|
BIN
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/file-icon.png
vendored
Normal file
BIN
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/file-icon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/link-icon.png
vendored
Normal file
BIN
.github/diy/.packages/luci-app-advancedplus/htdocs/luci-static/resources/fileassistant/link-icon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
228
.github/diy/.packages/luci-app-advancedplus/luasrc/controller/fileassistant.lua
vendored
Normal file
228
.github/diy/.packages/luci-app-advancedplus/luasrc/controller/fileassistant.lua
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
module("luci.controller.fileassistant", package.seeall)
|
||||
|
||||
function index()
|
||||
|
||||
local page
|
||||
page = entry({"admin", "system", "fileassistant"}, template("fileassistant"), _("文件管理"), 84)
|
||||
page.i18n = "base"
|
||||
page.dependent = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "open"}, call("fileassistant_open"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page.leaf = true
|
||||
|
||||
end
|
||||
|
||||
function list_response(path, success)
|
||||
luci.http.prepare_content("application/json")
|
||||
local result
|
||||
if success then
|
||||
local rv = scandir(path)
|
||||
result = {
|
||||
ec = 0,
|
||||
data = rv
|
||||
}
|
||||
else
|
||||
result = {
|
||||
ec = 1
|
||||
}
|
||||
end
|
||||
luci.http.write_json(result)
|
||||
end
|
||||
|
||||
function fileassistant_list()
|
||||
local path = luci.http.formvalue("path")
|
||||
list_response(path, true)
|
||||
end
|
||||
|
||||
function fileassistant_open()
|
||||
local path = luci.http.formvalue("path")
|
||||
local filename = luci.http.formvalue("filename")
|
||||
local io = require "io"
|
||||
local mime = to_mime(filename)
|
||||
|
||||
file = path..filename
|
||||
|
||||
local download_fpi = io.open(file, "r")
|
||||
luci.http.header('Content-Disposition', 'inline; filename="'..filename..'"' )
|
||||
luci.http.prepare_content(mime)
|
||||
luci.ltn12.pump.all(luci.ltn12.source.file(download_fpi), luci.http.write)
|
||||
end
|
||||
|
||||
function fileassistant_delete()
|
||||
local path = luci.http.formvalue("path")
|
||||
local isdir = luci.http.formvalue("isdir")
|
||||
path = path:gsub("<>", "/")
|
||||
path = path:gsub(" ", "\ ")
|
||||
local success
|
||||
if isdir then
|
||||
success = os.execute('rm -r "'..path..'"')
|
||||
else
|
||||
success = os.remove(path)
|
||||
end
|
||||
list_response(nixio.fs.dirname(path), success)
|
||||
end
|
||||
|
||||
function fileassistant_rename()
|
||||
local filepath = luci.http.formvalue("filepath")
|
||||
local newpath = luci.http.formvalue("newpath")
|
||||
local success = os.execute('mv "'..filepath..'" "'..newpath..'"')
|
||||
list_response(nixio.fs.dirname(filepath), success)
|
||||
end
|
||||
|
||||
function fileassistant_install()
|
||||
local filepath = luci.http.formvalue("filepath")
|
||||
local isdir = luci.http.formvalue("isdir")
|
||||
local ext = filepath:match(".+%.(%w+)$")
|
||||
filepath = filepath:gsub("<>", "/")
|
||||
filepath = filepath:gsub(" ", "\ ")
|
||||
local success
|
||||
if isdir == "1" then
|
||||
success = false
|
||||
elseif ext == "ipk" then
|
||||
success = installIPK(filepath)
|
||||
else
|
||||
success = false
|
||||
end
|
||||
list_response(nixio.fs.dirname(filepath), success)
|
||||
end
|
||||
|
||||
function installIPK(filepath)
|
||||
luci.sys.exec('opkg --force-depends install "'..filepath..'"')
|
||||
luci.sys.exec('rm -rf /tmp/luci-*')
|
||||
return true;
|
||||
end
|
||||
|
||||
function fileassistant_upload()
|
||||
local filecontent = luci.http.formvalue("upload-file")
|
||||
local filename = luci.http.formvalue("upload-filename")
|
||||
local uploaddir = luci.http.formvalue("upload-dir")
|
||||
local filepath = uploaddir..filename
|
||||
|
||||
local fp
|
||||
luci.http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fp and meta and meta.name == "upload-file" then
|
||||
fp = io.open(filepath, "w")
|
||||
end
|
||||
if fp and chunk then
|
||||
fp:write(chunk)
|
||||
end
|
||||
if fp and eof then
|
||||
fp:close()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
list_response(uploaddir, true)
|
||||
end
|
||||
|
||||
function scandir(directory)
|
||||
local i, t, popen = 0, {}, io.popen
|
||||
|
||||
local pfile = popen("ls -lh \""..directory.."\" | egrep '^d' ; ls -lh \""..directory.."\" | egrep -v '^d|^l'")
|
||||
for fileinfo in pfile:lines() do
|
||||
i = i + 1
|
||||
t[i] = fileinfo
|
||||
end
|
||||
pfile:close()
|
||||
pfile = popen("ls -lh \""..directory.."\" | egrep '^l' ;")
|
||||
for fileinfo in pfile:lines() do
|
||||
i = i + 1
|
||||
linkindex, _, linkpath = string.find(fileinfo, "->%s+(.+)$")
|
||||
local finalpath;
|
||||
if string.sub(linkpath, 1, 1) == "/" then
|
||||
finalpath = linkpath
|
||||
else
|
||||
finalpath = nixio.fs.realpath(directory..linkpath)
|
||||
end
|
||||
local linktype;
|
||||
if not finalpath then
|
||||
finalpath = linkpath;
|
||||
linktype = 'x'
|
||||
elseif nixio.fs.stat(finalpath, "type") == "dir" then
|
||||
linktype = 'z'
|
||||
else
|
||||
linktype = 'l'
|
||||
end
|
||||
fileinfo = string.sub(fileinfo, 2, linkindex - 1)
|
||||
fileinfo = linktype..fileinfo.."-> "..finalpath
|
||||
t[i] = fileinfo
|
||||
end
|
||||
pfile:close()
|
||||
return t
|
||||
end
|
||||
|
||||
MIME_TYPES = {
|
||||
["txt"] = "text/plain";
|
||||
["conf"] = "text/plain";
|
||||
["ovpn"] = "text/plain";
|
||||
["log"] = "text/plain";
|
||||
["js"] = "text/javascript";
|
||||
["json"] = "application/json";
|
||||
["css"] = "text/css";
|
||||
["htm"] = "text/html";
|
||||
["html"] = "text/html";
|
||||
["patch"] = "text/x-patch";
|
||||
["c"] = "text/x-csrc";
|
||||
["h"] = "text/x-chdr";
|
||||
["o"] = "text/x-object";
|
||||
["ko"] = "text/x-object";
|
||||
|
||||
["bmp"] = "image/bmp";
|
||||
["gif"] = "image/gif";
|
||||
["png"] = "image/png";
|
||||
["jpg"] = "image/jpeg";
|
||||
["jpeg"] = "image/jpeg";
|
||||
["svg"] = "image/svg+xml";
|
||||
|
||||
["zip"] = "application/zip";
|
||||
["pdf"] = "application/pdf";
|
||||
["xml"] = "application/xml";
|
||||
["xsl"] = "application/xml";
|
||||
["doc"] = "application/msword";
|
||||
["ppt"] = "application/vnd.ms-powerpoint";
|
||||
["xls"] = "application/vnd.ms-excel";
|
||||
["odt"] = "application/vnd.oasis.opendocument.text";
|
||||
["odp"] = "application/vnd.oasis.opendocument.presentation";
|
||||
["pl"] = "application/x-perl";
|
||||
["sh"] = "application/x-shellscript";
|
||||
["php"] = "application/x-php";
|
||||
["deb"] = "application/x-deb";
|
||||
["iso"] = "application/x-cd-image";
|
||||
["tgz"] = "application/x-compressed-tar";
|
||||
|
||||
["mp3"] = "audio/mpeg";
|
||||
["ogg"] = "audio/x-vorbis+ogg";
|
||||
["wav"] = "audio/x-wav";
|
||||
|
||||
["mpg"] = "video/mpeg";
|
||||
["mpeg"] = "video/mpeg";
|
||||
["avi"] = "video/x-msvideo";
|
||||
}
|
||||
|
||||
function to_mime(filename)
|
||||
if type(filename) == "string" then
|
||||
local ext = filename:match("[^%.]+$")
|
||||
|
||||
if ext and MIME_TYPES[ext:lower()] then
|
||||
return MIME_TYPES[ext:lower()]
|
||||
end
|
||||
end
|
||||
|
||||
return "application/octet-stream"
|
||||
end
|
20
.github/diy/.packages/luci-app-advancedplus/luasrc/view/fileassistant.htm
vendored
Normal file
20
.github/diy/.packages/luci-app-advancedplus/luasrc/view/fileassistant.htm
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<%+header%>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
<div class="upload-container" id="upload-container">
|
||||
<input id="upload-file" name="upload-file" class="upload-file" type="file">
|
||||
<button type="button" class="cbi-button cbi-input-apply">执行上传</button>
|
||||
</div>
|
||||
<div id="list-content"></div>
|
||||
</fieldset>
|
||||
|
||||
<script src="/luci-static/resources/fileassistant/fb.js?v=@ver"></script>
|
||||
|
||||
<%+footer%>
|
6
.github/diy/.packages/luci-app-transmission/root/etc/uci-defaults/luci-transmission
vendored
Normal file
6
.github/diy/.packages/luci-app-transmission/root/etc/uci-defaults/luci-transmission
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
rm -rf /etc/seccomp/transmission-daemon.json
|
||||
|
||||
sed -i "s/reload_service(/reload_service1(/" /etc/init.d/transmission
|
||||
|
||||
exit 0
|
46
.github/diy/patches/advancedplus.patch
vendored
Normal file
46
.github/diy/patches/advancedplus.patch
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
--- a/luci-app-advancedplus/luasrc/controller/advancedplus.lua
|
||||
+++ b/luci-app-advancedplus/luasrc/controller/advancedplus.lua
|
||||
@@ -9,12 +9,14 @@ function index()
|
||||
end
|
||||
|
||||
local page
|
||||
- page = entry({"admin","system","advancedplus"},alias("admin","system","advancedplus","kucatset"),_("Advanced plus"),61)
|
||||
+ page = entry({"admin","system","advancedplus"},alias("admin","system","advancedplus","advancededit"),_("Advanced plus"),61)
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-advancedplus" }
|
||||
+ if uci.cursor():get("luci", "main", "mediaurlbase") == "/luci-static/kucat" then
|
||||
entry({"admin","system","advancedplus","kucatset"},cbi("advancedplus/kucatset"),_("KuCat Theme Config"),20).leaf = true
|
||||
+ entry({"admin", "system","advancedplus","kucatupload"}, form("advancedplus/kucatupload"), _("Desktop background upload"), 80).leaf = true
|
||||
+ end
|
||||
entry({"admin","system","advancedplus","advancedset"},cbi("advancedplus/advancedset"),_("Advanced Setting"),10).leaf = true
|
||||
- entry({"admin","system","advancedplus","advancededit"},cbi("advancedplus/advancededit"),_("Advanced Edit"),60).leaf = true
|
||||
+ entry({"admin","system","advancedplus","advancededit"},cbi("advancedplus/advancededit"),_("Advanced Edit"),1).leaf = true
|
||||
entry({"admin", "system","advancedplus","upload"}, form("advancedplus/upload"), _("Login Background Upload"), 70).leaf = true
|
||||
- entry({"admin", "system","advancedplus","kucatupload"}, form("advancedplus/kucatupload"), _("Desktop background upload"), 80).leaf = true
|
||||
end
|
||||
|
||||
--- a/luci-app-advancedplus/luasrc/model/cbi/advancedplus/advancedset.lua
|
||||
+++ b/luci-app-advancedplus/luasrc/model/cbi/advancedplus/advancedset.lua
|
||||
@@ -24,7 +24,9 @@ ul:depends("qos", true)
|
||||
|
||||
-- e = t:option(Flag, "uhttps",translate('Accessing using HTTPS'), translate('Open the address in the background and use HTTPS for secure access'))
|
||||
|
||||
+if fs.access('/usr/bin/zsh') then
|
||||
e = t:option(Flag, "usshmenu",translate('No backend menu required'), translate('OPENWRT backend and SSH login do not display shortcut menus'))
|
||||
+end
|
||||
|
||||
if fs.access('/etc/config/netwizard') then
|
||||
e = t:option(Flag, "wizard",translate('Hide Wizard'), translate('Show or hide the setup wizard menu'))
|
||||
|
||||
--- a/luci-app-advancedplus/root/etc/init.d/advancedplus
|
||||
+++ b/luci-app-advancedplus/root/etc/init.d/advancedplus
|
||||
@@ -144,8 +144,10 @@ dev=`ifconfig | grep "Point-to-Point" | cut -d " " -f1`
|
||||
fi
|
||||
#cpumode=`uci -q get advancedplus.@basic[0].cpumode`
|
||||
#[ ! $cpumode ] || cpumodeset $cpumode /usr/bin/zsh
|
||||
+if [ "$(which zsh)" ]; then
|
||||
sed -i "\/bin\/zsh/d" /etc/profile
|
||||
[ "x$(uci -q get advancedplus.@basic[0].usshmenu)" = "x1" ] || echo '/usr/bin/zsh' >> /etc/profile
|
||||
+fi
|
||||
uci commit netwizard
|
||||
}
|
62
.github/diy/patches/cgroupfs-mount.patch
vendored
Normal file
62
.github/diy/patches/cgroupfs-mount.patch
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
diff --git a/utils/cgroupfs-mount/files/cgroupfs-mount.init b/utils/cgroupfs-mount/files/cgroupfs-mount.init
|
||||
index 0d6b68d..4ae3185 100755
|
||||
--- a/cgroupfs-mount/files/cgroupfs-mount.init
|
||||
+++ b/cgroupfs-mount/files/cgroupfs-mount.init
|
||||
@@ -4,9 +4,17 @@ START=01
|
||||
|
||||
boot() {
|
||||
# Procd mounts non-hierarchical cgroupfs so unmount first before cgroupfs-mount
|
||||
- if mountpoint -q /sys/fs/cgroup; then
|
||||
- umount /sys/fs/cgroup/
|
||||
- fi
|
||||
+ umount_cgroup() {
|
||||
+ for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
|
||||
+ if mountpoint -q /sys/fs/cgroup/$sys; then
|
||||
+ umount /sys/fs/cgroup/$sys || true
|
||||
+ fi
|
||||
+ done
|
||||
+ if mountpoint -q /sys/fs/cgroup; then
|
||||
+ umount /sys/fs/cgroup || true
|
||||
+ fi
|
||||
+ }
|
||||
|
||||
- cgroupfs-mount
|
||||
+ umount_cgroup
|
||||
+ cgroupfs-mount v2
|
||||
}
|
||||
|
||||
new file mode 100644
|
||||
index 00000000000..919684514af
|
||||
--- /dev/null
|
||||
+++ b/cgroupfs-mount/patches/900-add-cgroupfs2.patch
|
||||
@@ -0,0 +1,30 @@
|
||||
+--- a/cgroupfs-mount
|
||||
++++ b/cgroupfs-mount
|
||||
+@@ -26,7 +26,11 @@ fi
|
||||
+
|
||||
+ # mount /sys/fs/cgroup if not already done
|
||||
+ if ! mountpoint -q /sys/fs/cgroup; then
|
||||
+- mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
||||
++ if [ "$1" = "v2" ]; then
|
||||
++ mount -t cgroup2 cgroup2 /sys/fs/cgroup
|
||||
++ else
|
||||
++ mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
||||
++ fi
|
||||
+ fi
|
||||
+
|
||||
+ cd /sys/fs/cgroup
|
||||
+@@ -34,9 +38,11 @@ cd /sys/fs/cgroup
|
||||
+ # get/mount list of enabled cgroup controllers
|
||||
+ for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
|
||||
+ mkdir -p $sys
|
||||
+- if ! mountpoint -q $sys; then
|
||||
+- if ! mount -n -t cgroup -o $sys cgroup $sys; then
|
||||
+- rmdir $sys || true
|
||||
++ if [ "$1" != "v2" ]; then
|
||||
++ if ! mountpoint -q $sys; then
|
||||
++ if ! mount -n -t cgroup -o $sys cgroup $sys; then
|
||||
++ rmdir $sys || true
|
||||
++ fi
|
||||
+ fi
|
||||
+ fi
|
||||
+ done
|
12
.github/diy/patches/depends.patch
vendored
12
.github/diy/patches/depends.patch
vendored
@ -173,18 +173,6 @@
|
||||
|
||||
define KernelPackage/ipt-fullconenat
|
||||
|
||||
--- a/luci-app-easymesh/Makefile
|
||||
+++ b/luci-app-easymesh/Makefile
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Support for easymesh
|
||||
-LUCI_DEPENDS:=+kmod-cfg80211 +batctl-default +kmod-batman-adv +wpad-openssl +dawn
|
||||
+LUCI_DEPENDS:=+kmod-cfg80211 +batctl-default +kmod-batman-adv +wpad-wolfssl +dawn
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-easymesh
|
||||
|
||||
--- a/phtunnel/Makefile
|
||||
+++ b/phtunnel/Makefile
|
||||
@@ -36,7 +36,6 @@ PKG_SOURCE:=phtunnel
|
||||
|
21
.github/diy/patches/dnsmasq.patch
vendored
21
.github/diy/patches/dnsmasq.patch
vendored
@ -1,16 +1,3 @@
|
||||
--- a/dnsmasq/Makefile
|
||||
+++ b/dnsmasq/Makefile
|
||||
@@ -113,9 +113,6 @@ define Package/dnsmasq-full/config
|
||||
config PACKAGE_dnsmasq_full_ipset
|
||||
bool "Build with IPset support."
|
||||
default n
|
||||
- config PACKAGE_dnsmasq_full_nftset
|
||||
- bool "Build with Nftset support."
|
||||
- default y
|
||||
config PACKAGE_dnsmasq_full_conntrack
|
||||
bool "Build with Conntrack support."
|
||||
default y
|
||||
|
||||
--- a/dnsmasq/files/dnsmasq.init
|
||||
+++ b/dnsmasq/files/dnsmasq.init
|
||||
@@ -411,6 +411,21 @@ dhcp_this_host_add() {
|
||||
@ -35,14 +22,6 @@
|
||||
|
||||
if [ "$mode" -gt 0 ] ; then
|
||||
ifdashname="${ifname//./-}"
|
||||
@@ -931,6 +946,7 @@ dnsmasq_start()
|
||||
append_bool "$cfg" noping "--no-ping"
|
||||
append_bool "$cfg" rapidcommit "--dhcp-rapid-commit"
|
||||
append_bool "$cfg" scriptarp "--script-arp"
|
||||
+ append_parm "$cfg" mini_ttl "--min-ttl"
|
||||
|
||||
append_parm "$cfg" logfacility "--log-facility"
|
||||
config_get logfacility "$cfg" "logfacility"
|
||||
@@ -1173,6 +1190,14 @@ dnsmasq_start()
|
||||
esac
|
||||
|
||||
|
44
.github/diy/patches/luci-app-advanced.patch
vendored
44
.github/diy/patches/luci-app-advanced.patch
vendored
@ -1,44 +0,0 @@
|
||||
--- a/luci-app-advanced/Makefile
|
||||
+++ b/luci-app-advanced/Makefile
|
||||
@@ -35,9 +35,6 @@ define Package/$(PKG_NAME)/install
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
-
|
||||
- $(INSTALL_DIR) $(1)/bin
|
||||
- $(INSTALL_BIN) ./root/bin/* $(1)/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
--- a/luci-app-advanced/luasrc/model/cbi/advanced.lua
|
||||
+++ b/luci-app-advanced/luasrc/model/cbi/advanced.lua
|
||||
@@ -140,6 +140,28 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
+if nixio.fs.access("/etc/config/nginx")then
|
||||
+s:tab("nginxconf",translate("NGINX"),translate("本页是配置/etc/config/nginx包含NGINX配置文档内容。应用保存后自动重启生效"))
|
||||
+conf=s:taboption("nginxconf",Value,"nginxconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
+conf.template="cbi/tvalue"
|
||||
+conf.rows=20
|
||||
+conf.wrap="off"
|
||||
+conf.cfgvalue=function(t,t)
|
||||
+return e.readfile("/etc/config/nginx") or ""
|
||||
+end
|
||||
+conf.write=function(a,a,t)
|
||||
+if t then
|
||||
+t=t:gsub("\r\n?","\n")
|
||||
+e.writefile("/tmp/nginx",t)
|
||||
+if(luci.sys.call("cmp -s /tmp/nginx /etc/config/nginx")==1)then
|
||||
+e.writefile("/etc/config/nginx",t)
|
||||
+luci.sys.call("/etc/init.d/nginx reload >/dev/null")
|
||||
+end
|
||||
+e.remove("/tmp/nginx")
|
||||
+end
|
||||
+end
|
||||
+end
|
||||
+
|
||||
if nixio.fs.access("/etc/config/mwan3")then
|
||||
s:tab("mwan3conf",translate("负载均衡"),translate("本页是配置/etc/config/mwan3包含负载均衡设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("mwan3conf",Value,"mwan3conf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
12
.github/diy/patches/luci-app-cifs.patch
vendored
Normal file
12
.github/diy/patches/luci-app-cifs.patch
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
--- a/luci-app-cifs/luasrc/model/cbi/cifs.lua
|
||||
+++ b/luci-app-cifs/luasrc/model/cbi/cifs.lua
|
||||
@@ -7,7 +7,7 @@ local fs = require "nixio.fs"
|
||||
m = Map("cifs", translate("Mounting NAT drives"))
|
||||
m.description = translate("Allows you mounting Nat drives")
|
||||
|
||||
-m:section(SimpleSection).template = "cifs/cifs_status"
|
||||
+m:section(SimpleSection).template = "cifs_status"
|
||||
|
||||
s = m:section(TypedSection, "cifs", "Cifs")
|
||||
s.anonymous = true
|
||||
|
11
.github/diy/patches/luci-app-filebrowser.patch
vendored
Normal file
11
.github/diy/patches/luci-app-filebrowser.patch
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js
|
||||
+++ b/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js
|
||||
@@ -28,7 +28,7 @@ function renderStatus(isRunning, port) {
|
||||
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;
|
||||
+ renderHTML = spanTemp.format('green', _('FileBrowser'), _('RUNNING')) + button + "<span> 默认用户名与密码:admin</span>" ;
|
||||
} else {
|
||||
renderHTML = spanTemp.format('red', _('FileBrowser'), _('NOT RUNNING'));
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
--- a/luci-app-openvpn-server/root/etc/uci-defaults/openvpn
|
||||
+++ b/luci-app-openvpn-server/root/etc/uci-defaults/openvpn
|
||||
--- a/luci-app-openvpn-server/root/etc/uci-defaults/luci-openvpn
|
||||
+++ b/luci-app-openvpn-server/root/etc/uci-defaults/luci-openvpn
|
||||
@@ -1,5 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
+if [ ! "$(grep "myvpn" /etc/config/openvpn)" ]; then
|
||||
+rm -f /etc/config/openvpn
|
||||
+mv -f /etc/config/openvpn-opkg /etc/config/openvpn
|
||||
+ rm -f /etc/config/openvpn
|
||||
+ mv -f /etc/config/openvpn-opkg /etc/config/openvpn
|
||||
+fi
|
||||
+
|
||||
openvpn_port="$(uci -q get openvpn.myvpn.port)"
|
||||
|
11
.github/diy/patches/luci-app-transmission.patch
vendored
Normal file
11
.github/diy/patches/luci-app-transmission.patch
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js
|
||||
+++ b/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js
|
||||
@@ -34,7 +34,7 @@ return view.extend({
|
||||
var webinstalled = res[1] || !!uci.get_first('transmission', 'transmission', 'web_home');
|
||||
|
||||
var button = '';
|
||||
- if (running && webinstalled)
|
||||
+ if (running)
|
||||
button = ' <a class="btn" href="http://' + window.location.hostname + ':' + port + '" target="_blank" rel="noreferrer noopener">' + _('Open Web Interface') + '</a>';
|
||||
|
||||
var m, s, o;
|
36
.github/diy/patches/luci-dhcp.patch
vendored
36
.github/diy/patches/luci-dhcp.patch
vendored
@ -1,9 +1,9 @@
|
||||
--- a/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js
|
||||
+++ b/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js
|
||||
@@ -264,6 +264,29 @@ return view.extend({
|
||||
@@ -337,6 +337,25 @@ return view.extend({
|
||||
s.tab('mxhosts', _('MX'));
|
||||
s.tab('cnamehosts', _('CNAME'));
|
||||
s.tab('pxe_tftp', _('PXE/TFTP Settings'));
|
||||
s.tab('pxe_tftp', _('PXE/TFTP'));
|
||||
+ s.tab('custom_domain', _('Custom Redirect Domain'));
|
||||
+
|
||||
+ o = s.taboption('custom_domain', form.SectionValue, 'domain', form.GridSection, 'domain', null,
|
||||
@ -23,36 +23,6 @@
|
||||
+
|
||||
+ so = ss.option(form.Value, 'comments', _('Comments'));
|
||||
+ so.rmempty = true;
|
||||
+
|
||||
+ s.taboption('general', form.Flag, 'dns_redirect',
|
||||
+ _('DNS Redirect'),
|
||||
+ _('Redirect client DNS to dnsmasq'));
|
||||
|
||||
s.taboption('general', form.Flag, 'domainneeded',
|
||||
s.taboption('filteropts', form.Flag, 'domainneeded',
|
||||
_('Domain required'),
|
||||
@@ -439,6 +462,11 @@ return view.extend({
|
||||
o.optional = true;
|
||||
o.placeholder = '/etc/dnsmasq.hosts';
|
||||
|
||||
+ o = s.taboption('advanced', form.Flag, 'filter_aaaa',
|
||||
+ _('Disable IPv6 DNS forwards'),
|
||||
+ _('Filter IPv6(AAAA) DNS Query Name Resolve'));
|
||||
+ o.optional = true;
|
||||
+
|
||||
o = s.taboption('advanced', form.Flag, 'quietdhcp',
|
||||
_('Suppress logging'),
|
||||
_('Suppress logging of the routine operation for the DHCP protocol.'));
|
||||
@@ -558,6 +586,13 @@ return view.extend({
|
||||
o.datatype = 'range(0,10000)';
|
||||
o.placeholder = 1000;
|
||||
|
||||
+ o = s.taboption('advanced', form.Value, 'mini_ttl',
|
||||
+ _('Minimum TTL to send to clients'),
|
||||
+ _('Modify DNS entries minimum TTL (max is 86400, 0 is no modify)'));
|
||||
+ o.optional = true;
|
||||
+ o.datatype = 'range(0,86400)';
|
||||
+ o.placeholder = 0;
|
||||
+
|
||||
o = s.taboption('pxe_tftp', form.Flag, 'enable_tftp',
|
||||
_('Enable TFTP server'),
|
||||
_('Enable the built-in single-instance TFTP server.'));
|
||||
|
38
.github/diy/patches/opkginstall.patch
vendored
38
.github/diy/patches/opkginstall.patch
vendored
@ -42,7 +42,7 @@
|
||||
'click': handleInstall
|
||||
}, _('Upgrade…'));
|
||||
else
|
||||
@@ -392,6 +395,12 @@ function handleMode(ev)
|
||||
@@ -393,6 +396,12 @@ function handleMode(ev)
|
||||
|
||||
currentDisplayMode = tab.getAttribute('data-mode');
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
display(document.querySelector('input[name="filter"]').value);
|
||||
|
||||
ev.target.blur();
|
||||
@@ -660,6 +669,7 @@ function handleReset(ev)
|
||||
@@ -661,6 +670,7 @@ function handleReset(ev)
|
||||
function handleInstall(ev)
|
||||
{
|
||||
var name = ev.target.getAttribute('data-package'),
|
||||
@ -63,7 +63,7 @@
|
||||
pkg = packages.available.pkgs[name],
|
||||
depcache = {},
|
||||
size;
|
||||
@@ -785,7 +795,8 @@ function handleInstall(ev)
|
||||
@@ -786,7 +796,8 @@ function handleInstall(ev)
|
||||
'id': 'overwrite-cb',
|
||||
'type': 'checkbox',
|
||||
'name': 'overwrite',
|
||||
@ -73,7 +73,7 @@
|
||||
}), ' ',
|
||||
E('label', { 'for': 'overwrite-cb' }), ' ',
|
||||
_('Allow overwriting conflicting package files')
|
||||
@@ -799,7 +810,7 @@ function handleInstall(ev)
|
||||
@@ -800,7 +811,7 @@ function handleInstall(ev)
|
||||
}, _('Cancel')),
|
||||
' ',
|
||||
E('div', {
|
||||
@ -82,7 +82,7 @@
|
||||
'data-package': name,
|
||||
'class': 'btn cbi-button-action',
|
||||
'click': handleOpkg,
|
||||
@@ -985,6 +996,10 @@ function handleOpkg(ev)
|
||||
@@ -986,6 +997,10 @@ function handleOpkg(ev)
|
||||
|
||||
var argv = [ cmd, '--force-removal-of-dependent-packages' ];
|
||||
|
||||
@ -93,26 +93,16 @@
|
||||
if (rem && rem.checked)
|
||||
argv.push('--autoremove');
|
||||
|
||||
@@ -1090,8 +1105,8 @@ function updateLists(data)
|
||||
mount = L.toArray(data[0].filter(function(m) { return m.mount == '/' || m.mount == '/overlay' }))
|
||||
.sort(function(a, b) { return a.mount > b.mount })[0] || { size: 0, free: 0 };
|
||||
@@ -1088,7 +1103,7 @@ function updateLists(data)
|
||||
|
||||
- pg.firstElementChild.style.width = Math.floor(mount.size ? ((100 / mount.size) * mount.free) : 100) + '%';
|
||||
- pg.setAttribute('title', '%s (%1024mB)'.format(pg.firstElementChild.style.width, mount.free));
|
||||
+ pg.firstElementChild.style.width = Math.floor(mount.size ? ((100 / mount.size) * (mount.size-mount.free)) : 100) + '%';
|
||||
+ pg.setAttribute('title', '%.1024mB / %.1024mB (%s)'.format((mount.size-mount.free), mount.size, pg.firstElementChild.style.width));
|
||||
|
||||
parseList(data[1], packages.available);
|
||||
parseList(data[2], packages.installed);
|
||||
@@ -1130,14 +1145,14 @@ return view.extend({
|
||||
|
||||
E('div', { 'class': 'controls' }, [
|
||||
E('div', {}, [
|
||||
- E('label', {}, _('Free space') + ':'),
|
||||
+ E('label', {}, _('Used space') + ':'),
|
||||
E('div', { 'class': 'cbi-progressbar', 'title': _('unknown') }, E('div', {}, [ '\u00a0' ]))
|
||||
]),
|
||||
return (data ? Promise.resolve(data) : downloadLists()).then(function(data) {
|
||||
var pg = document.querySelector('.cbi-progressbar'),
|
||||
- mount = L.toArray(data[0].filter(function(m) { return m.mount == '/' || m.mount == '/overlay' }))
|
||||
+ mount = L.toArray(data[0].filter(function(m) { return m.mount == '/' || m.mount == '/overlay' }))
|
||||
.sort(function(a, b) { return a.mount > b.mount })[0] || { size: 0, free: 0 };
|
||||
|
||||
pg.firstElementChild.style.width = Math.floor(mount.size ? (100 / mount.size) * (mount.size - mount.free) : 100) + '%';
|
||||
@@ -1138,7 +1153,7 @@ return view.extend({
|
||||
E('div', {}, [
|
||||
E('label', {}, _('Filter') + ':'),
|
||||
E('span', { 'class': 'control-group' }, [
|
||||
@ -121,7 +111,7 @@
|
||||
E('button', { 'class': 'btn cbi-button', 'click': handleReset }, [ _('Clear') ])
|
||||
])
|
||||
]),
|
||||
@@ -1154,6 +1169,7 @@ return view.extend({
|
||||
@@ -1155,6 +1170,7 @@ return view.extend({
|
||||
E('label', {}, _('Actions') + ':'), ' ',
|
||||
E('span', { 'class': 'control-group' }, [
|
||||
E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleOpkg, 'disabled': isReadonlyView }, [ _('Update lists…') ]), ' ',
|
||||
|
12
.github/diy/patches/status.patch
vendored
12
.github/diy/patches/status.patch
vendored
@ -126,3 +126,15 @@
|
||||
E('button', {
|
||||
'class': 'btn cbi-button',
|
||||
'click': function() { location.href = 'nftables/iptables' }
|
||||
|
||||
--- a/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
|
||||
+++ b/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
|
||||
@@ -309,8 +309,6 @@ return baseclass.extend({
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
- if (L.hasSystemFeature('swconfig'))
|
||||
- return null;
|
||||
|
||||
var board = JSON.parse(data[1]),
|
||||
known_ports = [],
|
||||
|
Loading…
Reference in New Issue
Block a user