mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
PHP 8.1 support preparations
This commit is contained in:
@@ -6,7 +6,7 @@ use App\Server\Connections\ControlConnection;
|
|||||||
use App\Server\Connections\HttpConnection;
|
use App\Server\Connections\HttpConnection;
|
||||||
use Ratchet\ConnectionInterface;
|
use Ratchet\ConnectionInterface;
|
||||||
|
|
||||||
interface connectionmanager
|
interface ConnectionManager
|
||||||
{
|
{
|
||||||
public function storeConnection(string $host, ?string $subdomain, ?string $serverHost, ConnectionInterface $connection): ControlConnection;
|
public function storeConnection(string $host, ?string $subdomain, ?string $serverHost, ConnectionInterface $connection): ControlConnection;
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class LoggedRequest implements \JsonSerializable
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class Configuration implements \JsonSerializable
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return array_merge([
|
return array_merge([
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ abstract class AdminController extends Controller
|
|||||||
protected function shouldHandleRequest(Request $request, ConnectionInterface $httpConnection): bool
|
protected function shouldHandleRequest(Request $request, ConnectionInterface $httpConnection): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$authorization = Str::after($request->header('Authorization'), 'Basic ');
|
$authorization = Str::after($request->header('Authorization', ''), 'Basic ');
|
||||||
$authParts = explode(':', base64_decode($authorization), 2);
|
$authParts = explode(':', base64_decode($authorization), 2);
|
||||||
[$user, $password] = $authParts;
|
[$user, $password] = $authParts;
|
||||||
|
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Server\Http\Controllers\Admin;
|
|
||||||
|
|
||||||
use App\Contracts\UserRepository;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Ratchet\ConnectionInterface;
|
|
||||||
|
|
||||||
class StoreUsersController extends AdminController
|
|
||||||
{
|
|
||||||
protected $keepConnectionOpen = true;
|
|
||||||
|
|
||||||
/** @var UserRepository */
|
|
||||||
protected $userRepository;
|
|
||||||
|
|
||||||
public function __construct(UserRepository $userRepository)
|
|
||||||
{
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(Request $request, ConnectionInterface $httpConnection)
|
|
||||||
{
|
|
||||||
$validator = Validator::make($request->all(), [
|
|
||||||
'name' => 'required',
|
|
||||||
], [
|
|
||||||
'required' => 'The :attribute field is required.',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($validator->fails()) {
|
|
||||||
$httpConnection->send(respond_json(['errors' => $validator->getMessageBag()], 401));
|
|
||||||
$httpConnection->close();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$insertData = [
|
|
||||||
'name' => $request->get('name'),
|
|
||||||
'auth_token' => $request->get('token', (string) Str::uuid()),
|
|
||||||
'can_specify_subdomains' => (int) $request->get('can_specify_subdomains'),
|
|
||||||
'can_specify_domains' => (int) $request->get('can_specify_domains'),
|
|
||||||
'can_share_tcp_ports' => (int) $request->get('can_share_tcp_ports'),
|
|
||||||
'max_connections' => (int) $request->get('max_connections'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->userRepository
|
|
||||||
->storeUser($insertData)
|
|
||||||
->then(function ($user) use ($httpConnection) {
|
|
||||||
$httpConnection->send(respond_json(['user' => $user], 200));
|
|
||||||
$httpConnection->close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -332,7 +332,7 @@ class ControlMessageController implements MessageComponentInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (count($foundSubdomains) > 0 && ! is_null($user) && is_null($ownSubdomain)) {
|
if (count($foundSubdomains) > 0 && ! is_null($user) && is_null($ownSubdomain)) {
|
||||||
$message = config('expose.admin.messages.subdomain_reserved');
|
$message = config('expose.admin.messages.subdomain_reserved', '');
|
||||||
$message = str_replace(':subdomain', $subdomain, $message);
|
$message = str_replace(':subdomain', $subdomain, $message);
|
||||||
|
|
||||||
$connection->send(json_encode([
|
$connection->send(json_encode([
|
||||||
|
|||||||
BIN
builds/expose
BIN
builds/expose
Binary file not shown.
@@ -27,6 +27,7 @@
|
|||||||
"clue/reactphp-sqlite": "dev-modular-worker-for-phar-support",
|
"clue/reactphp-sqlite": "dev-modular-worker-for-phar-support",
|
||||||
"guzzlehttp/guzzle": "^7.2",
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
"guzzlehttp/psr7": "^1.7",
|
"guzzlehttp/psr7": "^1.7",
|
||||||
|
"illuminate/log": "^8.0",
|
||||||
"illuminate/http": "5.8.* || ^6.0 || ^7.0 || ^8.0",
|
"illuminate/http": "5.8.* || ^6.0 || ^7.0 || ^8.0",
|
||||||
"illuminate/pipeline": "^7.6 || ^8.0",
|
"illuminate/pipeline": "^7.6 || ^8.0",
|
||||||
"illuminate/validation": "^7.7 || ^8.0",
|
"illuminate/validation": "^7.7 || ^8.0",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'version' => '2.0.2',
|
'version' => '2.1.0',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -59,4 +59,6 @@ return [
|
|||||||
Illuminate\Translation\TranslationServiceProvider::class,
|
Illuminate\Translation\TranslationServiceProvider::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'locale' => 'en',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
2
expose
2
expose
@@ -19,7 +19,7 @@ define('LARAVEL_START', microtime(true));
|
|||||||
|
|
||||||
$autoloader = require file_exists(__DIR__.'/vendor/autoload.php') ? __DIR__.'/vendor/autoload.php' : __DIR__.'/../../autoload.php';
|
$autoloader = require file_exists(__DIR__.'/vendor/autoload.php') ? __DIR__.'/vendor/autoload.php' : __DIR__.'/../../autoload.php';
|
||||||
|
|
||||||
$options = getopt(null, [
|
$options = getopt('', [
|
||||||
'sqlite-worker',
|
'sqlite-worker',
|
||||||
]);
|
]);
|
||||||
if (isset($options['sqlite-worker'])) {
|
if (isset($options['sqlite-worker'])) {
|
||||||
|
|||||||
@@ -484,7 +484,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else class="flex-col bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-lg justify-center items-center flex py-4">
|
<div v-else class="flex-col bg-white dark:bg-gray-800 shadow overflow-hidden sm:rounded-lg justify-center items-center flex py-4">
|
||||||
<h1 class="text-lg">Waiting for connections...</h1>
|
<h1 class="text-lg">Waiting for connections...</h1>
|
||||||
<img src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl={{ subdomains[0] | url_encode }}&choe=UTF-8&chf=bg,s,FFFFFF00" />
|
<img src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl={{ subdomains[0] ?? '' | url_encode }}&choe=UTF-8&chf=bg,s,FFFFFF00" />
|
||||||
<a class="text-sm" href="{{ subdomains[0] }}" target="_blank">{{ subdomains[0] }}</a>
|
<a class="text-sm" href="{{ subdomains[0] }}" target="_blank">{{ subdomains[0] }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user