fix: update deploy local app
This commit is contained in:
parent
7f91070906
commit
9ac04821f5
@ -18,17 +18,33 @@ app
|
|||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const tokenUser = ctx.state.tokenUser;
|
const tokenUser = ctx.state.tokenUser;
|
||||||
const data = ctx.query?.data;
|
const data = ctx.query?.data;
|
||||||
const { id, key, force, install } = data;
|
const { id, key, force, install, appKey: postAppKey, version: postVersion = '1.0.0' } = data;
|
||||||
if (!id) {
|
if (!id || !postAppKey) {
|
||||||
ctx.throw(400, 'Invalid id');
|
ctx.throw(400, 'Invalid id or postAppKey');
|
||||||
}
|
}
|
||||||
let username = tokenUser.username;
|
let username = tokenUser.username;
|
||||||
if (data.username) {
|
if (data.username && username === 'admin') {
|
||||||
// username = data.username;
|
username = data.username;
|
||||||
}
|
}
|
||||||
const microApp = await AppListModel.findByPk(id);
|
let microApp: AppListModel;
|
||||||
|
if (!microApp && id) {
|
||||||
|
microApp = await AppListModel.findByPk(id);
|
||||||
|
}
|
||||||
|
if (!microApp && postAppKey) {
|
||||||
|
microApp = await AppListModel.findOne({
|
||||||
|
where: {
|
||||||
|
key: postAppKey,
|
||||||
|
version: postVersion,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!microApp) {
|
if (!microApp) {
|
||||||
ctx.throw(400, 'Invalid id');
|
if (id) {
|
||||||
|
ctx.throw(400, 'Invalid id');
|
||||||
|
} else {
|
||||||
|
ctx.throw(400, `Invalid appKey , no found app with key: ${postAppKey} and version: ${postVersion}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const { key: appKey, version } = microApp;
|
const { key: appKey, version } = microApp;
|
||||||
const check = await appPathCheck({ key: key });
|
const check = await appPathCheck({ key: key });
|
||||||
|
@ -25,7 +25,7 @@ export const installAppFromKey = async (key: string) => {
|
|||||||
}
|
}
|
||||||
let showAppInfo = {
|
let showAppInfo = {
|
||||||
key,
|
key,
|
||||||
status: 'inactive',
|
status: 'inactive' as const,
|
||||||
type: app?.type || 'system-app',
|
type: app?.type || 'system-app',
|
||||||
description: readmeDesc || '',
|
description: readmeDesc || '',
|
||||||
version,
|
version,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user