diff --git a/app/src/main/assets/defaultData/directLinkUpload.json b/app/src/main/assets/defaultData/directLinkUpload.json index 60d969ccf..299e5e589 100644 --- a/app/src/main/assets/defaultData/directLinkUpload.json +++ b/app/src/main/assets/defaultData/directLinkUpload.json @@ -1,4 +1,5 @@ { "UploadUrl": "http://sy.miaogongzi.cc/shuyuan,{\"method\":\"POST\",\"body\": {\"file\": \"fileRequest\"},\"type\": \"multipart/form-data\"}", - "DownloadUrlRule": "$.data@js:if (result == '') \n '' \n else \n 'https://shuyuan.miaogongzi.cc/shuyuan/' + result" + "DownloadUrlRule": "$.data@js:if (result == '') \n '' \n else \n 'https://shuyuan.miaogongzi.cc/shuyuan/' + result", + "summary": "有效期2天" } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt b/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt index fdfb7a72b..27da111e4 100644 --- a/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt +++ b/app/src/main/java/io/legado/app/help/DirectLinkUpload.kt @@ -12,6 +12,7 @@ object DirectLinkUpload { private const val uploadUrlKey = "directLinkUploadUrl" private const val downloadUrlRuleKey = "directLinkDownloadUrlRule" + private const val summaryKey = "directSummary" suspend fun upLoad(fileName: String, file: ByteArray, contentType: String): String { val url = getUploadUrl() @@ -58,9 +59,23 @@ object DirectLinkUpload { CacheManager.put(downloadUrlRuleKey, rule) } + fun getSummary(): String? { + return CacheManager.get(summaryKey) + ?: ruleDoc.readString("summary") + } + + fun putSummary(summary: String?) { + if (summary != null) { + CacheManager.put(summaryKey, summary) + } else { + CacheManager.delete(summaryKey) + } + } + fun delete() { CacheManager.delete(uploadUrlKey) CacheManager.delete(downloadUrlRuleKey) + CacheManager.delete(summaryKey) } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/config/DirectLinkUploadConfig.kt b/app/src/main/java/io/legado/app/ui/config/DirectLinkUploadConfig.kt index 0b1287139..7c8d2035b 100644 --- a/app/src/main/java/io/legado/app/ui/config/DirectLinkUploadConfig.kt +++ b/app/src/main/java/io/legado/app/ui/config/DirectLinkUploadConfig.kt @@ -39,6 +39,7 @@ class DirectLinkUploadConfig : BaseDialogFragment() { binding.toolBar.setBackgroundColor(primaryColor) binding.editUploadUrl.setText(DirectLinkUpload.getUploadUrl()) binding.editDownloadUrlRule.setText(DirectLinkUpload.getDownloadUrlRule()) + binding.editSummary.setText(DirectLinkUpload.getSummary()) binding.tvCancel.onClick { dismiss() } @@ -49,6 +50,7 @@ class DirectLinkUploadConfig : BaseDialogFragment() { binding.tvOk.onClick { val uploadUrl = binding.editUploadUrl.text?.toString() val downloadUrlRule = binding.editDownloadUrlRule.text?.toString() + val summary = binding.editSummary.text?.toString() uploadUrl ?: let { toastOnUi("上传Url不能为空") return@onClick @@ -59,6 +61,7 @@ class DirectLinkUploadConfig : BaseDialogFragment() { } DirectLinkUpload.putUploadUrl(uploadUrl) DirectLinkUpload.putDownloadUrlRule(downloadUrlRule) + DirectLinkUpload.putSummary(summary) dismiss() } } diff --git a/app/src/main/res/layout/dialog_direct_link_upload_config.xml b/app/src/main/res/layout/dialog_direct_link_upload_config.xml index 71524f83c..baaf68a5b 100644 --- a/app/src/main/res/layout/dialog_direct_link_upload_config.xml +++ b/app/src/main/res/layout/dialog_direct_link_upload_config.xml @@ -54,6 +54,20 @@ + + + + + + diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 6f6c01b64..406b83c4e 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -873,5 +873,6 @@ 拷贝播放Url 设置源变量 设置书籍变量 + 注释 diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index bfa80a6a1..5906f08a8 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -877,5 +877,6 @@ 拷贝播放Url 设置源变量 设置书籍变量 + 注释 diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 71c3bd820..c5ed32423 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -877,5 +877,6 @@ 拷贝播放Url 设置源变量 设置书籍变量 + 注释 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 7e3790e3f..7e99f47d4 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -874,5 +874,6 @@ 拷贝播放Url 设置源变量 设置书籍变量 + 注释 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 24c78879e..e1ae6c551 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -876,5 +876,6 @@ 複製播放Url 設定源變數 設定書籍變數 + 注释 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index fea4dd8c6..ac9cd51b6 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -876,5 +876,6 @@ 拷贝播放Url 设置源变量 设置书籍变量 + 注释 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 40835f394..ff752af6c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -877,5 +877,6 @@ 拷贝播放Url 设置源变量 设置书籍变量 + 注释