blockmine 1.6.1 → 1.6.3
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/README.md +1 -0
- package/backend/src/api/routes/pluginIde.js +43 -11
- package/backend/src/core/BotProcess.js +4 -0
- package/backend/src/core/EventGraphManager.js +3 -0
- package/backend/src/core/GraphExecutionEngine.js +7 -1
- package/backend/src/core/NodeRegistry.js +17 -1
- package/frontend/dist/assets/index-CIDmlKtb.js +8203 -0
- package/frontend/dist/assets/index-DF3i-W3m.css +1 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-4mfeN9LH.css +0 -1
- package/frontend/dist/assets/index-kCeS76bv.js +0 -8203
package/README.md
CHANGED
|
@@ -402,6 +402,33 @@ router.post('/:pluginName/fs', resolvePluginPath, async (req, res) => {
|
|
|
402
402
|
res.status(200).json({ message: 'Renamed successfully.' });
|
|
403
403
|
break;
|
|
404
404
|
|
|
405
|
+
case 'move':
|
|
406
|
+
if (!newPath) return res.status(400).json({ error: 'New path is required for move operation.' });
|
|
407
|
+
const safeMoveNewPath = path.resolve(req.pluginPath, newPath);
|
|
408
|
+
if (!safeMoveNewPath.startsWith(req.pluginPath)) return res.status(403).json({ error: 'Access denied: New path is outside of plugin directory.' });
|
|
409
|
+
if (!await fse.pathExists(safePath)) return res.status(404).json({ error: 'Source file or folder not found.' });
|
|
410
|
+
|
|
411
|
+
if (safeMoveNewPath.startsWith(safePath + path.sep)) {
|
|
412
|
+
return res.status(400).json({ error: 'Cannot move folder into itself.' });
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
let finalPath = safeMoveNewPath;
|
|
416
|
+
let counter = 1;
|
|
417
|
+
while (await fse.pathExists(finalPath)) {
|
|
418
|
+
const ext = path.extname(safeMoveNewPath);
|
|
419
|
+
const base = path.basename(safeMoveNewPath, ext);
|
|
420
|
+
const dir = path.dirname(safeMoveNewPath);
|
|
421
|
+
finalPath = path.join(dir, `${base} (${counter})${ext}`);
|
|
422
|
+
counter++;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
await fse.move(safePath, finalPath);
|
|
426
|
+
res.status(200).json({
|
|
427
|
+
message: 'Moved successfully.',
|
|
428
|
+
newPath: path.relative(req.pluginPath, finalPath)
|
|
429
|
+
});
|
|
430
|
+
break;
|
|
431
|
+
|
|
405
432
|
default:
|
|
406
433
|
res.status(400).json({ error: 'Invalid operation specified.' });
|
|
407
434
|
}
|
|
@@ -608,18 +635,23 @@ router.post('/:pluginName/create-pr', resolvePluginPath, async (req, res) => {
|
|
|
608
635
|
|
|
609
636
|
let branchExists = false;
|
|
610
637
|
try {
|
|
611
|
-
cp.execSync(`git
|
|
612
|
-
|
|
613
|
-
console.log(`[Plugin IDE] Ветка ${branch} уже существует, переключаемся на неё`);
|
|
638
|
+
cp.execSync(`git checkout -b ${branch}`, { stdio: 'pipe' });
|
|
639
|
+
console.log(`[Plugin IDE] Создана новая ветка ${branch}`);
|
|
614
640
|
} catch (e) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
641
|
+
try {
|
|
642
|
+
cp.execSync(`git checkout ${branch}`, { stdio: 'pipe' });
|
|
643
|
+
console.log(`[Plugin IDE] Переключились на существующую ветку ${branch}`);
|
|
644
|
+
} catch (e2) {
|
|
645
|
+
try {
|
|
646
|
+
cp.execSync(`git fetch origin ${branch}`, { stdio: 'pipe' });
|
|
647
|
+
cp.execSync(`git checkout -b ${branch} origin/${branch}`, { stdio: 'pipe' });
|
|
648
|
+
branchExists = true;
|
|
649
|
+
console.log(`[Plugin IDE] Создана ветка ${branch} из удаленной`);
|
|
650
|
+
} catch (e3) {
|
|
651
|
+
cp.execSync(`git checkout -B ${branch}`, { stdio: 'pipe' });
|
|
652
|
+
console.log(`[Plugin IDE] Принудительно создана ветка ${branch}`);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
623
655
|
}
|
|
624
656
|
|
|
625
657
|
const files = await fse.readdir(req.pluginPath);
|
|
@@ -420,6 +420,10 @@ process.on('message', async (message) => {
|
|
|
420
420
|
messageHandledByCustomParser = false;
|
|
421
421
|
const rawMessageText = jsonMsg.toString();
|
|
422
422
|
bot.events.emit('core:raw_message', rawMessageText, jsonMsg);
|
|
423
|
+
|
|
424
|
+
sendEvent('raw_message', {
|
|
425
|
+
rawText: rawMessageText
|
|
426
|
+
});
|
|
423
427
|
});
|
|
424
428
|
|
|
425
429
|
bot.events.on('chat:message', (data) => {
|
|
@@ -145,6 +145,9 @@ class EventGraphManager {
|
|
|
145
145
|
context.message = args.message;
|
|
146
146
|
context.chat_type = args.chatType;
|
|
147
147
|
break;
|
|
148
|
+
case 'raw_message':
|
|
149
|
+
context.rawText = args.rawText;
|
|
150
|
+
break;
|
|
148
151
|
case 'playerJoined':
|
|
149
152
|
case 'playerLeft':
|
|
150
153
|
context.user = args.user;
|
|
@@ -379,7 +379,13 @@ class GraphExecutionEngine {
|
|
|
379
379
|
else result = this.context[pinId];
|
|
380
380
|
break;
|
|
381
381
|
case 'event:chat':
|
|
382
|
-
if (pinId === '
|
|
382
|
+
if (pinId === 'username') result = this.context.username;
|
|
383
|
+
else if (pinId === 'message') result = this.context.message;
|
|
384
|
+
else if (pinId === 'chatType') result = this.context.chat_type;
|
|
385
|
+
else result = this.context[pinId];
|
|
386
|
+
break;
|
|
387
|
+
case 'event:raw_message':
|
|
388
|
+
if (pinId === 'rawText') result = this.context.rawText;
|
|
383
389
|
else result = this.context[pinId];
|
|
384
390
|
break;
|
|
385
391
|
case 'event:playerJoined':
|
|
@@ -129,7 +129,23 @@ class NodeRegistry {
|
|
|
129
129
|
{ id: 'username', type: 'String', name: 'Игрок' },
|
|
130
130
|
{ id: 'message', type: 'String', name: 'Сообщение' },
|
|
131
131
|
{ id: 'chatType', type: 'String', name: 'Тип чата' },
|
|
132
|
-
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
this.registerNodeType({
|
|
137
|
+
type: 'event:raw_message',
|
|
138
|
+
name: 'Событие: Сырое сообщение',
|
|
139
|
+
label: '📝 Сырое сообщение',
|
|
140
|
+
description: 'Срабатывает при получении любого сообщения в сыром виде (до парсинга).',
|
|
141
|
+
category: 'События',
|
|
142
|
+
graphType: event,
|
|
143
|
+
isEvent: true,
|
|
144
|
+
pins: {
|
|
145
|
+
inputs: [],
|
|
146
|
+
outputs: [
|
|
147
|
+
{ id: 'exec', type: 'Exec', name: 'Выполнить' },
|
|
148
|
+
{ id: 'rawText', type: 'String', name: 'Сырой текст' },
|
|
133
149
|
]
|
|
134
150
|
}
|
|
135
151
|
});
|