Skip to content

Commit

Permalink
3.0.4
Browse files Browse the repository at this point in the history
- Исправлены недопереводы
- Добавлена возможность удаления сервера
- Обновление пакетов
- Исправлены стили таблиц, отступы и подзаголовки в некоторых разделах
- Фиксы для консоли (новый шрифт, огран. обновлений и другой цвет меток времени)
- Различные мелкие фиксы
  • Loading branch information
Seeroy committed Jan 29, 2024
1 parent 4220589 commit 94a7b42
Show file tree
Hide file tree
Showing 27 changed files with 377 additions and 229 deletions.
12 changes: 10 additions & 2 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@
"creationStarted": "Server creation started<br>The creation process can be tracked in the task list at the bottom left<br>Once created, you will automatically be taken to the new server console",
"creationCompleted": "Server creation has been successfully completed!",
"uploadingFile": "Submitting your core file...",
"creationStartedShort": "Making some magic"
"creationStartedShort": "Making some magic",
"noCoreFile": "You didn't upload core .jar",
"noServerName": "Invalid server name",
"serverAlreadyExists": "Server already exists",
"noMemory": "Invalid memory value",
"noPort": "Invalid port value",
"noCoreSelected": "No core type/version selected"
},
"tasksTypes": {
"downloading": "Downloading",
Expand All @@ -165,6 +171,7 @@
"updating": "Updating",
"restarting": "Restarting",
"creating": "Creating",
"deletion": "Deleting",
"common": "Processing",
"unknown": "Unknown"
},
Expand Down Expand Up @@ -192,7 +199,8 @@
"restartOnError": "Restart the server when it crashes",
"restartAttempts": "Number of restart attempts",
"startScript": "Launch script",
"stopCommand": "Server stop command"
"stopCommand": "Server stop command",
"deleteServer": "Delete server?"
},
"kubekSettings": {
"language": "Interface language",
Expand Down
12 changes: 10 additions & 2 deletions languages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@
"creationStarted": "サーバー作成が開始されました。<br>作成プロセスは左下のタスクリストで追跡できます。<br>作成が完了すると、新しいサーバーコンソールに自動的に移動します。",
"creationCompleted": "サーバーの作成が正常に完了しました!",
"uploadingFile": "コアファイルのアップロード中...",
"creationStartedShort": "魔法をかけています"
"creationStartedShort": "魔法をかけています",
"noCoreFile": "コア .jar をアップロードしていません",
"noServerName": "無効なサーバー名です",
"serverAlreadyExists": "サーバーはすでに存在します",
"noMemory": "無効なメモリ値です",
"noPort": "無効なポート値",
"noCoreSelected": "コアのタイプ/バージョンが選択されていません"
},
"tasksTypes": {
"downloading": "ダウンロード中",
Expand All @@ -176,6 +182,7 @@
"downloadingCore": "コアのダウンロード中",
"creatingBat": "起動ファイルの準備中",
"completion": "完了",
"deletion": "削除中",
"completed": "完了",
"failed": "問題が発生しました"
},
Expand All @@ -192,7 +199,8 @@
"restartOnError": "クラッシュ時に再起動",
"restartAttempts": "再起動試行回数",
"startScript": "起動スクリプト",
"stopCommand": "サーバー停止コマンド"
"stopCommand": "サーバー停止コマンド",
"deleteServer": "サーバーを削除しますか?"
},
"kubekSettings": {
"language": "言語",
Expand Down
12 changes: 10 additions & 2 deletions languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@
"creationStarted": "Создание сервера запущено<br>Процесс создания можно отслеживать в списке задач слева снизу<br>После создания вы автоматически перейдете на консоль нового сервера",
"creationCompleted": "Создание сервера успешно завершено! Хотите перейти к нему?",
"uploadingFile": "Загружаем ваш файл ядра...",
"creationStartedShort": "Творим магию"
"creationStartedShort": "Творим магию",
"noCoreFile": "Вы не загрузили файл ядра",
"noServerName": "Неверное имя сервера",
"serverAlreadyExists": "Такой сервер уже существует",
"noMemory": "Неверное значение памяти",
"noPort": "Неверное значение порта",
"noCoreSelected": "Не выбрано ядро/версия ядра"
},
"tasksTypes": {
"downloading": "Скачивание",
Expand All @@ -165,6 +171,7 @@
"updating": "Обновление",
"restarting": "Перезапуск",
"creating": "Создание",
"deletion": "Удаление",
"common": "Процесс",
"unknown": "Неизвестно"
},
Expand Down Expand Up @@ -192,7 +199,8 @@
"restartOnError": "Перезапускать сервер при краше",
"restartAttempts": "Кол-во попыток перезапуска",
"startScript": "Скрипт запуска",
"stopCommand": "Команда остановки сервера"
"stopCommand": "Команда остановки сервера",
"deleteServer": "Удалить сервер?"
},
"kubekSettings": {
"language": "Язык интерфейса",
Expand Down
5 changes: 3 additions & 2 deletions modules/predefined.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ exports.TASKS_TYPES = {
UPDATING: "updating",
RESTARTING: "restarting",
CREATING: "creating",
DELETION: "deletion",
COMMON: "common",
UNKNOWN: "unknown"
}
Expand All @@ -72,10 +73,10 @@ exports.KUBEK_LOGO_ASCII = " /$$ /$$ /$$ \n
exports.UPDATES_URL_API = "https://api.github.com/repos/Seeroy/kubek-minecraft-dashboard/releases";

// URL к API для отправки статистики
exports.STATS_SEND_URL = "http://seeroy.ru:8080/save_kubek?savedata=";
exports.STATS_SEND_URL = "https://statscol.seeroy.ru/save_kubek?savedata=";

// URL с файлом ядер Spigot
exports.SPIGOT_JSON_URL = "http://kubek.seeroy.ru/spigots.json";
exports.SPIGOT_JSON_URL = "https://kubek.seeroy.ru/spigots.json";

// URL со списком доступных версий Java
exports.JAVA_LIST_URL = "https://api.adoptium.net/v3/info/available_releases";
Expand Down
32 changes: 32 additions & 0 deletions modules/serversManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const PREDEFINED = require("./predefined");
const CONFIGURATION = require("./configuration");
const COMMONS = require("./commons");
const TASKMANAGER = require("./taskManager");

const fs = require("fs");
const TASK_MANAGER = require("./taskManager");
const path = require("path");

// Проверить сервер на существование
exports.isServerExists = (serverName) => {
Expand Down Expand Up @@ -58,4 +63,31 @@ exports.setServerProperty = (serverName, property, value) => {
// DEVELOPED by seeeroy
exports.getServersList = () => {
return Object.keys(serversConfig);
};

// Безвозвратно удалить сервер
exports.deleteServer = (serverName) => {
if(this.isServerExists(serverName) && this.getServerStatus(serverName) === PREDEFINED.SERVER_STATUSES.STOPPED){
// Добавляем новую таску
let serverDelTaskID = TASK_MANAGER.addNewTask({
type: PREDEFINED.TASKS_TYPES.DELETION,
server: serverName,
status: PREDEFINED.SERVER_STATUSES.RUNNING
})

// Запускаем удаление папки
fs.rm("./servers/" + serverName, { recursive: true, force: true }, (err) => {
if(err){
throw err;
}
// Удаляем сервер из конфигурации и меняем статус таски
serversConfig[serverName] = null;
delete serversConfig[serverName];
CONFIGURATION.writeServersConfig(serversConfig);
let tData = TASK_MANAGER.getTaskData(serverDelTaskID);
tData.status = PREDEFINED.SERVER_CREATION_STEPS.COMPLETED;
});
return true;
}
return false;
};
8 changes: 5 additions & 3 deletions modules/taskManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ exports.getTaskData = (taskID) => {
// Удалить все завершённые задачи
exports.removeCompletedTasks = () => {
for (const [key, value] of Object.entries(tasks)) {
if(typeof value.currentStep !== "undefined" && value.currentStep === PREDEFINED.SERVER_CREATION_STEPS.COMPLETED){
tasks[key] = null;
delete tasks[key];
if (typeof value.currentStep !== "undefined" || typeof value.status !== "undefined") {
if (value.currentStep === PREDEFINED.SERVER_CREATION_STEPS.COMPLETED || value.status === PREDEFINED.SERVER_CREATION_STEPS.COMPLETED) {
tasks[key] = null;
delete tasks[key];
}
}
}
return true;
Expand Down
Loading

0 comments on commit 94a7b42

Please sign in to comment.