Kumpulan perubahan yang udah numpuk di working tree: refactor Setup (Gate/Vehicle/Member), rapihin memberin & stiker, service parking baru (ParkingUtilsServices, NetworkService), model/migration lot-parking & DHCP reservation, dan fitur baru Intercom (controller/model/migration/ view). ReportTransaksiController versi lokal ini WIP (~90%, masih didebug) - versi yang bener ada di server, jadi dikeluarin dari git (ditambahin ke .gitignore) biar gak numpuk nindihin punya server pas git pull di sana. Sekalian keluarin dump mentah tabel softseting (1.8MB, nyasar ke-commit), file .bak, dan arsip ad-hoc (api.tgz, c.zip) yang emang bukan source code. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EAJc2mrpj2cSTe4oowLPzQ
55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Intercom;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\IntercomCall;
|
|
|
|
class UIController extends Controller
|
|
{
|
|
// Dashboard operator pusat. Data real-time diambil via JS polling ke /api/v1/intercom/*.
|
|
public function index()
|
|
{
|
|
return view('Intercom.UI.index');
|
|
}
|
|
|
|
// Streaming/download rekaman per sesi. File ditulis Go relay (STORE_DIR).
|
|
public function recording($id)
|
|
{
|
|
$call = IntercomCall::findOrFail($id);
|
|
|
|
if (!$call->recording_path) {
|
|
abort(404, 'Belum ada rekaman untuk sesi ini');
|
|
}
|
|
|
|
$path = $call->recording_path;
|
|
|
|
// Amankan: hanya basename, cari di kandidat folder (relatif project + /opt).
|
|
$candidates = [
|
|
$path,
|
|
storage_path('app/intercom/' . basename($path)),
|
|
'/opt/intercom-relay/storage/' . basename($path),
|
|
];
|
|
|
|
$real = null;
|
|
foreach ($candidates as $c) {
|
|
if ($c && is_file($c)) {
|
|
$real = $c;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!$real) {
|
|
abort(404, 'File rekaman tidak ditemukan di server: ' . basename($path));
|
|
}
|
|
|
|
// File dari Go relay berupa raw PCM 16kHz mono 16-bit.
|
|
// Disajikan sebagai octet-stream biar bisa di-download / ffplay.
|
|
// Nanti kalau relay sudah tulis header WAV, ganti ke audio/wav.
|
|
return response()->file($real, [
|
|
'Content-Type' => 'application/octet-stream',
|
|
'Content-Disposition' => 'attachment; filename="' . basename($real) . '"',
|
|
]);
|
|
}
|
|
}
|