支持了手动配置ui的path
This commit is contained in:
parent
93d8a7c852
commit
0b375696f2
|
|
@ -314,9 +314,12 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
|||
router.get(connector.getEndpointRouter(), async (ctx) => {
|
||||
ctx.response.body = endpoints;
|
||||
});
|
||||
const socketAdminMountRaw = ui?.path || '/socket-admin123123';
|
||||
const socketAdminMount = socketAdminMountRaw.startsWith('/')
|
||||
? socketAdminMountRaw : `/${socketAdminMountRaw}`;
|
||||
// 注册静态资源
|
||||
if (!ui?.disable) {
|
||||
koa.use((0, koa_mount_1.default)('/socket-admin', (0, koa_static_1.default)(socketAdminUI)));
|
||||
koa.use((0, koa_mount_1.default)(socketAdminMount, (0, koa_static_1.default)(socketAdminUI)));
|
||||
}
|
||||
koa.use(router.routes());
|
||||
koa.on('error', (err) => {
|
||||
|
|
@ -328,7 +331,7 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
|||
const host = hostname || 'localhost';
|
||||
const port = nginx?.port || (clusterInfo.usingCluster ? (process.env.PM2_PORT || 8080) : serverConfiguration.port);
|
||||
const baseUrl = `${protocol}://${host}:${port}`;
|
||||
const adminUIUrl = `${baseUrl}/socket-admin`;
|
||||
const adminUIUrl = `${baseUrl}${socketAdminMount}`;
|
||||
console.log(chalk_1.default.greenBright.bold('\n🚀 Server started successfully!\n'));
|
||||
console.log(`🔗 ${chalk_1.default.cyan('Server URL')}: ${chalk_1.default.underline(baseUrl)}`);
|
||||
// socketio地址
|
||||
|
|
|
|||
|
|
@ -393,9 +393,12 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
|||
ctx.response.body = endpoints;
|
||||
});
|
||||
|
||||
const socketAdminMountRaw = ui?.path || '/socket-admin'
|
||||
const socketAdminMount = socketAdminMountRaw.startsWith('/')
|
||||
? socketAdminMountRaw : `/${socketAdminMountRaw}`;
|
||||
// 注册静态资源
|
||||
if (!ui?.disable) {
|
||||
koa.use(mount('/socket-admin', serve(socketAdminUI)));
|
||||
koa.use(mount(socketAdminMount, serve(socketAdminUI)));
|
||||
}
|
||||
|
||||
koa.use(router.routes());
|
||||
|
|
@ -410,7 +413,7 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
|||
const host = hostname || 'localhost';
|
||||
const port = nginx?.port || (clusterInfo.usingCluster ? (process.env.PM2_PORT || 8080) : serverConfiguration.port);
|
||||
const baseUrl = `${protocol}://${host}:${port}`;
|
||||
const adminUIUrl = `${baseUrl}/socket-admin`;
|
||||
const adminUIUrl = `${baseUrl}${socketAdminMount}`;
|
||||
|
||||
console.log(chalk.greenBright.bold('\n🚀 Server started successfully!\n'));
|
||||
console.log(`🔗 ${chalk.cyan('Server URL')}: ${chalk.underline(baseUrl)}`);
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
<svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet">
|
||||
<circle cx="128" cy="128" r="114" stroke="#FFF" stroke-width="20" fill="none" />
|
||||
<path d="M97.637 121.69c27.327-22.326 54.058-45.426 81.98-67.097-14.646 22.505-29.708 44.711-44.354 67.215-12.562.06-25.123.06-37.626-.119zM120.737 134.132c12.621 0 25.183 0 37.745.179-27.505 22.206-54.117 45.484-82.099 67.096 14.646-22.505 29.708-44.77 44.354-67.275z" fill="#FFF"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 473 B |
|
|
@ -1,4 +0,0 @@
|
|||
<svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet">
|
||||
<circle cx="128" cy="128" r="114" stroke="#010101" stroke-width="20" fill="none" />
|
||||
<path d="M97.637 121.69c27.327-22.326 54.058-45.426 81.98-67.097-14.646 22.505-29.708 44.711-44.354 67.215-12.562.06-25.123.06-37.626-.119zM120.737 134.132c12.621 0 25.183 0 37.745.179-27.505 22.206-54.117 45.484-82.099 67.096 14.646-22.505 29.708-44.77 44.354-67.275z" fill="#010101"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 478 B |
|
|
@ -1 +1,23 @@
|
|||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/socket-admin/favicon.png"><title>Socket.IO Admin For OAK</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link href="/socket-admin/css/app.cc95923b.css" rel="preload" as="style"><link href="/socket-admin/css/chunk-vendors.9f55d012.css" rel="preload" as="style"><link href="/socket-admin/js/app.8f417b7c.js" rel="preload" as="script"><link href="/socket-admin/js/chunk-vendors.1619c6bb.js" rel="preload" as="script"><link href="/socket-admin/css/chunk-vendors.9f55d012.css" rel="stylesheet"><link href="/socket-admin/css/app.cc95923b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but Socket.IO Admin For OAK doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/socket-admin/js/chunk-vendors.1619c6bb.js"></script><script src="/socket-admin/js/app.8f417b7c.js"></script></body></html>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.png"><title>Socket.IO Admin For OAK</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><script>(function() {
|
||||
const rawUrl= window.location.href.split('#')[0]
|
||||
const basePath = rawUrl.endsWith('/') ? rawUrl : rawUrl + '/';
|
||||
// 处理basePath
|
||||
window.__BASE_PATH__ = basePath;
|
||||
})();</script><script>(function(){
|
||||
const assetsList = ['css/app.cc95923b.css','js/app.b14a0147.js','css/chunk-vendors.9f55d012.css','js/chunk-vendors.1619c6bb.js']//inject
|
||||
const basePath = window.__BASE_PATH__;
|
||||
// 如果是js开头则创建script标签,css开头则创建link标签
|
||||
assetsList.forEach((item) => {
|
||||
const tag = item.startsWith('js') ? 'script' : 'link';
|
||||
const el = document.createElement(tag);
|
||||
if (tag === 'script') {
|
||||
el.src = basePath + item;
|
||||
el.async = true;
|
||||
} else {
|
||||
el.rel = 'stylesheet';
|
||||
el.href = basePath + item;
|
||||
}
|
||||
document.head.appendChild(el);
|
||||
});
|
||||
})()</script></head><script>// Additional script to handle dynamic loading
|
||||
console.log("Dynamic loading script initialized.");</script><body><noscript><strong>We're sorry but Socket.IO Admin For OAK doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script>window.__TIMESTAMP__ = 1746759862617;</script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue