Skip to content
Snippets Groups Projects
Unverified Commit dd67534b authored by Recolic's avatar Recolic Committed by GitHub
Browse files

Merge pull request #2 from qzwlecr/master

bugfix: satisfy re-sign API.
parents d572a954 fea0b654
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/fish #!/usr/bin/fish
test -z $_openid; and echo 'openid is unset.' ; and exit 1 test -z $_openid; and echo 'openid is unset.' ; and exit 1
set _url "https://www.teachermate.com.cn/wechat/wechat/guide/signin?openid=$_openid" set _url "https://v18.teachermate.cn/wechat/wechat/guide/signin?openid=$_openid"
set _resign_url "https://v18.teachermate.cn/api/v1/wechat/re-auth?m=s_signin&code=$_openid&state=$_openid"
#simply reuse openid for resign
source ../config.fish source ../config.fish
...@@ -59,6 +61,8 @@ while true ...@@ -59,6 +61,8 @@ while true
test -f $tmpfl; and sleep $_monitor_interval test -f $tmpfl; and sleep $_monitor_interval
date date
curl -L "$_url" -v 2>$cookiefl > $tmpfl curl -L "$_url" -v 2>$cookiefl > $tmpfl
#First sign is not necessary now, but maybe useful later
curl -L "$_resign_url" -v 2>$cookiefl > $tmpfl
if grep '{"data":\[\],"msg":"unauthorized"}' $tmpfl if grep '{"data":\[\],"msg":"unauthorized"}' $tmpfl
on_badid on_badid
continue continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment