新增配置页一键清除并保留 DeepSeek 密钥
This commit is contained in:
@@ -83,6 +83,8 @@ powershell -NoProfile -File ./scripts/verify-apk.ps1
|
|||||||
|
|
||||||
保存后,关键字、话术和图片从下一次评论识别起生效,同时在提交前核对命中的话术库。搜索范围、类型名称、任务及回复上限和动作区间用于下次新任务。恢复保留搜索计划、处理进度和已记录的抽取进度。
|
保存后,关键字、话术和图片从下一次评论识别起生效,同时在提交前核对命中的话术库。搜索范围、类型名称、任务及回复上限和动作区间用于下次新任务。恢复保留搜索计划、处理进度和已记录的抽取进度。
|
||||||
|
|
||||||
|
在「配置」底部的「本机数据」中,点「一键清除所有已保存数据」并确认,可删除本机配置、内容类型、关键字、话术及图片副本、任务记录和日志。清除后恢复默认设置,内容库为空,已保存的 DeepSeek 密钥和手机相册中的原图会保留。清除前需结束正在运行的任务或图片导入。
|
||||||
|
|
||||||
## 恢复和兼容性
|
## 恢复和兼容性
|
||||||
|
|
||||||
发送前,应用核对原评论对象和编辑框,把视频或笔记指纹、原评论标识、回复正文和图片列表写入本地检查点。回执不明确时,任务保留待核对记录,任务页显示原评论作者与待核对的图文。恢复时先定位同一未完成内容并跳过已尝试的原评论,也会跳过已结束处理的内容。内容指纹基于可见作者和标题,同作者、同标题的不同内容可能合并,标题变化也可能改变指纹。
|
发送前,应用核对原评论对象和编辑框,把视频或笔记指纹、原评论标识、回复正文和图片列表写入本地检查点。回执不明确时,任务保留待核对记录,任务页显示原评论作者与待核对的图文。恢复时先定位同一未完成内容并跳过已尝试的原评论,也会跳过已结束处理的内容。内容指纹基于可见作者和标题,同作者、同标题的不同内容可能合并,标题变化也可能改变指纹。
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ android {
|
|||||||
applicationId = "com.jieliu.app"
|
applicationId = "com.jieliu.app"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 44
|
versionCode = 45
|
||||||
versionName = "0.1.43"
|
versionName = "0.1.44"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import android.os.Handler
|
|||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
|
import android.util.Log
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowInsets
|
import android.view.WindowInsets
|
||||||
@@ -71,11 +72,13 @@ class MainActivity : Activity() {
|
|||||||
)
|
)
|
||||||
private data class RetainedTemplates(val draft: TemplateDraft?, val photoImport: PhotoImport?)
|
private data class RetainedTemplates(val draft: TemplateDraft?, val photoImport: PhotoImport?)
|
||||||
|
|
||||||
private val store: LocalStore get() = (application as ShijianApp).store
|
private val shijian: ShijianApp get() = application as ShijianApp
|
||||||
|
private val store: LocalStore get() = shijian.store
|
||||||
private val photos by lazy { PhotoLibrary(applicationContext) }
|
private val photos by lazy { PhotoLibrary(applicationContext) }
|
||||||
private val handler = Handler(Looper.getMainLooper())
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
private val refresh = object : Runnable {
|
private val refresh = object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
finishSavedDataReset()
|
||||||
finishPhotoImport()
|
finishPhotoImport()
|
||||||
renderCurrent()
|
renderCurrent()
|
||||||
handler.postDelayed(this, 600L)
|
handler.postDelayed(this, 600L)
|
||||||
@@ -142,7 +145,7 @@ class MainActivity : Activity() {
|
|||||||
if (requestCode != PICK_TEMPLATE_PHOTO) return
|
if (requestCode != PICK_TEMPLATE_PHOTO) return
|
||||||
val target = photoTarget ?: return
|
val target = photoTarget ?: return
|
||||||
photoTarget = null
|
photoTarget = null
|
||||||
if (resultCode != RESULT_OK || data == null) return
|
if (shijian.savedDataReset != null || resultCode != RESULT_OK || data == null) return
|
||||||
val fields = templateFields
|
val fields = templateFields
|
||||||
val remaining = fields?.remainingFor(target)
|
val remaining = fields?.remainingFor(target)
|
||||||
if (fields == null || remaining == null) {
|
if (fields == null || remaining == null) {
|
||||||
@@ -240,9 +243,13 @@ class MainActivity : Activity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun renderCurrent() {
|
private fun renderCurrent() {
|
||||||
|
if (shijian.savedDataReset != null) {
|
||||||
|
if (content.childCount == 0) replace(column().apply { addView(card("正在清除已保存数据")) })
|
||||||
|
return
|
||||||
|
}
|
||||||
when (selected) {
|
when (selected) {
|
||||||
Tab.TASK -> renderTask()
|
Tab.TASK -> renderTask()
|
||||||
Tab.SETTINGS -> if (content.childCount == 0) replace(configView ?: guardedPage(::configPage).also { configView = it })
|
Tab.SETTINGS -> if (content.childCount == 0) replace(configView ?: settingsPage().also { configView = it })
|
||||||
Tab.LOGS -> if (logVersion != store.logVersion) {
|
Tab.LOGS -> if (logVersion != store.logVersion) {
|
||||||
logVersion = store.logVersion
|
logVersion = store.logVersion
|
||||||
replace(guardedPage(::logsPage))
|
replace(guardedPage(::logsPage))
|
||||||
@@ -350,6 +357,64 @@ class MainActivity : Activity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun settingsPage() = column().apply {
|
||||||
|
addView(guardedPage(::configPage))
|
||||||
|
addView(card("本机数据").apply {
|
||||||
|
addView(action("一键清除所有已保存数据", click = ::confirmClearSavedData).apply {
|
||||||
|
setTextColor(ALERT)
|
||||||
|
background = RippleDrawable(ColorStateList.valueOf(0x22863c15), rounded(0xffffeee6.toInt(), 12), null)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun confirmClearSavedData() {
|
||||||
|
checkSavedDataCanBeCleared()
|
||||||
|
val dialog = AlertDialog.Builder(this)
|
||||||
|
.setTitle("清除所有已保存数据?")
|
||||||
|
.setMessage("将清除拾见本机保存的配置、内容库、绑定图片、任务检查点和运行日志。DeepSeek 密钥会保留。清除后恢复默认设置,此操作无法撤销。")
|
||||||
|
.setNegativeButton("取消", null)
|
||||||
|
.setPositiveButton("清除数据") { _, _ -> perform(::startSavedDataReset) }
|
||||||
|
.show()
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ALERT)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkSavedDataCanBeCleared() {
|
||||||
|
check(!TaskControl.inProgress) { "请先暂停任务并等待任务停止。" }
|
||||||
|
check(photoImport == null && photoTarget == null) { "请等待图片导入完成。" }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun startSavedDataReset() {
|
||||||
|
checkSavedDataCanBeCleared()
|
||||||
|
val dataStore = store
|
||||||
|
val work = FutureTask { dataStore.clearSavedData() }
|
||||||
|
val thread = Thread(work, "saved-data-reset")
|
||||||
|
shijian.savedDataReset = work
|
||||||
|
try {
|
||||||
|
thread.start()
|
||||||
|
} catch (error: RuntimeException) {
|
||||||
|
shijian.savedDataReset = null
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
select(Tab.SETTINGS)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun finishSavedDataReset() {
|
||||||
|
val work = shijian.savedDataReset?.takeIf { it.isDone } ?: return
|
||||||
|
shijian.savedDataReset = null
|
||||||
|
configView = null
|
||||||
|
templateFields = null
|
||||||
|
restoredTemplates = null
|
||||||
|
photoTarget = null
|
||||||
|
select(selected)
|
||||||
|
try {
|
||||||
|
work.get()
|
||||||
|
toast("已清除所有已保存数据。")
|
||||||
|
} catch (error: Exception) {
|
||||||
|
Log.w("Shijian", "本机数据清除未完成", error)
|
||||||
|
toast("清除未完成,请重试。")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun configPage(): View {
|
private fun configPage(): View {
|
||||||
val plan = store.readPlan()
|
val plan = store.readPlan()
|
||||||
val specs = PlatformRegistry.platforms
|
val specs = PlatformRegistry.platforms
|
||||||
@@ -896,6 +961,7 @@ class MainActivity : Activity() {
|
|||||||
private fun replace(page: View) { content.removeAllViews(); content.addView(page) }
|
private fun replace(page: View) { content.removeAllViews(); content.addView(page) }
|
||||||
|
|
||||||
private fun perform(action: () -> Unit) {
|
private fun perform(action: () -> Unit) {
|
||||||
|
if (shijian.savedDataReset != null) return
|
||||||
try {
|
try {
|
||||||
action()
|
action()
|
||||||
} catch (error: Exception) {
|
} catch (error: Exception) {
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.jieliu.app
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import com.jieliu.app.data.LocalStore
|
import com.jieliu.app.data.LocalStore
|
||||||
|
import java.util.concurrent.FutureTask
|
||||||
|
|
||||||
class ShijianApp : Application() {
|
class ShijianApp : Application() {
|
||||||
val store by lazy { LocalStore(this) }
|
val store by lazy { LocalStore(this) }
|
||||||
|
internal var savedDataReset: FutureTask<Unit>? = null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.time.LocalDateTime
|
|||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
class LocalStore(context: Context) : TaskRunStorage {
|
class LocalStore(context: Context) : TaskRunStorage {
|
||||||
|
private val app = context.applicationContext
|
||||||
private val settings = File(context.filesDir, "settings.json")
|
private val settings = File(context.filesDir, "settings.json")
|
||||||
private val task = File(context.filesDir, "checkpoint.json")
|
private val task = File(context.filesDir, "checkpoint.json")
|
||||||
private val log = File(context.filesDir, "activity.log")
|
private val log = File(context.filesDir, "activity.log")
|
||||||
@@ -40,7 +41,8 @@ class LocalStore(context: Context) : TaskRunStorage {
|
|||||||
private set
|
private set
|
||||||
|
|
||||||
@Synchronized override fun readPlan(): TaskPlan =
|
@Synchronized override fun readPlan(): TaskPlan =
|
||||||
(settings.readJson()?.getJSONObject("plan")?.toPlan() ?: TaskPlan()).migrateContentTypes()
|
(settings.readJson()?.takeIf { it.has("plan") }?.getJSONObject("plan")?.toPlan()
|
||||||
|
?: TaskPlan(keywords = emptyList(), contentTypes = emptyList())).migrateContentTypes()
|
||||||
|
|
||||||
@Synchronized fun hasApiKey(): Boolean = settings.readJson()?.has("deepSeekKey") == true
|
@Synchronized fun hasApiKey(): Boolean = settings.readJson()?.has("deepSeekKey") == true
|
||||||
|
|
||||||
@@ -125,6 +127,23 @@ class LocalStore(context: Context) : TaskRunStorage {
|
|||||||
checkpointLoaded = true
|
checkpointLoaded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized fun clearSavedData() {
|
||||||
|
try {
|
||||||
|
val savedKey = settings.readJson()?.opt("deepSeekKey")
|
||||||
|
val photos = PhotoLibrary(app)
|
||||||
|
photos.clearStagedPhotos()
|
||||||
|
listOf(task.pendingWrite, settings.pendingWrite, task, log, olderLog)
|
||||||
|
.forEach { Files.deleteIfExists(it.toPath()) }
|
||||||
|
if (savedKey == null) Files.deleteIfExists(settings.toPath())
|
||||||
|
else settings.replaceWith(JSONObject().put("deepSeekKey", savedKey))
|
||||||
|
photos.clearImportedPhotos()
|
||||||
|
} finally {
|
||||||
|
cachedCheckpoint = null
|
||||||
|
checkpointLoaded = false
|
||||||
|
logVersion++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Synchronized override fun appendLog(message: String, warning: Boolean) {
|
@Synchronized override fun appendLog(message: String, warning: Boolean) {
|
||||||
try {
|
try {
|
||||||
if (log.length() >= 128 * 1024) Files.move(log.toPath(), olderLog.toPath(), REPLACE_EXISTING)
|
if (log.length() >= 128 * 1024) Files.move(log.toPath(), olderLog.toPath(), REPLACE_EXISTING)
|
||||||
@@ -147,8 +166,10 @@ class LocalStore(context: Context) : TaskRunStorage {
|
|||||||
|
|
||||||
private fun File.readJson(): JSONObject? = if (isFile) JSONObject(readText()) else null
|
private fun File.readJson(): JSONObject? = if (isFile) JSONObject(readText()) else null
|
||||||
|
|
||||||
|
private val File.pendingWrite: File get() = File(parentFile, "$name.new")
|
||||||
|
|
||||||
private fun File.replaceWith(body: JSONObject) {
|
private fun File.replaceWith(body: JSONObject) {
|
||||||
val temp = File(parentFile, "$name.new")
|
val temp = pendingWrite
|
||||||
try {
|
try {
|
||||||
FileOutputStream(temp).use { stream ->
|
FileOutputStream(temp).use { stream ->
|
||||||
stream.write(body.toString().toByteArray(Charsets.UTF_8))
|
stream.write(body.toString().toByteArray(Charsets.UTF_8))
|
||||||
|
|||||||
@@ -143,12 +143,30 @@ class PhotoLibrary(context: Context) {
|
|||||||
fun cleanupStaged(): Unit = synchronized(lock) {
|
fun cleanupStaged(): Unit = synchronized(lock) {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return@synchronized
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return@synchronized
|
||||||
try {
|
try {
|
||||||
orphanedStages().forEach(::deleteStageSafely)
|
ownedStages().filterNot { it in activeStages }.forEach(::deleteStageSafely)
|
||||||
} catch (error: Exception) {
|
} catch (error: Exception) {
|
||||||
Log.w(TAG, "无法扫描暂存图片(${error.javaClass.simpleName})")
|
Log.w(TAG, "无法扫描暂存图片(${error.javaClass.simpleName})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun clearStagedPhotos(): Unit = synchronized(lock) {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return@synchronized
|
||||||
|
val staged = ownedStages()
|
||||||
|
staged.forEach { uri ->
|
||||||
|
deleteStage(uri)
|
||||||
|
activeStages.remove(uri)
|
||||||
|
}
|
||||||
|
check(staged.isEmpty() || ownedStages().isEmpty()) { "无法清除拾见的相册暂存图片。" }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun clearImportedPhotos(): Unit = synchronized(lock) {
|
||||||
|
val directory = imports.toPath()
|
||||||
|
if (Files.notExists(directory, NOFOLLOW_LINKS)) return@synchronized
|
||||||
|
Files.walk(directory).use { paths ->
|
||||||
|
paths.sorted(Comparator.reverseOrder()).forEach { Files.deleteIfExists(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** The caller must keep settings, in-progress edits, and every resumable checkpoint reference. */
|
/** The caller must keep settings, in-progress edits, and every resumable checkpoint reference. */
|
||||||
fun pruneImports(keepIds: Set<String>): Unit = synchronized(lock) {
|
fun pruneImports(keepIds: Set<String>): Unit = synchronized(lock) {
|
||||||
imports.listFiles()?.forEach { file ->
|
imports.listFiles()?.forEach { file ->
|
||||||
@@ -227,7 +245,7 @@ class PhotoLibrary(context: Context) {
|
|||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.Q)
|
@TargetApi(Build.VERSION_CODES.Q)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
private fun orphanedStages(): List<Uri> {
|
private fun ownedStages(): List<Uri> {
|
||||||
val collection = imageCollection()
|
val collection = imageCollection()
|
||||||
val queryUri = if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) MediaStore.setIncludePending(collection) else collection
|
val queryUri = if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) MediaStore.setIncludePending(collection) else collection
|
||||||
val query = Bundle().apply {
|
val query = Bundle().apply {
|
||||||
@@ -236,7 +254,8 @@ class PhotoLibrary(context: Context) {
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) putInt(MediaStore.QUERY_ARG_MATCH_PENDING, MediaStore.MATCH_INCLUDE)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) putInt(MediaStore.QUERY_ARG_MATCH_PENDING, MediaStore.MATCH_INCLUDE)
|
||||||
}
|
}
|
||||||
val columns = arrayOf(BaseColumns._ID, MediaColumns.RELATIVE_PATH, MediaColumns.DISPLAY_NAME, MediaColumns.OWNER_PACKAGE_NAME)
|
val columns = arrayOf(BaseColumns._ID, MediaColumns.RELATIVE_PATH, MediaColumns.DISPLAY_NAME, MediaColumns.OWNER_PACKAGE_NAME)
|
||||||
return resolver.query(queryUri, columns, query, null)?.use { cursor ->
|
val rows = checkNotNull(resolver.query(queryUri, columns, query, null)) { "无法读取拾见的相册暂存图片。" }
|
||||||
|
return rows.use { cursor ->
|
||||||
buildList {
|
buildList {
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
if (cursor.getString(3) != app.packageName) continue
|
if (cursor.getString(3) != app.packageName) continue
|
||||||
@@ -247,26 +266,30 @@ class PhotoLibrary(context: Context) {
|
|||||||
(1..TaskPlan.MAX_TEMPLATE_PHOTOS).any { name == stageFileName(albumName, format, it) }
|
(1..TaskPlan.MAX_TEMPLATE_PHOTOS).any { name == stageFileName(albumName, format, it) }
|
||||||
}
|
}
|
||||||
) continue
|
) continue
|
||||||
val uri = ContentUris.withAppendedId(collection, cursor.getLong(0))
|
add(ContentUris.withAppendedId(collection, cursor.getLong(0)))
|
||||||
if (uri !in activeStages) add(uri)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.orEmpty()
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.Q)
|
||||||
|
private fun deleteStageSafely(uri: Uri) {
|
||||||
|
try {
|
||||||
|
deleteStage(uri)
|
||||||
|
} catch (error: Exception) {
|
||||||
|
Log.w(TAG, "无法清理暂存图片(${error.javaClass.simpleName})")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.Q)
|
@TargetApi(Build.VERSION_CODES.Q)
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
private fun deleteStageSafely(uri: Uri) {
|
private fun deleteStage(uri: Uri) {
|
||||||
try {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
val includePending = Bundle().apply { putInt(MediaStore.QUERY_ARG_MATCH_PENDING, MediaStore.MATCH_INCLUDE) }
|
val includePending = Bundle().apply { putInt(MediaStore.QUERY_ARG_MATCH_PENDING, MediaStore.MATCH_INCLUDE) }
|
||||||
resolver.delete(uri, includePending)
|
resolver.delete(uri, includePending)
|
||||||
} else {
|
} else {
|
||||||
resolver.delete(MediaStore.setIncludePending(uri), null, null)
|
resolver.delete(MediaStore.setIncludePending(uri), null, null)
|
||||||
}
|
}
|
||||||
} catch (error: Exception) {
|
|
||||||
Log.w(TAG, "无法清理暂存图片(${error.javaClass.simpleName})")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.Q)
|
@TargetApi(Build.VERSION_CODES.Q)
|
||||||
|
|||||||
+58
-8
@@ -14,6 +14,8 @@
|
|||||||
--tint: #e5f0e8;
|
--tint: #e5f0e8;
|
||||||
--line: #cbd7ce;
|
--line: #cbd7ce;
|
||||||
--alert: #863c15;
|
--alert: #863c15;
|
||||||
|
--danger: #9a342b;
|
||||||
|
--danger-tint: #f7e9e6;
|
||||||
font: 16px/1.55 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
|
font: 16px/1.55 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
background: #e8ede6;
|
background: #e8ede6;
|
||||||
@@ -177,6 +179,9 @@
|
|||||||
background: var(--green);
|
background: var(--green);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action.danger { color: var(--danger); background: var(--danger-tint); }
|
||||||
|
.action.primary.danger { color: #fff; background: var(--danger); }
|
||||||
|
|
||||||
.action[aria-disabled="true"] {
|
.action[aria-disabled="true"] {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #668b7a;
|
background: #668b7a;
|
||||||
@@ -425,6 +430,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="action primary" id="save-preview">保存配置</button>
|
<button type="button" class="action primary" id="save-preview">保存配置</button>
|
||||||
|
<div class="card" style="margin-top: 12px">
|
||||||
|
<h3>本机数据</h3>
|
||||||
|
<button type="button" class="action danger" id="reset-preview">一键清除所有已保存数据</button>
|
||||||
|
</div>
|
||||||
<p id="library-status" role="status" hidden></p>
|
<p id="library-status" role="status" hidden></p>
|
||||||
</div>
|
</div>
|
||||||
<nav class="app-nav" aria-label="配置页导航">
|
<nav class="app-nav" aria-label="配置页导航">
|
||||||
@@ -442,7 +451,8 @@
|
|||||||
<div class="phone-content">
|
<div class="phone-content">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h3>运行日志</h3>
|
<h3>运行日志</h3>
|
||||||
<ul class="entries">
|
<p id="empty-log" hidden>启动任务后会在这里显示运行步骤。</p>
|
||||||
|
<ul class="entries" id="log-entries">
|
||||||
<li><time datetime="2026-11-26T12:56:05+08:00">11-26 12:56:05</time> 运行 任务完成 · 处理 1 条 · 确认发送 1 条</li>
|
<li><time datetime="2026-11-26T12:56:05+08:00">11-26 12:56:05</time> 运行 任务完成 · 处理 1 条 · 确认发送 1 条</li>
|
||||||
<li><time datetime="2026-11-26T12:56:05+08:00">11-26 12:56:05</time> 运行 第 1 条视频已确认 1/1 条回复</li>
|
<li><time datetime="2026-11-26T12:56:05+08:00">11-26 12:56:05</time> 运行 第 1 条视频已确认 1/1 条回复</li>
|
||||||
<li class="warning"><time datetime="2026-11-25T15:22:14+08:00">11-25 15:22:14</time> 异常 抖音评论未回读到完整内容或未看到唯一发送按钮</li>
|
<li class="warning"><time datetime="2026-11-25T15:22:14+08:00">11-25 15:22:14</time> 异常 抖音评论未回读到完整内容或未看到唯一发送按钮</li>
|
||||||
@@ -483,6 +493,14 @@
|
|||||||
<button type="button" class="action primary" id="delete-confirm">删除</button>
|
<button type="button" class="action primary" id="delete-confirm">删除</button>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
<dialog id="reset-dialog" aria-labelledby="reset-title" aria-describedby="reset-message">
|
||||||
|
<h2 id="reset-title">清除所有已保存数据?</h2>
|
||||||
|
<p id="reset-message">将清除拾见本机保存的配置、内容库、绑定图片、任务检查点和运行日志。DeepSeek 密钥会保留。清除后恢复默认设置,此操作无法撤销。</p>
|
||||||
|
<div class="library-actions">
|
||||||
|
<button type="button" class="action" id="reset-cancel" autofocus>取消</button>
|
||||||
|
<button type="button" class="action primary danger" id="reset-confirm">清除数据</button>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
<script>
|
<script>
|
||||||
const byId = id => document.getElementById(id);
|
const byId = id => document.getElementById(id);
|
||||||
const scope = byId("search-scope");
|
const scope = byId("search-scope");
|
||||||
@@ -495,6 +513,7 @@
|
|||||||
const phrasePicker = byId("reply-phrase");
|
const phrasePicker = byId("reply-phrase");
|
||||||
const editDialog = byId("library-editor");
|
const editDialog = byId("library-editor");
|
||||||
const deleteDialog = byId("library-delete");
|
const deleteDialog = byId("library-delete");
|
||||||
|
const resetDialog = byId("reset-dialog");
|
||||||
const singleLine = byId("library-value");
|
const singleLine = byId("library-value");
|
||||||
const multiLine = byId("library-phrase-text");
|
const multiLine = byId("library-phrase-text");
|
||||||
const editError = byId("library-error");
|
const editError = byId("library-error");
|
||||||
@@ -700,11 +719,7 @@
|
|||||||
for (const picker of [platformPicker, replyMode, bilibiliScope]) {
|
for (const picker of [platformPicker, replyMode, bilibiliScope]) {
|
||||||
picker.addEventListener("change", updateCommentSettings);
|
picker.addEventListener("change", updateCommentSettings);
|
||||||
}
|
}
|
||||||
byId("save-preview").addEventListener("click", () => {
|
function updateTaskPreview() {
|
||||||
const status = byId("library-status");
|
|
||||||
const invalid = [byId("video-limit"), byId("replies-per-video")].find(input => !input.validity.valid);
|
|
||||||
const error = invalid ? `${invalid.labels[0].textContent}须为 1–100 的整数。` : "";
|
|
||||||
if (!error) {
|
|
||||||
const platform = platformPicker.selectedOptions[0];
|
const platform = platformPicker.selectedOptions[0];
|
||||||
const unit = platform.dataset.unit;
|
const unit = platform.dataset.unit;
|
||||||
const limit = byId("video-limit").valueAsNumber;
|
const limit = byId("video-limit").valueAsNumber;
|
||||||
@@ -718,15 +733,50 @@
|
|||||||
byId("task-scope").textContent = `内容类型 ${searchTypes.length} 个 · 单次 ${limit} 个${unit}`;
|
byId("task-scope").textContent = `内容类型 ${searchTypes.length} 个 · 单次 ${limit} 个${unit}`;
|
||||||
byId("task-summary").textContent = `已处理${unit} 0 / ${limit} · ${confirmedLabel} 0 条`;
|
byId("task-summary").textContent = `已处理${unit} 0 / ${limit} · ${confirmedLabel} 0 条`;
|
||||||
progress.max = limit;
|
progress.max = limit;
|
||||||
|
progress.value = 0;
|
||||||
progress.setAttribute("aria-label", `已处理 0 个${unit},共 ${limit} 个`);
|
progress.setAttribute("aria-label", `已处理 0 个${unit},共 ${limit} 个`);
|
||||||
type.hidden = searchTypes.length === 0;
|
type.hidden = searchTypes.length === 0;
|
||||||
type.textContent = searchTypes.length ? `内容类型 · ${searchTypes[0].name}` : "";
|
type.textContent = searchTypes.length ? `内容类型 · ${searchTypes[0].name}` : "";
|
||||||
}
|
}
|
||||||
status.textContent = error || "预览配置已更新。";
|
function showConfigStatus(message, invalid) {
|
||||||
status.classList.toggle("error", Boolean(error));
|
const status = byId("library-status");
|
||||||
|
status.textContent = message;
|
||||||
|
status.classList.toggle("error", Boolean(invalid));
|
||||||
status.hidden = false;
|
status.hidden = false;
|
||||||
invalid?.focus({ preventScroll: true });
|
invalid?.focus({ preventScroll: true });
|
||||||
status.scrollIntoView({ block: "nearest", inline: "nearest" });
|
status.scrollIntoView({ block: "nearest", inline: "nearest" });
|
||||||
|
}
|
||||||
|
byId("save-preview").addEventListener("click", () => {
|
||||||
|
const invalid = [byId("video-limit"), byId("replies-per-video")].find(input => !input.validity.valid);
|
||||||
|
if (!invalid) updateTaskPreview();
|
||||||
|
showConfigStatus(invalid ? `${invalid.labels[0].textContent}须为 1–100 的整数。` : "预览配置已更新。", invalid);
|
||||||
|
});
|
||||||
|
byId("reset-preview").addEventListener("click", () => resetDialog.showModal());
|
||||||
|
byId("reset-cancel").addEventListener("click", () => resetDialog.close());
|
||||||
|
byId("reset-confirm").addEventListener("click", () => {
|
||||||
|
for (const type of types) {
|
||||||
|
for (const rule of type.rules) {
|
||||||
|
for (const phrase of rule.phrases) phrase.photos.forEach(photo => URL.revokeObjectURL(photo.url));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
types.length = 0;
|
||||||
|
nextId = 0;
|
||||||
|
editing = deleting = photoTarget = undefined;
|
||||||
|
singleLine.value = multiLine.value = fileInput.value = "";
|
||||||
|
for (const picker of [platformPicker, replyMode, bilibiliScope, scope]) picker.selectedIndex = 0;
|
||||||
|
for (const input of [byId("video-limit"), byId("replies-per-video")]) input.value = input.defaultValue;
|
||||||
|
const pending = byId("pending-receipt-preview");
|
||||||
|
pending.open = false;
|
||||||
|
pending.hidden = true;
|
||||||
|
byId("log-entries").replaceChildren();
|
||||||
|
byId("log-entries").hidden = true;
|
||||||
|
byId("empty-log").hidden = false;
|
||||||
|
resetDialog.close();
|
||||||
|
setStatus();
|
||||||
|
updateCommentSettings();
|
||||||
|
redrawLibrary();
|
||||||
|
updateTaskPreview();
|
||||||
|
showConfigStatus("已清除所有已保存数据。");
|
||||||
});
|
});
|
||||||
updateCommentSettings();
|
updateCommentSettings();
|
||||||
redrawLibrary();
|
redrawLibrary();
|
||||||
|
|||||||
+9
-1
@@ -1,6 +1,14 @@
|
|||||||
# 拾见开发进度
|
# 拾见开发进度
|
||||||
|
|
||||||
最近更新于 2026-11-27 16:05(UTC+8)。以下按开发轮次倒序记录。
|
最近更新于 2026-11-27 16:35(UTC+8)。以下按开发轮次倒序记录。
|
||||||
|
|
||||||
|
## 2026-11-27 · 拾见 0.1.44 配置页一键清除
|
||||||
|
|
||||||
|
- 在「配置 → 本机数据」新增「一键清除所有已保存数据」。确认后恢复默认任务配置,清除内容库、导入的图片副本、应用创建的相册暂存、任务检查点和运行日志。已保存的 DeepSeek 密钥加密内容与原始相册图片保留。
|
||||||
|
- 清除需在任务和图片导入停止后进行。点击取消会保留当前数据,确认后在后台清理并刷新当前页面,失败时可以重试。
|
||||||
|
- 静态预览在 Chrome 的 1440 和 390 像素宽度通过验证,覆盖确认文案、取消、清除、恢复默认及重新保存。
|
||||||
|
- vivo Android 12 使用独立安装的测试包验收。取消后配置、话术和绑定图、任务记录和日志均保留。确认后配置恢复默认,内容库、检查点、两代日志、导入图片及相册暂存均已清除。同一个测试密钥仍可解密,独立相册原图可正常读取。测试包和相册测试素材已移除,原装机版的配置和检查点文件校验一致。
|
||||||
|
- 调试 APK 已离线生成并通过 v2 签名校验。74 项 JVM 单元测试通过,Lint 为 0 个错误、3 个既有警告。
|
||||||
|
|
||||||
## 2026-11-27 · 拾见 0.1.43 快手图片与视频真机闭环
|
## 2026-11-27 · 拾见 0.1.43 快手图片与视频真机闭环
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user