Skip to content

Commit 6335331

Browse files
committed
Merge remote-tracking branch 'upstream/master' into merge-upstream
2 parents ab530b8 + 083cb29 commit 6335331

File tree

127 files changed

+2871
-1391
lines changed

Some content is hidden

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

127 files changed

+2871
-1391
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: BUG提交 / BUG Report
2+
description: Report bugs to developers
3+
labels: ["BUG"]
4+
body:
5+
- type: checkboxes
6+
attributes:
7+
label: 确认 / Assignments
8+
description: 提交issue请确保完成以下前提,否则该issue可能被忽略 / Make sure you read checkboxs below
9+
options:
10+
- label: 搜索现有issues,不存在相似或相关的issue / No similar or related issues
11+
required: true
12+
- label: 最新[测试版](https://github.com/gedoor/legado/actions/workflows/test.yml)依然存在此问题 / Latest beta app does not work
13+
required: true
14+
- label: 此问题和Xposed、Lsposed、Magisk、手机主题、浏览器插件、无障碍服务等无关 / Make sure your machine is not touched by hook frameworks, plugins, accessibility etc
15+
required: true
16+
17+
- type: textarea
18+
attributes:
19+
label: 问题描述 / Describe Bugs
20+
validations:
21+
required: true
22+
- type: textarea
23+
attributes:
24+
label: 复现步骤 / How to reproduce
25+
validations:
26+
required: true
27+
- type: checkboxes
28+
attributes:
29+
label: 确认 / Assignment
30+
options:
31+
- label: 已经提交复现所需要的附加资料 / Submit additions related with bugs
32+
required: true
33+
- type: textarea
34+
attributes:
35+
label: 其他信息 / Additions
36+
description: |
37+
反馈WEB书架前端问题时请提供浏览器版本信息,如Edge 129.0.2792.89
38+
placeholder: "请用```将提交的内容包裹"
39+
40+
- type: textarea
41+
attributes:
42+
label: 日志提交 / Relevant log output
43+
description: |
44+
阅读日志位于我的-关于-崩溃日志、保存日志、书架-右上角-日志,或者自行使用log工具抓取日志
45+
如果崩溃日志中包含`java.lang.OutOfMemoryError`,请安装最新测试版,在其他设置里打开记录堆转储,复现崩溃后去关于那里点保存日志,然后去备份目录里将heapDump文件夹里的文件打包压缩一下上传上来
46+
placeholder: "请用```将日志内容包裹"
47+
48+
- type: input
49+
attributes:
50+
label: 阅读版本 / Legado version
51+
placeholder: "3.22.110823"
52+
validations:
53+
required: true
54+
- type: input
55+
attributes:
56+
label: Android版本 / Android version
57+
placeholder: "Android 12"
58+
validations:
59+
required: true
60+
- type: input
61+
attributes:
62+
label: 机型 / Model
63+
placeholder: "Redmi K30 Pro"
64+
validations:
65+
required: true
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 功能请求 / Features
2+
description: Request new features
3+
labels: ["需求"]
4+
body:
5+
- type: checkboxes
6+
attributes:
7+
label: 确认 / Assignments
8+
description: 提交issue请确保完成以下前提,否则该issue可能被忽略 / Make sure you read checkbox below
9+
options:
10+
- label: 搜索现有issues,不存在相似或相关的issue / No related requests
11+
required: true
12+
13+
- type: textarea
14+
attributes:
15+
label: 功能描述 / Features
16+
placeholder: 请清晰的、详细的描述你想要的功能
17+
validations:
18+
required: true
19+
- type: textarea
20+
attributes:
21+
label: 期望实现方式 / How to implement
22+
placeholder: 阅读应该如何实现该功能
23+
validations:
24+
required: true
25+
- type: textarea
26+
attributes:
27+
label: 附加信息 / Additions
28+
placeholder: 其他的与功能相关的附加信息
29+
- type: textarea
30+
attributes:
31+
label: 效果演示 / Demo
32+
placeholder: 可以手绘一些草图,或者提供可借鉴的图片

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 简繁转化
4+
url: https://github.com/liuyueyi/quick-chinese-transfer/issues/new
5+
about: 简繁转化问题请优先到quick-chinese-transfer反馈
6+
- name: 讨论 / Discussions
7+
url: https://github.com/gedoor/legado/discussions
8+
about: Please ask and answer questions here.
9+
- name: 常见问题 / Wiki
10+
url: https://github.com/gedoor/legado/wiki
11+
about: Read wiki if your are new here.

.github/dependabot.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
registries:
8+
maven-google:
9+
type: maven-repository
10+
# url: https://maven.google.com
11+
url: https://dl.google.com/dl/android/maven2/
12+
password: dummy
13+
username: dummy
14+
maven-central:
15+
type: maven-repository
16+
url: https://repo1.maven.org/maven2/
17+
password: dummy
18+
username: dummy
19+
maven-jitpack:
20+
type: maven-repository
21+
url: https://jitpack.io
22+
password: dummy
23+
username: dummy
24+
25+
updates:
26+
- package-ecosystem: gradle
27+
directory: "/"
28+
schedule:
29+
interval: "weekly"
30+
registries: "*"
31+
open-pull-requests-limit: 20
32+
groups:
33+
kotlin_KSP:
34+
patterns:
35+
- "org.jetbrains.kotlin:*"
36+
- "com.google.devtools.ksp"
37+
# Maintain dependencies for GitHub Actions
38+
- package-ecosystem: "github-actions"
39+
directory: "/"
40+
schedule:
41+
interval: "weekly"
42+
- package-ecosystem: npm
43+
directory: "modules/web"
44+
schedule:
45+
interval: "weekly"

.github/scripts/cronet.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env bash
2+
3+
#分支Stable Dev Beta
4+
branch=$1
5+
#api 最大偏移
6+
max_offset=$2
7+
8+
[ -z $1 ] && branch=Stable
9+
[ -z $2 ] && max_offset=3
10+
[ -z $GITHUB_ENV ] && echo "Error: Unexpected github workflow environment" && exit
11+
12+
offset=0
13+
14+
function fetch_version() {
15+
# 获取最新cronet版本
16+
lastest_cronet_version=`curl -s "https://chromiumdash.appspot.com/fetch_releases?channel=$branch&platform=Android&num=1&offset=$offset" | jq .[0].version -r`
17+
echo "lastest_cronet_version: $lastest_cronet_version"
18+
#lastest_cronet_version=100.0.4845.0
19+
lastest_cronet_main_version=${lastest_cronet_version%%\.*}.0.0.0
20+
check_version_exit
21+
}
22+
function check_version_exit() {
23+
# 检查版本是否存在
24+
local jar_url="https://storage.googleapis.com/chromium-cronet/android/$lastest_cronet_version/Release/cronet/cronet_api.jar"
25+
statusCode=$(curl -s -I -w %{http_code} "$jar_url" -o /dev/null)
26+
if [ $statusCode == "404" ]; then
27+
echo "storage.googleapis.com return 404 for cronet $lastest_cronet_version"
28+
if [[ $max_offset > $offset ]]; then
29+
offset=$(expr $offset + 1)
30+
echo "retry with offset $offset"
31+
fetch_version
32+
else
33+
exit
34+
fi
35+
fi
36+
}
37+
function version_compare() {
38+
# 版本号比较 本地版本小于远程版本时返回0
39+
local local_version=$1
40+
local remote_version=$2
41+
if [[ $local_version == $remote_version ]]; then
42+
return 1
43+
fi
44+
if [[ $(printf '%s\n' "$1" "$2" | sort -V | head -n1) == $remote_version ]]; then
45+
return 1
46+
else
47+
return 0
48+
fi
49+
}
50+
51+
# 添加变量到github env
52+
function write_github_env_variable() {
53+
echo "$1=$2" >> $GITHUB_ENV
54+
}
55+
56+
function sync_proguard_rules() {
57+
local raw_github_git="https://raw.githubusercontent.com/chromium/chromium/$lastest_cronet_version"
58+
local proguard_paths=(
59+
components/cronet/android/cronet_combined_impl_native_proguard_golden.cfg
60+
)
61+
local proguard_rules_path="$GITHUB_WORKSPACE/app/cronet-proguard-rules.pro"
62+
rm -f $proguard_rules_path
63+
echo "fetch cronet proguard rules from upstream $raw_github_git"
64+
for path in ${proguard_paths[@]}
65+
do
66+
echo "fetching $path ..."
67+
curl "$raw_github_git/$path" >> $proguard_rules_path
68+
done
69+
}
70+
##########
71+
# 获取本地cronet版本
72+
path=$GITHUB_WORKSPACE/gradle.properties
73+
current_cronet_version=`cat $path | grep CronetVersion | sed s/CronetVersion=//`
74+
echo "current_cronet_version: $current_cronet_version"
75+
76+
echo "fetch $branch release info from https://chromiumdash.appspot.com ..."
77+
fetch_version
78+
79+
if version_compare $current_cronet_version $lastest_cronet_version; then
80+
# 更新gradle.properties
81+
sed -i s/CronetVersion=.*/CronetVersion=$lastest_cronet_version/ $path
82+
sed -i s/CronetMainVersion=.*/CronetMainVersion=$lastest_cronet_main_version/ $path
83+
# 更新cronet_proguard_rules.pro
84+
sync_proguard_rules
85+
# 更新cronet版本
86+
sed -i "s/## cronet版本: .*/## cronet版本: $lastest_cronet_version/" $GITHUB_WORKSPACE/app/src/main/assets/updateLog.md
87+
# 生成pull request信息
88+
write_github_env_variable PR_TITLE "Bump cronet from $current_cronet_version to $lastest_cronet_version"
89+
write_github_env_variable PR_BODY "Changes in the [Git log](https://chromium.googlesource.com/chromium/src/+log/$current_cronet_version..$lastest_cronet_version)"
90+
# 生成cronet flag
91+
write_github_env_variable cronet ok
92+
fi

.github/scripts/lzy_web.py

Lines changed: 98 additions & 0 deletions
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

Lines changed: 47 additions & 0 deletions
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)

0 commit comments

Comments
 (0)