update 2022-09-03 20:16:00

This commit is contained in:
github-actions[bot] 2022-09-03 20:16:00 +08:00
parent 30d1d4db00
commit bac64e8a8a
23 changed files with 1360 additions and 0 deletions

68
filebrowser/Makefile Normal file
View File

@ -0,0 +1,68 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=filebrowser
PKG_VERSION:=2.21.1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=b73d278
PKG_SOURCE_URL:=https://github.com/filebrowser/filebrowser
PKG_MIRROR_HASH:=66b9df31f98bec22715a7fe9ca73962c1e5a5c1b3bcfb99fd0ac1703118ee4c8
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=CN_SZTL <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=golang/host node/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/filebrowser/filebrowser
GO_PKG_LDFLAGS_X:= \
$(GO_PKG)/v2/version.CommitSHA=$(PKG_SOURCE_VERSION) \
$(GO_PKG)/v2/version.Version=v$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/filebrowser
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Web File Browser
URL:=https://github.com/filebrowser/filebrowser
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/filebrowser/description
filebrowser provides a file managing interface within a specified directory
and it can be used to upload, delete, preview, rename and edit your files.
It allows the creation of multiple users and each user can have its own directory.
It can be used as a standalone app or as a middleware.
endef
define Build/Compile
( \
pushd "$(PKG_BUILD_DIR)/frontend" ; \
npm ci; \
npm run lint ; \
npm run build ; \
popd ; \
$(call GoPackage/Build/Compile) ; \
)
endef
define Package/filebrowser/install
$(call GoPackage/Package/Install/Bin,$(1))
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(CURDIR)/files/filebrowser.config $(1)/etc/config/filebrowser
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(CURDIR)/files/filebrowser.init $(1)/etc/init.d/filebrowser
endef
$(eval $(call GoBinPackage,filebrowser))
$(eval $(call BuildPackage,filebrowser))

View File

@ -0,0 +1,9 @@
config filebrowser 'config'
option addr_type 'lan'
option db_dir '/etc'
option db_name 'filebrowser.db'
option enabled '0'
option port '8989'
option root_dir '/'

View File

@ -0,0 +1,34 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2021 ImmortalWrt
START=90
STOP=10
addr_type="$(uci get filebrowser.config.addr_type)"
db_dir="$(uci get filebrowser.config.db_dir)"
[ "${db_dir}" == "/" ] || db_dir="${db_dir%*/}"
db_name="$(uci get filebrowser.config.db_name| sed 's#/##g')"
enabled="$(uci get filebrowser.config.enabled)"
port="$(uci get filebrowser.config.port)"
root_dir="$(uci get filebrowser.config.root_dir)"
if [ "${addr_type}" == "local" ];then
addr="127.0.0.1"
elif [ "${addr_type}" == "lan" ];then
addr="$(uci get network.lan.ipaddr)"
elif [ "${addr_type}" == "wan" ];then
addr="0.0.0.0"
fi
start() {
stop
[ "$enabled" == "1" ] || exit 0
mkdir -p "${root_dir}"
mkdir -p "${db_dir}"
filebrowser -a "${addr}" -d "${db_dir}/${db_name}" -p "${port}" -r "${root_dir}" >/dev/null 2>&1 &
}
stop() {
echo "${db_dir}/${db_name}" > "/lib/upgrade/keep.d/filebrowser"
killall -9 filebrowser >/dev/null 2>&1
}

44
lua-neturl/Makefile Normal file
View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2022 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=neturl
PKG_VERSION:=1.1-1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/golgote/neturl/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=25f3a94ba9f435ef1395555de2bf17d6f934d789fa515ed965405919e42be27b
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=MIT
PKG_LICNESE_FILES:=LICENSE.txt
include $(INCLUDE_DIR)/package.mk
define Package/lua-neturl
SUBMENU:=Lua
SECTION:=lang
CATEGORY:=Languages
TITLE:=URL and Query string parser, builder, normalizer for Lua
URL:=https://github.com/golgote/neturl
DEPENDS:=+lua
PKGARCH:=all
endef
define Package/lua-neturl/description
This small Lua library provides a few functions to parse URL with
querystring and build new URL easily.
endef
define Build/Compile
endef
define Package/lua-neturl/install
$(INSTALL_DIR) $(1)/usr/lib/lua
$(CP) $(PKG_BUILD_DIR)/lib/net/url.lua $(1)/usr/lib/lua/
endef
$(eval $(call BuildPackage,lua-neturl))

