feat: enhance WebSocket proxy with user connection management and status reporting
- Updated StudioOpts type to include infoList for user connection status. - Added rendering of connection info in createStudioAppListHtml. - Modified self-restart logic to use a specific app path. - Improved WebSocket connection handling in wsProxyManager, including user registration and ID management. - Implemented connection status checks and responses in UserV1Proxy. - Introduced renderServerHtml function to inject server data into HTML responses. - Refactored page-proxy request handling for better URL management.
This commit is contained in:
@@ -184,7 +184,7 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
|
||||
/**
|
||||
* url是pathname的路径
|
||||
*/
|
||||
const url = pathname;
|
||||
const url = pathname || '';
|
||||
if (!domainApp && noProxyUrl.includes(url)) {
|
||||
if (url === '/') {
|
||||
rediretHome(req, res);
|
||||
@@ -312,13 +312,14 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
|
||||
const indexFile = isExist.indexFilePath; // 已经必定存在了
|
||||
try {
|
||||
let appFileUrl: string;
|
||||
if (domainApp) {
|
||||
appFileUrl = (url + '').replace(`/`, '');
|
||||
} else {
|
||||
appFileUrl = (url + '').replace(`/${user}/${app}/`, '');
|
||||
}
|
||||
|
||||
appFileUrl = url.replace(`/${user}/${app}/`, '');
|
||||
appFileUrl = decodeURIComponent(appFileUrl); // Decode URL components
|
||||
let appFile = await userApp.getFile(appFileUrl);
|
||||
if (!appFile && domainApp) {
|
||||
const domainAppFileUrl = url.replace(`/`, '');
|
||||
appFile = await userApp.getFile(domainAppFileUrl);
|
||||
}
|
||||
if (!appFile && url.endsWith('/')) {
|
||||
appFile = await userApp.getFile(appFileUrl + 'index.html');
|
||||
} else if (!appFile && !url.endsWith('/')) {
|
||||
|
||||
Reference in New Issue
Block a user