Fix: API UUID Err

This commit is contained in:
Unitwk 2024-04-18 10:57:14 +08:00
parent 5557f69dec
commit 1a51f39a59
2 changed files with 3 additions and 2 deletions

View File

@ -24,7 +24,8 @@ router.get(
try {
const daemonId = String(ctx.query.daemonId);
const instanceUuid = String(ctx.query.uuid);
if (!isHaveInstanceByUuid(getUserUuid(ctx), daemonId, instanceUuid)) return;
if (!isHaveInstanceByUuid(getUserUuid(ctx), daemonId, instanceUuid))
throw new Error($t("TXT_CODE_permission.forbidden"));
const remoteService = RemoteServiceSubsystem.getInstance(daemonId);
const result = await new RemoteRequest(remoteService).request("instance/detail", {
instanceUuid

View File

@ -148,7 +148,7 @@ export function getUserUuid(ctx: Koa.ParameterizedContext): string {
if (isApiRequest(ctx)) {
const user = getUuidByApiKey(getApiKey(ctx));
if (user && user.uuid) {
return user.userName;
return user.uuid;
} else {
return "";
}