Skip to content

Commit 51c16a1

Browse files
committed
fetch太慢去除历史提交记录
0 parents  commit 51c16a1

File tree

1,294 files changed

+194322
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,294 files changed

+194322
-0
lines changed
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: "[BUG] 问题提交模板"
3+
about: 请从符号">"后面开始填写内容,填写内容可以参考 https://github.com/gedoor/legado/issues/505                    
4+
title: "[BUG] "
5+
labels: 'BUG'
6+
assignees: ''
7+
---
8+
9+
10+
### 机型(如Redmi K30 Pro)
11+
>
12+
13+
14+
### 安卓版本(如Android 7.1.1)
15+
>
16+
17+
18+
### 阅读Legdao版本(我的-关于-版本,如3.20.112220)
19+
>
20+
21+
### 网络环境(移动,联通,电信,移动宽带,联通宽带,电信宽带,等等..)
22+
>
23+
24+
25+
### 问题描述(简要描述发生的问题)
26+
>
27+
28+
29+
### 使用书源(填写URL或者JSON)
30+
>
31+
32+
33+
```json
34+
35+
36+
37+
38+
39+
40+
```
41+
42+
### 复现步骤(详细描述导致问题产生的操作步骤,如果能稳定复现)
43+
>
44+
45+
46+
47+
48+
### 日志提交(问题截图或者日志)
49+
>
50+
51+
52+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: "[FeatureRequest] 功能请求模板"
3+
about: 提交你希望能够在阅读中增加的功能
4+
title: "[Feature Request] "
5+
labels: '需求'
6+
assignees: ''
7+
---
8+
9+
### 功能描述(请清晰的、详细的描述你想要的功能)
10+
>
11+
12+
### 期望实现方式(阅读应该如何实现该功能)
13+
>
14+
15+
### 附加信息(其他的与功能相关的附加信息)
16+
>
17+
18+
### 效果演示(可以手绘一些草图,或者提供可借鉴的图片)
19+
>

.github/scripts/lzy_web.py

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import requests, os, datetime, sys
2+
3+
# Cookie 中 phpdisk_info 的值
4+
cookie_phpdisk_info = os.environ.get('phpdisk_info')
5+
# Cookie 中 ylogin 的值
6+
cookie_ylogin = os.environ.get('ylogin')
7+
8+
# 请求头
9+
headers = {
10+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36 Edg/89.0.774.45',
11+
'Accept-Language': 'zh-CN,zh;q=0.9',
12+
'Referer': 'https://pc.woozooo.com/account.php?action=login'
13+
}
14+
15+
# 小饼干
16+
cookie = {
17+
'ylogin': cookie_ylogin,
18+
'phpdisk_info': cookie_phpdisk_info
19+
}
20+
21+
22+
# 日志打印
23+
def log(msg):
24+
utc_time = datetime.datetime.utcnow()
25+
china_time = utc_time + datetime.timedelta(hours=8)
26+
print(f"[{china_time.strftime('%Y.%m.%d %H:%M:%S')}] {msg}")
27+
28+
29+
# 检查是否已登录
30+
def login_by_cookie():
31+
url_account = "https://pc.woozooo.com/account.php"
32+
if cookie['phpdisk_info'] is None:
33+
log('ERROR: 请指定 Cookie 中 phpdisk_info 的值!')
34+
return False
35+
if cookie['ylogin'] is None:
36+
log('ERROR: 请指定 Cookie 中 ylogin 的值!')
37+
return False
38+
res = requests.get(url_account, headers=headers, cookies=cookie, verify=True)
39+
if '网盘用户登录' in res.text:
40+
log('ERROR: 登录失败,请更新Cookie')
41+
return False
42+
else:
43+
log('登录成功')
44+
return True
45+
46+
47+
# 上传文件
48+
def upload_file(file_dir, folder_id):
49+
file_name = os.path.basename(file_dir)
50+
url_upload = "https://up.woozooo.com/fileup.php"
51+
headers['Referer'] = f'https://up.woozooo.com/mydisk.php?item=files&action=index&u={cookie_ylogin}'
52+
post_data = {
53+
"task": "1",
54+
"folder_id": folder_id,
55+
"id": "WU_FILE_0",
56+
"name": file_name,
57+
}
58+
files = {'upload_file': (file_name, open(file_dir, "rb"), 'application/octet-stream')}
59+
res = requests.post(url_upload, data=post_data, files=files, headers=headers, cookies=cookie, timeout=120).json()
60+
log(f"{file_dir} -> {res['info']}")
61+
return res['zt'] == 1
62+
63+
64+
# 上传文件夹内的文件
65+
def upload_folder(folder_dir, folder_id):
66+
file_list = sorted(os.listdir(folder_dir), reverse=True)
67+
for file in file_list:
68+
path = os.path.join(folder_dir, file)
69+
if os.path.isfile(path):
70+
upload_file(path, folder_id)
71+
else:
72+
upload_folder(path, folder_id)
73+
74+
75+
# 上传
76+
def upload(dir, folder_id):
77+
if dir is None:
78+
log('ERROR: 请指定上传的文件路径')
79+
return
80+
if folder_id is None:
81+
log('ERROR: 请指定蓝奏云的文件夹id')
82+
return
83+
if os.path.isfile(dir):
84+
upload_file(dir, str(folder_id))
85+
else:
86+
upload_folder(dir, str(folder_id))
87+
88+
89+
if __name__ == '__main__':
90+
argv = sys.argv[1:]
91+
if len(argv) != 2:
92+
log('ERROR: 参数错误,请以这种格式重新尝试\npython lzy_web.py 需上传的路径 蓝奏云文件夹id')
93+
# 需上传的路径
94+
upload_path = argv[0]
95+
# 蓝奏云文件夹id
96+
lzy_folder_id = argv[1]
97+
if login_by_cookie():
98+
upload(upload_path, lzy_folder_id)

