fix(browser-bridge): don't send X-Verstak-Secret when empty/undefined; add integration tests

This commit is contained in:
2026-06-09 01:02:37 +08:00
parent fa5001341e
commit b002005a42
4 changed files with 308 additions and 5 deletions
+7 -4
View File
@@ -175,6 +175,12 @@ function flushQueue() {
const secret = config.secret || '';
const deviceId = config.deviceId || DEFAULT_DEVICE_ID;
const headers = { 'Content-Type': 'application/json' };
// Only send secret header if it's a non-empty string
if (secret && typeof secret === 'string' && secret.length > 0) {
headers['X-Verstak-Secret'] = secret;
}
const payload = {
version: 1,
device_id: 'firefox-' + deviceId,
@@ -183,10 +189,7 @@ function flushQueue() {
fetch(`http://127.0.0.1:${port}/api/events`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Verstak-Secret': secret,
},
headers,
body: JSON.stringify(payload),
signal: AbortSignal.timeout(5000),
})
+1 -1
View File
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Verstak Bridge",
"version": "1.0.3",
"version": "1.0.4",
"description": "Отслеживает активные вкладки и отправляет события в Verstak",
"author": "Verstak",
"homepage_url": "https://git.mirv.top/mirivlad/verstak",