itismyskillmarket 1.3.31 → 1.3.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -2
- package/gui/app.js +13 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2600,11 +2600,17 @@ API_ROUTES.POST["/api/upload"] = async (req, res, _url) => {
|
|
|
2600
2600
|
jsonResponse(res, 400, { error: "ZIP archive is empty" });
|
|
2601
2601
|
return;
|
|
2602
2602
|
}
|
|
2603
|
-
const
|
|
2603
|
+
const normalizeEntryName = (name) => name.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
2604
|
+
const pkgEntry = entries.find((e) => {
|
|
2605
|
+
const normalized = normalizeEntryName(e.entryName);
|
|
2606
|
+
return normalized === "package.json" || normalized.endsWith("/package.json");
|
|
2607
|
+
});
|
|
2604
2608
|
let skillName = "";
|
|
2605
2609
|
let pkgInfo = {};
|
|
2610
|
+
let pkgEntryRelativePath = "";
|
|
2606
2611
|
if (pkgEntry) {
|
|
2607
2612
|
try {
|
|
2613
|
+
pkgEntryRelativePath = normalizeEntryName(pkgEntry.entryName);
|
|
2608
2614
|
pkgInfo = JSON.parse(pkgEntry.getData().toString("utf-8"));
|
|
2609
2615
|
skillName = pkgInfo.skillmarket?.id || pkgInfo.name?.replace(/^@[^/]+\//, "") || "";
|
|
2610
2616
|
} catch {
|
|
@@ -2626,7 +2632,13 @@ API_ROUTES.POST["/api/upload"] = async (req, res, _url) => {
|
|
|
2626
2632
|
mkdirSync(skillDir, { recursive: true });
|
|
2627
2633
|
zip.extractAllTo(skillDir, true);
|
|
2628
2634
|
const skillMdExists = existsSync3(join3(skillDir, "SKILL.md")) || entries.some((e) => e.entryName.endsWith("SKILL.md"));
|
|
2629
|
-
|
|
2635
|
+
let pkgJsonPath = join3(skillDir, "package.json");
|
|
2636
|
+
if (pkgEntryRelativePath) {
|
|
2637
|
+
const extractedPkgPath = join3(skillDir, pkgEntryRelativePath);
|
|
2638
|
+
if (existsSync3(extractedPkgPath)) {
|
|
2639
|
+
pkgJsonPath = extractedPkgPath;
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2630
2642
|
if (existsSync3(pkgJsonPath)) {
|
|
2631
2643
|
try {
|
|
2632
2644
|
pkgInfo = JSON.parse(readFileSync2(pkgJsonPath, "utf-8"));
|
package/gui/app.js
CHANGED
|
@@ -220,6 +220,10 @@ const translations = {
|
|
|
220
220
|
'upload.id': 'ID',
|
|
221
221
|
'upload.version': 'Version',
|
|
222
222
|
'upload.description': 'Description',
|
|
223
|
+
'upload.validation': 'Validation',
|
|
224
|
+
'upload.stats': 'Stats',
|
|
225
|
+
'upload.done': '✅ Done',
|
|
226
|
+
'upload.noSkillUploaded': 'No skill uploaded. Please upload first.',
|
|
223
227
|
'upload.platforms': 'Platforms',
|
|
224
228
|
'upload.fileCount': 'Files',
|
|
225
229
|
'upload.hasPackageJson': 'package.json',
|
|
@@ -444,6 +448,10 @@ const translations = {
|
|
|
444
448
|
'upload.id': 'ID',
|
|
445
449
|
'upload.version': '版本',
|
|
446
450
|
'upload.description': '描述',
|
|
451
|
+
'upload.validation': '验证',
|
|
452
|
+
'upload.stats': '统计',
|
|
453
|
+
'upload.done': '✅ 完成',
|
|
454
|
+
'upload.noSkillUploaded': '未上传技能,请先上传。',
|
|
447
455
|
'upload.platforms': '支持平台',
|
|
448
456
|
'upload.fileCount': '文件数',
|
|
449
457
|
'upload.hasPackageJson': 'package.json',
|
|
@@ -1149,7 +1157,7 @@ function goBackFromPlatformDetail() {
|
|
|
1149
1157
|
|
|
1150
1158
|
async function loadHelp() {
|
|
1151
1159
|
const container = document.getElementById('help-content');
|
|
1152
|
-
container.innerHTML =
|
|
1160
|
+
container.innerHTML = `<div class="loading">${t('loading.generic')}</div>`;
|
|
1153
1161
|
|
|
1154
1162
|
try {
|
|
1155
1163
|
const response = await fetch('/api/config');
|
|
@@ -2056,7 +2064,7 @@ async function handleUpload(file, skillNameOverride) {
|
|
|
2056
2064
|
}
|
|
2057
2065
|
|
|
2058
2066
|
progressFill.style.width = '100%';
|
|
2059
|
-
progressText.textContent = '
|
|
2067
|
+
progressText.textContent = t('upload.done');
|
|
2060
2068
|
|
|
2061
2069
|
uploadState.data = result;
|
|
2062
2070
|
uploadState.skillName = skillNameOverride || result.skillName;
|
|
@@ -2097,7 +2105,7 @@ function renderUploadPreview(data) {
|
|
|
2097
2105
|
</div>
|
|
2098
2106
|
|
|
2099
2107
|
<div class="upload-preview-section">
|
|
2100
|
-
<h3
|
|
2108
|
+
<h3>${t('upload.validation')}</h3>
|
|
2101
2109
|
<div>
|
|
2102
2110
|
<span class="upload-preview-badge ${data.hasPackageJson ? 'success' : 'warning'}">
|
|
2103
2111
|
📦 ${t('upload.hasPackageJson')}: ${data.hasPackageJson ? t('upload.yes') : t('upload.no')}
|
|
@@ -2109,7 +2117,7 @@ function renderUploadPreview(data) {
|
|
|
2109
2117
|
</div>
|
|
2110
2118
|
|
|
2111
2119
|
<div class="upload-preview-section" style="border-bottom:none;margin-bottom:0;padding-bottom:0;">
|
|
2112
|
-
<h3
|
|
2120
|
+
<h3>${t('upload.stats')}</h3>
|
|
2113
2121
|
<div class="upload-preview-stats">
|
|
2114
2122
|
<div class="upload-preview-stat">
|
|
2115
2123
|
<div class="upload-preview-stat-value">${data.fileCount}</div>
|
|
@@ -2127,7 +2135,7 @@ function renderUploadPreview(data) {
|
|
|
2127
2135
|
/** 执行上传后的操作 */
|
|
2128
2136
|
async function executeUploadAction(action) {
|
|
2129
2137
|
if (!uploadState.data || !uploadState.skillName) {
|
|
2130
|
-
showToast('
|
|
2138
|
+
showToast(t('upload.noSkillUploaded'), 'error');
|
|
2131
2139
|
return;
|
|
2132
2140
|
}
|
|
2133
2141
|
|