SIMON Master Console Rebuild
True command center for SIMON + WEB360
This rebuild gives you a cleaner production spine: interactive tree, live viewer, guarded editor, dynamic graphics, architecture map, and note storage. It is designed to sit beside your existing
console.php
and become the stronger replacement path.
Dashboard
Tree
Viewer
System Map
File Registry
Notes
Files
15,338
Folders
408
Scanned Size
3.84 GB
PHP Files
890
Editable Text Files
12,599
File viewer
guarded to /htdocs
/web360/connlink/connector.php
<?php /** * /web360/connlink/connector.php * Universal carrier HTTP proxy. * * GET: * carrier=<key> required — must exist in registry.json * + any carrier-specific query overrides (merged into defaults) * * Reserved param names: carrier, action (not forwarded). * Secrets are never forwarded from the client; they are injected server-side via auth.php. * * Returns JSON: * { carrier, provider, category, http, latencyMs, cacheHit, itemCount, items[] } * * Route maps to sheet columns in Widget_Backend_Map + AI_Voice_Calendar_Bridge. */ declare(strict_types=1); header('Content-Type: application/json; charset=utf-8'); /* ---------- CORS ---------- */ $allowedOrigins = [ 'http://localhost:8000', 'http://127.0.0.1:8000', 'http://localhost', 'http://127.0.0.1', ]; $origin = $_SERVER['HTTP_ORIGIN'] ?? ''; if ($origin !== '' && in_array($origin, $allowedOrigins, true)) { header('Access-Control-Allow-Origin: ' . $origin); } else { // Same-origin requests will not have Origin; allow empty as well. header('Access-Control-Allow-Origin: ' . ($origin ?: '*')); } header('Vary: Origin'); header('Access-Control-Allow-Methods: GET, OPTIONS'); header('Access-Control-Allow-Headers: Content-Type'); if (($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'OPTIONS') { http_response_code(204); exit; } require_once __DIR__ . '/functions.php'; require_once __DIR__ . '/auth.php'; require_once __DIR__ . '/normalize.php'; /* ---------- Input ---------- */ $carrierKey = preg_replace('/[^a-z0-9_\-]/i', '', (string)($_GET['carrier'] ?? '')); if ($carrierKey === '') { http_response_code(400); echo json_encode(['error' => 'missing_carrier']); exit; } $registry = conn_load_registry(); if (!isset($registry[$carrierKey])) { http_response_code(404); echo json_encode(['error' => 'unknown_carrier', 'carrier' => $carrierKey]); exit; } $carrier = $registry[$carrierKey]; /* ---------- Param merge ---------- */ $reserved = ['carrier', 'action']; $clientParams = array_diff_key($_GET, array_flip($reserved)); // Very light whitelist: strings / numbers only, strip any auth-related keys the client might try foreach (['apiKey','api_key','token','access_token','authorization','Authorization'] as $blocked) { unset($clientParams[$blocked]); } $params = array_merge($carrier['defaults'] ?? [], $clientParams); /* ---------- Auth ---------- */ $auth = conn_resolve_auth($carrier); if (isset($auth['error'])) { http_response_code(500); conn_log_event($carrierKey, 'auth_error', ['error' => $auth['error']]); echo json_encode(['error' => $auth['error'], 'carrier' => $carrierKey]); exit; } $params = array_merge($params, $auth['query'] ?? []); $headers = array_merge($carrier['headers'] ?? [], $auth['headers'] ?? []); /* ---------- Cache ---------- */ $safeParams = $params; foreach (($auth['query'] ?? []) as $k => $_) unset($safeParams[$k]); $cacheKey = $carrierKey . '_' . substr(sha1(json_encode($safeParams)), 0, 10); $ttl = (int)($carrier['cacheTtlSec'] ?? 300); if ($cached = conn_cache_get($cacheKey, $ttl)) { echo json_encode(array_merge($cached, ['cacheHit' => true])); exit; } /* ---------- Execute ---------- */ $url = conn_build_url((string)$carrier['endpoint'], $params); $resp = conn_http_get($url, $headers, 12); $raw = $resp['body'] ? (json_decode($resp['body'], true) ?? []) : []; $items = conn_normalize((string)($carrier['normalizationProfile'] ?? ''), $raw); $result = [ 'carrier' => $carrierKey, 'provider' => $carrier['provider'] ?? '', 'category' => $carrier['category'] ?? '', 'http' => $resp['http'], 'latencyMs' => $resp['latencyMs'], 'cacheHit' => false, 'itemCount' => count($items), 'items' => $items, ]; if ($resp['http'] >= 200 && $resp['http'] < 300 && count($items) > 0) { conn_cache_put($cacheKey, $result); } conn_log_event( $carrierKey, ($resp['http'] >= 200 && $resp['http'] < 300) ? 'feed_fetch' : 'feed_error', [ 'http' => $resp['http'], 'latencyMs' => $resp['latencyMs'], 'itemCount' => count($items), 'error' => $resp['error'] ?? null, ] ); if ($resp['http'] >= 400) { http_response_code($resp['http']); $result['error'] = $resp['error'] ?: ('HTTP ' . $resp['http']); } echo json_encode($result, JSON_UNESCAPED_SLASHES);
Save file
Quick jump
open a path
Open