mirror of
https://github.com/kenzok8/openwrt-packages
synced 2025-01-08 11:17:27 +08:00
update 2022-04-25 07:45:21
This commit is contained in:
parent
bba44b906d
commit
847d577cef
@ -1,52 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=app-store-ui
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=10
|
||||
|
||||
PKG_HOST_ONLY=1
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/${PKG_NAME}
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/app-store-ui
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=App Store UI
|
||||
BUILDONLY:=1
|
||||
endef
|
||||
|
||||
define Package/app-store-ui/description
|
||||
UI for luci-app-store
|
||||
endef
|
||||
|
||||
define Host/Prepare
|
||||
mkdir -p $(HOST_BUILD_DIR)
|
||||
$(CP) ./src/. $(HOST_BUILD_DIR)
|
||||
find $(HOST_BUILD_DIR) -name .svn | $(XARGS) rm -rf
|
||||
endef
|
||||
|
||||
define Host/Configure
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(HOST_BUILD_DIR)/src/dist
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,app-store-ui))
|
16
app-store-ui/src/dist/index.html
vendored
16
app-store-ui/src/dist/index.html
vendored
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite App</title>
|
||||
<script type="module" crossorigin src="/luci-static/istore/index.js"></script>
|
||||
<link rel="modulepreload" href="/luci-static/istore/vendor.js">
|
||||
<link rel="stylesheet" href="/luci-static/istore/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
67
linkease/Makefile
Normal file
67
linkease/Makefile
Normal file
@ -0,0 +1,67 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
# Copyright (C) 2020 jjm2473@gmail.com
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_ARCH_LINKEASE:=$(ARCH)
|
||||
|
||||
PKG_NAME:=linkease
|
||||
PKG_VERSION:=0.7.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://fw.koolcenter.com/binary/LinkEase/LinuxStorage/
|
||||
PKG_HASH:=26ebbb22d78fd2ceb009226a0d85a40f100d502595b59c8a43eea5e4394ee292
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=LinkEase - the file cloud
|
||||
DEPENDS:=@(arm||x86_64||aarch64)
|
||||
URL:=https://www.ddnsto.com/linkease/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
LinkEase is a file cloud
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/linkease
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
[ -f /etc/uci-defaults/linkease ] && /etc/uci-defaults/linkease && rm -f /etc/uci-defaults/linkease
|
||||
fi
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin/linkease-plugins $(1)/etc/config $(1)/etc/init.d $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/linkease.$(PKG_ARCH_LINKEASE) $(1)/usr/sbin/linkease
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/heif-converter.$(PKG_ARCH_LINKEASE) $(1)/usr/sbin/heif-converter
|
||||
$(INSTALL_BIN) ./files/linkease-config.sh $(1)/usr/sbin/linkease-config.sh
|
||||
$(INSTALL_BIN) ./files/aria2.sh $(1)/usr/sbin/linkease-plugins/aria2.sh
|
||||
$(INSTALL_CONF) ./files/linkease.config $(1)/etc/config/linkease
|
||||
$(INSTALL_BIN) ./files/linkease.init $(1)/etc/init.d/linkease
|
||||
$(INSTALL_BIN) ./files/linkease.uci-default $(1)/etc/uci-defaults/linkease
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
134
linkease/files/aria2.sh
Executable file
134
linkease/files/aria2.sh
Executable file
@ -0,0 +1,134 @@
|
||||
#!/bin/bash
|
||||
|
||||
sh_ver="1.0.0"
|
||||
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/sbin:/bin
|
||||
aria2_conf_dir=/var/etc/aria2/
|
||||
#替换成你设备aria2.conf路径
|
||||
aria2_conf=${aria2_conf_dir}/aria2.conf.main
|
||||
#替换成你设备的aria2c路径
|
||||
aria2c=/usr/bin/aria2c
|
||||
Green_font_prefix="\033[32m"
|
||||
Red_font_prefix="\033[31m"
|
||||
Green_background_prefix="\033[42;37m"
|
||||
Red_background_prefix="\033[41;37m"
|
||||
Font_color_suffix="\033[0m"
|
||||
Info="[${Green_font_prefix}信息${Font_color_suffix}]"
|
||||
Error="[${Red_font_prefix}错误${Font_color_suffix}]"
|
||||
Tip="[${Green_font_prefix}注意${Font_color_suffix}]"
|
||||
error_code=11
|
||||
success_code=0
|
||||
|
||||
return_error(){
|
||||
echo 'Content-Type:application/json;charset=utf-8'
|
||||
echo
|
||||
echo "{
|
||||
"\"success\"":$error_code,
|
||||
"\"error\"":"\"$1\"",
|
||||
"\"result"\":null
|
||||
}"
|
||||
exit 1
|
||||
}
|
||||
return_ok(){
|
||||
echo 'Content-Type:application/json;charset=utf-8'
|
||||
echo
|
||||
echo "{
|
||||
"\"success\"":$success_code,
|
||||
"\"error\"":"\"$1\"",
|
||||
"\"result"\":null
|
||||
}"
|
||||
exit 0
|
||||
}
|
||||
return_result(){
|
||||
echo 'Content-Type:application/json;charset=utf-8'
|
||||
echo
|
||||
echo "{
|
||||
"\"success\"":$success_code,
|
||||
"\"error\"":"\"\"",
|
||||
"\"result"\":$1
|
||||
}"
|
||||
exit 0
|
||||
}
|
||||
|
||||
#进程中是否运行aria2
|
||||
check_pid() {
|
||||
PID=$(ps -ef | grep "aria2c" | grep -v grep | grep -v "aria2.sh" | grep -v "init.d" | grep -v "service" | awk '{print $2}')
|
||||
}
|
||||
|
||||
#aria2是否正在运行
|
||||
aria2_work_status(){
|
||||
check_pid
|
||||
# [[ ! -z ${PID} ]] && echo -e "${Error} Aria2 正在运行,请检查 !" && exit 1
|
||||
[[ ! -z ${PID} ]] && return_ok "Aria2正在运行"
|
||||
return_error "Aria2未运行"
|
||||
}
|
||||
|
||||
#检测设备是否安装aria2
|
||||
check_installed_status() {
|
||||
[[ ! -e ${aria2c} ]] && return_error "Aria2 没有安装,请检查 !"
|
||||
[[ ! -e ${aria2_conf} ]] && return_error "Aria2 配置文件不存在,请检查 !"
|
||||
# return_ok "Aria2已安装"
|
||||
}
|
||||
#读取aria2配置信息
|
||||
read_config() {
|
||||
check_installed_status
|
||||
if [[ ! -e ${aria2_conf} ]]; then
|
||||
return_error "Aria2 配置文件不存在,请检查 !"
|
||||
else
|
||||
conf_text=$(cat ${aria2_conf} | grep -v '#')
|
||||
aria2_dir=$(echo -e "${conf_text}" | grep "^dir=" | awk -F "=" '{print $NF}')
|
||||
aria2_port=$(echo -e "${conf_text}" | grep "^rpc-listen-port=" | awk -F "=" '{print $NF}')
|
||||
aria2_passwd=$(echo -e "${conf_text}" | grep "^rpc-secret=" | awk -F "=" '{print $NF}')
|
||||
aria2_bt_port=$(echo -e "${conf_text}" | grep "^listen-port=" | awk -F "=" '{print $NF}')
|
||||
aria2_dht_port=$(echo -e "${conf_text}" | grep "^dht-listen-port=" | awk -F "=" '{print $NF}')
|
||||
|
||||
return_result "{
|
||||
"\"dir"\":"\"$aria2_dir"\",
|
||||
"\"rpc-listen-port"\":"\"$aria2_port"\",
|
||||
"\"rpc-secret"\":"\"$aria2_passwd"\",
|
||||
"\"listen-port"\":"\"$aria2_bt_port"\",
|
||||
"\"dht-listen-port"\":"\"$aria2_dht_port"\"}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#"Content-Type:text/html;charset=utf-8"
|
||||
#echo
|
||||
|
||||
#SERVER_SOFTWARE = $SERVER_SOFTWARE #服务器软件
|
||||
#SERVER_NAME = $SERVER_NAME #服务器主机名
|
||||
#GATEWAY_INTERFACE = $GATEWAY_INTERFACE #CGI版本
|
||||
#SERVER_PROTOCOL = $SERVER_PROTOCOL #通信使用的协议
|
||||
#SERVER_PORT = $SERVER_PORT #服务器的端口号
|
||||
#REQUEST_METHOD = $REQUEST_METHOD #请求方法(GET/POST/PUT/DELETE..)
|
||||
#HTTP_ACCEPT = $HTTP_ACCEPT #HTTP定义的浏览器能够接受的数据类型
|
||||
#SCRIPT_NAME = $SCRIPT_NAME #当前运行的脚本名称(包含路径)
|
||||
#QUERY_STRING = $QUERY_STRING #地址栏中传的数据(get方式)
|
||||
#REMOTE_ADDR = $REMOTE_ADDR #客户端的ip
|
||||
|
||||
#根据url QUERY调不同方法
|
||||
query(){
|
||||
aria2Query=${QUERY_STRING}
|
||||
parse(){
|
||||
echo $1 | sed 's/.*'$2'=\([[:alnum:]]*\).*/\1/'
|
||||
}
|
||||
value=$(parse $aria2Query "action")
|
||||
|
||||
if [ ! -z = "$value" ]
|
||||
then
|
||||
if [ "$value" = "status" ]
|
||||
then
|
||||
check_installed_status
|
||||
elif [ "$value" = "readConfig" ]
|
||||
then
|
||||
read_config
|
||||
elif [ "$value" = "workStatus" ]
|
||||
then
|
||||
aria2_work_status
|
||||
else
|
||||
echo
|
||||
fi
|
||||
else
|
||||
return_error "action不能为空"
|
||||
fi
|
||||
}
|
||||
query
|
37
linkease/files/linkease-config.sh
Executable file
37
linkease/files/linkease-config.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
save)
|
||||
if [ ! -z "$2" ]; then
|
||||
uci set linkease.@linkease[0].preconfig=$2
|
||||
uci commit
|
||||
fi
|
||||
;;
|
||||
|
||||
load)
|
||||
if [ -f "/usr/sbin/preconfig.data" ]; then
|
||||
data=`cat /usr/sbin/preconfig.data`
|
||||
uci set linkease.@linkease[0].preconfig=${data}
|
||||
uci commit
|
||||
rm /usr/sbin/preconfig.data
|
||||
else
|
||||
data=`uci get linkease.@linkease[0].preconfig`
|
||||
fi
|
||||
|
||||
if [ -z "${data}" ]; then
|
||||
echo "nil"
|
||||
else
|
||||
echo "${data}"
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
status)
|
||||
echo "TODO"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {save|load|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
4
linkease/files/linkease.config
Normal file
4
linkease/files/linkease.config
Normal file
@ -0,0 +1,4 @@
|
||||
config linkease
|
||||
option 'port' '8897'
|
||||
option 'preconfig' ''
|
||||
option 'enabled' '1'
|
27
linkease/files/linkease.init
Executable file
27
linkease/files/linkease.init
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
get_config() {
|
||||
config_get_bool enabled $1 enabled 1
|
||||
config_get_bool logger $1 logger
|
||||
config_get port $1 port 8897
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load linkease
|
||||
config_foreach get_config linkease
|
||||
[ $enabled != 1 ] && return 1
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/linkease
|
||||
[ -n "$port" ] && procd_append_param command --deviceAddr ":$port"
|
||||
[ "$logger" == 1 ] && procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "linkease"
|
||||
}
|
22
linkease/files/linkease.uci-default
Executable file
22
linkease/files/linkease.uci-default
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@linkease[-1]
|
||||
add ucitrack linkease
|
||||
set ucitrack.@linkease[-1].init=linkease
|
||||
commit ucitrack
|
||||
|
||||
delete firewall.linkease
|
||||
set firewall.linkease=rule
|
||||
set firewall.linkease.name="linkease"
|
||||
set firewall.linkease.target="ACCEPT"
|
||||
set firewall.linkease.src="wan"
|
||||
set firewall.linkease.proto="tcp"
|
||||
set firewall.linkease.dest_port="8897"
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
/etc/init.d/linkease enable
|
||||
/etc/init.d/linkease start
|
||||
|
||||
exit 0
|
1
luci-app-ddnsto/po/zh_Hans
Symbolic link
1
luci-app-ddnsto/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
17
luci-app-linkease/Makefile
Normal file
17
luci-app-linkease/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for linkease
|
||||
LUCI_DEPENDS:=+linkease
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=2.1.1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
25
luci-app-linkease/luasrc/controller/linkease.lua
Normal file
25
luci-app-linkease/luasrc/controller/linkease.lua
Normal file
@ -0,0 +1,25 @@
|
||||
module("luci.controller.linkease", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/linkease") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "linkease"}, cbi("linkease"), _("LinkEase"), 20).dependent = true
|
||||
|
||||
entry({"admin", "services", "linkease_status"}, call("linkease_status"))
|
||||
end
|
||||
|
||||
function linkease_status()
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local port = tonumber(uci:get_first("linkease", "linkease", "port"))
|
||||
|
||||
local status = {
|
||||
running = (sys.call("pidof linkease >/dev/null") == 0),
|
||||
port = (port or 8897)
|
||||
}
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(status)
|
||||
end
|
20
luci-app-linkease/luasrc/model/cbi/linkease.lua
Normal file
20
luci-app-linkease/luasrc/model/cbi/linkease.lua
Normal file
@ -0,0 +1,20 @@
|
||||
--wulishui <wulishui@gmail.com> ,20200911
|
||||
--jjm2473 <jjm2473@gmail.com> ,20210127
|
||||
|
||||
local m, s
|
||||
|
||||
m = Map("linkease", translate("LinkEase"), translate("LinkEase is an efficient data transfer tool."))
|
||||
|
||||
m:section(SimpleSection).template = "linkease_status"
|
||||
|
||||
s=m:section(TypedSection, "linkease", translate("Global settings"))
|
||||
s.addremove=false
|
||||
s.anonymous=true
|
||||
|
||||
s:option(Flag, "enabled", translate("Enable")).rmempty=false
|
||||
|
||||
s:option(Value, "port", translate("Port")).rmempty=false
|
||||
|
||||
return m
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
<%+linkease_status%>
|
27
luci-app-linkease/luasrc/view/linkease_status.htm
Normal file
27
luci-app-linkease/luasrc/view/linkease_status.htm
Normal file
@ -0,0 +1,27 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url("admin/services/linkease_status")%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('linkease_status');
|
||||
if (st && tb)
|
||||
{
|
||||
if (st.running)
|
||||
{
|
||||
tb.innerHTML = '<br/><em style=\"color:green\"><%:The LinkEase service is running.%></em>'
|
||||
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open LinkEase%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + st.port + "/')\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
tb.innerHTML = '<br/><em style=\"color:red\"><%:The LinkEase service is not running.%></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:LinkEase Status%></legend>
|
||||
<p id="linkease_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
27
luci-app-linkease/po/zh-cn/linkease.po
Normal file
27
luci-app-linkease/po/zh-cn/linkease.po
Normal file
@ -0,0 +1,27 @@
|
||||
msgid "LinkEase"
|
||||
msgstr "易有云文件管理器"
|
||||
|
||||
msgid "Running state"
|
||||
msgstr "运行状态"
|
||||
|
||||
msgid "Click to open LinkEase"
|
||||
msgstr "点击打开易有云"
|
||||
|
||||
msgid "LinkEase is an efficient data transfer tool."
|
||||
msgstr "易有云是一个微型家庭数据服务中心,主要用于文件的集中存放、读取、备份及日常管理。释放用户终端设备空间,实现个人、家庭文件长久留存;支持家庭相册、视频文件随时随地多终端查看、播放,满足家庭文件的日常管理。"
|
||||
|
||||
msgid "Port"
|
||||
msgstr "端口"
|
||||
|
||||
msgid "The LinkEase service is running."
|
||||
msgstr "易有云服务已启动"
|
||||
|
||||
msgid "The LinkEase service is not running."
|
||||
msgstr "易有云服务未启动"
|
||||
|
||||
msgid "LinkEase Status"
|
||||
msgstr "易有云服务状态"
|
||||
|
||||
msgid "Collecting data..."
|
||||
msgstr "收集数据..."
|
||||
|
1
luci-app-linkease/po/zh_Hans
Symbolic link
1
luci-app-linkease/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
4
luci-app-linkease/root/etc/uci-defaults/50_luci-linkease
Executable file
4
luci-app-linkease/root/etc/uci-defaults/50_luci-linkease
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
19
luci-app-quickstart/Makefile
Normal file
19
luci-app-quickstart/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for quickstart
|
||||
LUCI_DEPENDS:=+quickstart +shadow-utils +shadow-useradd +luci-app-store +mount-utils
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=0.3.6-1
|
||||
# PKG_RELEASE MUST be empty for luci.mk
|
||||
PKG_RELEASE:=
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
175
luci-app-quickstart/luasrc/controller/istore_backend.lua
Normal file
175
luci-app-quickstart/luasrc/controller/istore_backend.lua
Normal file
@ -0,0 +1,175 @@
|
||||
-- Copyright 2022 xiaobao <xiaobao@linkease.com>
|
||||
-- Licensed to the public under the MIT License
|
||||
|
||||
local http = require "luci.http"
|
||||
local nixio = require "nixio"
|
||||
local ltn12 = require "luci.ltn12"
|
||||
local table = require "table"
|
||||
local util = require "luci.util"
|
||||
|
||||
module("luci.controller.istore_backend", package.seeall)
|
||||
|
||||
local BLOCKSIZE = 2048
|
||||
local ISTOREOS_PORT = 3038
|
||||
|
||||
function index()
|
||||
entry({"istore"}, call("istore_backend")).leaf=true
|
||||
end
|
||||
|
||||
function sink_socket(sock, io_err)
|
||||
if sock then
|
||||
return function(chunk, err)
|
||||
if not chunk then
|
||||
return 1
|
||||
else
|
||||
return sock:send(chunk)
|
||||
end
|
||||
end
|
||||
else
|
||||
return ltn12.sink.error(io_err or "unable to send socket")
|
||||
end
|
||||
end
|
||||
|
||||
local function session_retrieve(sid, allowed_users)
|
||||
local sdat = util.ubus("session", "get", { ubus_rpc_session = sid })
|
||||
if type(sdat) == "table" and
|
||||
type(sdat.values) == "table" and
|
||||
type(sdat.values.token) == "string" and
|
||||
(not allowed_users or
|
||||
util.contains(allowed_users, sdat.values.username))
|
||||
then
|
||||
return sid, sdat.values
|
||||
end
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
function istore_backend()
|
||||
local sock = nixio.connect("127.0.0.1", ISTOREOS_PORT)
|
||||
if not sock then
|
||||
http.status(500, "connect failed")
|
||||
return
|
||||
end
|
||||
local input = {}
|
||||
input[#input+1] = http.getenv("REQUEST_METHOD") .. " " .. http.getenv("REQUEST_URI") .. " HTTP/1.1"
|
||||
local req = http.context.request
|
||||
local start = "HTTP_"
|
||||
local start_len = string.len(start)
|
||||
local ctype = http.getenv("CONTENT_TYPE")
|
||||
if ctype then
|
||||
input[#input+1] = "Content-Type: " .. ctype
|
||||
end
|
||||
for k, v in pairs(req.message.env) do
|
||||
if string.sub(k, 1, start_len) == start and not string.find(k, "FORWARDED") then
|
||||
input[#input+1] = string.sub(k, start_len+1, string.len(k)) .. ": " .. v
|
||||
end
|
||||
end
|
||||
local sid = http.getcookie("sysauth")
|
||||
if sid then
|
||||
local sid, sdat = session_retrieve(sid, nil)
|
||||
if sdat ~= nil then
|
||||
input[#input+1] = "X-Forwarded-Sid: " .. sid
|
||||
input[#input+1] = "X-Forwarded-Token: " .. sdat.token
|
||||
end
|
||||
end
|
||||
-- input[#input+1] = "X-Forwarded-For: " .. http.getenv("REMOTE_HOST") ..":".. http.getenv("REMOTE_PORT")
|
||||
local num = tonumber(http.getenv("CONTENT_LENGTH")) or 0
|
||||
input[#input+1] = "Content-Length: " .. tostring(num)
|
||||
input[#input+1] = "\r\n"
|
||||
local source = ltn12.source.cat(ltn12.source.string(table.concat(input, "\r\n")), http.source())
|
||||
local ret = ltn12.pump.all(source, sink_socket(sock, "write sock error"))
|
||||
if ret ~= 1 then
|
||||
sock:close()
|
||||
http.status(500, "proxy error")
|
||||
return
|
||||
end
|
||||
|
||||
local linesrc = sock:linesource()
|
||||
local line, code, error = linesrc()
|
||||
if not line then
|
||||
sock:close()
|
||||
http.status(500, "response parse failed")
|
||||
return
|
||||
end
|
||||
|
||||
local protocol, status, msg = line:match("^([%w./]+) ([0-9]+) (.*)")
|
||||
if not protocol then
|
||||
sock:close()
|
||||
http.status(500, "response protocol error")
|
||||
return
|
||||
end
|
||||
num = tonumber(status) or 0
|
||||
http.status(num, msg)
|
||||
|
||||
local chunked = 0
|
||||
line = linesrc()
|
||||
while line and line ~= "" do
|
||||
local key, val = line:match("^([%w-]+)%s?:%s?(.*)")
|
||||
if key and key ~= "Status" then
|
||||
if key == "Transfer-Encoding" and val == "chunked" then
|
||||
chunked = 1
|
||||
end
|
||||
if key ~= "Connection" and key ~= "Transfer-Encoding" then
|
||||
http.header(key, val)
|
||||
end
|
||||
end
|
||||
line = linesrc()
|
||||
end
|
||||
if not line then
|
||||
sock:close()
|
||||
http.status(500, "parse header failed")
|
||||
return
|
||||
end
|
||||
|
||||
local body_buffer = linesrc(true)
|
||||
if chunked == 1 then
|
||||
ltn12.pump.all(chunksource(sock, body_buffer), http.write)
|
||||
else
|
||||
local body_source = ltn12.source.cat(ltn12.source.string(body_buffer), sock:blocksource())
|
||||
ltn12.pump.all(body_source, http.write)
|
||||
end
|
||||
|
||||
sock:close()
|
||||
end
|
||||
|
||||
function chunksource(sock, buffer)
|
||||
buffer = buffer or ""
|
||||
return function()
|
||||
local output
|
||||
local _, endp, count = buffer:find("^([0-9a-fA-F]+);?.-\r\n")
|
||||
while not count and #buffer <= 1024 do
|
||||
local newblock, code = sock:recv(1024 - #buffer)
|
||||
if not newblock then
|
||||
return nil, code
|
||||
end
|
||||
buffer = buffer .. newblock
|
||||
_, endp, count = buffer:find("^([0-9a-fA-F]+);?.-\r\n")
|
||||
end
|
||||
count = tonumber(count, 16)
|
||||
if not count then
|
||||
return nil, -1, "invalid encoding"
|
||||
elseif count == 0 then
|
||||
return nil
|
||||
elseif count + 2 <= #buffer - endp then
|
||||
output = buffer:sub(endp+1, endp+count)
|
||||
buffer = buffer:sub(endp+count+3)
|
||||
return output
|
||||
else
|
||||
output = buffer:sub(endp+1, endp+count)
|
||||
buffer = ""
|
||||
if count - #output > 0 then
|
||||
local remain, code = sock:recvall(count-#output)
|
||||
if not remain then
|
||||
return nil, code
|
||||
end
|
||||
output = output .. remain
|
||||
count, code = sock:recvall(2)
|
||||
else
|
||||
count, code = sock:recvall(count+2-#buffer+endp)
|
||||
end
|
||||
if not count then
|
||||
return nil, code
|
||||
end
|
||||
return output
|
||||
end
|
||||
end
|
||||
end
|
39
luci-app-quickstart/luasrc/controller/quickstart.lua
Normal file
39
luci-app-quickstart/luasrc/controller/quickstart.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local http = require "luci.http"
|
||||
|
||||
module("luci.controller.quickstart", package.seeall)
|
||||
|
||||
local page_index = {"admin", "quickstart", "pages"}
|
||||
|
||||
function index()
|
||||
if luci.sys.call("pgrep quickstart >/dev/null") == 0 then
|
||||
entry({"admin", "quickstart"}, call("redirect_index"), _("QuickStart"), 1)
|
||||
entry({"admin", "network_guide"}, call("networkguide_index"), _("NetworkGuide"), 2)
|
||||
entry({"admin", "quickstart", "pages"}, call("quickstart_index")).leaf = true
|
||||
if nixio.fs.access("/usr/lib/lua/luci/view/quickstart/main_dev.htm") then
|
||||
entry({"admin", "quickstart", "dev"}, call("quickstart_dev")).leaf = true
|
||||
end
|
||||
else
|
||||
entry({"admin", "quickstart"})
|
||||
entry({"admin", "quickstart", "pages"}, call("redirect_fallback")).leaf = true
|
||||
end
|
||||
end
|
||||
|
||||
function networkguide_index()
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","quickstart","pages","network"))
|
||||
end
|
||||
|
||||
function redirect_index()
|
||||
luci.http.redirect(luci.dispatcher.build_url(unpack(page_index)))
|
||||
end
|
||||
|
||||
function redirect_fallback()
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","status"))
|
||||
end
|
||||
|
||||
function quickstart_index()
|
||||
luci.template.render("quickstart/main", {prefix=luci.dispatcher.build_url(unpack(page_index))})
|
||||
end
|
||||
|
||||
function quickstart_dev()
|
||||
luci.template.render("quickstart/main_dev", {prefix=luci.dispatcher.build_url(unpack({"admin", "quickstart", "dev"}))})
|
||||
end
|
16
luci-app-quickstart/luasrc/view/quickstart/landing.htm
Normal file
16
luci-app-quickstart/luasrc/view/quickstart/landing.htm
Normal file
@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; url=<%=url('admin/quickstart/pages')%>" />
|
||||
<script type="text/javascript">
|
||||
function onload() {
|
||||
setTimeout(function(){
|
||||
localtion.href="<%=url('admin/quickstart/pages')%>";
|
||||
document.body.style.display='block';
|
||||
},1000);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="display:none" onload="onload">
|
||||
Landing to <a href="<%=url('admin/quickstart/pages')%>">main page</a>
|
||||
</body>
|
||||
</html>
|
12
luci-app-quickstart/luasrc/view/quickstart/main.htm
Normal file
12
luci-app-quickstart/luasrc/view/quickstart/main.htm
Normal file
@ -0,0 +1,12 @@
|
||||
<%+header%>
|
||||
<script>
|
||||
(function(){
|
||||
var vue_prefix="<%=prefix%>";
|
||||
window.vue_base = vue_prefix + '/';
|
||||
})();
|
||||
</script>
|
||||
<div id="app">
|
||||
</div>
|
||||
<script type="module" crossorigin src="/luci-static/quickstart/index.js<%# ?v=PKG_VERSION %>"></script>
|
||||
<link rel="stylesheet" href="/luci-static/quickstart/style.css<%# ?v=PKG_VERSION %>">
|
||||
<%+footer%>
|
7
luci-app-quickstart/po/zh-cn/quickstart.po
Normal file
7
luci-app-quickstart/po/zh-cn/quickstart.po
Normal file
@ -0,0 +1,7 @@
|
||||
msgid "NetworkGuide"
|
||||
msgstr "网络向导"
|
||||
|
||||
msgid "QuickStart"
|
||||
msgstr "首页"
|
||||
|
||||
|
1
luci-app-quickstart/po/zh_Hans
Symbolic link
1
luci-app-quickstart/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
4
luci-app-quickstart/root/etc/uci-defaults/50_luci-quickstart
Executable file
4
luci-app-quickstart/root/etc/uci-defaults/50_luci-quickstart
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"admin/quickstart": {
|
||||
"title": "QuickStart",
|
||||
"order": 1,
|
||||
"action": {
|
||||
"type": "template",
|
||||
"path": "quickstart/landing"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -362,6 +362,8 @@ footer.mobile-hide {
|
||||
|
||||
.status-bar .inner .right-part {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.status-bar .inner .flag {
|
||||
@ -593,6 +595,13 @@ footer.mobile-hide {
|
||||
.status {
|
||||
margin-bottom: -0.375rem;
|
||||
}
|
||||
.icon-con{
|
||||
margin-right: -0.1rem !important;
|
||||
}
|
||||
.icon-con img{
|
||||
width: 2.5rem !important;
|
||||
height: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 浏览器的黑暗模式 */
|
||||
|
@ -7,10 +7,10 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Argon Theme
|
||||
LUCI_DEPENDS:=
|
||||
PKG_VERSION:=2.2.9
|
||||
PKG_RELEASE:=20211016-1
|
||||
LUCI_DEPENDS:=+curl +jsonfilter
|
||||
PKG_VERSION:=2.2.9.4
|
||||
PKG_RELEASE:=20220421
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
@ -1,2 +1,2 @@
|
||||
Drop background here!
|
||||
accept jpg png gif and mp4
|
||||
accept jpg png gif mp4 webm
|
||||
|
File diff suppressed because one or more lines are too long
@ -1434,6 +1434,10 @@ fieldset>fieldset,
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.cbi-tblsection {
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
@ -1521,6 +1525,11 @@ tr>th,
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cbi-section-table-row>.cbi-value-field .cbi-input-text,
|
||||
.cbi-section-table-row>.cbi-value-field .cbi-input-password {
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.cbi-section-table-row>.cbi-value-field [data-dynlist]>input,
|
||||
.cbi-section-table-row>.cbi-value-field input.cbi-input-password {
|
||||
width: calc(100% - 1.5rem);
|
||||
@ -1530,6 +1539,11 @@ tr>th,
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.cbi-section-table-row>.cbi-value-field .control-group {
|
||||
display: inline-flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div>table>tbody>tr:nth-of-type(2n),
|
||||
div>.table>.tr:nth-of-type(2n) {
|
||||
background-color: #f9f9f9;
|
||||
@ -2901,7 +2915,7 @@ td>.ifacebadge,
|
||||
}
|
||||
|
||||
.cbi-section-table-row>.cbi-value-field .cbi-dropdown {
|
||||
min-width: 7rem;
|
||||
min-width: 3rem;
|
||||
}
|
||||
|
||||
.cbi-section-create {
|
||||
|
@ -37,13 +37,15 @@ return baseclass.extend({
|
||||
|
||||
handleMenuExpand: function (ev) {
|
||||
var a = ev.target, slide = a.parentNode, slide_menu = a.nextElementSibling;
|
||||
var collapse = false;
|
||||
|
||||
document.querySelectorAll('.main .main-left .nav > li >ul.active').forEach(function (ul) {
|
||||
if (ul !== slide_menu) {
|
||||
$(ul).stop(true).slideUp("fast", function () {
|
||||
ul.classList.remove('active');
|
||||
ul.previousElementSibling.classList.remove('active');
|
||||
});
|
||||
$(ul).stop(true).slideUp("fast", function () {
|
||||
ul.classList.remove('active');
|
||||
ul.previousElementSibling.classList.remove('active');
|
||||
});
|
||||
if (!collapse && ul === slide_menu) {
|
||||
collapse = true;
|
||||
}
|
||||
|
||||
});
|
||||
@ -52,11 +54,13 @@ return baseclass.extend({
|
||||
return;
|
||||
|
||||
|
||||
$(slide).find(".slide-menu").slideDown("fast",function(){
|
||||
slide_menu.classList.add('active');
|
||||
a.classList.add('active');
|
||||
});
|
||||
a.blur();
|
||||
if (!collapse) {
|
||||
$(slide).find(".slide-menu").slideDown("fast",function(){
|
||||
slide_menu.classList.add('active');
|
||||
a.classList.add('active');
|
||||
});
|
||||
a.blur();
|
||||
}
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
},
|
||||
|
@ -23,7 +23,6 @@
|
||||
<a class="luci-link" href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> /
|
||||
<a href="https://github.com/jerrykuku/luci-theme-argon">ArgonTheme <%# vPKG_VERSION %></a> /
|
||||
<%= ver.distversion %>
|
||||
<ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
@ -41,6 +40,5 @@
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<script type="text/javascript">L.require('menu-argon')</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -21,6 +21,7 @@
|
||||
local util = require "luci.util"
|
||||
local http = require "luci.http"
|
||||
local disp = require "luci.dispatcher"
|
||||
local ver = require "luci.version"
|
||||
|
||||
local boardinfo = util.ubus("system", "board")
|
||||
|
||||
@ -85,7 +86,7 @@
|
||||
<meta name="msapplication-TileColor" content="<%=bar_color%>">
|
||||
<meta name="msapplication-TileImage" content="<%=media%>/icon/ms-icon-144x144.png">
|
||||
<meta name="theme-color" content="<%=bar_color%>">
|
||||
<link rel="stylesheet" href="<%=media%>/css/cascade.css?v=<%=math.random(1,100000)%>">
|
||||
<link rel="stylesheet" href="<%=media%>/css/cascade.css<%# ?v=PKG_VERSION %>">
|
||||
<style title="text/css">
|
||||
<% if mode == 'normal' then %>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
@ -115,10 +116,10 @@
|
||||
</style>
|
||||
<% end -%>
|
||||
<script src="<%=media%>/js/polyfill.min.js"></script>
|
||||
<script src="<%=url('admin/translations', luci.i18n.context.lang)%>?v=2.2.4"></script>
|
||||
<script src="<%=resource%>/cbi.js?v=2.2.4"></script>
|
||||
<script src="<%=resource%>/luci.js?v=2.2.4"></script>
|
||||
<script src="<%=media%>/js/jquery.min.js?v=2.2.4"></script>
|
||||
<script src="<%=url('admin/translations', luci.i18n.context.lang)%>?v=<%=ver.luciversion%>"></script>
|
||||
<script src="<%=resource%>/cbi.js?v=<%=ver.luciversion%>"></script>
|
||||
<script src="<%=resource%>/luci.js?v=<%=ver.luciversion%>"></script>
|
||||
<script src="<%=media%>/js/jquery.min.js?v=3.5.1"></script>
|
||||
</head>
|
||||
|
||||
<body
|
||||
|
@ -21,6 +21,7 @@
|
||||
local util = require "luci.util"
|
||||
local http = require "luci.http"
|
||||
local disp = require "luci.dispatcher"
|
||||
local ver = require "luci.version"
|
||||
|
||||
local boardinfo = util.ubus("system", "board")
|
||||
|
||||
@ -82,7 +83,7 @@
|
||||
<meta name="msapplication-TileColor" content="<%=bar_color%>">
|
||||
<meta name="msapplication-TileImage" content="<%=media%>/icon/ms-icon-144x144.png">
|
||||
<meta name="theme-color" content="<%=bar_color%>">
|
||||
<link rel="stylesheet" href="<%=media%>/css/cascade.css?v=<%=math.random(1,100000)%>">
|
||||
<link rel="stylesheet" href="<%=media%>/css/cascade.css<%# ?v=PKG_VERSION %>">
|
||||
<style title="text/css">
|
||||
<% if mode == 'normal' then %>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
@ -111,13 +112,8 @@
|
||||
<%=css %>
|
||||
</style>
|
||||
<% end -%>
|
||||
<script src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script>
|
||||
<script src="<%=resource%>/cbi.js<%# ?v=PKG_VERSION %>"></script>
|
||||
<script src="<%=resource%>/xhr.js<%# ?v=PKG_VERSION %>"></script>
|
||||
<script src="<%=media%>/js/jquery.min.js<%# ?v=PKG_VERSION %>"></script>
|
||||
<script src="<%=media%>/js/jquery.min.js?v=3.5.1"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body
|
||||
class="lang_<%=luci.i18n.context.lang%> <% if node then %><%= striptags( node.title ) %><% end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>"
|
||||
data-page="<%= table.concat(disp.context.requestpath, "-") %>">
|
||||
<body>
|
||||
|
@ -5,34 +5,10 @@
|
||||
-%>
|
||||
|
||||
<%
|
||||
local ver = require "luci.version"
|
||||
|
||||
if not luci.dispatcher.context.template_header_sent then
|
||||
include("themes/" .. theme .. "/header_login")
|
||||
luci.dispatcher.context.template_header_sent = true
|
||||
end
|
||||
|
||||
local applyconf = luci.config and luci.config.apply
|
||||
%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/promis.min.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/luci.js"></script>
|
||||
<script type="text/javascript">
|
||||
L = new LuCI(<%= luci.http.write_json({
|
||||
token = token,
|
||||
media = media,
|
||||
resource = resource,
|
||||
scriptname = luci.http.getenv("SCRIPT_NAME"),
|
||||
pathinfo = luci.http.getenv("PATH_INFO"),
|
||||
documentroot = luci.http.getenv("DOCUMENT_ROOT"),
|
||||
requestpath = luci.dispatcher.context.requestpath,
|
||||
dispatchpath = luci.dispatcher.context.path,
|
||||
pollinterval = luci.config.main.pollinterval or 5,
|
||||
ubuspath = luci.config.main.ubuspath or '/ubus/',
|
||||
sessionid = luci.dispatcher.context.authsession,
|
||||
nodespec = luci.dispatcher.context.dispatched,
|
||||
apply_rollback = math.max(applyconf and applyconf.rollback or 90, 90),
|
||||
apply_holdoff = math.max(applyconf and applyconf.holdoff or 4, 1),
|
||||
apply_timeout = math.max(applyconf and applyconf.timeout or 5, 1),
|
||||
apply_display = math.max(applyconf and applyconf.display or 1.5, 1),
|
||||
rollback_token = rollback_token
|
||||
}) %>);
|
||||
</script>
|
||||
|
@ -42,6 +42,9 @@
|
||||
end
|
||||
|
||||
|
||||
local imageTypes = " jpg png gif "
|
||||
local videoTypes = " mp4 webm "
|
||||
local allTypes = imageTypes .. videoTypes
|
||||
function fetchMedia(path,themeDir)
|
||||
local backgroundTable = {}
|
||||
local backgroundCount = 0
|
||||
@ -49,7 +52,7 @@
|
||||
attr = fs.stat(f)
|
||||
if attr then
|
||||
local ext = fs.basename(f):match(".+%.(%w+)$")
|
||||
if ext == "jpg" or ext == "png" or ext == "gif" or ext == "mp4" then
|
||||
if ext ~= nil and string.match(allTypes, " "..ext.." ") ~= nil then
|
||||
local bg = {}
|
||||
bg.type = ext
|
||||
bg.url = themeDir .. fs.basename(f)
|
||||
@ -62,24 +65,23 @@
|
||||
end
|
||||
|
||||
local boardinfo = util.ubus("system", "board")
|
||||
local bingUrl = "http://www.bing.com/"
|
||||
local bingApiUrl = bingUrl .. "HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US"
|
||||
local themeDir = media .. "/background/"
|
||||
local bgUrl = media .. "/img/bg1.jpg"
|
||||
local useBing = fs.access('/etc/config/argon') and "1" or "0"
|
||||
local backgroundTable, backgroundCount = fetchMedia("/www" .. themeDir .. "*",themeDir)
|
||||
local backgroundType = "Image"
|
||||
local mimeType = ""
|
||||
|
||||
if ( backgroundCount > 0 ) then
|
||||
local currentBg = backgroundTable[math.random(1,backgroundCount)]
|
||||
bgUrl = currentBg.url
|
||||
if (currentBg.type == "mp4" ) then
|
||||
if (string.match(videoTypes, " "..currentBg.type.." ") ~= nil) then
|
||||
backgroundType = "Video"
|
||||
mimeType = "video/" .. currentBg.type
|
||||
end
|
||||
else
|
||||
local bing = sys.exec("wget --timeout=0.5 -qO- '%s'" %bingApiUrl)
|
||||
local bing = sys.exec("/usr/libexec/argon/bing_wallpaper")
|
||||
if (bing and bing ~= '') then
|
||||
bgUrl = bingUrl .. json.parse(bing).images[1].url
|
||||
bgUrl = bing
|
||||
end
|
||||
end
|
||||
%>
|
||||
@ -89,7 +91,7 @@
|
||||
<!-- Video Player Start -->
|
||||
<div class="video">
|
||||
<video autoplay loop muted id="video">
|
||||
<source src="<%=bgUrl%>" type="video/mp4">
|
||||
<source src="<%=bgUrl%>" type="<%=mimeType%>">
|
||||
</video>
|
||||
</div>
|
||||
<div class="volume-control mute"></div>
|
||||
|
52
luci-theme-argon/root/usr/libexec/argon/bing_wallpaper
Executable file
52
luci-theme-argon/root/usr/libexec/argon/bing_wallpaper
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# author jjm2473
|
||||
|
||||
BING_BASE=http://www.bing.com
|
||||
CACHE=/var/run/argon_bing.url
|
||||
WRLOCK=/var/lock/argon_bing.lock
|
||||
|
||||
fetch_url_path() {
|
||||
curl --fail --show-error --max-time 1 \
|
||||
"$BING_BASE/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US" 2>/dev/null \
|
||||
| jsonfilter -q -e '@.images[0].url'
|
||||
}
|
||||
|
||||
try_update() {
|
||||
local lock="$WRLOCK"
|
||||
exec 200>$lock
|
||||
|
||||
if flock -n 200 >/dev/null 2>&1; then
|
||||
local path=`fetch_url_path`
|
||||
if [ -n "$path" ]; then
|
||||
echo "${BING_BASE}${path}" | tee "$CACHE"
|
||||
else
|
||||
if [ -s "$CACHE" ]; then
|
||||
cat "$CACHE"
|
||||
else
|
||||
touch "$CACHE"
|
||||
fi
|
||||
fi
|
||||
flock -u 200 >/dev/null 2>&1
|
||||
elif [ -s "$CACHE" ]; then
|
||||
cat "$CACHE"
|
||||
fi
|
||||
}
|
||||
|
||||
get_url() {
|
||||
if [ -f "$CACHE" ]; then
|
||||
local idle_t=$((`date '+%s'` - `date -r "$CACHE" '+%s' 2>/dev/null || echo '0'`))
|
||||
if [ -s "$CACHE" ]; then
|
||||
if [ $idle_t -le 43200 ]; then
|
||||
cat "$CACHE"
|
||||
return
|
||||
fi
|
||||
else
|
||||
if [ $idle_t -le 120 ]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
try_update
|
||||
}
|
||||
|
||||
get_url
|
61
quickstart/Makefile
Normal file
61
quickstart/Makefile
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
# Copyright (C) 2020 jjm2473@gmail.com
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_ARCH_quickstart:=$(ARCH)
|
||||
|
||||
PKG_NAME:=quickstart
|
||||
PKG_VERSION:=0.3.6
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://fw.koolcenter.com/binary/quickstart/
|
||||
PKG_HASH:=ff807b6927a6f3e858c0734cb55105ac60ebdb8ffe694436101ace0ed80c1dd9
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=Quickstart, the quick start.
|
||||
DEPENDS:=@(x86_64||aarch64)
|
||||
URL:=https://easepi.linkease.com/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Quickstart is a dashboard & user guide
|
||||
endef
|
||||
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
[ -f /etc/uci-defaults/quickstart ] && /etc/uci-defaults/quickstart && rm -f /etc/uci-defaults/quickstart
|
||||
fi
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/quickstart.$(PKG_ARCH_quickstart) $(1)/usr/sbin/quickstart
|
||||
$(INSTALL_BIN) ./files/quickstart.init $(1)/etc/init.d/quickstart
|
||||
$(INSTALL_BIN) ./files/quickstart.uci-default $(1)/etc/uci-defaults/quickstart
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
13
quickstart/files/quickstart.init
Normal file
13
quickstart/files/quickstart.init
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=92
|
||||
USE_PROCD=1
|
||||
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/quickstart serve
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
6
quickstart/files/quickstart.uci-default
Executable file
6
quickstart/files/quickstart.uci-default
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/quickstart enable
|
||||
/etc/init.d/quickstart start
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user