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.
- package/.kiro/steering/product.md +27 -0
- package/.kiro/steering/structure.md +89 -0
- package/.kiro/steering/tech.md +94 -0
- package/CHANGELOG.md +147 -112
- package/backend/cli.js +59 -57
- package/backend/prisma/migrations/20250701190321_add/migration.sql +2 -2
- package/backend/prisma/migrations/20250709150611_add_run_on_startup_to_tasks/migration.sql +21 -21
- package/backend/prisma/migrations/20250709151124_make_cron_pattern_optional/migration.sql +21 -21
- package/backend/prisma/migrations/20250718181335_add_plugin_data_store/migration.sql +14 -14
- package/backend/prisma/migrations/20250719115906_add_plugin_owner_to_graphs/migration.sql +45 -45
- package/backend/prisma/migrations/20250723160648_add_bot_sort_order/migration.sql +2 -2
- package/backend/prisma/migrations/20250816083216_add_panel_user_bot_access/migration.sql +30 -0
- package/backend/prisma/migrations/migration_lock.toml +2 -2
- package/backend/prisma/schema.prisma +244 -229
- package/backend/src/api/middleware/botAccess.js +35 -0
- package/backend/src/api/routes/auth.js +633 -595
- package/backend/src/api/routes/bots.js +294 -179
- package/backend/src/api/routes/eventGraphs.js +459 -459
- package/backend/src/api/routes/pluginIde.js +6 -2
- package/backend/src/api/routes/servers.js +27 -0
- package/backend/src/core/BotManager.js +0 -1
- package/backend/src/core/BotProcess.js +1 -2
- package/backend/src/core/GraphExecutionEngine.js +917 -917
- package/backend/src/core/PluginLoader.js +208 -86
- package/backend/src/core/PluginManager.js +465 -427
- package/backend/src/core/commands/dev.js +6 -1
- package/backend/src/real-time/presence.js +74 -0
- package/backend/src/real-time/socketHandler.js +2 -0
- package/backend/src/server.js +193 -186
- package/frontend/dist/assets/index-BFd7YoAj.css +1 -0
- package/frontend/dist/assets/index-DxdxTe6I.js +8352 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-CA3XrPPP.css +0 -1
- 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.
|
|
682
|
+
cp.execFileSync('git', ['push', 'origin', branch, '--force']);
|
|
679
683
|
console.log(`[Plugin IDE] Ветка ${branch} обновлена`);
|
|
680
684
|
} else {
|
|
681
|
-
cp.
|
|
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({
|