mirror of
https://github.com/appwrite/appwrite
synced 2026-05-21 07:58:55 +00:00
debug platforms
This commit is contained in:
parent
59c41478ca
commit
9b58ae7ff5
1 changed files with 16 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ use Utopia\DSN\DSN;
|
|||
use Utopia\Logger\Log;
|
||||
use Utopia\System\System;
|
||||
use Utopia\Telemetry\Adapter\None as NoTelemetry;
|
||||
use Utopia\Validator\Hostname;
|
||||
use Utopia\WebSocket\Adapter;
|
||||
use Utopia\WebSocket\Server;
|
||||
|
||||
|
|
@ -533,6 +534,21 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
|||
* Skip this check for non-web platforms which are not required to send an origin header.
|
||||
*/
|
||||
$origin = $request->getOrigin();
|
||||
$hostnames = explode(',', System::getEnv('_APP_CONSOLE_HOSTNAMES', ''));
|
||||
$validator = new Hostname();
|
||||
foreach ($hostnames as $hostname) {
|
||||
$hostname = trim($hostname);
|
||||
if (!$validator->isValid($hostname)) {
|
||||
continue;
|
||||
}
|
||||
$console->setAttribute('platforms', [
|
||||
'$collection' => ID::custom('platforms'),
|
||||
'type' => Origin::CLIENT_TYPE_WEB,
|
||||
'name' => $hostname,
|
||||
'hostname' => $hostname,
|
||||
], Document::SET_TYPE_APPEND);
|
||||
}
|
||||
|
||||
var_dump([
|
||||
'_APP_CONSOLE_HOSTNAMES' => System::getEnv('_APP_CONSOLE_HOSTNAMES'),
|
||||
'platforms '=> $console->getAttribute('platforms', [])
|
||||
|
|
|
|||
Loading…
Reference in a new issue