Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

### Frontend
- **HTML5 + CSS3 + Vanilla JavaScript** (بدون مكتبات خارجية)
- **Service Worker** (sw.js v80) لـ caching و offline
- **Service Worker** (sw.js v81) لـ caching و offline
- **HLS.js** (1.6.10) لدعم HLS
- **hls.js CDN**: jsdelivr → unpkg fallback

Expand Down Expand Up @@ -132,7 +132,7 @@ Radio/
│ └── tools.mjs # لوحة الأوامر + المشاركة + الإبلاغ + عشوائي (~8KB)
├── css/
│ └── styles.css # أنماط CSS
├── sw.js # Service Worker (v80)
├── sw.js # Service Worker (v81)
├── manifest.webmanifest # PWA Manifest
├── offline.html # صفحة offline
├── robots.txt # robots.txt
Expand Down Expand Up @@ -288,5 +288,9 @@ GitHub Pages deployment stamps a generated `build-info.json` with the exact depl
Merges to `main` now publish the checked-out application without first crawling the entire station catalog. Catalog refresh policy is unchanged: stations update daily at 02:17 UTC, SDR every six hours at :11 UTC, and the `workflow_dispatch` action still supports `all`, `stations`, `sdr`. The upload and post-deploy provenance verifier run for both fast code deploys and scheduled data deploys, so a merge is **not** proof of a published release until the verifier passes.


### KiwiSDR native playback and responsive listening cockpit (v80)
### KiwiSDR native playback and responsive listening cockpit (v81)
The KiwiSDR embedded player now uses the receiver's native `/<timestamp>/SND` WebSocket and Kiwi text commands with uncompressed big-endian PCM audio. The first real SND packet, rather than merely opening a WebSocket, confirms a playable receiver. Manual frequency/mode tuning, bounded audio buffering, audio-context cleanup, and operator API permissions are preserved. The optional Cloudflare WebSocket bridge remains disabled until separately deployed and verified; HTTP receivers cannot be played natively from a secure GitHub Pages context without that service. The original receiver URL remains accessible as a fallback. The responsive header, directory grid and Kiwi listening dialog have been updated for phone and desktop screens.


### KiwiSDR Cloudflare relay activation (v81)
Site owner reports the independent Worker `https://radio-atlas-kiwi-bridge.ossam-hashim.workers.dev` has been enabled and `/healthz` returned HTTP 200. HTTP KiwiSDR devices that advertise `ext_api > 0` now *attempt* the in-app secure WSS bridge; HTTPS devices connect directly. Failed connections stay in Radio Atlas, show a receiver error and retain a clearly labeled optional original-device link. The owner reported no successful real WebSocket or decoded audio test yet. `healthz` alone does **not** demonstrate working stream relaying. See `proxy/KIWI_README.md` for staged browser/audio verification and origin requirements.
12 changes: 9 additions & 3 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

> **صيانة المصادر العالمية — 2026-11-19:** خط الأساس المعلن في manifest v34 هو 60,732 محطة، بينما صفوف stations.json الفعلية 60,741 (انحراف سابق +9)؛ آخر سجل قديم فحص 1,185 رابطًا وصنّف 1,071 alive (مش ضمان تشغيل صوت). أضفنا فاحص دليل الصوت التدريجي (48 رابطًا في دورة المحطات)، وحماية تمنع فقد أكثر من 20% من المحطات بسبب جلب ناقص. لا حذف للمحطات ولا تغيير لمعرّفاتها. التفاصيل والتقييم في [تقرير تدقيق المصادر](docs/RADIO_SOURCES_AUDIT_2026-11-19.md). اكتمال التفعيل معلق على CI والنشر ودورة صيانة فعلية.

> **تحسين موثوقية تشغيل البث — 2026-11-19:** استكمال بند المشغّل P1-3: قائمة بدائل المحطة نفسها أصبحت HTTPS فقط، تُزال منها الروابط المكررة وغير الآمنة، ويُسمح بأربع محاولات مباشرة كحد أقصى ثم بروكسي اختياري مرة واحدة، وتُستخدم نفس القائمة عند استعادة آخر محطة. لا دمج حسب تشابه الأسماء، ولا تغيير لعنصر الصوت أو بيانات المفضلة. Service Worker v80.
> **تحسين موثوقية تشغيل البث — 2026-11-19:** استكمال بند المشغّل P1-3: قائمة بدائل المحطة نفسها أصبحت HTTPS فقط، تُزال منها الروابط المكررة وغير الآمنة، ويُسمح بأربع محاولات مباشرة كحد أقصى ثم بروكسي اختياري مرة واحدة، وتُستخدم نفس القائمة عند استعادة آخر محطة. لا دمج حسب تشابه الأسماء، ولا تغيير لعنصر الصوت أو بيانات المفضلة. Service Worker v81.

