Browse Source

Fix errors when the daemon is not started

feature/bump-dependencies
Timothée Jaussoin 2 months ago
parent
commit
ca648dfa68
  1. 12
      app/Helpers/UtilsHelper.php
  2. 4
      app/Views/page.tpl

12
app/Helpers/UtilsHelper.php

@ -825,6 +825,8 @@ function requestURL(string $url, int $timeout = 10, bool $json = false, array $h
*/
function requestAPI(string $action, int $timeout = 2, ?array $post = null): string|false
{
if (!file_exists(API_SOCKET)) return false;
$browser = (new React\Http\Browser(
new React\Socket\FixedUriConnector(
API_SOCKET,
@ -849,6 +851,16 @@ function requestAPI(string $action, int $timeout = 2, ?array $post = null): stri
}
}
/**
* Get the motification time of the API socket file
*/
function socketAPITime(): int
{
if (!file_exists(API_SOCKET)) return 0;
return filemtime(API_SOCKET);
}
/**
* @desc Get distance between two coordinates
*

4
app/Views/page.tpl

@ -15,12 +15,12 @@
<link rel="stylesheet" href="<?php echo
\Movim\Route::urlize('colors') .
'?t=' .
filemtime(CACHE_PATH . 'socketapi.sock');
socketAPITime();
?>" type="text/css" />
<script src="<?php echo
\Movim\Route::urlize('system') .
'?t=' .
filemtime(CACHE_PATH . 'socketapi.sock');
socketAPITime();
?>" defer></script>
<meta name="viewport" content="width=device-width, user-scalable=no">
<%scripts%>

Loading…
Cancel
Save