- Extensions: rewrite both Chrome MV3 & Firefox MV2 with reliable chrome.history.search incremental pull (not onVisited), local search-engine filtering, URL dedup, 30s alarm, retry queue, Bearer token header - Add icons (16/48/96/128) for both browsers - Manifest fixes: chrome action popup, firefox options_ui + browser shim - history-server: require NAVI_SYNC_TOKEN for POST /sync & GET history, NAVI_ADMIN_TOKEN for DELETE; fix RWMutex deadlock (unlock before sortDashyFavorites) that stalled syncs with valid token - admin-server: require NAVI_ADMIN_TOKEN for item add/delete writes
53 lines
2.2 KiB
HTML
53 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>JianF Nav Sync 设置</title>
|
|
<style>
|
|
*{box-sizing:border-box;margin:0;padding:0}
|
|
body{font-family:system-ui,sans-serif;padding:24px;max-width:500px;margin:0 auto;width:340px}
|
|
h1{font-size:18px;font-weight:700;margin-bottom:16px}
|
|
label{display:block;font-size:13px;font-weight:600;margin:10px 0 4px;color:#334155}
|
|
input{width:100%;padding:8px 12px;border:1px solid #ddd;border-radius:8px;font-size:14px}
|
|
button{margin-top:14px;padding:8px 20px;border:none;border-radius:8px;font-weight:600;cursor:pointer;font-size:14px}
|
|
.save{background:#0ea5e9;color:#fff}
|
|
.sync{background:#22c55e;color:#fff;margin-left:8px}
|
|
.status{margin-top:12px;font-size:12px;color:#64748b}
|
|
</style>
|
|
<script>if (typeof browser !== "undefined" && typeof chrome === "undefined") { window.chrome = browser; } else if (typeof browser !== "undefined") { window.chrome = window.chrome || browser; }</script>
|
|
</head>
|
|
<body>
|
|
<h1> JianF Nav Sync</h1>
|
|
<label>导航服务地址</label>
|
|
<input id="url" placeholder="https://nav.example.com">
|
|
<label>同步令牌(可选)</label>
|
|
<input id="token" type="password" placeholder="NAVI_SYNC_TOKEN">
|
|
<label>设备名称</label>
|
|
<input id="device" placeholder="desktop-chrome">
|
|
<div>
|
|
<button class="save" onclick="save()">保存</button>
|
|
<button class="sync" onclick="doSync()">立即同步</button>
|
|
</div>
|
|
<div class="status" id="status"></div>
|
|
<script>
|
|
chrome.runtime.sendMessage({action:'getConfig'},(d)=>{
|
|
document.getElementById('url').value=d.serverUrl||'';
|
|
document.getElementById('token').value=d.syncToken||'';
|
|
document.getElementById('device').value=d.deviceName||'';
|
|
});
|
|
function save(){
|
|
chrome.runtime.sendMessage({action:'setConfig',data:{
|
|
serverUrl:document.getElementById('url').value.replace(/\/$/,''),
|
|
syncToken:document.getElementById('token').value,
|
|
deviceName:document.getElementById('device').value,
|
|
}},()=>{document.getElementById('status').textContent='已保存 OK'});
|
|
}
|
|
function doSync(){
|
|
chrome.runtime.sendMessage({action:'sync'},(r)=>{
|
|
document.getElementById('status').textContent=r.skipped?'无待同步':r.ok?`同步 ${r.count} 条,共 ${r.total}`:`失败: ${r.error||r.status}`;
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|