修复
This commit is contained in:
@@ -27,7 +27,8 @@ export default {
|
|||||||
dedupe: ['tslib']
|
dedupe: ['tslib']
|
||||||
}),
|
}),
|
||||||
commonjs({
|
commonjs({
|
||||||
transformMixedEsModules: true
|
transformMixedEsModules: true,
|
||||||
|
ignoreDynamicRequires: true
|
||||||
}),
|
}),
|
||||||
json(),
|
json(),
|
||||||
terser({
|
terser({
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ export class Core {
|
|||||||
return res.status(400).json({ status: 400, message: "缺少 path 参数" });
|
return res.status(400).json({ status: 400, message: "缺少 path 参数" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const { ModCheckService } = await import('./dearth/index.js');
|
const { ModCheckService } = await import('./dearth/index');
|
||||||
const checkService = new ModCheckService(modsPath);
|
const checkService = new ModCheckService(modsPath);
|
||||||
const results = await checkService.checkMods();
|
const results = await checkService.checkMods();
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ export class Core {
|
|||||||
bundleName: bundleName.trim()
|
bundleName: bundleName.trim()
|
||||||
});
|
});
|
||||||
|
|
||||||
const { ModCheckService } = await import('./dearth/index.js');
|
const { ModCheckService } = await import('./dearth/index');
|
||||||
const checkService = new ModCheckService(folderPath);
|
const checkService = new ModCheckService(folderPath);
|
||||||
const results = await checkService.checkModsWithBundle(bundleName.trim());
|
const results = await checkService.checkModsWithBundle(bundleName.trim());
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ export class Core {
|
|||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
this.app.get('/templates', async (req, res) => {
|
this.app.get('/templates', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
const templates = await templateManager.getTemplates();
|
const templates = await templateManager.getTemplates();
|
||||||
@@ -321,7 +321,7 @@ export class Core {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ export class Core {
|
|||||||
try {
|
try {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
|
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateService = (templateModule as any).TemplateService;
|
const TemplateService = (templateModule as any).TemplateService;
|
||||||
const templateService = new TemplateService();
|
const templateService = new TemplateService();
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ export class Core {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ export class Core {
|
|||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
const path = await import('path');
|
const path = await import('path');
|
||||||
const { exec } = await import('child_process');
|
const { exec } = await import('child_process');
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
|
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
@@ -449,7 +449,7 @@ export class Core {
|
|||||||
this.app.get('/templates/:id/export', async (req, res) => {
|
this.app.get('/templates/:id/export', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ export class Core {
|
|||||||
return res.status(400).json({ status: 400, message: "只支持 .zip 文件" });
|
return res.status(400).json({ status: 400, message: "只支持 .zip 文件" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
|
|
||||||
@@ -631,7 +631,7 @@ export class Core {
|
|||||||
unlinkSync(tempFilePath);
|
unlinkSync(tempFilePath);
|
||||||
|
|
||||||
// 导入模板
|
// 导入模板
|
||||||
const templateModule = await import('./template/index.js');
|
const templateModule = await import('./template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
|
|
||||||
@@ -661,8 +661,8 @@ export class Core {
|
|||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = err as Error;
|
const error = err as Error;
|
||||||
const { requestId } = req.body;
|
const { requestId, url } = req.body;
|
||||||
logger.error("/templates/install-from-url 路由错误", error);
|
logger.error("/templates/install-from-url 路由错误", { error: error.message, stack: error.stack, url });
|
||||||
|
|
||||||
// 发送错误信息到SSE连接
|
// 发送错误信息到SSE连接
|
||||||
if (sseConnections.has(requestId)) {
|
if (sseConnections.has(requestId)) {
|
||||||
@@ -670,7 +670,8 @@ export class Core {
|
|||||||
sseRes.write(`data: ${JSON.stringify({
|
sseRes.write(`data: ${JSON.stringify({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
status: 500,
|
status: 500,
|
||||||
message: "安装模板失败"
|
message: "安装模板失败",
|
||||||
|
details: error.message
|
||||||
})}\n\n`);
|
})}\n\n`);
|
||||||
sseRes.end();
|
sseRes.end();
|
||||||
sseConnections.delete(requestId);
|
sseConnections.delete(requestId);
|
||||||
@@ -679,7 +680,11 @@ export class Core {
|
|||||||
// 清理下载状态
|
// 清理下载状态
|
||||||
downloadStates.delete(requestId);
|
downloadStates.delete(requestId);
|
||||||
|
|
||||||
res.status(500).json({ status: 500, message: "安装模板失败" });
|
res.status(500).json({
|
||||||
|
status: 500,
|
||||||
|
message: "安装模板失败",
|
||||||
|
details: error.message
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ export class ModCheckService {
|
|||||||
jarData = fs.readFileSync(file.filename);
|
jarData = fs.readFileSync(file.filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { yauzl_promise } = await import("../utils/ziplib.js");
|
const { yauzl_promise } = await import("../utils/ziplib");
|
||||||
const zipEntries = await yauzl_promise(jarData);
|
const zipEntries = await yauzl_promise(jarData);
|
||||||
|
|
||||||
for (const entry of zipEntries) {
|
for (const entry of zipEntries) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export async function mlsetup(ml: string, mcv: string, mlv: string, path: string
|
|||||||
messageWS.serverInstallStep(`Applying Template: ${template}`, 1, totalSteps);
|
messageWS.serverInstallStep(`Applying Template: ${template}`, 1, totalSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
const templateModule = await import('../template/index.js');
|
const templateModule = await import('../template/index');
|
||||||
const TemplateManager = (templateModule as any).TemplateManager;
|
const TemplateManager = (templateModule as any).TemplateManager;
|
||||||
const templateManager = new TemplateManager();
|
const templateManager = new TemplateManager();
|
||||||
const templates = await templateManager.getTemplates();
|
const templates = await templateManager.getTemplates();
|
||||||
|
|||||||
@@ -558,7 +558,9 @@ async function downloadAndInstallTemplate(template: StoreTemplate) {
|
|||||||
// 关闭通知
|
// 关闭通知
|
||||||
message.destroy(notificationKey);
|
message.destroy(notificationKey);
|
||||||
|
|
||||||
message.error(data.message || t('template.install_failed'));
|
const errorMessage = data.message || t('template.install_failed');
|
||||||
|
const errorDetails = data.details ? ` (${data.details})` : '';
|
||||||
|
message.error(errorMessage + errorDetails);
|
||||||
// 重置状态
|
// 重置状态
|
||||||
downloadLoading.value = false;
|
downloadLoading.value = false;
|
||||||
showDownloadProgress.value = false;
|
showDownloadProgress.value = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user