Remove temporary media debug messaging and proxy logging

This commit is contained in:
Jage9
2026-02-22 03:14:01 -05:00
parent f79d944f32
commit e433f3b142
4 changed files with 2 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
window.CHGRID_WEB_VERSION = "2026.02.22 R141";
window.CHGRID_WEB_VERSION = "2026.02.22 R142";
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -162,23 +162,13 @@ type RadioSpatialConfig = {
export class RadioStationRuntime {
private readonly sharedRadioSources = new Map<string, SharedRadioSource>();
private readonly itemRadioOutputs = new Map<string, ItemRadioOutput>();
private readonly lastStreamStatusAt = new Map<string, number>();
private layerEnabled = true;
constructor(
private readonly audio: AudioEngine,
private readonly getSpatialConfig: (item: WorldItem) => RadioSpatialConfig,
private readonly onStreamStatus?: (message: string) => void,
) {}
private reportStreamStatus(message: string, dedupeKey: string): void {
const now = Date.now();
const lastAt = this.lastStreamStatusAt.get(dedupeKey) ?? 0;
if (now - lastAt < 3000) return;
this.lastStreamStatusAt.set(dedupeKey, now);
this.onStreamStatus?.(message);
}
cleanup(itemId: string): void {
const output = this.itemRadioOutputs.get(itemId);
if (!output) return;
@@ -327,18 +317,6 @@ export class RadioStationRuntime {
element.crossOrigin = 'anonymous';
element.loop = true;
element.preload = 'none';
element.addEventListener('error', () => {
this.reportStreamStatus(
`Media stream failed: ${streamUrl}`,
`error:${streamUrl}`,
);
});
element.addEventListener('canplay', () => {
this.reportStreamStatus(
`Media stream ready: ${streamUrl}`,
`ready:${streamUrl}`,
);
});
const source = audioCtx.createMediaElementSource(element);
void element.play().catch(() => undefined);
const shared: SharedRadioSource = {

View File

@@ -185,7 +185,7 @@ let outputMode = localStorage.getItem(AUDIO_OUTPUT_MODE_STORAGE_KEY) === 'mono'
let connecting = false;
const messageBuffer: string[] = [];
let messageCursor = -1;
const radioRuntime = new RadioStationRuntime(audio, getItemSpatialConfig, (message) => updateStatus(message));
const radioRuntime = new RadioStationRuntime(audio, getItemSpatialConfig);
const itemEmitRuntime = new ItemEmitRuntime(audio, resolveIncomingSoundUrl, getItemSpatialConfig);
let internalClipboardText = '';
let replaceTextOnNextType = false;

View File

@@ -12,27 +12,6 @@
* - Provides same-origin endpoint for browser playback.
*/
ini_set('display_errors', '0');
ini_set('log_errors', '1');
error_reporting(E_ALL);
function proxy_log_path()
{
$tmp = sys_get_temp_dir();
if (!is_string($tmp) || $tmp === '') {
$tmp = '/tmp';
}
return rtrim($tmp, '/\\') . '/chgrid_media_proxy_error.log';
}
ini_set('error_log', proxy_log_path());
function proxy_debug_log($message)
{
$line = date('c') . ' ' . $message . PHP_EOL;
@file_put_contents(proxy_log_path(), $line, FILE_APPEND);
}
$GLOBALS['CHGRID_PROXY_HEADERS_SENT'] = false;
$GLOBALS['CHGRID_PROXY_STATUS'] = 200;
$GLOBALS['CHGRID_PROXY_UP_HEADERS'] = array();
@@ -113,17 +92,6 @@ function proxy_write_callback($ch, $chunk)
return $len;
}
register_shutdown_function(function () {
$e = error_get_last();
if (!$e) {
return;
}
proxy_debug_log('FATAL: ' . json_encode($e));
});
proxy_debug_log('START method=' . (isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'unknown') . ' uri=' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''));
header('X-ChatGrid-MediaProxy: reached');
function set_status($code)
{
$map = array(
@@ -262,7 +230,6 @@ $ok = curl_exec($ch);
if ($ok === false) {
$err = curl_error($ch);
curl_close($ch);
proxy_debug_log('ERROR curl_exec failed: ' . $err);
send_text(502, 'upstream fetch failed: ' . $err);
}