v0.14.12: SearXNG pageno pagination + max_results HTML mode UI

- SearXNG: pageno分页+URL去重+早退, 准确满足max_results
- SearXNG: HTML模式禁用单次结果数输入框+提示
- menu.ts: 关于对话框版本号同步
- 版本号0.14.12
This commit is contained in:
紫影233
2026-07-10 12:55:51 +08:00
parent e3b44a0357
commit c824562f68
7 changed files with 137 additions and 60 deletions
+17
View File
@@ -66,6 +66,17 @@ export async function loadSearxngConfig(db: ChatDB): Promise<void> {
updateEnabledUI(searxngConfig.enabled);
}
/** 根据返回格式动态启用/禁用「单次结果数」输入框 */
function updateMaxResultsVisibility(): void {
const format = (document.querySelector('#searxngFormat') as HTMLSelectElement).value;
const isHtml = format === 'html';
const input = document.querySelector('#searxngMaxResults') as HTMLInputElement;
const hint = document.querySelector('#searxngMaxResultsHint') as HTMLElement;
input.disabled = isHtml;
input.style.opacity = isHtml ? '0.4' : '';
hint.style.display = isHtml ? '' : 'none';
}
/** 刷新 UI 控件以匹配当前配置 */
function syncFormFromConfig(): void {
(document.querySelector('#searxngUrl') as HTMLInputElement).value = searxngConfig.url;
@@ -82,6 +93,7 @@ function syncFormFromConfig(): void {
const toggle = document.querySelector('#toggleSearxngEnabled') as HTMLInputElement;
toggle.checked = searxngConfig.enabled;
updateEnabledUI(searxngConfig.enabled);
updateMaxResultsVisibility();
}
/** 启用/禁用状态切换 UI */
@@ -130,6 +142,11 @@ export function initSearxngModal(): void {
logInfo('SearXNG', checked ? '已启用' : '已禁用');
});
// ── 返回格式切换 → 动态启用/禁用「单次结果数」 ──
document.querySelector('#searxngFormat')!.addEventListener('change', () => {
updateMaxResultsVisibility();
});
// ── 保存按钮 ──
document.querySelector('#btnSaveSearxng')!.addEventListener('click', async () => {
const url = (document.querySelector('#searxngUrl') as HTMLInputElement).value.trim();