## 1) الوضع الحالي — نوفمبر 2026

Expand Down Expand Up @@ -43,7 +43,7 @@
| ملف الإقلاع السريع | stations_head.json (~530KB) | data/ |
| تدفق منسّق مُتحقق | 1185 مُفحوص · 1086 شغّال · 50 «جرّبها» · 49 ميت | data/stream_checks.json |
| جسم الواجهة | js/app.js ~79KB (نواة) + 5 وحدات ES Modules | js/app.js |
| إصدار Service Worker | v80 | sw.js (الجذر — المسار المسجل في js/app.js) |
| إصدار Service Worker | v81 | sw.js (الجذر — المسار المسجل في js/app.js) |
| الاختبارات | 92 اختبار crawler + مجموعة اختبارات JS (node --test) | tests/ |
| جدولة التحديث | SDR كل 6 ساعات · المحطات يوميًا | .github/workflows/update-data.yml |

Expand Down Expand Up @@ -203,6 +203,12 @@


### KiwiSDR native player / listening cockpit — 2026-11-20
- Frontend PR: native KiwiSDR `SND` WebSocket, proper authorization and tuning commands, big-endian PCM decoding, responsive desktop/mobile SDR dialog and listening shell. Incremented root Service Worker to v80.
- Frontend PR: native KiwiSDR `SND` WebSocket, proper authorization and tuning commands, big-endian PCM decoding, responsive desktop/mobile SDR dialog and listening shell. Incremented root Service Worker to v81.
- **Deployment dependency:** GitHub Pages cannot operate a server-side HTTP/WS-to-WSS bridge; HTTP-only Kiwi receivers require a separately deployed, origin-restricted relay, its verified workers.dev URL and a controlled frontend activation.
- **Acceptance:** browser test on publicly consenting Kiwi receivers, real decoded audio over HTTPS and HTTP relay, no iframe escape, accessibility and full CI checks; never classify as globally verified before those pass.


