@pixelbyte-software/pixcode 1.51.6 → 1.51.8
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/assets/{index-DodOzOl5.js → index--kNEhygZ.js} +158 -158
- package/dist/assets/index-BLN05G-9.css +32 -0
- package/dist/index.html +2 -2
- package/dist-server/server/index.js +35 -10
- package/dist-server/server/index.js.map +1 -1
- package/package.json +1 -1
- package/server/index.js +35 -10
- package/dist/assets/index-Bbmw_Gy1.css +0 -32
|
@@ -244,6 +244,14 @@ async function readLatestPixcodePackageMetadata() {
|
|
|
244
244
|
tarballUrl: latestEntry?.dist?.tarball || null,
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
+
function isSafePackageVersion(version) {
|
|
248
|
+
return typeof version === 'string' && /^\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/.test(version.trim());
|
|
249
|
+
}
|
|
250
|
+
function buildPixcodeTarballUrl(version) {
|
|
251
|
+
if (!isSafePackageVersion(version))
|
|
252
|
+
return null;
|
|
253
|
+
return `https://registry.npmjs.org/@pixelbyte-software/pixcode/-/pixcode-${version.trim()}.tgz`;
|
|
254
|
+
}
|
|
247
255
|
async function runRuntimeDirUpdateJob(job, runtimeDir, latestVersion, tarballUrl) {
|
|
248
256
|
appendUpdateJobLog(job, 'meta', `Update mode: runtime-dir\nRuntime: ${runtimeDir}\n`);
|
|
249
257
|
appendUpdateJobLog(job, 'meta', `Downloading ${tarballUrl}\n`);
|
|
@@ -344,7 +352,7 @@ function readCurrentPackageVersion() {
|
|
|
344
352
|
return SERVER_VERSION;
|
|
345
353
|
}
|
|
346
354
|
}
|
|
347
|
-
function createSystemUpdateJob(actorUser) {
|
|
355
|
+
function createSystemUpdateJob(actorUser, options = {}) {
|
|
348
356
|
const activeJob = getActiveUpdateJob();
|
|
349
357
|
if (activeJob)
|
|
350
358
|
return activeJob;
|
|
@@ -355,7 +363,7 @@ function createSystemUpdateJob(actorUser) {
|
|
|
355
363
|
updatedAt: new Date().toISOString(),
|
|
356
364
|
completedAt: null,
|
|
357
365
|
fromVersion: SERVER_VERSION,
|
|
358
|
-
toVersion: null,
|
|
366
|
+
toVersion: isSafePackageVersion(options.targetVersion) ? options.targetVersion.trim() : null,
|
|
359
367
|
installMode,
|
|
360
368
|
runtimeDir: process.env.PIXCODE_RUNTIME_DIR || null,
|
|
361
369
|
actorUserId: actorUser?.id ?? actorUser?.userId ?? null,
|
|
@@ -375,7 +383,10 @@ function createSystemUpdateJob(actorUser) {
|
|
|
375
383
|
appendUpdateJobLog(job, 'stderr', `Registry precheck failed: ${error.message}\n`);
|
|
376
384
|
return { latestVersion: null, tarballUrl: null };
|
|
377
385
|
});
|
|
378
|
-
|
|
386
|
+
const requestedVersion = isSafePackageVersion(options.targetVersion) ? options.targetVersion.trim() : null;
|
|
387
|
+
const resolvedVersion = latest.latestVersion || requestedVersion || null;
|
|
388
|
+
const resolvedTarballUrl = latest.tarballUrl || buildPixcodeTarballUrl(resolvedVersion);
|
|
389
|
+
job.toVersion = resolvedVersion;
|
|
379
390
|
if (!IS_PLATFORM && installMode === 'npm' && latest.latestVersion && latest.latestVersion === SERVER_VERSION) {
|
|
380
391
|
job.status = 'completed';
|
|
381
392
|
job.alreadyLatest = true;
|
|
@@ -384,10 +395,13 @@ function createSystemUpdateJob(actorUser) {
|
|
|
384
395
|
return;
|
|
385
396
|
}
|
|
386
397
|
if (runtimeDir) {
|
|
387
|
-
if (!
|
|
388
|
-
throw new Error('Registry response missing latest version or tarball URL.');
|
|
398
|
+
if (!resolvedVersion || !resolvedTarballUrl) {
|
|
399
|
+
throw new Error('Registry response missing latest version or tarball URL. Try manual update or retry when registry access is available.');
|
|
389
400
|
}
|
|
390
|
-
|
|
401
|
+
if (!latest.latestVersion) {
|
|
402
|
+
appendUpdateJobLog(job, 'meta', `Using requested target version ${resolvedVersion} after registry precheck failed.\n`);
|
|
403
|
+
}
|
|
404
|
+
job.toVersion = await runRuntimeDirUpdateJob(job, runtimeDir, resolvedVersion, resolvedTarballUrl);
|
|
391
405
|
}
|
|
392
406
|
else {
|
|
393
407
|
const updateCommand = IS_PLATFORM
|
|
@@ -1378,7 +1392,9 @@ app.get('/api/system/update-state', authenticateToken, (req, res) => {
|
|
|
1378
1392
|
});
|
|
1379
1393
|
});
|
|
1380
1394
|
app.post('/api/system/update-jobs', authenticateToken, requireAdmin, requireApiScope('system:update'), (req, res) => {
|
|
1381
|
-
const job = createSystemUpdateJob(req.user
|
|
1395
|
+
const job = createSystemUpdateJob(req.user, {
|
|
1396
|
+
targetVersion: req.body?.targetVersion || req.body?.latestVersion,
|
|
1397
|
+
});
|
|
1382
1398
|
res.status(job.status === 'queued' ? 202 : 200).json({
|
|
1383
1399
|
success: true,
|
|
1384
1400
|
job: snapshotUpdateJob(job),
|
|
@@ -3474,9 +3490,18 @@ function handleShellConnection(ws, request) {
|
|
|
3474
3490
|
}
|
|
3475
3491
|
else if (data.type === 'resize') {
|
|
3476
3492
|
// Handle terminal resize
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3493
|
+
const session = ptySessionKey ? ptySessionsMap.get(ptySessionKey) : null;
|
|
3494
|
+
const activePty = session?.pty || shellProcess;
|
|
3495
|
+
if (activePty && typeof activePty.resize === 'function' && session?.lifecycleState !== 'completed' && session?.lifecycleState !== 'failed') {
|
|
3496
|
+
try {
|
|
3497
|
+
activePty.resize(data.cols, data.rows);
|
|
3498
|
+
}
|
|
3499
|
+
catch (error) {
|
|
3500
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3501
|
+
if (!/already exited/i.test(message)) {
|
|
3502
|
+
console.warn('Terminal resize failed:', message);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3480
3505
|
}
|
|
3481
3506
|
}
|
|
3482
3507
|
}
|