()
| 216 | } catch (e) { /* ignore */ } |
| 217 | |
| 218 | async function loadVisibleSourcesFromApi() { |
| 219 | try { |
| 220 | const res = await fetch(withBase('/api/pro/sources/visible.php'), { |
| 221 | credentials: 'include', |
| 222 | headers: { 'Accept': 'application/json' }, |
| 223 | }); |
| 224 | if (!res.ok) return null; |
| 225 | const data = await res.json().catch(() => null); |
| 226 | if (!data || data.ok !== true) return null; |
| 227 | return data; |
| 228 | } catch (e) { |
| 229 | return null; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | export async function initSourceSelector(opts = {}) { |
| 234 | const wrap = document.getElementById('sourceSelectorWrap'); |
no test coverage detected