Anpassenden der Websocket Konfiguration

main
boban 2025-09-29 02:32:33 +02:00
parent 08c58699ba
commit 75ffc68c78
6 changed files with 54 additions and 52 deletions

30
an config:clear Normal file
View File

@ -0,0 +1,30 @@
SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS
Commands marked with * may be preceded by a number, _N.
Notes in parentheses indicate the behavior if _N is given.
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
h H Display this help.
q :q Q :Q ZZ Exit.
---------------------------------------------------------------------------
MMOOVVIINNGG
e ^E j ^N CR * Forward one line (or _N lines).
y ^Y k ^K ^P * Backward one line (or _N lines).
f ^F ^V SPACE * Forward one window (or _N lines).
b ^B ESC-v * Backward one window (or _N lines).
z * Forward one window (and set window to _N).
w * Backward one window (and set window to _N).
ESC-SPACE * Forward one window, but don't stop at end-of-file.
d ^D * Forward one half-window (and set half-window to _N).
u ^U * Backward one half-window (and set half-window to _N).
ESC-) RightArrow * Right one half screen width (or _N positions).
ESC-( LeftArrow * Left one half screen width (or _N positions).
ESC-} ^RightArrow Right to last column displayed.
ESC-{ ^LeftArrow Left to first column.
F Forward forever; like "tail -f".
ESC-F Like F but stop when search pattern is found.
r ^R ^L Repaint screen.
R

View File

@ -52,7 +52,7 @@ return [
'secret' => env('REVERB_APP_SECRET'),
'app_id' => env('REVERB_APP_ID'),
'options' => [
'host' => env('REVERB_HOST'), // öffentlich (gleicht VITE_REVERB_HOST)
'host' => env('REVERB_HOST'),
'port' => (int) env('REVERB_PORT', 443),
'scheme' => env('REVERB_SCHEME', 'https'),
'path' => env('REVERB_PATH', '/ws'),

View File

@ -3,4 +3,4 @@ window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
import './webserver/websocket.js'
import './webserver/websocket.js';

View File

@ -1,46 +1,18 @@
// resources/js/plugins/connector.js
function readMetaConfig() {
const el = (typeof document !== 'undefined')
? document.querySelector('meta[name="reverb"]')
: null;
if (!el) return null;
const { host, port, scheme, path, key } = el.dataset; // data-*
function fromWindow() {
const isHttps = typeof window !== 'undefined' && window.location.protocol === 'https:'
return {
host: host || null,
port: port ? Number(port) : null,
scheme: scheme || null,
path: path || null,
key: key || null,
};
host: (typeof window !== 'undefined' && window.location.hostname) || '127.0.0.1',
port: isHttps ? 443 : 80,
scheme: isHttps ? 'https' : 'http',
path: '/ws',
key: import.meta?.env?.VITE_REVERB_APP_KEY || ''
}
}
const meta = readMetaConfig()
const fallback = readViteEnv()
const base = meta ?? fallback ?? fromWindow()
function readViteEnv() {
const env = (typeof import.meta !== 'undefined' && import.meta.env) ? import.meta.env : {};
return {
host: env.VITE_REVERB_HOST || env.APP_HOST || '127.0.0.1',
port: env.VITE_REVERB_PORT ? Number(env.VITE_REVERB_PORT) : 443,
scheme: (env.VITE_REVERB_SCHEME || 'https').toLowerCase(),
path: env.VITE_REVERB_PATH || '/ws',
key: env.VITE_REVERB_APP_KEY || 'mailwolt-yhp47tbt1aebhr1fgvgj',
};
// harte Korrektur: NIEMALS 8080 nach außen geben
if (Number(base.port) === 8080 && (base.scheme || 'https').startsWith('http')) {
base.port = (base.scheme === 'https') ? 443 : 80
}
function normalize(cfg) {
const c = { ...cfg };
if (!c.path || typeof c.path !== 'string') c.path = '/ws';
if (!c.path.startsWith('/')) c.path = '/' + c.path;
c.wsScheme = (c.scheme === 'http' ? 'ws' : 'wss');
return c;
}
const fromMeta = readMetaConfig();
const base = fromMeta ?? readViteEnv();
export const wsConfig = normalize({
host: base.host || '127.0.0.1',
port: base.port || 443,
scheme: base.scheme || 'https',
path: base.path || '/ws',
key: base.key || 'mailwolt-yhp47tbt1aebhr1fgvgj',
});

View File

@ -1,14 +1,14 @@
import Echo from 'laravel-echo'
import Pusher from 'pusher-js'
import {wsConfig} from "./connector.js";
import { wsConfig } from './connector.js'
window.Pusher = Pusher
const host = wsConfig.host || window.location.hostname
const port = Number(wsConfig.port) || 443 // <- post -> port
const port = Number(wsConfig.port) || 443 // <— port!
const scheme = (wsConfig.scheme || 'https').toLowerCase()
const path = wsConfig.path || '/ws'
const tls = scheme === 'https'
const tls = scheme === 'https' // <— boolean
const key = wsConfig.key
window.Echo = new Echo({
@ -18,6 +18,6 @@ window.Echo = new Echo({
wsPort: port,
wssPort: port,
forceTLS: tls,
enabledTransports: ['ws', 'wss'],
enabledTransports: ['ws','wss'],
wsPath: path,
})

View File

@ -4,11 +4,11 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="reverb"
data-host="{{ config('reverb.servers.reverb.host') }}"
data-port="{{ config('reverb.servers.reverb.port') }}"
data-scheme="{{ config('reverb.servers.reverb.scheme') }}"
data-host="{{ request()->getHost() }}"
data-port="{{ request()->isSecure() ? 443 : 80 }}"
data-scheme="{{ request()->isSecure() ? 'https' : 'http' }}"
data-path="{{ config('reverb.servers.reverb.path') }}"
data-key="{{ config('reverb.servers.reverb.key') }}">
data-key="{{ env('REVERB_APP_KEY') }}">
<title>@yield('title', config('app.name'))</title>
@vite(['resources/css/app.css','resources/js/app.js'])
@livewireStyles