mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
@@ -65,13 +65,13 @@ class Client
|
||||
});
|
||||
|
||||
$connection->on('authenticationFailed', function ($data) use ($deferred) {
|
||||
$this->logger->error($data->data->message);
|
||||
$this->logger->error($data->message);
|
||||
|
||||
$this->exit($deferred);
|
||||
});
|
||||
|
||||
$connection->on('subdomainTaken', function ($data) use ($deferred) {
|
||||
$this->logger->error($data->data->message);
|
||||
$this->logger->error($data->message);
|
||||
|
||||
$this->exit($deferred);
|
||||
});
|
||||
@@ -94,6 +94,7 @@ class Client
|
||||
$host .= ":{$this->configuration->port()}";
|
||||
}
|
||||
|
||||
$this->logger->info($data->message);
|
||||
$this->logger->info("Connected to {$httpProtocol}://{$data->subdomain}.{$host}");
|
||||
|
||||
static::$subdomains[] = "$data->subdomain.{$this->configuration->host()}:{$this->configuration->port()}";
|
||||
|
||||
@@ -34,10 +34,10 @@ class ControlConnection
|
||||
$this->socket->on('message', function (Message $message) {
|
||||
$decodedEntry = json_decode($message);
|
||||
|
||||
$this->emit($decodedEntry->event ?? '', [$decodedEntry]);
|
||||
$this->emit($decodedEntry->event ?? '', [$decodedEntry->data]);
|
||||
|
||||
if (method_exists($this, $decodedEntry->event ?? '')) {
|
||||
call_user_func([$this, $decodedEntry->event], $decodedEntry);
|
||||
call_user_func([$this, $decodedEntry->event], $decodedEntry->data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,8 +45,10 @@ class ControlConnection
|
||||
{
|
||||
$this->socket->send(json_encode([
|
||||
'event' => 'createProxy',
|
||||
'data' => [
|
||||
'request_id' => $requestId,
|
||||
'client_id' => $this->client_id,
|
||||
],
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@ class SaveSettingsController extends AdminController
|
||||
{
|
||||
config()->set('expose.admin.validate_auth_tokens', $request->has('validate_auth_tokens'));
|
||||
|
||||
config()->set('expose.admin.messages.invalid_auth_token', $request->get('invalid_auth_token'));
|
||||
|
||||
config()->set('expose.admin.messages.subdomain_taken', $request->get('subdomain_taken'));
|
||||
|
||||
config()->set('expose.admin.messages.message_of_the_day', $request->get('motd'));
|
||||
|
||||
$httpConnection->send(str(new Response(301, [
|
||||
'Location' => '/settings'
|
||||
])));
|
||||
|
||||
@@ -89,8 +89,11 @@ class ControlMessageController implements MessageComponentInterface
|
||||
|
||||
$connection->send(json_encode([
|
||||
'event' => 'authenticated',
|
||||
'data' => [
|
||||
'message' => config('expose.admin.messages.message_of_the_day'),
|
||||
'subdomain' => $connectionInfo->subdomain,
|
||||
'client_id' => $connectionInfo->client_id
|
||||
],
|
||||
]));
|
||||
}, function () use ($connection) {
|
||||
$connection->send(json_encode([
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Expose</title>
|
||||
<meta charset="UTF-8">
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tailwindcss/ui@latest/dist/tailwind-ui.min.css">
|
||||
</head>
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
<div role="group" aria-labelledby="label-email">
|
||||
<div class="sm:grid sm:grid-cols-3 sm:gap-4 sm:items-baseline">
|
||||
<div>
|
||||
<div class="text-base leading-6 font-medium text-gray-900 sm:text-sm sm:leading-5 sm:text-gray-700" id="label-email">
|
||||
<div
|
||||
class="text-base leading-6 font-medium text-gray-900 sm:text-sm sm:leading-5 sm:text-gray-700"
|
||||
id="label-email">
|
||||
Authentication
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,16 +26,70 @@
|
||||
name="validate_auth_tokens"
|
||||
value="1"
|
||||
{% if configuration.validate_auth_tokens %} checked="checked" {% endif %}
|
||||
class="form-checkbox h-4 w-4 text-indigo-600 transition duration-150 ease-in-out" />
|
||||
class="form-checkbox h-4 w-4 text-indigo-600 transition duration-150 ease-in-out"/>
|
||||
</div>
|
||||
<div class="pl-7 text-sm leading-5">
|
||||
<label for="authentication" class="font-medium text-gray-700">Require authentication tokens</label>
|
||||
<p class="text-gray-500">Only allow connection from clients with valid authentication tokens</p>
|
||||
<label for="authentication" class="font-medium text-gray-700">Require
|
||||
authentication tokens</label>
|
||||
<p class="text-gray-500">Only allow connection from clients with
|
||||
valid authentication tokens</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-6 sm:mt-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-200 sm:pt-5">
|
||||
<label for="motd"
|
||||
class="block text-sm font-medium leading-5 text-gray-700 sm:mt-px sm:pt-2">
|
||||
Message of the day
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0 sm:col-span-2">
|
||||
<div class="max-w-lg flex rounded-md shadow-sm">
|
||||
<textarea id="motd" name="motd" rows="3"
|
||||
class="form-textarea block w-full transition duration-150 ease-in-out sm:text-sm sm:leading-5">{{ attribute(configuration, 'messages.message_of_the_day') }}</textarea>
|
||||
</div>
|
||||
<p class="mt-2 text-sm text-gray-500">This message will be shown, when a
|
||||
successful connection can be established.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-6 sm:mt-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-200 sm:pt-5">
|
||||
<label for="invalid_auth_token"
|
||||
class="block text-sm font-medium leading-5 text-gray-700 sm:mt-px sm:pt-2">
|
||||
Authentication Failed
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0 sm:col-span-2">
|
||||
<div class="max-w-lg flex rounded-md shadow-sm">
|
||||
<textarea id="invalid_auth_token"
|
||||
name="invalid_auth_token"
|
||||
rows="3"
|
||||
class="form-textarea block w-full transition duration-150 ease-in-out sm:text-sm sm:leading-5">{{ attribute(configuration, 'messages.invalid_auth_token') }}</textarea>
|
||||
</div>
|
||||
<p class="mt-2 text-sm text-gray-500">This message will be shown, when a
|
||||
user tries to connect with an invalid authentication token.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-6 sm:mt-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-200 sm:pt-5">
|
||||
<label for="subdomain_taken"
|
||||
class="block text-sm font-medium leading-5 text-gray-700 sm:mt-px sm:pt-2">
|
||||
Subdomain taken
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0 sm:col-span-2">
|
||||
<div class="max-w-lg flex rounded-md shadow-sm">
|
||||
<textarea id="subdomain_taken" name="subdomain_taken" rows="3"
|
||||
class="form-textarea block w-full transition duration-150 ease-in-out sm:text-sm sm:leading-5">{{ attribute(configuration, 'messages.subdomain_taken') }}</textarea>
|
||||
</div>
|
||||
<p class="mt-2 text-sm text-gray-500">This message will be shown, when a
|
||||
user tries to connect with an already registered subdomain. You can use
|
||||
<code class="font-mono bg-gray-500 text-white p-1">:subdomain</code> as
|
||||
a placeholder.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user