mirror of
https://github.com/Aminark/legado-ios.git
synced 2026-10-24 04:41:23 +08:00
支持 EPUB 2/3 导入、目录、封面和章节插图,保留本地书管理与阅读进度。 修复 JSON 模板、动态替换与请求参数兼容,以及 RSS 翻页和连续滚动定位。 更新编辑器工具栏和回归测试,发布版本为 0.1.12(build 18)。
45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
"""Local, synthetic RSS responses for the LegadoRSSFlowUITests scheme."""
|
|
|
|
import http.server
|
|
import json
|
|
import urllib.parse
|
|
|
|
BASE_URL = "http://127.0.0.1:18763"
|
|
|
|
|
|
class Fixture(http.server.BaseHTTPRequestHandler):
|
|
def do_GET(self):
|
|
parsed = urllib.parse.urlsplit(self.path)
|
|
query = urllib.parse.parse_qs(parsed.query)
|
|
key = query.get("key", [""])[0]
|
|
page = query.get("page", ["1"])[0]
|
|
if parsed.path == "/source.json":
|
|
payload = {
|
|
"sourceUrl": BASE_URL,
|
|
"sourceName": "RSS 全流程测试",
|
|
"sortUrl": "全部::" + BASE_URL + "/feed?page={{page}}",
|
|
"searchUrl": BASE_URL + "/feed?key={{key}}&page={{page}}",
|
|
"ruleArticles": "$.items",
|
|
"ruleTitle": "$.title",
|
|
"ruleLink": "$.link",
|
|
"ruleDescription": "$.description",
|
|
"ruleNextPage": "PAGE",
|
|
}
|
|
else:
|
|
title = f"搜索结果 {key} 第{page}页" if key else "首页文章"
|
|
payload = {"items": [{
|
|
"title": title,
|
|
"link": BASE_URL + "/article/" + key + "/" + page,
|
|
"description": "<p>这是用于全流程测试的自造订阅正文。</p>",
|
|
}]}
|
|
body = json.dumps(payload, ensure_ascii=False).encode()
|
|
self.send_response(200)
|
|
self.send_header("Content-Type", "application/json; charset=utf-8")
|
|
self.send_header("Content-Length", str(len(body)))
|
|
self.end_headers()
|
|
self.wfile.write(body)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
http.server.ThreadingHTTPServer(("127.0.0.1", 18763), Fixture).serve_forever()
|