feat: patient view, media player, and rich editor enhancements

This commit is contained in:
SajjadMahmoody
2026-04-23 21:24:36 +03:30
parent 95592aa510
commit 063b20d26f
101 changed files with 9648 additions and 117 deletions
+32
View File
@@ -36,6 +36,38 @@ public static function fromConfig(): static
);
}
public function ping(): array
{
if (! $this->isConfigured()) {
return ['connected' => false, 'path' => null];
}
$ip = escapeshellarg($this->peerIp);
$cmd = PHP_OS_FAMILY === 'Windows'
? "ping -n 1 -w 1000 {$ip}"
: "ping -c 1 -W 1 {$ip}";
exec($cmd . ' 2>&1', $output, $exitCode);
if ($exitCode !== 0) {
return ['connected' => false, 'path' => null];
}
$path = null;
try {
$response = Http::timeout(3)
->withHeader('X-Sync-Token', $this->token)
->get("http://{$this->peerIp}:{$this->peerPort}/api/sync/ping");
if ($response->successful() && $response->json('status') === 'ok') {
$path = $response->json('path');
}
} catch (\Throwable) {
}
return ['connected' => true, 'path' => $path];
}
public function isConfigured(): bool
{
return $this->peerIp !== '' && $this->token !== '';