secubox-openwrt/package/secubox/luci-app-secubox-p2p/htdocs/luci-static/resources/view/secubox-p2p/services.js
CyberMind-FR 304ac7b9a1 feat: P2P App Store, Remote Access & Mesh Media packages
P2P App Store Emancipation:
- secubox-p2p: Package distribution via mesh peers (CGI API, RPCD, CLI)
- packages.js: LuCI view with LOCAL/PEER badges, fetch/install actions
- devstatus.js: Dev Status widget with Gitea commits, v1.0 progress tracking
- secubox-feed: sync-content command for auto-installing content packages
- ACL fix for P2P feed RPCD methods

Remote Access:
- secubox-app-rustdesk: Native hbbs/hbbr relay server from GitHub releases
- secubox-app-guacamole: LXC Debian container with guacd + Tomcat (partial)

Content Distribution:
- secubox-content-pkg: Auto-package Metablogizer/Streamlit as IPKs
- Auto-publish hooks in metablogizerctl and streamlitctl

Mesh Media:
- secubox-app-ksmbd: In-kernel SMB3 server with ksmbdctl CLI
- Pre-configured shares for Jellyfin, Lyrion, Backup

UI Consistency:
- client-guardian: Ported to sh-page-header chip layout
- auth-guardian: Ported to sh-page-header chip layout

Fixes:
- services.js: RPC expect unwrapping bug fix
- metablogizer: Chunked upload for uhttpd 64KB limit

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 00:33:53 +01:00

72 lines
2.2 KiB
JavaScript

'use strict';
'require view';
'require ui';
'require secubox-p2p/api as P2PAPI';
return view.extend({
services: [],
sharedServices: [],
load: function() {
var self = this;
return Promise.all([
P2PAPI.getServices(),
P2PAPI.getSharedServices()
]).then(function(results) {
// RPC expect unwraps the response - results[0] IS the services array
self.services = Array.isArray(results[0]) ? results[0] : (results[0].services || []);
self.sharedServices = Array.isArray(results[1]) ? results[1] : (results[1].shared_services || []);
return {};
}).catch(function() { return {}; });
},
render: function() {
var self = this;
return E('div', { 'class': 'cbi-map' }, [
E('h2', {}, 'P2P Services'),
E('div', { 'class': 'cbi-section' }, [
E('h3', {}, 'Local Services'),
E('table', { 'class': 'table' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th' }, 'Service'),
E('th', { 'class': 'th' }, 'Port'),
E('th', { 'class': 'th' }, 'Protocol'),
E('th', { 'class': 'th' }, 'Status')
])
].concat(this.services.map(function(svc) {
return E('tr', { 'class': 'tr' }, [
E('td', { 'class': 'td' }, svc.name),
E('td', { 'class': 'td' }, svc.port || '-'),
E('td', { 'class': 'td' }, svc.protocol || 'tcp'),
E('td', { 'class': 'td' }, E('span', { 'style': 'color: ' + (svc.status === 'running' ? 'green' : 'red') }, svc.status))
]);
})))
]),
E('div', { 'class': 'cbi-section' }, [
E('h3', {}, 'Shared Services from Peers'),
this.sharedServices.length > 0 ?
E('table', { 'class': 'table' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th' }, 'Service'),
E('th', { 'class': 'th' }, 'Peer'),
E('th', { 'class': 'th' }, 'Address')
])
].concat(this.sharedServices.map(function(svc) {
return E('tr', { 'class': 'tr' }, [
E('td', { 'class': 'td' }, svc.name),
E('td', { 'class': 'td' }, svc.peer || 'Unknown'),
E('td', { 'class': 'td' }, svc.address || '-')
]);
}))) :
E('p', {}, 'No shared services from peers.')
])
]);
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});