.github/scripts/tg_bot.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import os, sys, telebot
2+
3+
# 上传文件
4+
def upload_file(tb, chat_id, file_dir):
5+
doc = open(file_dir, 'rb')
6+
tb.send_document(chat_id, doc)
7+
8+
# 上传文件夹内的文件
9+
def upload_folder(tb, chat_id, folder_dir):
10+
file_list = sorted(os.listdir(folder_dir))
11+
for file in file_list:
12+
path = os.path.join(folder_dir, file)
13+
if os.path.isfile(path):
14+
upload_file(tb, chat_id, path)
15+
else:
16+
upload_folder(tb, chat_id, path)
17+
18+
# 上传
19+
def upload(tb, chat_id, dir):
20+
if tb is None:
21+
log('ERROR: 输入正确的token')
22+
return
23+
if chat_id is None:
24+
log('ERROR: 输入正确的chat_id')
25+
return
26+
if dir is None:
27+
log('ERROR: 请指定上传的文件路径')
28+
return
29+
if os.path.isfile(dir):
30+
upload_file(tb, chat_id, dir)
31+
else:
32+
upload_folder(tb, chat_id, dir)
33+
34+
if __name__ == '__main__':
35+
argv = sys.argv[1:]
36+
if len(argv) != 3:
37+
log('ERROR: 参数错误,请以这种格式重新尝试\npython tg_bot.py $token $chat_id 待上传的路径')
38+
# Token
39+
TOKEN = argv[0]
40+
# chat_id
41+
chat_id = argv[1]
42+
# 待上传文件的路径
43+
upload_path = argv[2]
44+
#创建连接
45+
tb = telebot.TeleBot(TOKEN)
46+
#开始上传
47+
upload(tb, chat_id, upload_path)

.github/workflows/autoupdatefork.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#更新fork
2+
name: update fork
3+
4+
on:
5+
schedule:
6+
- cron: '0 16 * * *' #设置定时任务
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.event.repository.owner.id == github.event.sender.id && github.actor != 'gedoor' }}
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Install git
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get -y install git
21+
- name: Set env
22+
run: |
23+
git config --global user.email "[email protected]"
24+
git config --global user.name "github-actions"
25+
- name: Update fork
26+
run: |
27+
git remote add upstream https://github.com/gedoor/legado.git
28+
git remote -v
29+
git fetch upstream
30+
git checkout master
31+
git merge upstream/master
32+
git push origin master

.github/workflows/legado.jks

2.18 KB
Binary file not shown.

