1
0
mirror of https://github.com/fumiama/copymanga.git synced 2026-06-04 23:10:23 +08:00
注意
> 由于大版本更新, 闪退问题可能增加. 由于修复 bug, 更新可能比较频繁, 如无 API 代理需求可以暂缓更新.
新增
1. 更安全的 API 代理, 旧版代理将无法使用
2. 关于显示插件版本
修复
1. 无法搜索汉字漫画
优化
1. 代码组织架构
This commit is contained in:
源文雨
2025-03-27 18:46:10 +09:00
parent 0b5148d908
commit d169c51153
20 changed files with 70 additions and 42 deletions

View File

@@ -11,8 +11,8 @@ android {
applicationId 'top.fumiama.copymanga'
minSdkVersion 23
targetSdkVersion 34
versionCode 67
versionName '2.4.0'
versionCode 68
versionName '2.4.1'
resourceConfigurations += ['zh', 'zh-rCN']
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -60,6 +60,8 @@ import top.fumiama.copymanga.ui.download.DownloadFragment
import top.fumiama.copymanga.ui.download.NewDownloadFragment
import top.fumiama.copymanga.api.update.Update
import top.fumiama.copymanga.api.user.Member
import top.fumiama.copymanga.lib.Comancry
import top.fumiama.copymanga.lib.Comandy
import top.fumiama.dmzj.copymanga.BuildConfig
import top.fumiama.dmzj.copymanga.R
import java.io.File
@@ -405,7 +407,12 @@ class MainActivity : AppCompatActivity() {
private fun showAbout() {
val dl = android.app.AlertDialog.Builder(this)
dl.setMessage(R.string.app_description)
val comandy = "网络增强: ${Comandy.instance.status}, 版本 ${Config.comandy_version.value}"
val comancry = "API代理: ${Comancry.instance.status}, 版本 ${Config.comancry_version.value}"
dl.setMessage("${getString(R.string.app_description)}\n" +
"\n$comandy\n" +
"$comancry\n\n"+ File("/proc/self/cmdline").readText() + "\n" +
"安装位置: ${applicationInfo.sourceDir}")
dl.setTitle("${getString(R.string.action_info)} ${BuildConfig.VERSION_NAME}")
dl.setIcon(R.mipmap.ic_launcher)
dl.setPositiveButton(android.R.string.ok) { _, _ -> }

View File

@@ -2,11 +2,11 @@ package top.fumiama.copymanga.api
import com.bumptech.glide.load.model.LazyHeaders
import top.fumiama.copymanga.MainActivity
import top.fumiama.copymanga.tools.file.PreferenceBoolean
import top.fumiama.copymanga.tools.file.PreferenceInt
import top.fumiama.copymanga.tools.file.PreferenceString
import top.fumiama.copymanga.tools.file.UserPreferenceInt
import top.fumiama.copymanga.tools.file.UserPreferenceString
import top.fumiama.copymanga.storage.PreferenceBoolean
import top.fumiama.copymanga.storage.PreferenceInt
import top.fumiama.copymanga.storage.PreferenceString
import top.fumiama.copymanga.storage.UserPreferenceInt
import top.fumiama.copymanga.storage.UserPreferenceString
import top.fumiama.copymanga.net.Proxy
import top.fumiama.copymanga.net.Resolution
import top.fumiama.dmzj.copymanga.R

View File

@@ -9,6 +9,18 @@ class Comancry: LazyLibrary<ComancryMethods>(
ComancryMethods::class.java, "libcomancry.so", "API代理",
Config.net_use_api_proxy, Config.comancry_version
) {
val enabled: Boolean
get() {
if (isInInit.get()) {
Log.d("MyComancry", "$name block enabled for isInInit")
return false
}
return isInUse.value
}
val status: String get() = if(enabled) {
if (isInUse.value) "生效(手动)" else "生效(自动)"
} else "无效"
suspend fun decrypt(sd: String, data: ByteArray): String? {
// 将 ByteArray 转换为 char*
val nativeMemory = Memory(data.size.toLong())

View File

@@ -1,12 +1,34 @@
package top.fumiama.copymanga.lib
import android.util.Log
import top.fumiama.copymanga.api.Config
import top.fumiama.copymanga.lib.template.LazyLibrary
import top.fumiama.copymanga.net.DownloadTools
class Comandy: LazyLibrary<ComandyMethods>(
ComandyMethods::class.java, "libcomandy.so", "网络增强",
Config.net_use_comandy, Config.comandy_version
) {
private var mEnabled: Boolean? = null
val enabled: Boolean
get() {
if (isInInit.get()) {
Log.d("MyComandy", "$name block enabled for isInInit")
return false
}
if (mEnabled != true && DownloadTools.failTimes.get() >= 2) {
mEnabled = true
return true
}
if (mEnabled != null) return mEnabled!!
val v = isInUse.value
mEnabled = v
return v
}
val status: String get() = if(enabled) {
if (isInUse.value) "生效(手动)" else "生效(自动)"
} else "无效"
companion object {
val instance = Comandy()
}

View File

@@ -12,8 +12,8 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import top.fumiama.copymanga.MainActivity
import top.fumiama.copymanga.json.ComandyVersion
import top.fumiama.copymanga.tools.file.PreferenceBoolean
import top.fumiama.copymanga.tools.file.UserPreferenceInt
import top.fumiama.copymanga.storage.PreferenceBoolean
import top.fumiama.copymanga.storage.UserPreferenceInt
import top.fumiama.copymanga.net.DownloadTools
import top.fumiama.copymanga.net.Client
import top.fumiama.dmzj.copymanga.R
@@ -24,13 +24,13 @@ import java.util.zip.GZIPInputStream
open class LazyLibrary<T: Library>(
private val clazz: Class<T>,
private val name: String,
val name: String,
private val functionName: String,
private val isInUse: PreferenceBoolean,
val isInUse: PreferenceBoolean,
private val version: UserPreferenceInt
) {
private val repoName = name.substring(3).substringBeforeLast(".")
private var isInInit = AtomicBoolean(false)
var isInInit = AtomicBoolean(false)
private var mInstance: T? = null
suspend fun getInstance(): T? {
//Log.d("MyLazyLibrary", "get instance @$field")
@@ -39,22 +39,6 @@ open class LazyLibrary<T: Library>(
//Log.d("MyLazyLibrary", "init instance @$field")
return mInstance
}
private var mEnabled: Boolean? = null
val enabled: Boolean
get() {
if (isInInit.get()) {
Log.d("MyLazyLibrary", "$name block enabled for isInInit")
return false
}
if (mEnabled != true && DownloadTools.failTimes.get() >= 2) {
mEnabled = true
return true
}
if (mEnabled != null) return mEnabled!!
val v = isInUse.value
mEnabled = v
return v
}
private var mLibraryFile: File? = null
private suspend fun libraryFile(): File? {
if (isInInit.get()) return null

View File

@@ -9,6 +9,7 @@ import kotlinx.coroutines.withContext
import top.fumiama.copymanga.MainActivity
import top.fumiama.copymanga.api.Config
import top.fumiama.copymanga.json.ComandyCapsule
import top.fumiama.copymanga.lib.Comancry
import top.fumiama.copymanga.lib.Comandy
import java.io.ByteArrayOutputStream
import java.io.InputStream

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.file
package top.fumiama.copymanga.storage
import java.io.File

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.file
package top.fumiama.copymanga.storage
import android.util.Log
import androidx.preference.PreferenceManager

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.file
package top.fumiama.copymanga.storage
import android.util.Log
import androidx.preference.PreferenceManager

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.file
package top.fumiama.copymanga.storage
import android.util.Log
import androidx.preference.PreferenceManager

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.file
package top.fumiama.copymanga.storage
//PropertiesTools.kt
//created by fumiama 20200724
import android.util.Log

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.file
package top.fumiama.copymanga.storage
import android.util.Log
import androidx.appcompat.app.AppCompatActivity.MODE_PRIVATE

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.file
package top.fumiama.copymanga.storage
import android.util.Log
import androidx.appcompat.app.AppCompatActivity.MODE_PRIVATE

View File

@@ -17,7 +17,7 @@ import top.fumiama.copymanga.MainActivity
import top.fumiama.copymanga.api.manga.Downloader
import top.fumiama.copymanga.api.manga.Reader
import top.fumiama.copymanga.view.template.NoBackRefreshFragment
import top.fumiama.copymanga.tools.file.FileUtils
import top.fumiama.copymanga.storage.FileUtils
import top.fumiama.copymanga.view.interaction.Navigate
import top.fumiama.dmzj.copymanga.R
import java.io.File

View File

@@ -17,7 +17,7 @@ import top.fumiama.copymanga.api.manga.Downloader
import top.fumiama.copymanga.api.manga.Reader
import top.fumiama.copymanga.view.template.MangaPagesFragmentTemplate
import top.fumiama.copymanga.view.template.CardList
import top.fumiama.copymanga.tools.file.FileUtils
import top.fumiama.copymanga.storage.FileUtils
import top.fumiama.copymanga.view.interaction.Navigate
import top.fumiama.copymanga.view.interaction.UITools
import top.fumiama.dmzj.copymanga.R

View File

@@ -37,6 +37,8 @@ import top.fumiama.copymanga.view.operation.GlideHideLottieViewListener
import top.fumiama.copymanga.view.interaction.Navigate
import top.fumiama.dmzj.copymanga.R
import java.lang.ref.WeakReference
import java.net.URLEncoder
import java.nio.charset.Charset
class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
lateinit var homeHandler: HomeHandler
@@ -293,7 +295,7 @@ class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
override fun getItemCount() = (results?.results?.list?.size?:0) + if (query?.isNotEmpty() == true) 1 else 0
suspend fun refresh(q: CharSequence) = withContext(Dispatchers.IO) {
query = q.toString()
query = URLEncoder.encode(q.toString(), Charset.defaultCharset().name())
activity?.apply {
PausableDownloader(getString(R.string.searchApiUrl).format(Config.myHostApiUrl.value, 0, query, type)) {
results = Gson().fromJson(it.decodeToString(), BookListStructure::class.java)

View File

@@ -57,7 +57,7 @@ import top.fumiama.copymanga.api.Config
import top.fumiama.copymanga.view.template.TitleActivityTemplate
import top.fumiama.copymanga.net.template.PausableDownloader
import top.fumiama.copymanga.net.DownloadTools
import top.fumiama.copymanga.tools.thread.TimeThread
import top.fumiama.copymanga.view.interaction.TimeThread
import top.fumiama.copymanga.view.Font
import top.fumiama.copymanga.view.ScaleImageView
import top.fumiama.dmzj.copymanga.R

View File

@@ -1,4 +1,4 @@
package top.fumiama.copymanga.tools.thread
package top.fumiama.copymanga.view.interaction
import android.os.Handler

View File

@@ -15,7 +15,7 @@
<string name="menu_home">主页</string>
<string name="menu_sort">分类</string>
<string name="menu_rank">排行</string>
<string name="app_description">©20222024源文雨\n本应用为拷贝漫画的第三方客户端数据均来源于网络作者不对其中所呈现的任何内容负责。</string>
<string name="app_description">©20222025源文雨\n本应用为拷贝漫画的第三方客户端数据均来源于网络作者不对其中所呈现的任何内容负责。</string>
<string name="menu_history">浏览历史</string>
<string name="menu_sub">我的订阅</string>
<string name="menu_download">我的下载</string>