blockmine 1.18.4 → 1.19.1

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.
Files changed (35) hide show
  1. package/.kiro/steering/product.md +27 -0
  2. package/.kiro/steering/structure.md +89 -0
  3. package/.kiro/steering/tech.md +94 -0
  4. package/CHANGELOG.md +147 -112
  5. package/backend/cli.js +59 -57
  6. package/backend/prisma/migrations/20250701190321_add/migration.sql +2 -2
  7. package/backend/prisma/migrations/20250709150611_add_run_on_startup_to_tasks/migration.sql +21 -21
  8. package/backend/prisma/migrations/20250709151124_make_cron_pattern_optional/migration.sql +21 -21
  9. package/backend/prisma/migrations/20250718181335_add_plugin_data_store/migration.sql +14 -14
  10. package/backend/prisma/migrations/20250719115906_add_plugin_owner_to_graphs/migration.sql +45 -45
  11. package/backend/prisma/migrations/20250723160648_add_bot_sort_order/migration.sql +2 -2
  12. package/backend/prisma/migrations/20250816083216_add_panel_user_bot_access/migration.sql +30 -0
  13. package/backend/prisma/migrations/migration_lock.toml +2 -2
  14. package/backend/prisma/schema.prisma +244 -229
  15. package/backend/src/api/middleware/botAccess.js +35 -0
  16. package/backend/src/api/routes/auth.js +633 -595
  17. package/backend/src/api/routes/bots.js +294 -179
  18. package/backend/src/api/routes/eventGraphs.js +459 -459
  19. package/backend/src/api/routes/pluginIde.js +6 -2
  20. package/backend/src/api/routes/servers.js +27 -0
  21. package/backend/src/core/BotManager.js +0 -1
  22. package/backend/src/core/BotProcess.js +1 -2
  23. package/backend/src/core/GraphExecutionEngine.js +917 -917
  24. package/backend/src/core/PluginLoader.js +208 -86
  25. package/backend/src/core/PluginManager.js +465 -427
  26. package/backend/src/core/commands/dev.js +6 -1
  27. package/backend/src/real-time/presence.js +74 -0
  28. package/backend/src/real-time/socketHandler.js +2 -0
  29. package/backend/src/server.js +193 -186
  30. package/frontend/dist/assets/index-BFd7YoAj.css +1 -0
  31. package/frontend/dist/assets/index-DxdxTe6I.js +8352 -0
  32. package/frontend/dist/index.html +2 -2
  33. package/package.json +1 -1
  34. package/frontend/dist/assets/index-CA3XrPPP.css +0 -1
  35. package/frontend/dist/assets/index-CM9ljR30.js +0 -8352
@@ -588,6 +588,10 @@ router.post('/:pluginName/create-pr', resolvePluginPath, async (req, res) => {
588
588
  if (!branch) {
589
589
  return res.status(400).json({ error: 'Название ветки обязательно.' });
590
590
  }
591
+ // Validate branch name: only allow letters, numbers, dashes, underscores, dots, slashes
592
+ if (!branch.match(/^[\w\-.\/]+$/)) {
593
+ return res.status(400).json({ error: 'Некорректное имя ветки.' });
594
+ }
591
595
 
592
596
  try {
593
597
  cp.execSync('git --version');
@@ -675,10 +679,10 @@ router.post('/:pluginName/create-pr', resolvePluginPath, async (req, res) => {
675
679
 
676
680
 
677
681
  if (branchExists) {
678
- cp.execSync(`git push origin ${branch} --force`);
682
+ cp.execFileSync('git', ['push', 'origin', branch, '--force']);
679
683
  console.log(`[Plugin IDE] Ветка ${branch} обновлена`);
680
684
  } else {
681
- cp.execSync(`git push -u origin ${branch}`);
685
+ cp.execFileSync('git', ['push', '-u', 'origin', branch]);
682
686
  console.log(`[Plugin IDE] Новая ветка ${branch} создана`);
683
687
  }
684
688
 
@@ -32,6 +32,33 @@ router.post('/', authorize('server:create'), async (req, res) => {
32
32
  }
33
33
  });
34
34
 
35
+ router.put('/:id', authorize('server:create'), async (req, res) => {
36
+ try {
37
+ const serverId = parseInt(req.params.id, 10);
38
+ if (isNaN(serverId)) return res.status(400).json({ error: 'Некорректный ID сервера' });
39
+
40
+ const { name, host, port, version } = req.body;
41
+ const dataToUpdate = {};
42
+ if (name !== undefined) dataToUpdate.name = name;
43
+ if (host !== undefined) dataToUpdate.host = host;
44
+ if (port !== undefined && port !== '') dataToUpdate.port = parseInt(port, 10);
45
+ if (version !== undefined) dataToUpdate.version = version;
46
+
47
+ Object.keys(dataToUpdate).forEach(k => { if (dataToUpdate[k] === undefined) delete dataToUpdate[k]; });
48
+
49
+ if (dataToUpdate.name) {
50
+ const existing = await prisma.server.findFirst({ where: { name: dataToUpdate.name, id: { not: serverId } } });
51
+ if (existing) return res.status(409).json({ error: 'Сервер с таким именем уже существует' });
52
+ }
53
+
54
+ const updated = await prisma.server.update({ where: { id: serverId }, data: dataToUpdate });
55
+ res.json(updated);
56
+ } catch (error) {
57
+ console.error('[API /api/servers] Ошибка обновления сервера:', error);
58
+ res.status(500).json({ error: 'Не удалось обновить сервер' });
59
+ }
60
+ });
61
+
35
62
  router.delete('/:id', authorize('server:delete'), async (req, res) => {
36
63
  try {
37
64
  const serverId = parseInt(req.params.id, 10);
@@ -390,7 +390,6 @@ class BotManager {
390
390
  if (decryptedConfig.proxyPassword) decryptedConfig.proxyPassword = decrypt(decryptedConfig.proxyPassword);
391
391
 
392
392
  if (decryptedConfig.proxyUsername) decryptedConfig.proxyUsername = decryptedConfig.proxyUsername.trim();
393
- if (decryptedConfig.proxyPassword) decryptedConfig.proxyPassword = decryptedConfig.proxyPassword.trim();
394
393
 
395
394
  const fullBotConfig = { ...decryptedConfig, plugins: sortedPlugins };
396
395
  const botProcessPath = path.resolve(__dirname, 'BotProcess.js');
@@ -187,9 +187,8 @@ process.on('message', async (message) => {
187
187
  if (config.proxyHost && config.proxyPort) {
188
188
  sendLog(`[System] Используется прокси: ${config.proxyHost}:${config.proxyPort}`);
189
189
 
190
- // Очищаем пароль от лишних символов
191
- const cleanProxyPassword = config.proxyPassword ? config.proxyPassword.trim() : null;
192
190
  const cleanProxyUsername = config.proxyUsername ? config.proxyUsername.trim() : null;
191
+ const cleanProxyPassword = config.proxyPassword || null;
193
192
 
194
193
  botOptions.connect = (client) => {
195
194
  SocksClient.createConnection({