MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / network_utilities_menu

Function network_utilities_menu

Scripts/Settings.py:7563–7605  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7561 state.appsPath = (data.roots.find(function(root){ return root.label === 'DedSec'; }) || {}).path || data.current_path;
7562 data = await apiGet('/api/files?path=' + encodeURIComponent(state.appsPath));
7563 } else {
7564 state.appsPath = data.current_path;
7565 }
7566 document.getElementById('appsPath').textContent = data.current_path;
7567 document.getElementById('appsRoots').innerHTML = pathButtons(data.roots || []);
7568 bindRootButtons('appsRoots', function(newPath){ loadApps(newPath).catch(handleError); });
7569 var rows = [];
7570 if (data.parent_path) {
7571 rows.push('<div class="file-row"><div class="file-row-top"><div><div class="file-name">..</div><div class="file-meta">Go back</div></div></div><div class="file-actions"><button class="file-btn open-app-dir" data-path="' + escapeHtml(data.parent_path) + '">Open</button></div></div>');
7572 }
7573 rows = rows.concat(data.entries.map(function(entry) {
7574 var actions = [];
7575 if (entry.is_dir) {
7576 actions.push('<button class="file-btn open-app-dir" data-path="' + escapeHtml(entry.path) + '">Open</button>');
7577 }
7578 if (!entry.is_dir && entry.runnable) {
7579 actions.push('<button class="file-btn run-app-script" data-path="' + escapeHtml(entry.path) + '">Run</button>');
7580 }
7581 return '<div class="file-row"><div class="file-row-top"><div><div class="file-name">' + escapeHtml(entry.name) + '</div><div class="file-meta">' + (entry.is_dir ? t('Folder') : (entry.runnable ? t('Runnable file') : t('File'))) + '</div></div></div><div class="file-actions">' + actions.join('') + '</div></div>';
7582 }));
7583 document.getElementById('appsList').innerHTML = rows.join('');
7584 document.querySelectorAll('.open-app-dir').forEach(function(btn){
7585 btn.addEventListener('click', function(){ loadApps(btn.getAttribute('data-path')).catch(handleError); });
7586 });
7587 document.querySelectorAll('.run-app-script').forEach(function(btn){
7588 btn.addEventListener('click', function(){ runDedSec(btn.getAttribute('data-path')); });
7589 });
7590 }
7591
7592 async function runDedSec(path) {
7593 try {
7594 var data = await apiPost('/api/dedsec/run', { path: path });
7595 await refreshJobs(data.session.id);
7596 setActiveApp('terminal');
7597 showToast(t('Launched') + ' ' + (data.session.label || 'session'));
7598 } catch (err) { handleError(err); }
7599 }
7600
7601 async function loadStore() {
7602 var data = await apiGet('/api/programs');
7603 var items = data.programs || [];
7604 document.getElementById('storeList').innerHTML = items.map(function(program) {
7605 var actions = [
7606 '<button class="file-btn install-program" data-id="' + escapeHtml(program.id) + '">Install</button>',
7607 '<button class="file-btn run-program" data-id="' + escapeHtml(program.id) + '">Run</button>',
7608 '<button class="file-btn delete-program" data-id="' + escapeHtml(program.id) + '">Delete</button>',

Callers 1

mainFunction · 0.70

Calls 12

printFunction · 0.85
inputFunction · 0.85
network_print_statusFunction · 0.70
network_load_configFunction · 0.70
_Function · 0.70
network_disable_torFunction · 0.70
network_enable_torFunction · 0.70
network_disable_vpnFunction · 0.70
network_enable_vpnFunction · 0.70

Tested by

no test coverage detected