This commit is contained in:
1 parent
48af9d7e72
commit
7224137ed2
5 files changed
+35
-4
No files matched your search
@@ -1,5 +1,9 @@
|
||||
# 更新日志
|
||||
|
||||
## 0.0.2
|
||||
|
||||
- 设备上新增「从文件导入」:浏览选择 .json / .jsonl / .txt 书源文件直接导入;导入提示里显示因需要 JS/WebView 被禁用的个数。
|
||||
|
||||
## 0.0.1
|
||||
|
||||
- 新书源:在本机直接运行 Legado 书源 JSON 规则(搜索、发现、详情、目录、正文),不依赖 Legado App;需要 JS / WebView 的书源暂不支持。
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
| 导入即禁用 | 已实现,未实测 | 规则里含 JS / WebView 的书源导入时自动禁用,并在库里记录原因 |
|
||||
| 书源有效性检查 | 已实现,未实测 | 逐个走完整读书流程(搜索、详情、目录、第一章正文),任一环节失败即禁用;响应时间、禁用原因存库并在网页显示 |
|
||||
| 书架换源 | 已实现,未实测 | 设置里和远程管理网页都有「书架换源」(网页里后台搜索并显示进度,关掉页面后回来可接上):书源失效的书排在前面,在其他书源搜同名书后改读新来源;书架身份、阅读进度和时间不变,目录重新拉取,章节序号可能与旧目录不一致 |
|
||||
| 书源导入 | 已实现,未实测 | 设置页粘贴 Legado 书源 JSON、填地址或本地文件路径;支持单个、数组或每行一个 |
|
||||
| 书源导入 | 已实现,未实测 | 设置页可粘贴 Legado 书源 JSON、填地址,或在「从文件导入」里浏览设备选 .json / .jsonl / .txt 文件;支持单个、数组或每行一个(jsonl) |
|
||||
| 登录 | 不支持 | 不处理登录;书源 header / Cookie 规则中的静态值可用,登录 JS 不支持 |
|
||||
| 搜索 | 已实现,未实测 | 同时搜所有已启用书源(4 路并发),单个书源失败不影响其他;只取第一页 |
|
||||
| 发现 / 分类 | 已实现,未实测 | 来自书源 exploreUrl(`标题::地址` 或 JSON);含 JS 的条目跳过 |
|
||||
|
||||
@@ -36,4 +36,6 @@ return {
|
||||
["书源不可用"] = "Source unavailable",
|
||||
["搜索失败"] = "Search failed",
|
||||
["书架里还没有这个书源的书"] = "No books from this source on the shelf",
|
||||
["从文件导入"] = "Import from file",
|
||||
[",%1 个需要 JS/WebView 已禁用"] = ", %1 need JS/WebView and were disabled",
|
||||
}
|
||||
@@ -36,4 +36,6 @@ return {
|
||||
["书源不可用"] = "書源不可用",
|
||||
["搜索失败"] = "搜索失敗",
|
||||
["书架里还没有这个书源的书"] = "書架裡還沒有這個書源的書",
|
||||
["从文件导入"] = "從檔案匯入",
|
||||
[",%1 个需要 JS/WebView 已禁用"] = ",%1 個需要 JS/WebView 已停用",
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
--[[--
|
||||
开源阅读书源设置:导入 Legado 书源(地址 / 本地文件 / 粘贴 JSON)、启停与删除、书架换源。
|
||||
开源阅读书源设置:导入 Legado 书源(地址 / 选择 .json、.jsonl 文件 / 粘贴 JSON)、启停与删除、书架换源。
|
||||
|
||||
@module moonsource_legadorule.setting
|
||||
--]]
|
||||
@@ -32,9 +32,11 @@ local function finishImport(text)
|
||||
toast(_("没有找到有效的书源"))
|
||||
return
|
||||
end
|
||||
Sources.add(rules)
|
||||
local _added, disabled = Sources.add(rules)
|
||||
require("source.registry").reload()
|
||||
toast(T(_("已导入 %1 个书源,跳过 %2 个无效项"), #rules, skipped))
|
||||
local msg = T(_("已导入 %1 个书源,跳过 %2 个无效项"), #rules, skipped)
|
||||
if disabled and disabled > 0 then msg = msg .. T(_(",%1 个需要 JS/WebView 已禁用"), disabled) end
|
||||
toast(msg)
|
||||
end
|
||||
|
||||
local function import(value)
|
||||
@@ -72,6 +74,21 @@ local function importDialog()
|
||||
}:show()
|
||||
end
|
||||
|
||||
local function importFile()
|
||||
local lfs = require("libs/libkoreader-lfs")
|
||||
local start = lfs.attributes("/mnt/us", "mode") == "directory" and "/mnt/us"
|
||||
or require("datastorage"):getDataDir()
|
||||
require("ui.themes.widgets.path_picker"):new{
|
||||
path = start,
|
||||
select_file = true,
|
||||
filter = function(name)
|
||||
local lower = name:lower()
|
||||
return lower:match("%.jsonl?$") ~= nil or lower:match("%.txt$") ~= nil
|
||||
end,
|
||||
on_select = import,
|
||||
}:show()
|
||||
end
|
||||
|
||||
local function manageOne(entry)
|
||||
local Sources = require("moonsource_legadorule.sources")
|
||||
require("ui.themes.widgets.list"):new{
|
||||
@@ -193,6 +210,12 @@ function Setting.rows()
|
||||
callback = importDialog,
|
||||
})
|
||||
end,
|
||||
function(iw)
|
||||
return Row().widget({
|
||||
width = iw, chevron = true, kind = "nav", icon = "download", title = _("从文件导入"),
|
||||
callback = importFile,
|
||||
})
|
||||
end,
|
||||
function(iw)
|
||||
return Row().widget({
|
||||
width = iw, chevron = true, kind = "nav", icon = "sync", title = _("书架换源"),
|
||||
|
||||
Reference in new issue
Block a user