MCPcopy Create free account
hub / github.com/error311/FileRise / loadGateways

Function loadGateways

public/js/adminPanel.js:4540–4574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4538 };
4539
4540 const loadGateways = async () => {
4541 try {
4542 setStatus(tf('loading', 'Loading…'));
4543 const res = await fetch(withBase('/api/pro/gateways/list.php'), {
4544 method: 'GET',
4545 credentials: 'include',
4546 headers: { 'Accept': 'application/json' },
4547 });
4548 const data = await safeJson(res);
4549 if (!res.ok || !data || data.ok !== true) {
4550 throw new Error(data?.error || tf('gateway_list_failed', 'Failed to load gateway shares.'));
4551 }
4552 state.gateways = Array.isArray(data.gateways) ? data.gateways : [];
4553 renderList();
4554 renderManagedGatewayOptions();
4555 if (state.editingId || state.previewGatewayId) {
4556 const current = activeGateway();
4557 if (!current) {
4558 state.previewGatewayId = '';
4559 state.lastTestResult = null;
4560 }
4561 refreshSnippetPreview();
4562 }
4563 renderManagedStatus();
4564 const countMsg = tf('gateway_count', '{count} gateway share(s).').replace('{count}', String(state.gateways.length));
4565 setStatus(countMsg, 'muted');
4566 } catch (err) {
4567 console.warn('Gateway list failed', err);
4568 state.gateways = [];
4569 renderList();
4570 renderManagedGatewayOptions();
4571 renderManagedStatus();
4572 setStatus(err?.message || tf('gateway_list_failed', 'Failed to load gateway shares.'), 'danger');
4573 }
4574 };
4575
4576 const runGatewayTest = async (id) => {
4577 if (!id) return;

Callers 3

saveGatewayFunction · 0.85
deleteGatewayFunction · 0.85
initGatewaysSectionFunction · 0.85

Calls 9

withBaseFunction · 0.85
activeGatewayFunction · 0.85
refreshSnippetPreviewFunction · 0.85
renderManagedStatusFunction · 0.85
setStatusFunction · 0.70
tfFunction · 0.70
safeJsonFunction · 0.70
renderListFunction · 0.70

Tested by

no test coverage detected