Merge remote-tracking branch 'origin/master'

pull/878/head
gedoor 4 years ago
commit facebb6cd8
  1. 60
      .github/scripts/lzy.sh
  2. 48
      .github/workflows/legado.yml

@ -0,0 +1,60 @@
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# --------------------------------------------------------------
# 系统: ALL
# 项目: 蓝奏云上传文件
# 版本: 1.0.3
# 作者: XIU2
# 官网: https://shell.xiu2.xyz
# 项目: https://github.com/XIU2/Shell
# --------------------------------------------------------------
USERNAME="admin" # 蓝奏云用户名
COOKIE_PHPDISK_INFO="$LANZOU_PSD" # Cookie 中 phpdisk_info 的值
COOKIE_YLOGIN="$LANZOU_ID" # Cookie 中 ylogin 的值
UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.7.3670.199 Safari/537.36"
HEADER_CHECK_LOGIN="User-Agent: ${UA}
Referer: https://up.woozooo.com/mydisk.php?item=files&action=index&u=${USERNAME}
Accept-Language: zh-CN,zh;q=0.9"
URL_ACCOUNT="https://pc.woozooo.com/account.php"
URL_UPLOAD="https://up.woozooo.com/fileup.php"
INFO="[信息]" && ERROR="[错误]" && TIP="[注意]"
# 检查是否已登录
_CHECK_LOGIN() {
if [[ "${COOKIE_PHPDISK_INFO}" = "" || "${COOKIE_PHPDISK_INFO}" = "XXX" ]]; then
_NOTICE "ERROR" "请指定 Cookie 中 phpdisk_info 的值!"
fi
if [[ "${COOKIE_YLOGIN}" = "" || "${COOKIE_YLOGIN}" = "XXX" ]]; then
_NOTICE "ERROR" "请指定 Cookie 中 ylogin 的值!"
fi
HTML_CHECK_LOGIN=$(curl -s --http1.1 -b "ylogin=${COOKIE_YLOGIN};phpdisk_info=${COOKIE_PHPDISK_INFO}" -H "${HEADER_CHECK_LOGIN}" "${URL_ACCOUNT}"|grep "登录")
[[ ! -z "${HTML_CHECK_LOGIN}" ]] && _NOTICE "ERROR" "Cookie 已失效,请更新!"
}
# 上传文件
_UPLOAD() {
[[ $(du "${NAME_FILE}"|awk '{print $1}') -gt 100000000 ]] && _NOTICE "ERROR" "${NAME}文件大于 100MB!"
HTML_UPLOAD=$(curl --connect-timeout 120 -m 5000 --retry 2 -s -b "ylogin=${COOKIE_YLOGIN};phpdisk_info=${COOKIE_PHPDISK_INFO}" -H "${URL_UPLOAD}" -F "task=1" -F "id=WU_FILE_0" -F "folder_id=${FOLDER_ID}" -F "name=${NAME}" -F "upload_file=@${NAME_FILE}" "${URL_UPLOAD}"|grep '\\u4e0a\\u4f20\\u6210\\u529f')
[[ -z "${HTML_UPLOAD}" ]] && _NOTICE "ERROR" "${NAME}文件上传失败!"
echo -e "${INFO} 文件上传成功![$(date '+%Y/%m/%d %H:%M')]"
}
NAME="$1" # 文件名
NAME_FILE="$2" # 文件路径
FOLDER_ID="$3" # 上传文件夹ID
if [[ -z "${NAME}" ]]; then
echo -e "${ERROR} 未指定文件名!" && exit 1
elif [[ -z "${NAME_FILE}" ]]; then
echo -e "${ERROR} 未指定文件路径!" && exit 1
elif [[ -z "${FOLDER_ID}" ]]; then
echo -e "${ERROR} 未指定上传文件夹ID!" && exit 1
fi
_CHECK_LOGIN
_UPLOAD

@ -6,11 +6,6 @@ on:
push:
branches:
- master
# tags:
# - '3.*'
# pull_request:
# branches:
# - master
# watch:
# types: [started]
# schedule:
@ -25,8 +20,8 @@ jobs:
# LANZOU_PSD : pc.woozooo.com -> Cookie -> phpdisk_info
LANZOU_ID: ${{ secrets.LANZOU_ID }}
LANZOU_PSD: ${{ secrets.LANZOU_PSD }}
# 蓝奏云里的文件夹名(需手动在蓝奏云创建
LANZOU_FOLDER: '阅读3测试版'
# 蓝奏云里的文件夹ID(阅读3测试版:2670621
LANZOU_FOLDER_ID: '2670621'
# 是否上传到artifact
UPLOAD_ARTIFACT: 'true'
steps:
@ -68,28 +63,23 @@ jobs:
with:
name: legado apk
path: ${{ github.workspace }}/app/build/outputs/apk/app/release/*.apk
- name: Set Up Python 3
if: ${{ env.LANZOU_PSD }}
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Dependence Install
if: ${{ env.LANZOU_PSD }}
run: |
pip install requests
pip install lanzou-api
- name: Download Script
if: ${{ env.LANZOU_PSD }}
shell: python
run: |
import requests,os
res = requests.get('https://raw.githubusercontent.com/Celeter/build/master/.github/scripts/API_lanzou.py')
with open(os.environ["FILE_PATH"], 'wb') as f:
f.write(res.content)
env:
FILE_PATH: ${{ github.workspace }}/.github/lzy.py
- name: Upload App To Lanzou
if: ${{ env.LANZOU_PSD }}
run: python $GITHUB_WORKSPACE/.github/lzy.py
run: |
path="$GITHUB_WORKSPACE/app/build/outputs/apk/app/release/"
files=$(ls $path)
for f in $files
do
if [[ $f == *"apk" ]]; then
file=$f
fi
done
version=${file:0-15:11}
echo $version
bash $GITHUB_WORKSPACE/.github/scripts/lzy.sh "legado_app_$version.apk" "$GITHUB_WORKSPACE/app/build/outputs/apk/app/release/legado_app_$version.apk" "${{ env.LANZOU_FOLDER_ID }}"
echo "分享链接: https://kunfei.lanzous.com/b0f810h4b"
env:
UPLOAD_FOLDER: ${{ github.workspace }}/app/build/outputs/apk/app/release/
LANZOU_ID: ${{ env.LANZOU_ID }}
LANZOU_PSD: ${{ env.LANZOU_PSD }}

Loading…
Cancel
Save