()
| 183 | } |
| 184 | |
| 185 | async function loadVisibleSources() { |
| 186 | if (__copyMoveSourcesCache) return __copyMoveSourcesCache; |
| 187 | try { |
| 188 | const res = await fetch(withBase('/api/pro/sources/visible.php'), { |
| 189 | credentials: 'include', |
| 190 | headers: { 'Accept': 'application/json' } |
| 191 | }); |
| 192 | if (!res.ok) return null; |
| 193 | const data = await res.json().catch(() => null); |
| 194 | if (!data || data.ok !== true || !data.enabled) return null; |
| 195 | const list = Array.isArray(data.sources) ? data.sources : []; |
| 196 | __copyMoveSourcesCache = list; |
| 197 | return list; |
| 198 | } catch (e) { |
| 199 | return null; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | function populateSourceSelect(selectEl, sources, activeId) { |
| 204 | if (!selectEl) return; |
no test coverage detected