备份:快捷键 字典 服务器 默认webDav账号
This commit is contained in:
@@ -45,6 +45,8 @@ object Backup {
|
|||||||
"txtTocRule.json",
|
"txtTocRule.json",
|
||||||
"httpTTS.json",
|
"httpTTS.json",
|
||||||
"keyboardAssists.json",
|
"keyboardAssists.json",
|
||||||
|
"dictRule.json",
|
||||||
|
"servers.json",
|
||||||
DirectLinkUpload.ruleFileName,
|
DirectLinkUpload.ruleFileName,
|
||||||
ReadBookConfig.configFileName,
|
ReadBookConfig.configFileName,
|
||||||
ReadBookConfig.shareConfigFileName,
|
ReadBookConfig.shareConfigFileName,
|
||||||
@@ -86,6 +88,8 @@ object Backup {
|
|||||||
writeListToJson(appDb.txtTocRuleDao.all, "txtTocRule.json", backupPath)
|
writeListToJson(appDb.txtTocRuleDao.all, "txtTocRule.json", backupPath)
|
||||||
writeListToJson(appDb.httpTTSDao.all, "httpTTS.json", backupPath)
|
writeListToJson(appDb.httpTTSDao.all, "httpTTS.json", backupPath)
|
||||||
writeListToJson(appDb.keyboardAssistsDao.all, "keyboardAssists.json", backupPath)
|
writeListToJson(appDb.keyboardAssistsDao.all, "keyboardAssists.json", backupPath)
|
||||||
|
writeListToJson(appDb.dictRuleDao.all, "dictRule.json", backupPath)
|
||||||
|
writeListToJson(appDb.serverDao.all, "servers.json", backupPath)
|
||||||
ensureActive()
|
ensureActive()
|
||||||
GSON.toJson(ReadBookConfig.configList).let {
|
GSON.toJson(ReadBookConfig.configList).let {
|
||||||
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.configFileName)
|
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.configFileName)
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ object BackupConfig {
|
|||||||
PreferKey.backupPath,
|
PreferKey.backupPath,
|
||||||
PreferKey.defaultBookTreeUri,
|
PreferKey.defaultBookTreeUri,
|
||||||
PreferKey.webDavDeviceName,
|
PreferKey.webDavDeviceName,
|
||||||
PreferKey.webDavUrl,
|
// PreferKey.webDavUrl,
|
||||||
PreferKey.webDavDir,
|
// PreferKey.webDavDir,
|
||||||
PreferKey.webDavAccount,
|
// PreferKey.webDavAccount,
|
||||||
PreferKey.webDavPassword,
|
// PreferKey.webDavPassword,
|
||||||
PreferKey.launcherIcon,
|
PreferKey.launcherIcon,
|
||||||
PreferKey.bitmapCacheSize,
|
PreferKey.bitmapCacheSize,
|
||||||
PreferKey.webServiceWakeLock,
|
PreferKey.webServiceWakeLock,
|
||||||
|
|||||||
@@ -112,6 +112,15 @@ object Restore {
|
|||||||
fileToListT<HttpTTS>(path, "httpTTS.json")?.let {
|
fileToListT<HttpTTS>(path, "httpTTS.json")?.let {
|
||||||
appDb.httpTTSDao.insert(*it.toTypedArray())
|
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 {
|
fileToListT<ReadRecord>(path, "readRecord.json")?.let {
|
||||||
it.forEach { readRecord ->
|
it.forEach { readRecord ->
|
||||||
//判断是不是本机记录
|
//判断是不是本机记录
|
||||||
|
|||||||
@@ -110,20 +110,14 @@ object NetworkUtils {
|
|||||||
* 获取绝对地址
|
* 获取绝对地址
|
||||||
*/
|
*/
|
||||||
fun getAbsoluteURL(baseURL: String?, relativePath: String): String {
|
fun getAbsoluteURL(baseURL: String?, relativePath: String): String {
|
||||||
if (baseURL.isNullOrEmpty()) return relativePath
|
if (baseURL.isNullOrEmpty()) return relativePath.trim()
|
||||||
if (relativePath.isAbsUrl()) return relativePath
|
var absoluteUrl: URL? = null
|
||||||
if (relativePath.isDataUrl()) return relativePath
|
|
||||||
if (relativePath.startsWith("javascript")) return ""
|
|
||||||
var relativeUrl = relativePath
|
|
||||||
try {
|
try {
|
||||||
val absoluteUrl = URL(baseURL.substringBefore(","))
|
absoluteUrl = URL(baseURL.substringBefore(","))
|
||||||
val parseUrl = URL(absoluteUrl, relativePath)
|
|
||||||
relativeUrl = parseUrl.toString()
|
|
||||||
return relativeUrl
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printOnDebug()
|
e.printOnDebug()
|
||||||
}
|
}
|
||||||
return relativeUrl
|
return getAbsoluteURL(absoluteUrl, relativePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user