.github/workflows/release.yml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'CHANGELOG.md'
9+
# schedule:
10+
# - cron: '0 4 * * *'
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
env:
16+
# 登录蓝奏云后在控制台运行document.cookie
17+
ylogin: ${{ secrets.LANZOU_ID }}
18+
phpdisk_info: ${{ secrets.LANZOU_PSD }}
19+
# 蓝奏云里的文件夹ID(阅读3测试版:2670621)
20+
LANZOU_FOLDER_ID: 'b0f7pt4ja'
21+
# 是否上传到artifact
22+
UPLOAD_ARTIFACT: 'true'
23+
steps:
24+
- uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
27+
- uses: actions/cache@v2
28+
with:
29+
path: |
30+
~/.gradle/caches
31+
~/.gradle/wrapper
32+
key: ${{ runner.os }}-legado-${{ hashFiles('**/updateLog.md') }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
33+
restore-keys: |
34+
${{ runner.os }}-legado-${{ hashFiles('**/updateLog.md') }}-
35+
- name: Release Apk Sign
36+
run: |
37+
echo "给apk增加签名"
38+
cp $GITHUB_WORKSPACE/.github/workflows/legado.jks $GITHUB_WORKSPACE/app/legado.jks
39+
sed '$a\RELEASE_STORE_FILE=./legado.jks' $GITHUB_WORKSPACE/gradle.properties -i
40+
sed '$a\RELEASE_KEY_ALIAS=legado' $GITHUB_WORKSPACE/gradle.properties -i
41+
sed '$a\RELEASE_STORE_PASSWORD=gedoor_legado' $GITHUB_WORKSPACE/gradle.properties -i
42+
sed '$a\RELEASE_KEY_PASSWORD=gedoor_legado' $GITHUB_WORKSPACE/gradle.properties -i
43+
- name: Unify Version Name
44+
run: |
45+
echo "统一版本号"
46+
VERSION=$(date -d "8 hour" -u +3.%y.%m%d%H)
47+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
48+
sed "/def version/c def version = \"$VERSION\"" $GITHUB_WORKSPACE/app/build.gradle -i
49+
- name: Build With Gradle
50+
run: |
51+
echo "开始进行release构建"
52+
chmod +x gradlew
53+
./gradlew assembleRelease --build-cache --parallel
54+
- name: Organize the Files
55+
run: |
56+
mkdir -p ${{ github.workspace }}/apk/
57+
cp -rf ${{ github.workspace }}/app/build/outputs/apk/*/*/*.apk ${{ github.workspace }}/apk/
58+
- name: Upload App To Artifact
59+
if: ${{ env.UPLOAD_ARTIFACT != 'false' }}
60+
uses: actions/upload-artifact@v2
61+
with:
62+
name: legado apk
63+
path: ${{ github.workspace }}/apk/*.apk
64+
- name: Upload App To Lanzou
65+
if: ${{ env.ylogin }}
66+
run: |
67+
path="$GITHUB_WORKSPACE/apk/"
68+
python3 $GITHUB_WORKSPACE/.github/scripts/lzy_web.py "$path" "$LANZOU_FOLDER_ID"
69+
echo "[$(date -u -d '+8 hour' '+%Y.%m.%d %H:%M:%S')] 分享链接: https://kunfei.lanzoux.com/b0f7pt4ja"
70+
- name: Release
71+
uses: softprops/action-gh-release@59c3b4891632ff9a897f99a91d7bc557467a3a22
72+
with:
73+
name: legado_app_${{ env.RELEASE_VERSION }}
74+
tag_name: ${{ env.RELEASE_VERSION }}
75+
body_path: ${{ github.workspace }}/CHANGELOG.md
76+
draft: false
77+
prerelease: false
78+
files: ${{ github.workspace }}/apk/*.apk
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
- name: Push Assets To "release" Branch
82+
run: |
83+
cd $GITHUB_WORKSPACE/apk || exit 1
84+
git init
85+
git config --local user.name "github-actions[bot]"
86+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
87+
git checkout -b release
88+
git add *.apk
89+
git commit -m "${{ env.RELEASE_VERSION }}"
90+
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
91+
git push -f -u origin release
92+
- name: Purge Jsdelivr Cache
93+
run: |
94+
result=$(curl -s https://purge.jsdelivr.net/gh/${{ github.repository }}@release/)
95+
if echo $result |grep -q 'success.*true'; then
96+
echo "jsdelivr缓存更新成功"
97+
else
98+
echo $result
99+
fi

0 commit comments

Comments
 (0)