View File

@ -0,0 +1,11 @@
--- a/lib/net/url.lua
+++ b/lib/net/url.lua
@@ -340,7 +340,7 @@ function M:setAuthority(authority)
self.password = v
return ''
end)
- if string.find(userinfo, "^[%w%+%.]+$") then
+ if string.find(userinfo, "^[%p%w%+%.]+$") then
self.user = userinfo
else
-- incorrect userinfo

View File

@ -0,0 +1,43 @@
# Copyright (C) 2019 sirpdboy <https://github.com/sirpdboy/luci-app-advanced/>
#
#
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/package.mk
PKG_NAME:=luci-app-advanced
PKG_VERSION:=1.20
PKG_RELEASE:=20220218
define Package/$(PKG_NAME)
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
DEPENDS:=
TITLE:=LuCI Support for advanced and filebrowser
PKGARCH:=all
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
$(CP) ./luasrc/* $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/advanced $(1)/etc/config/
$(INSTALL_DIR) $(1)/www
cp -pR ./htdocs/* $(1)/www/
$(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)))

View File

@ -0,0 +1,2 @@
# luci-app-advanced
luci-app-advanced 高级设置包括smartdnsopenclash防火墙DHCP等。

View 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;
}
}

View 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});
});
})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,9 @@
module("luci.controller.advanced",package.seeall)
function index()
if not nixio.fs.access("/etc/config/advanced")then
return
end
local e
e=entry({"admin","system","advanced"},cbi("advanced"),_("高级设置"),60)
e.dependent=true
end

View 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

View File

@ -0,0 +1,344 @@
local e=require"nixio.fs"
local t=require"luci.sys"
local t=luci.model.uci.cursor()
m=Map("advanced",translate("高级进阶设置"),translate("<font color=\"Red\"><strong>配置文档是直接编辑的除非你知道自己在干什么,否则请不要轻易修改这些配置文档。配置不正确可能会导致不能开机等错误。</strong></font><br/>"))
m.apply_on_parse=true
s=m:section(TypedSection,"advanced")
s.anonymous=true
if nixio.fs.access("/bin/nuc")then
s:tab("mode",translate("模式设置"),translate("<br />可以在这里切换旁路由和正常模式,重置你的网络设置。<br /><font color=\"Red\"><strong>点击后会立即重启设备,没有确认过程,请谨慎操作!</strong></font><br/>"))
o=s:taboption("mode",Button,"nucmode",translate("切换为旁路由模式"),translate("<font color=\"green\"><strong>本模式适合于单口和多网口主机,自动将网口全桥接好!<br />默认gateway是192.168.1.1ipaddr是192.168.1.2。用本机接口LAN接上级LAN当旁路由主路由关闭DHCP服务。应用生效会重启软路由</strong></font><br/>"))
o.inputtitle = translate("Apply")
o.inputstyle = "reset"
o.write = function()
luci.sys.exec("/bin/nuc &> /dev/null &")
end
o=s:taboption("mode",Button,"normalmode",translate("切换成路由模式"),translate("<font color=\"green\"><strong>本模式适合于有两个网口或以上的设备使用,如多网口软路由或者虚拟了两个以上网口的虚拟机使用!应用生效会重启软路由!。</strong></font><br/>"))
o.inputtitle = translate("Apply")
o.inputstyle = "reset"
o.write = function()
luci.sys.exec("/bin/normalmode &> /dev/null &")
end
o=s:taboption("mode",Button,"ipmode6",translate("设置为IPV6网络"),translate("<font color=\"green\"><strong>点击应用切换到IPV6模式保存应用后即刻有效</strong></font><br/>"))
o.inputtitle = translate("Apply")
o.inputstyle = "add"
o.write = function(self, section)
luci.sys.exec("ipmode6 &> /dev/null &")
end
o=s:taboption("mode",Button,"ipmode4",translate("设置为IPV4网络"),translate("<font color=\"green\"><strong>点击应用切换到IPV4模式保存应用后即刻有效</strong></font><br/>"))
o.inputtitle = translate("Apply")
o.inputstyle = "add"
o.write = function(self, section)
luci.sys.exec("ipmode4 &> /dev/null &")
end
end
if nixio.fs.access("/etc/dnsmasq.conf")then
s:tab("dnsmasqconf",translate("dnsmasq"),translate("本页是配置/etc/dnsmasq.conf的文档内容。应用保存后自动重启生效"))
conf=s:taboption("dnsmasqconf",Value,"dnsmasqconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/dnsmasq.conf")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/dnsmasq.conf",t)
if(luci.sys.call("cmp -s /tmp/dnsmasq.conf /etc/dnsmasq.conf")==1)then
e.writefile("/etc/dnsmasq.conf",t)
luci.sys.call("/etc/init.d/dnsmasq restart >/dev/null")
end
e.remove("/tmp/dnsmasq.conf")
end
end
end
if nixio.fs.access("/etc/config/network")then
s:tab("netwrokconf",translate("网络"),translate("本页是配置/etc/config/network包含网络配置文档内容。应用保存后自动重启生效"))
conf=s:taboption("netwrokconf",Value,"netwrokconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/network")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/network",t)
if(luci.sys.call("cmp -s /tmp/network /etc/config/network")==1)then
e.writefile("/etc/config/network",t)
luci.sys.call("/etc/init.d/network restart >/dev/null")
end
e.remove("/tmp/network")
end
end
end
if nixio.fs.access("/etc/config/wireless")then
s:tab("wirelessconf",translate("无线"), translate("本页是/etc/config/wireless的配置文件内容应用保存后自动重启生效."))
conf=s:taboption("wirelessconf",Value,"wirelessconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/wireless")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/etc/config/wireless.tmp",t)
if(luci.sys.call("cmp -s /etc/config/wireless.tmp /etc/config/wireless")==1)then
e.writefile("/etc/config/wireless",t)
luci.sys.call("wifi reload >/dev/null &")
end
e.remove("/tmp//tmp/wireless.tmp")
end
end
end
if nixio.fs.access("/etc/hosts")then
s:tab("hostsconf",translate("hosts"),translate("本页是配置/etc/hosts的文档内容。应用保存后自动重启生效"))
conf=s:taboption("hostsconf",Value,"hostsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/hosts")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/hosts.tmp",t)
if(luci.sys.call("cmp -s /tmp/hosts.tmp /etc/hosts")==1)then
e.writefile("/etc/hosts",t)
luci.sys.call("/etc/init.d/dnsmasq restart >/dev/null")
end
e.remove("/tmp/hosts.tmp")
end
end
end
if nixio.fs.access("/etc/config/arpbind")then
s:tab("arpbindconf",translate("ARP绑定"),translate("本页是配置/etc/config/arpbind包含APR绑定MAC地址文档内容。应用保存后自动重启生效"))
conf=s:taboption("arpbindconf",Value,"arpbindconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/arpbind")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/arpbind",t)
if(luci.sys.call("cmp -s /tmp/arpbind /etc/config/arpbind")==1)then
e.writefile("/etc/config/arpbind",t)
luci.sys.call("/etc/init.d/arpbind restart >/dev/null")
end
e.remove("/tmp/arpbind")
end
end
end
if nixio.fs.access("/etc/config/firewall")then
s:tab("firewallconf",translate("防火墙"),translate("本页是配置/etc/config/firewall包含防火墙协议设置文档内容。应用保存后自动重启生效"))
conf=s:taboption("firewallconf",Value,"firewallconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/firewall")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/firewall",t)
if(luci.sys.call("cmp -s /tmp/firewall /etc/config/firewall")==1)then
e.writefile("/etc/config/firewall",t)
luci.sys.call("/etc/init.d/firewall restart >/dev/null")
end
e.remove("/tmp/firewall")
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("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/mwan3")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/mwan3",t)
if(luci.sys.call("cmp -s /tmp/mwan3 /etc/config/mwan3")==1)then
e.writefile("/etc/config/mwan3",t)
luci.sys.call("/etc/init.d/mwan3 restart >/dev/null")
end
e.remove("/tmp/mwan3")
end
end
end
if nixio.fs.access("/etc/config/dhcp")then
s:tab("dhcpconf",translate("DHCP"),translate("本页是配置/etc/config/DHCP包含机器名等设置文档内容。应用保存后自动重启生效"))
conf=s:taboption("dhcpconf",Value,"dhcpconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/dhcp")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/dhcp",t)
if(luci.sys.call("cmp -s /tmp/dhcp /etc/config/dhcp")==1)then
e.writefile("/etc/config/dhcp",t)
luci.sys.call("/etc/init.d/network restart >/dev/null")
end
e.remove("/tmp/dhcp")
end
end
end
if nixio.fs.access("/etc/config/ddns")then
s:tab("ddnsconf",translate("DDNS"),translate("本页是配置/etc/config/ddns包含动态域名设置文档内容。应用保存后自动重启生效"))
conf=s:taboption("ddnsconf",Value,"ddnsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/ddns")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/ddns",t)
if(luci.sys.call("cmp -s /tmp/ddns /etc/config/ddns")==1)then
e.writefile("/etc/config/ddns",t)
luci.sys.call("/etc/init.d/ddns restart >/dev/null")
end
e.remove("/tmp/ddns")
end
end
end
if nixio.fs.access("/etc/config/timecontrol")then
s:tab("timecontrolconf",translate("时间控制"),translate("本页是配置/etc/config/timecontrol包含上网时间控制配置文档内容。应用保存后自动重启生效"))
conf=s:taboption("timecontrolconf",Value,"timecontrolconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/timecontrol")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/timecontrol",t)
if(luci.sys.call("cmp -s /tmp/timecontrol /etc/config/timecontrol")==1)then
e.writefile("/etc/config/timecontrol",t)
luci.sys.call("/etc/init.d/timecontrol restart >/dev/null")
end
e.remove("/tmp/timecontrol")
end
end
end
if nixio.fs.access("/etc/config/rebootschedule")then
s:tab("rebootscheduleconf",translate("定时设置"),translate("本页是配置/etc/config/rebootschedule包含定时设置任务配置文档内容。应用保存后自动重启生效"))
conf=s:taboption("rebootscheduleconf",Value,"rebootscheduleconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/rebootschedule")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/rebootschedule",t)
if(luci.sys.call("cmp -s /tmp/rebootschedule /etc/config/rebootschedule")==1)then
e.writefile("/etc/config/rebootschedule",t)
luci.sys.call("/etc/init.d/rebootschedule restart >/dev/null")
end
e.remove("/tmp/rebootschedule")
end
end
end
if nixio.fs.access("/etc/config/wolplus")then
s:tab("wolplusconf",translate("网络唤醒"),translate("本页是配置/etc/config/wolplus包含网络唤醒配置文档内容。应用保存后自动重启生效"))
conf=s:taboption("wolplusconf",Value,"wolplusconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/wolplus")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/wolplus",t)
if(luci.sys.call("cmp -s /tmp/wolplus /etc/config/wolplus")==1)then
e.writefile("/etc/config/wolplus",t)
luci.sys.call("/etc/init.d/wolplus restart >/dev/null")
end
e.remove("/tmp/wolplus")
end
end
end
if nixio.fs.access("/etc/config/smartdns")then
s:tab("smartdnsconf",translate("SMARTDNS"),translate("本页是配置/etc/config/smartdns包含smartdns配置文档内容。应用保存后自动重启生效"))
conf=s:taboption("smartdnsconf",Value,"smartdnsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/smartdns")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/smartdns",t)
if(luci.sys.call("cmp -s /tmp/smartdns /etc/config/smartdns")==1)then
e.writefile("/etc/config/smartdns",t)
luci.sys.call("/etc/init.d/smartdns restart >/dev/null")
end
e.remove("/tmp/smartdns")
end
end
end
if nixio.fs.access("/etc/config/openclash")then
s:tab("openclashconf",translate("openclash"),translate("本页是配置/etc/config/openclash的文档内容。应用保存后自动重启生效"))
conf=s:taboption("openclashconf",Value,"openclashconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
conf.template="cbi/tvalue"
conf.rows=20
conf.wrap="off"
conf.cfgvalue=function(t,t)
return e.readfile("/etc/config/openclash")or""
end
conf.write=function(a,a,t)
if t then
t=t:gsub("\r\n?","\n")
e.writefile("/tmp/openclash",t)
if(luci.sys.call("cmp -s /tmp/openclash /etc/config/openclash")==1)then
e.writefile("/etc/config/openclash",t)
luci.sys.call("/etc/init.d/openclash restart >/dev/null")
end
e.remove("/tmp/openclash")
end
end
end
return m

View 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%>

View File

@ -0,0 +1,20 @@
<%+header%>
<link rel="stylesheet" href="/luci-static/resources/fb/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/fb/fb.js?v=@ver"></script>
<%+footer%>

View File

@ -0,0 +1,26 @@
#!/bin/sh
uci set network.@globals[0].ula_prefix=''
uci set network.lan.delegate='0'
uci set network.wan.mtu=1460
uci set network.wan.metric='41'
uci set network.wan.delegate='0'
uci set network.wan.ipv6='0'
uci commit network
uci set dhcp.@dnsmasq[0].cachesize='15000'
uci set dhcp.@dnsmasq[0].min_ttl='3600'
uci set dhcp.@dnsmasq[0].filter_aaaa='1'
uci set dhcp.@dnsmasq[0].localservice='0'
uci set dhcp.@dnsmasq[0].nonwildcard='0'
uci set dhcp.@dnsmasq[0].rebind_protection='0'
uci set dhcp.@dnsmasq[0].noresolv='0'
uci set dhcp.lan.ra=''
uci set dhcp.lan.ndp=''
uci set dhcp.lan.dhcpv6=''
uci set dhcp.lan.ignore='0'
uci set dhcp.lan.ra_management='1'
uci set dhcp.lan.ra_default='1'
uci set dhcp.lan.force='1'
uci commit dhcp
sed -i "/list server/d" /etc/config/dhcp
/etc/init.d/network restart
/etc/init.d/dnsmasq restart

View File

@ -0,0 +1,27 @@
#!/bin/sh
uci set dhcp.@dnsmasq[0].cachesize='15000'
uci set dhcp.@dnsmasq[0].min_ttl='3600'
uci set dhcp.@dnsmasq[0].filter_aaaa='0'
uci set dhcp.@dnsmasq[0].localservice='0'
uci set dhcp.@dnsmasq[0].nonwildcard='0'
uci set dhcp.@dnsmasq[0].rebind_protection='0'
uci set dhcp.@dnsmasq[0].noresolv='1'
uci set dhcp.lan.ra='server'
uci set dhcp.lan.ndp=''
uci set dhcp.lan.dhcpv6=''
uci set dhcp.lan.ignore='0'
uci set dhcp.lan.ra_management='1'
uci set dhcp.lan.ra_default='1'
uci set dhcp.lan.force='1'
uci commit dhcp
uci set network.@globals[0].ula_prefix=''
uci set network.lan.delegate='0'
uci set network.wan.mtu=1460
uci set network.wan.metric='41'
uci set network.wan.delegate='0'
uci set network.wan.ipv6='auto'
uci commit network
sed -i "/list server/d" /etc/config/dhcp
/etc/init.d/network restart
/etc/init.d/dnsmasq restart

View File

@ -0,0 +1,30 @@
#!/bin/sh
uci set system.@system[0].hostname="Openwrt"
uci commit
cat > /etc/config/network <<EOF
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ifname 'eth0 eth2 eth3'
config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'
option hostname 'Openwrt'
EOF
sed -i '/REDIRECT --to-ports 53/d' /etc/firewall.user
sed -i '/MASQUERADE/d' /etc/firewall.user
echo "iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53" >> /etc/firewall.user
echo "iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53" >> /etc/firewall.user
reboot

View File

@ -0,0 +1,80 @@
#!/bin/sh
ip=/usr/sbin/ip
vconfig=/sbin/vconfig
ifconfig=/sbin/ifconfig
uci set system.@system[0].hostname="Openwrt"
uci commit
cat > /etc/config/network <<EOF
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option type 'bridge'
option ifname 'eth0 eth1 eth2 eth3 eth4 eth5 eth0.12 eth0.13 eth0.14 eth0.15 eth0.16 eth0.17 eth0.18'
option proto 'static'
option ipaddr '192.168.1.2'
option netmask '255.255.255.0'
option gateway '192.168.1.1'
option dns '223.5.5.5'
config interface 'wan'
option ifname 'eth0.11'
option proto 'dhcp'
option hostname 'Openwrt'
EOF
#for eth1
$ip link add link eth0 eth0.11 type vlan proto 802.1ad id 11
$ifconfig eth0.11 hw ether 58:b0:35:86:cf:11
$vconfig set_flag eth0.11 1 1
$ifconfig eth0.11 up
#for eth2
$ip link add link eth0 eth0.12 type vlan proto 802.1ad id 12
$ifconfig eth0.12 hw ether 58:b0:35:86:cf:12
$vconfig set_flag eth0.12 1 2
$ifconfig eth0.12 up
#for eth3
$ip link add link eth0 eth0.13 type vlan proto 802.1ad id 13
$ifconfig eth0.13 hw ether 58:b0:35:86:cf:13
$vconfig set_flag eth0.13 1 3
$ifconfig eth0.13 up
#for eth4
$ip link add link eth0 eth0.14 type vlan proto 802.1ad id 14
$ifconfig eth0.14 hw ether 58:b0:35:86:cf:14
$vconfig set_flag eth0.14 1 3
$ifconfig eth0.14 up
#for eth5
$ip link add link eth0 eth0.15 type vlan proto 802.1ad id 15
$ifconfig eth0.15 hw ether 58:b0:35:86:cf:15
$vconfig set_flag eth0.15 1 3
$ifconfig eth0.15 up
#for eth6
$ip link add link eth0 eth0.16 type vlan proto 802.1ad id 16
$ifconfig eth0.16 hw ether 58:b0:35:86:cf:16
$vconfig set_flag eth0.16 1 3
$ifconfig eth0.16 up
#for eth7
$ip link add link eth0 eth0.17 type vlan proto 802.1ad id 17
$ifconfig eth0.17 hw ether 58:b0:35:86:cf:17
$vconfig set_flag eth0.17 1 3
$ifconfig eth0.17 up
#for eth8
$ip link add link eth0 eth0.18 type vlan proto 802.1ad id 18
$ifconfig eth0.18 hw ether 58:b0:35:86:cf:18
$vconfig set_flag eth0.18 1 3
$ifconfig eth0.18 up
sed -i '/MASQUERADE/d' /etc/firewall.user
echo "iptables -t nat -I POSTROUTING -j MASQUERADE" >> /etc/firewall.user
reboot

View File

@ -0,0 +1,2 @@
config advanced
option enabled '1'

View File

@ -0,0 +1,7 @@
#!/bin/sh
ver=$(date +%s)
sed -i "s/@ver/$ver/g" /usr/lib/lua/luci/view/filebrowser.htm
rm -f /tmp/luci-indexcache
exit 0