Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tbblgm119
lede
提交
d3d6c4ab
L
lede
项目概览
tbblgm119
/
lede
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
lede
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d3d6c4ab
编写于
5月 31, 2019
作者:
L
LEAN-ESX
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
luci-app-familycloud: add CT Family Cloud Speeder package
上级
1c4e85af
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
434 addition
and
1 deletion
+434
-1
package/lean/luci-app-familycloud/Makefile
package/lean/luci-app-familycloud/Makefile
+18
-0
package/lean/luci-app-familycloud/luasrc/controller/familycloud.lua
...an/luci-app-familycloud/luasrc/controller/familycloud.lua
+23
-0
package/lean/luci-app-familycloud/luasrc/model/cbi/familycloud.lua
...ean/luci-app-familycloud/luasrc/model/cbi/familycloud.lua
+22
-0
package/lean/luci-app-familycloud/luasrc/model/cbi/familycloudlog.lua
.../luci-app-familycloud/luasrc/model/cbi/familycloudlog.lua
+14
-0
package/lean/luci-app-familycloud/luasrc/view/familycloud/familycloud_status.htm
...amilycloud/luasrc/view/familycloud/familycloud_status.htm
+22
-0
package/lean/luci-app-familycloud/root/etc/config/familycloud
...age/lean/luci-app-familycloud/root/etc/config/familycloud
+6
-0
package/lean/luci-app-familycloud/root/etc/init.d/familycloud
...age/lean/luci-app-familycloud/root/etc/init.d/familycloud
+25
-0
package/lean/luci-app-familycloud/root/etc/ppp/ip-up.d/familycloud.sh
.../luci-app-familycloud/root/etc/ppp/ip-up.d/familycloud.sh
+3
-0
package/lean/luci-app-familycloud/root/etc/uci-defaults/familycloud
...an/luci-app-familycloud/root/etc/uci-defaults/familycloud
+11
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/config.ini
...milycloud/root/usr/share/familycloud/CloudDisk/config.ini
+10
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/config.json
...ilycloud/root/usr/share/familycloud/CloudDisk/config.json
+1
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup.sh
...milycloud/root/usr/share/familycloud/CloudDisk/speedup.sh
+45
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup_router.sh
...ud/root/usr/share/familycloud/CloudDisk/speedup_router.sh
+41
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/utils.sh
...familycloud/root/usr/share/familycloud/CloudDisk/utils.sh
+43
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.ini
...lycloud/root/usr/share/familycloud/FamilyCloud/config.ini
+14
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.json
...ycloud/root/usr/share/familycloud/FamilyCloud/config.json
+1
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup.sh
...lycloud/root/usr/share/familycloud/FamilyCloud/speedup.sh
+48
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup_router.sh
.../root/usr/share/familycloud/FamilyCloud/speedup_router.sh
+43
-0
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/utils.sh
...milycloud/root/usr/share/familycloud/FamilyCloud/utils.sh
+43
-0
package/network/utils/curl/Config.in
package/network/utils/curl/Config.in
+1
-1
未找到文件。
package/lean/luci-app-familycloud/Makefile
0 → 100644
浏览文件 @
d3d6c4ab
# 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
:=
3
include
$(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
package/lean/luci-app-familycloud/luasrc/controller/familycloud.lua
0 → 100644
浏览文件 @
d3d6c4ab
module
(
"luci.controller.familycloud"
,
package
.
seeall
)
function
index
()
if
not
nixio
.
fs
.
access
(
"/etc/config/ipsec"
)
then
return
end
entry
({
"admin"
,
"services"
,
"familycloud"
},
firstchild
(),
_
(
"天翼家庭云/云盘提速"
),
80
).
dependent
=
false
entry
({
"admin"
,
"services"
,
"familycloud"
,
"general"
},
cbi
(
"familycloud"
),
_
(
"Base Setting"
),
1
)
entry
({
"admin"
,
"services"
,
"familycloud"
,
"log"
},
form
(
"familycloudlog"
),
_
(
"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
package/lean/luci-app-familycloud/luasrc/model/cbi/familycloud.lua
0 → 100644
浏览文件 @
d3d6c4ab
mp
=
Map
(
"familycloud"
,
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
package/lean/luci-app-familycloud/luasrc/model/cbi/familycloudlog.lua
0 → 100644
浏览文件 @
d3d6c4ab
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
\ No newline at end of file
package/lean/luci-app-familycloud/luasrc/view/familycloud/familycloud_status.htm
0 → 100644
浏览文件 @
d3d6c4ab
<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>
\ No newline at end of file
package/lean/luci-app-familycloud/root/etc/config/familycloud
0 → 100644
浏览文件 @
d3d6c4ab
config familycloud
option token 'f18a1952289c4659b3722ad54d3d92fb'
option speedertype 'CloudDisk'
option enabled '0'
package/lean/luci-app-familycloud/root/etc/init.d/familycloud
0 → 100755
浏览文件 @
d3d6c4ab
#!/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
}
package/lean/luci-app-familycloud/root/etc/ppp/ip-up.d/familycloud.sh
0 → 100755
浏览文件 @
d3d6c4ab
#!/bin/sh
sleep
60
&&
/etc/init.d/familycloud restart
package/lean/luci-app-familycloud/root/etc/uci-defaults/familycloud
0 → 100755
浏览文件 @
d3d6c4ab
#!/bin/sh
uci
-q
batch
<<-
EOF
>/dev/null
delete ucitrack.@familycloud[-1]
add ucitrack familycloud
set ucitrack.@familycloud[-1].init=familycloud
commit ucitrack
EOF
rm
-f
/tmp/luci-indexcache
exit
0
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/config.ini
0 → 100644
浏览文件 @
d3d6c4ab
{
"accessToken":
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"setting":
{
"method":
"GET",
"rate":
600
},
"extra_header":
{
"User-Agent":
"Apache-HttpClient/UNAVAILABLE
(java
1.4)"
}
}
\ No newline at end of file
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/config.json
0 → 120000
浏览文件 @
d3d6c4ab
/tmp/config.json
\ No newline at end of file
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup.sh
0 → 100755
浏览文件 @
d3d6c4ab
#!/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
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup_router.sh
0 → 100644
浏览文件 @
d3d6c4ab
#!/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
"*******************************************"
package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/utils.sh
0 → 100755
浏览文件 @
d3d6c4ab
#!/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'
}
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.ini
0 → 100644
浏览文件 @
d3d6c4ab
{
"accessToken":
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"AppKey":
"600100885",
"setting":
{
"method":
"POST",
"rate":
600
},
"send_data":
{
"prodCode":
"76"
},
"extra_header":
{
"User-Agent":
"Apache-HttpClient/UNAVAILABLE
(java
1.4)"
}
}
\ No newline at end of file
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.json
0 → 120000
浏览文件 @
d3d6c4ab
/tmp/config.json
\ No newline at end of file
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup.sh
0 → 100755
浏览文件 @
d3d6c4ab
#!/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
\ No newline at end of file
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup_router.sh
0 → 100644
浏览文件 @
d3d6c4ab
#!/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
"*******************************************"
package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/utils.sh
0 → 100755
浏览文件 @
d3d6c4ab
#!/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'
}
package/network/utils/curl/Config.in
浏览文件 @
d3d6c4ab
...
...
@@ -4,7 +4,7 @@ comment "SSL support"
choice
prompt "Selected SSL library"
default LIBCURL_
MBEDTLS
default LIBCURL_
OPENSSL
config LIBCURL_MBEDTLS
bool "mbed TLS"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录