fix: #877
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s
This commit is contained in:
1 parent
d3acd1efc1
commit
805e014a75
2 files changed
+4
-3
No files matched your search
@@ -7,13 +7,13 @@ import { SelfInfo } from '@/core/types';
|
|||||||
import { NodeIKernelLoginListener } from '@/core/listeners';
|
import { NodeIKernelLoginListener } from '@/core/listeners';
|
||||||
import { NodeIKernelLoginService } from '@/core/services';
|
import { NodeIKernelLoginService } from '@/core/services';
|
||||||
import { NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core/wrapper';
|
import { NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core/wrapper';
|
||||||
import { InitWebUi, WebUiConfig } from '@/webui';
|
import { InitWebUi, WebUiConfig, webUiRuntimePort } from '@/webui';
|
||||||
import { NapCatOneBot11Adapter } from '@/onebot';
|
import { NapCatOneBot11Adapter } from '@/onebot';
|
||||||
|
|
||||||
//Framework ES入口文件
|
//Framework ES入口文件
|
||||||
export async function getWebUiUrl() {
|
export async function getWebUiUrl() {
|
||||||
const WebUiConfigData = (await WebUiConfig.GetWebUIConfig());
|
const WebUiConfigData = (await WebUiConfig.GetWebUIConfig());
|
||||||
return 'http://127.0.0.1:' + WebUiConfigData.port + '/webui/?token=' + WebUiConfigData.token;
|
return 'http://127.0.0.1:' + webUiRuntimePort + '/webui/?token=' + WebUiConfigData.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function NCoreInitFramework(
|
export async function NCoreInitFramework(
|
||||||
|
|||||||
+2
-1
@@ -29,7 +29,7 @@ export let webUiPathWrapper: NapCatPathWrapper;
|
|||||||
const MAX_PORT_TRY = 100;
|
const MAX_PORT_TRY = 100;
|
||||||
import * as net from 'node:net';
|
import * as net from 'node:net';
|
||||||
import { WebUiDataRuntime } from './src/helper/Data';
|
import { WebUiDataRuntime } from './src/helper/Data';
|
||||||
|
export let webUiRuntimePort = 6099;
|
||||||
export async function InitPort(parsedConfig: WebUiConfigType): Promise<[string, number, string]> {
|
export async function InitPort(parsedConfig: WebUiConfigType): Promise<[string, number, string]> {
|
||||||
try {
|
try {
|
||||||
await tryUseHost(parsedConfig.host);
|
await tryUseHost(parsedConfig.host);
|
||||||
@@ -45,6 +45,7 @@ export async function InitWebUi(logger: LogWrapper, pathWrapper: NapCatPathWrapp
|
|||||||
webUiPathWrapper = pathWrapper;
|
webUiPathWrapper = pathWrapper;
|
||||||
WebUiConfig = new WebUiConfigWrapper();
|
WebUiConfig = new WebUiConfigWrapper();
|
||||||
const [host, port, token] = await InitPort(await WebUiConfig.GetWebUIConfig());
|
const [host, port, token] = await InitPort(await WebUiConfig.GetWebUIConfig());
|
||||||
|
webUiRuntimePort = port;
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
logger.log('[NapCat] [WebUi] Current WebUi is not run.');
|
logger.log('[NapCat] [WebUi] Current WebUi is not run.');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user