### KiwiSDR hosted bridge activation — 2026-11-20
- Owner supplied confirmed Workers hostname `https://radio-atlas-kiwi-bridge.ossam-hashim.workers.dev` and reports HTTP 200 from `/healthz` (response body inferred from deployed code, not separately byte-checked).
- Frontend configured to attempt WSS relay for HTTP-only publicly listed KiwiSDR receivers (when `ext_api > 0`). Receiver remains in-app on failure; normal station player unaffected. Cache bumped to v81.
- **Acceptance limitation:** Cloudflare Agent could not test unauthorized WebSocket rejection or real SND playback. Before claiming end-to-end availability, test 403 origin rejection, 403 non-catalog receiver, a permitted WSS handshake, valid `SND` frames and actual audio from consenting receivers on Android and desktop. Avoid claiming all receivers work.
8 changes: 5 additions & 3 deletions js/modules/sdr.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,11 @@ function closeSDR() {


/* ================= KiwiSDR native WebSocket audio ================= */
// Set this only after the independently deployed Cloudflare WebSocket relay
// is live and its /healthz check passes. GitHub Pages cannot proxy sockets.
var KIWI_WS_RELAY = '';
// Separate Cloudflare Worker public hostname supplied by site owner on 2026-11-20.
// Worker deployment and /healthz are reported live; actual WebSocket audio
// remains subject to separate per-receiver verification and permission.
// A failed relay must not cause a cross-site navigation or disrupt FM playback.
var KIWI_WS_RELAY = 'https://radio-atlas-kiwi-bridge.ossam-hashim.workers.dev';
var kiwiWs = null;
var kiwiAudioCtx = null;
var kiwiGain = null;
Expand Down
2 changes: 1 addition & 1 deletion sw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var CACHE = 'radio-atlas-v80';
var CACHE = 'radio-atlas-v81';
var SHELL = ['./', './index.html', './offline.html', './about.html', './contact.html', './terms.html', './privacy.html', './dmca.html', './css/styles.css', './js/app.js', './js/analytics.js', './manifest.webmanifest', './icons/icon.svg',
'./icons/icon-192.png', './icons/icon-512.png', './icons/icon-maskable-192.png', './icons/icon-maskable-512.png',
'./js/modules/mobile.mjs', './js/modules/map.mjs', './js/modules/player.mjs', './js/modules/regions.mjs', './js/modules/sdr.mjs', './js/modules/tools.mjs'];
Expand Down
65 changes: 65 additions & 0 deletions tests/kiwi-bridge-live.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
'use strict';
const { test } = require('node:test');
const assert = require('node:assert/strict');
const https = require('node:https');

// Publicly deployed Cloudflare Worker is independently probed from the
// GitHub Actions runner, not just mocked. No real SDR allocations here.
const base = 'https://radio-atlas-kiwi-bridge.ossam-hashim.workers.dev';

function request(path, options = {}) {
return new Promise((resolve, reject) => {
const req = https.request(base + path, {
method: 'GET',
timeout: 12000,
headers: options.upgrade ? {
Connection: 'Upgrade',
Upgrade: 'websocket',
'Sec-WebSocket-Version': '13',
'Sec-WebSocket-Key': 'dGhlIHNhbXBsZSBub25jZQ==',
Origin: options.origin
} : {}
}, res => {
const parts = [];
res.on('data', p => parts.push(p));
res.on('end', () => resolve({
status: res.statusCode,
body: Buffer.concat(parts).toString('utf8').slice(0, 400)
}));
});
req.on('upgrade', (res, socket) => {
socket.destroy();
resolve({status: res.statusCode, body: 'Unexpected WebSocket upgrade'});
});
req.on('timeout', () => req.destroy(new Error('Cloudflare bridge probe timed out')));
req.on('error', reject);
req.end();
});
}

test('live Kiwi bridge healthz returns exactly ok', {timeout:15000}, async () => {
const r = await request('/healthz');
assert.equal(r.status, 200, r.body);
assert.equal(r.body, 'ok');
});

test('live Kiwi bridge rejects foreign Origin before reading receiver', {timeout:15000}, async () => {
const r = await request('/kiwi/ws?receiver=https%3A%2F%2Fexample.com%2F', {
upgrade:true, origin:'https://evil.example'
});
assert.equal(r.status, 403, r.body);
assert.match(r.body, /Origin forbidden/);
});

test('live Kiwi bridge rejects unlisted receiver with valid site Origin', {timeout:15000}, async () => {
const r = await request('/kiwi/ws?receiver=https%3A%2F%2Fexample.com%2F', {
upgrade:true, origin:'https://samotech.github.io'
});
assert.equal(r.status, 403, r.body);
assert.match(r.body, /not approved/);
});

test('live Kiwi bridge requires WebSocket upgrade', {timeout:15000}, async () => {
const r = await request('/kiwi/ws?receiver=https%3A%2F%2Fexample.com%2F');
assert.equal(r.status, 426, r.body);
});
3 changes: 2 additions & 1 deletion tests/kiwi-native.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ test('KiwiSDR connects to timestamped SND endpoint, not obsolete /0', () => {
const addr = ctx.kiwiSocketAddress('https://receiver.example:8073/');
assert.match(addr, /^wss:\/\/receiver\.example:8073\/\d+\/SND$/);
assert.equal(ctx.kiwiSocketAddress('javascript:alert(1)'), '');
assert.equal(ctx.kiwiSocketAddress('http://receiver.example:8073/'), '');
assert.equal(ctx.kiwiSocketAddress('http://receiver.example:8073/'), 'wss://radio-atlas-kiwi-bridge.ossam-hashim.workers.dev/kiwi/ws?receiver=http%3A%2F%2Freceiver.example%3A8073%2F');
assert.equal(ctx.kiwiSocketAddress('https://user:pass@receiver.example/'), '');
assert.equal(ctx.kiwiSocketAddress('http://user:pass@receiver.example/'), '');
});

test('KiwiSDR audio decodes big-endian uncompressed SND frame', () => {
Expand Down
Loading