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:
@@ -1,8 +1,18 @@
|
||||
type StudioOpts = { user: string, userAppKey?: string; appIds: string[] }
|
||||
type StudioOpts = {
|
||||
user: string,
|
||||
userAppKey?: string;
|
||||
appIds: string[]
|
||||
infoList?: {
|
||||
user: string;
|
||||
id: string;
|
||||
status: 'waiting' | 'connected' | 'closed';
|
||||
}[]
|
||||
}
|
||||
export const createStudioAppListHtml = (opts: StudioOpts) => {
|
||||
const user = opts.user!;
|
||||
const userAppKey = opts?.userAppKey;
|
||||
let showUserAppKey = userAppKey;
|
||||
const infos = opts.infoList || [];
|
||||
if (showUserAppKey && showUserAppKey.startsWith(user + '--')) {
|
||||
showUserAppKey = showUserAppKey.replace(user + '--', '');
|
||||
}
|
||||
@@ -333,7 +343,7 @@ export const createStudioAppListHtml = (opts: StudioOpts) => {
|
||||
</div>
|
||||
` : ''}
|
||||
${appListContent}
|
||||
|
||||
<pre>${JSON.stringify(infos, null, 2)}</pre>
|
||||
<div class="footer">
|
||||
© ${new Date().getFullYear()} Studio - 应用管理
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user