blockmine 1.0.7 → 1.0.9

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 CHANGED
@@ -39,7 +39,7 @@ BlockMine — это open-source решение для централизова
39
39
 
40
40
  ## 🚀 Ключевые возможности
41
41
 
42
- * **💻 Современный веб-интерфейс**: Адаптивная панель на React и Tailwind CSS для управления ботами, серверами и плагинами с любого устройства.
42
+ * **💻 Современный веб-интерфейс**: Адаптивная панель на React и Tailwind CSS для управления ботами, серверами и плагинами
43
43
  * **🤖 Комплексное управление ботами**:
44
44
  * Запуск, остановка и перезапуск ботов в один клик.
45
45
  * Интерактивная консоль для каждого бота.
package/backend/cli.js CHANGED
@@ -1,15 +1,26 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
+
3
+
2
4
  const fs = require('fs');
5
+ const os = require('os');
3
6
  const path = require('path');
4
7
  const { execSync } = require('child_process');
5
8
  const { startServer } = require('./src/server.js');
6
9
 
10
+ const DATA_DIR = path.join(os.homedir(), '.blockmine');
11
+ if (!fs.existsSync(DATA_DIR)) {
12
+ console.log(`[BlockMine] Создание папки для данных: ${DATA_DIR}`);
13
+ fs.mkdirSync(DATA_DIR, { recursive: true });
14
+ }
15
+
16
+ process.env.DATABASE_URL = `file:${path.join(DATA_DIR, 'blockmine.db')}`;
7
17
  const prismaSchemaPath = path.join(__dirname, 'prisma', 'schema.prisma');
8
18
 
9
19
  function runCommand(command) {
10
20
  try {
11
21
  console.log(`> ${command}`);
12
- execSync(command, { stdio: 'inherit', cwd: __dirname });
22
+ const shell = process.platform === 'win32' ? 'cmd.exe' : '/bin/sh';
23
+ execSync(command, { stdio: 'inherit', cwd: __dirname, shell: shell });
13
24
  } catch (e) {
14
25
  console.error(`Команда "${command}" не удалась:`, e);
15
26
  process.exit(1);
@@ -18,12 +29,13 @@ function runCommand(command) {
18
29
 
19
30
  async function main() {
20
31
  console.log('Запуск панели управления BlockMine...');
21
-
32
+ console.log(`[BlockMine] Хранилище данных: ${DATA_DIR}`);
33
+
34
+ const dbPath = path.join(DATA_DIR, 'blockmine.db');
22
35
 
23
- const migrationsPath = path.join(__dirname, 'prisma', 'migrations');
24
- if (!fs.existsSync(migrationsPath)) {
25
- console.log('Папка с миграциями не найдена. Создаем первоначальную миграцию...');
26
- runCommand(`npx prisma migrate dev --name init --schema=${prismaSchemaPath}`);
36
+ if (!fs.existsSync(dbPath)) {
37
+ console.log('База данных не найдена. Создаем и применяем все миграции...');
38
+ runCommand(`npx prisma migrate deploy --schema=${prismaSchemaPath}`);
27
39
  console.log('Первоначальная настройка базы данных завершена.');
28
40
  } else {
29
41
  console.log('Проверка и применение обновлений базы данных...');
@@ -6,7 +6,7 @@ generator client {
6
6
 
7
7
  datasource db {
8
8
  provider = "sqlite"
9
- url = "file:./dev.db"
9
+ url = env("DATABASE_URL")
10
10
  }
11
11
 
12
12
  model Server {
@@ -1,12 +1,15 @@
1
1
 
2
2
  const path = require('path');
3
3
  const fs = require('fs/promises');
4
+ const os = require('os');
4
5
  const { PrismaClient } = require('@prisma/client');
5
6
  const AdmZip = require('adm-zip');
6
7
  const semver = require('semver');
7
8
 
8
9
  const prisma = new PrismaClient();
9
- const PLUGINS_BASE_DIR = path.resolve(__dirname, '../../storage/plugins');
10
+
11
+ const DATA_DIR = path.join(os.homedir(), '.blockmine');
12
+ const PLUGINS_BASE_DIR = path.join(DATA_DIR, 'storage', 'plugins');
10
13
 
11
14
  class PluginManager {
12
15
  constructor() {
@@ -27,7 +27,7 @@ class PingCommand extends Command {
27
27
  if (target) {
28
28
  bot.api.sendMessage(typeChat, `Понг, ${user.username}! Пингую игрока ${target}.`, user.username);
29
29
  } else {
30
- bot.api.sendMessage(typeChat, `В`, user.username);
30
+ bot.api.sendMessage(typeChat, `Понг, ${user.username}!`, user.username);
31
31
  }
32
32
  }
33
33
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  {
3
3
  "name": "blockmine",
4
- "version": "1.0.7",
4
+ "version": "1.0.9",
5
5
  "description": "Мощная панель управления ботами для Майнкрафта.",
6
6
  "author": "merka",
7
7
  "license": "MIT",
@@ -1,40 +0,0 @@
1
- const Command = require('../system/Command');
2
-
3
- class WarnCommand extends Command {
4
- constructor() {
5
- super({
6
- name: 'warn',
7
- description: 'Выдать предупреждение игроку.',
8
- aliases: ['пред'],
9
- cooldown: 10,
10
-
11
- permissions: 'admin.warn',
12
-
13
- owner: 'system',
14
- allowedChatTypes: ['chat', 'private'],
15
-
16
- args: [
17
- {
18
- name: 'target',
19
- type: 'string',
20
- required: true,
21
- description: 'Ник игрока'
22
- },
23
- {
24
- name: 'reason',
25
- type: 'greedy_string',
26
- required: true,
27
- description: 'Причина предупреждения'
28
- }
29
- ]
30
- });
31
- }
32
-
33
- async handler(bot, typeChat, user, { target, reason }) {
34
-
35
- bot.api.sendMessage(
36
- typeChat, `${user.username} выдал предупреждение игроку ${target}. Причина: ${reason}`);
37
- }
38
- }
39
-
40
- module.exports = WarnCommand;