mirror of
https://github.com/coolsnowwolf/luci
synced 2025-01-09 09:17:27 +08:00
luci-app-familycloud: drop application
This commit is contained in:
parent
041a2230c5
commit
db827a3078
@ -1,18 +0,0 @@
|
||||
# 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 FamilyCloudSpeeder
|
||||
LUCI_DEPENDS:=+coreutils +coreutils-nohup +libreadline +libcurl +libopenssl +bash +curl +wget +openssl-util +ca-certificates +ca-bundle
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-familycloud
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=6
|
||||
|
||||
include ../../luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
@ -1,21 +0,0 @@
|
||||
module("luci.controller.familycloud", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/familycloud") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "familycloud"}, firstchild(), _("天翼家庭云/云盘提速"), 80).dependent = false
|
||||
|
||||
entry({"admin", "services", "familycloud", "general"}, cbi("familycloud/familycloud"), _("Base Setting"), 1)
|
||||
entry({"admin", "services", "familycloud", "log"}, form("familycloud/familycloud_log"), _("Log"), 2)
|
||||
|
||||
entry({"admin", "services", "familycloud", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("ps | grep speedup.sh | grep -v grep >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
@ -1,22 +0,0 @@
|
||||
mp = Map("familycloud")
|
||||
mp.title = translate("天翼家庭云/天翼云盘提速")
|
||||
mp.description = translate("天翼家庭云/天翼云盘提速 (最高可达500Mbps)")
|
||||
|
||||
mp:section(SimpleSection).template = "familycloud/familycloud_status"
|
||||
|
||||
s = mp:section(TypedSection, "familycloud")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
enabled = s:option(Flag, "enabled", translate("启用提速"))
|
||||
enabled.default = 0
|
||||
enabled.rmempty = false
|
||||
|
||||
speedtype = s:option(ListValue, "speedertype", translate("天翼提速包类型"))
|
||||
speedtype:value("CloudDisk", translate("天翼云盘提速"))
|
||||
speedtype:value("FamilyCloud", translate("天翼家庭云提速"))
|
||||
|
||||
account = s:option(Value, "token", translate("AccessToken"))
|
||||
account.datatype = "string"
|
||||
|
||||
return mp
|
@ -1,14 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/tmp/familycloud.log"
|
||||
|
||||
f = SimpleForm("logview")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 15
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
t.readonly = "readonly"
|
||||
|
||||
return f
|
@ -1,22 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[familycloud]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('familycloud_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>Family cloud <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>Family cloud <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="familycloud_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
@ -1,6 +0,0 @@
|
||||
|
||||
config familycloud
|
||||
option token 'f18a1952289c4659b3722ad54d3d92fb'
|
||||
option speedertype 'CloudDisk'
|
||||
option enabled '0'
|
||||
|
@ -1,25 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
TYPE=$(uci get familycloud.@familycloud[0].speedertype)
|
||||
TOKEN=$(uci get familycloud.@familycloud[0].token)
|
||||
|
||||
|
||||
start()
|
||||
{
|
||||
stop
|
||||
enable=$(uci get familycloud.@familycloud[0].enabled)
|
||||
[ $enable -eq 0 ] && exit 0
|
||||
sed "s/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/$TOKEN/" /usr/share/familycloud/$TYPE/config.ini > /tmp/config.json
|
||||
bash /usr/share/familycloud/$TYPE/speedup.sh > /tmp/familycloud.log &
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
kill -9 $(ps | grep speedup.sh | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 60 && /etc/init.d/familycloud restart
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@familycloud[-1]
|
||||
add ucitrack familycloud
|
||||
set ucitrack.@familycloud[-1].init=familycloud
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
touch /tmp/config.json
|
||||
|
||||
ln -s /tmp/config.json /usr/share/familycloud/CloudDisk/config.json
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
|
||||
exit 0
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"accessToken": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"setting": {
|
||||
"method": "GET",
|
||||
"rate": 600
|
||||
},
|
||||
"extra_header": {
|
||||
"User-Agent": "Apache-HttpClient/UNAVAILABLE (java 1.4)"
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
base_dir=`dirname $0`
|
||||
source "$base_dir/utils.sh"
|
||||
config="$base_dir/config.json"
|
||||
|
||||
|
||||
accessToken=`getSingleJsonValue "$config" "accessToken"`
|
||||
method=`getSingleJsonValue "$config" "method"`
|
||||
rate=`getSingleJsonValue "$config" "rate"`
|
||||
UA=`getSingleJsonValue "$config" "User-Agent"`
|
||||
extra_header="User-Agent:$UA"
|
||||
|
||||
|
||||
HOST="http://api.cloud.189.cn"
|
||||
LOGIN_URL="/loginByOpen189AccessToken.action"
|
||||
ACCESS_URL="/speed/startSpeedV2.action"
|
||||
count=0
|
||||
echo "*******************************************"
|
||||
while :
|
||||
do
|
||||
count=$((count+1))
|
||||
echo "Sending heart_beat package <$count>"
|
||||
split="~"
|
||||
headers_string="$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
result=`get "$HOST$LOGIN_URL?accessToken=$accessToken" "$headers"`
|
||||
session_key=`echo "$result" | grep -Eo "sessionKey>.*</sessionKey" | sed 's/<\/sessionKey//' | sed 's/sessionKey>//'`
|
||||
session_secret=`echo "$result" | grep -Eo "sessionSecret>.*</sessionSecret" | sed 's/sessionSecret>//' | sed 's/<\/sessionSecret//'`
|
||||
date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'`
|
||||
data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date"
|
||||
key="$session_secret"
|
||||
signature=`hashHmac "sha1" "$data" "$key"`
|
||||
headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
qosClientSn="$session_key"
|
||||
result=`get "$HOST$ACCESS_URL?qosClientSn=$qosClientSn" "$headers"`
|
||||
echo "heart_beat:<signature:$signature>"
|
||||
echo "date:<$date>"
|
||||
echo -e "response:\n$result"
|
||||
[[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed"
|
||||
echo "Sending heart_beat package <$count> $hint"
|
||||
echo "*******************************************"
|
||||
sleep ${rate}
|
||||
done
|
@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
base_dir=`dirname $0`
|
||||
source "$base_dir/utils.sh"
|
||||
config="$base_dir/config.json"
|
||||
|
||||
echoToLogreader() {
|
||||
logger -t CloudDisk "${1}"
|
||||
}
|
||||
|
||||
accessToken=`getSingleJsonValue "$config" "accessToken"`
|
||||
method=`getSingleJsonValue "$config" "method"`
|
||||
UA=`getSingleJsonValue "$config" "User-Agent"`
|
||||
extra_header="User-Agent:$UA"
|
||||
|
||||
|
||||
HOST="http://api.cloud.189.cn"
|
||||
LOGIN_URL="/loginByOpen189AccessToken.action"
|
||||
ACCESS_URL="/speed/startSpeedV2.action"
|
||||
echoToLogreader "*******************************************"
|
||||
echoToLogreader "Sending Heartbeat Package ..."
|
||||
split="~"
|
||||
headers_string="$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
result=`get "$HOST$LOGIN_URL?accessToken=$accessToken" "$headers"`
|
||||
session_key=`echo "$result" | grep -Eo "sessionKey>.*</sessionKey" | sed 's/<\/sessionKey//' | sed 's/sessionKey>//'`
|
||||
session_secret=`echo "$result" | grep -Eo "sessionSecret>.*</sessionSecret" | sed 's/sessionSecret>//' | sed 's/<\/sessionSecret//'`
|
||||
date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'`
|
||||
data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date"
|
||||
key="$session_secret"
|
||||
signature=`hashHmac "sha1" "$data" "$key"`
|
||||
headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
qosClientSn=`cat /proc/sys/kernel/random/uuid`
|
||||
result=`get "$HOST$ACCESS_URL?qosClientSn=$qosClientSn" "$headers"`
|
||||
echoToLogreader "Heartbeat Signature: $signature"
|
||||
echoToLogreader "Date: $date"
|
||||
echoToLogreader "Response: $result"
|
||||
[[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed"
|
||||
echoToLogreader "Heartbeating $hint."
|
||||
echoToLogreader "*******************************************"
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CONNECTION_TIME="15"
|
||||
TRANSMISSION_TIME="15"
|
||||
|
||||
formatHeaderString() {
|
||||
OLD_IFS=$IFS
|
||||
IFS="$1"
|
||||
STR="$2"
|
||||
ARRAY=(${STR})
|
||||
for i in "${!ARRAY[@]}"
|
||||
do
|
||||
HEADERS="$HEADERS -H '${ARRAY[$i]}'"
|
||||
done
|
||||
echo ${HEADERS} | sed 's/^ //'
|
||||
IFS=${OLD_IFS}
|
||||
}
|
||||
|
||||
get() {
|
||||
HEADER="$1"
|
||||
URL="$2"
|
||||
eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" "${HEADER}" "${URL}"
|
||||
}
|
||||
|
||||
post() {
|
||||
HEADER="$1"
|
||||
URL="$2"
|
||||
PAYLOAD="$3"
|
||||
eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" -X POST "${URL}" "${HEADER}" -w %{http_code} -d "'$PAYLOAD'"
|
||||
}
|
||||
|
||||
getSingleJsonValue() {
|
||||
FILE="$1"
|
||||
KEY="$2"
|
||||
cat ${FILE} | grep "$KEY" | sed 's/,$//' | awk -F "[:]" '{ print $2 }' | sed 's/ //g' | sed 's/"//g'
|
||||
}
|
||||
|
||||
hashHmac() {
|
||||
digest="$1"
|
||||
data="$2"
|
||||
key="$3"
|
||||
echo -n "$data" | openssl dgst "-$digest" -hmac "$key" | sed -e 's/^.* //' | tr 'a-z' 'A-Z'
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"accessToken": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"AppKey": "600100885",
|
||||
"setting": {
|
||||
"method": "POST",
|
||||
"rate": 600
|
||||
},
|
||||
"send_data": {
|
||||
"prodCode": "76"
|
||||
},
|
||||
"extra_header": {
|
||||
"User-Agent": "Apache-HttpClient/UNAVAILABLE (java 1.4)"
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
/tmp/config.json
|
@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
base_dir=`dirname $0`
|
||||
source "$base_dir/utils.sh"
|
||||
config="$base_dir/config.json"
|
||||
|
||||
|
||||
accessToken=`getSingleJsonValue "$config" "accessToken"`
|
||||
AppKey=`getSingleJsonValue "$config" "AppKey"`
|
||||
method=`getSingleJsonValue "$config" "method"`
|
||||
rate=`getSingleJsonValue "$config" "rate"`
|
||||
prodCode=`getSingleJsonValue "$config" "prodCode"`
|
||||
UA=`getSingleJsonValue "$config" "User-Agent"`
|
||||
extra_header="User-Agent:$UA"
|
||||
|
||||
|
||||
HOST="http://api.cloud.189.cn"
|
||||
LOGIN_URL="/login4MergedClient.action"
|
||||
ACCESS_URL="/family/qos/startQos.action"
|
||||
count=0
|
||||
echo "*******************************************"
|
||||
while :
|
||||
do
|
||||
count=$((count+1))
|
||||
echo "Sending heart_beat package <$count>"
|
||||
split="~"
|
||||
headers_string="AppKey:$AppKey"${split}"$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
result=`post "$headers" "$HOST$LOGIN_URL?accessToken=$accessToken"`
|
||||
session_key=`echo "$result" | grep -Eo "familySessionKey>.+</familySessionKey" | sed 's/familySessionKey>//' | sed 's/<\/familySessionKey//'`
|
||||
session_secret=`echo "$result" | grep -Eo "familySessionSecret>.+</familySessionSecret" | sed 's/familySessionSecret>//' | sed 's/<\/familySessionSecret//'`
|
||||
date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'`
|
||||
data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date"
|
||||
key="$session_secret"
|
||||
signature=`hashHmac "sha1" "$data" "$key"`
|
||||
headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
send_data="prodCode=$prodCode"
|
||||
result=`post "$headers" "$HOST$ACCESS_URL" "$send_data"`
|
||||
echo "heart_beat:<signature:$signature>"
|
||||
echo "date:<$date>"
|
||||
echo "status_code:${result: -3}"
|
||||
echo -e "response:\n`echo ${result} | sed "s^[0-9]\{3\}$^^"`"
|
||||
[[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed"
|
||||
echo "Sending heart_beat package <$count> $hint"
|
||||
echo "*******************************************"
|
||||
sleep ${rate}
|
||||
done
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
base_dir=`dirname $0`
|
||||
source "$base_dir/utils.sh"
|
||||
config="$base_dir/config.json"
|
||||
|
||||
echoToLogreader() {
|
||||
logger -t FamilyCloud "${1}"
|
||||
}
|
||||
|
||||
accessToken=`getSingleJsonValue "$config" "accessToken"`
|
||||
AppKey=`getSingleJsonValue "$config" "AppKey"`
|
||||
method=`getSingleJsonValue "$config" "method"`
|
||||
prodCode=`getSingleJsonValue "$config" "prodCode"`
|
||||
UA=`getSingleJsonValue "$config" "User-Agent"`
|
||||
extra_header="User-Agent:$UA"
|
||||
|
||||
|
||||
HOST="http://api.cloud.189.cn"
|
||||
LOGIN_URL="/login4MergedClient.action"
|
||||
ACCESS_URL="/family/qos/startQos.action"
|
||||
echoToLogreader "*******************************************"
|
||||
echoToLogreader "Sending Heartbeat Package ..."
|
||||
split="~"
|
||||
headers_string="AppKey:$AppKey"${split}"$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
result=`post "$headers" "$HOST$LOGIN_URL?accessToken=$accessToken"`
|
||||
session_key=`echo "$result" | grep -Eo "familySessionKey>.+</familySessionKey" | sed 's/familySessionKey>//' | sed 's/<\/familySessionKey//'`
|
||||
session_secret=`echo "$result" | grep -Eo "familySessionSecret>.+</familySessionSecret" | sed 's/familySessionSecret>//' | sed 's/<\/familySessionSecret//'`
|
||||
date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'`
|
||||
data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date"
|
||||
key="$session_secret"
|
||||
signature=`hashHmac "sha1" "$data" "$key"`
|
||||
headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header"
|
||||
headers=`formatHeaderString "$split" "$headers_string"`
|
||||
send_data="prodCode=$prodCode"
|
||||
result=`post "$headers" "$HOST$ACCESS_URL" "$send_data"`
|
||||
echoToLogreader "Heartbeat Signature: $signature"
|
||||
echoToLogreader "Date: $date"
|
||||
echoToLogreader "Response: ${result}"
|
||||
[[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed"
|
||||
echoToLogreader "Heartbeating $hint."
|
||||
echoToLogreader "*******************************************"
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CONNECTION_TIME="15"
|
||||
TRANSMISSION_TIME="15"
|
||||
|
||||
formatHeaderString() {
|
||||
OLD_IFS=$IFS
|
||||
IFS="$1"
|
||||
STR="$2"
|
||||
ARRAY=(${STR})
|
||||
for i in "${!ARRAY[@]}"
|
||||
do
|
||||
HEADERS="$HEADERS -H '${ARRAY[$i]}'"
|
||||
done
|
||||
echo ${HEADERS} | sed 's/^ //'
|
||||
IFS=${OLD_IFS}
|
||||
}
|
||||
|
||||
get() {
|
||||
HEADER="$1"
|
||||
URL="$2"
|
||||
eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" "${HEADER}" "${URL}"
|
||||
}
|
||||
|
||||
post() {
|
||||
HEADER="$1"
|
||||
URL="$2"
|
||||
PAYLOAD="$3"
|
||||
eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" -X POST "${URL}" "${HEADER}" -w %{http_code} -d "'$PAYLOAD'"
|
||||
}
|
||||
|
||||
getSingleJsonValue() {
|
||||
FILE="$1"
|
||||
KEY="$2"
|
||||
cat ${FILE} | grep "$KEY" | sed 's/,$//' | awk -F "[:]" '{ print $2 }' | sed 's/ //g' | sed 's/"//g'
|
||||
}
|
||||
|
||||
hashHmac() {
|
||||
digest="$1"
|
||||
data="$2"
|
||||
key="$3"
|
||||
echo -n "$data" | openssl dgst "-$digest" -hmac "$key" | sed -e 's/^.* //' | tr 'a-z' 'A-Z'
|
||||
}
|
Loading…
Reference in New Issue
Block a user