备份:快捷键 字典 服务器 默认webDav账号

This commit is contained in:
Xwite
2023-03-06 19:19:44 +08:00
parent fbe0a15d43
commit 3fc61da293
4 changed files with 21 additions and 14 deletions

View File

@@ -45,6 +45,8 @@ object Backup {
"txtTocRule.json",
"httpTTS.json",
"keyboardAssists.json",
"dictRule.json",
"servers.json",
DirectLinkUpload.ruleFileName,
ReadBookConfig.configFileName,
ReadBookConfig.shareConfigFileName,
@@ -86,6 +88,8 @@ object Backup {
writeListToJson(appDb.txtTocRuleDao.all, "txtTocRule.json", backupPath)
writeListToJson(appDb.httpTTSDao.all, "httpTTS.json", backupPath)
writeListToJson(appDb.keyboardAssistsDao.all, "keyboardAssists.json", backupPath)
writeListToJson(appDb.dictRuleDao.all, "dictRule.json", backupPath)
writeListToJson(appDb.serverDao.all, "servers.json", backupPath)
ensureActive()
GSON.toJson(ReadBookConfig.configList).let {
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.configFileName)

View File

@@ -45,10 +45,10 @@ object BackupConfig {
PreferKey.backupPath,
PreferKey.defaultBookTreeUri,
PreferKey.webDavDeviceName,
PreferKey.webDavUrl,
PreferKey.webDavDir,
PreferKey.webDavAccount,
PreferKey.webDavPassword,
// PreferKey.webDavUrl,
// PreferKey.webDavDir,
// PreferKey.webDavAccount,
// PreferKey.webDavPassword,
PreferKey.launcherIcon,
PreferKey.bitmapCacheSize,
PreferKey.webServiceWakeLock,

View File

@@ -112,6 +112,15 @@ object Restore {
fileToListT<HttpTTS>(path, "httpTTS.json")?.let {
appDb.httpTTSDao.insert(*it.toTypedArray())
}
fileToListT<DictRule>(path, "dictRule.json")?.let {
appDb.dictRuleDao.insert(*it.toTypedArray())
}
fileToListT<Server>(path, "servers.json")?.let {
appDb.serverDao.insert(*it.toTypedArray())
}
fileToListT<KeyboardAssists>(path, "keyboardAssists.json")?.let {
appDb.keyboardAssistsDao.insert(*it.toTypedArray())
}
fileToListT<ReadRecord>(path, "readRecord.json")?.let {
it.forEach { readRecord ->
//判断是不是本机记录

View File

@@ -110,20 +110,14 @@ object NetworkUtils {
* 获取绝对地址
*/
fun getAbsoluteURL(baseURL: String?, relativePath: String): String {
if (baseURL.isNullOrEmpty()) return relativePath
if (relativePath.isAbsUrl()) return relativePath
if (relativePath.isDataUrl()) return relativePath
if (relativePath.startsWith("javascript")) return ""
var relativeUrl = relativePath
if (baseURL.isNullOrEmpty()) return relativePath.trim()
var absoluteUrl: URL? = null
try {
val absoluteUrl = URL(baseURL.substringBefore(","))
val parseUrl = URL(absoluteUrl, relativePath)
relativeUrl = parseUrl.toString()
return relativeUrl
absoluteUrl = URL(baseURL.substringBefore(","))
} catch (e: Exception) {
e.printOnDebug()
}
return relativeUrl
return getAbsoluteURL(absoluteUrl, relativePath)
}
/**