diff --git a/README.md b/README.md index 0ef96a8..a5dc2d9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/mesacarlos/WebConsole)](https://github.com/mesacarlos/WebConsole/releases/latest) ![GitHub All Releases](https://img.shields.io/github/downloads/mesacarlos/WebConsole/total?label=total%20downloads) -WebConsole is a Spigot plugin for Minecraft 1.8-1.18+ that allows you to view your server console and manage your server from anywhere. It creates a WebSocket server in the background used by the web interface to send commands, receive your console log and manage your server. +WebConsole is a Spigot plugin for Minecraft 1.8-1.21+ that allows you to view your server console and manage your server from anywhere. It creates a WebSocket server in the background used by the web interface to send commands, receive your console log and manage your server. Don't worry about privacy or security: all data is stored in your browser locally and your PC will connect directly to your minecraft server. No intermediary web servers, just you and your MC server. diff --git a/client/package-lock.json b/client/package-lock.json index a64010c..300a268 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "web-console-client", - "version": "2.5.0", + "version": "2.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "web-console-client", - "version": "2.5.0", + "version": "2.6.0", "dependencies": { "@angular/animations": "~13.3.0", "@angular/common": "~13.3.0", @@ -26,6 +26,7 @@ "@ngx-translate/core": "^14.0.0", "@ngx-translate/http-loader": "^7.0.0", "@popperjs/core": "^2.10.2", + "ansi_up": "^6.0.2", "bootstrap": "^5.1.3", "rxjs": "~7.5.0", "tslib": "^2.3.0", @@ -3432,6 +3433,14 @@ "ajv": "^8.8.2" } }, + "node_modules/ansi_up": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/ansi_up/-/ansi_up-6.0.2.tgz", + "integrity": "sha512-3G3vKvl1ilEp7J1u6BmULpMA0xVoW/f4Ekqhl8RTrJrhEBkonKn5k3bUc5Xt+qDayA6iDX0jyUh3AbZjB/l0tw==", + "engines": { + "node": "*" + } + }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -14572,6 +14581,11 @@ "fast-deep-equal": "^3.1.3" } }, + "ansi_up": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/ansi_up/-/ansi_up-6.0.2.tgz", + "integrity": "sha512-3G3vKvl1ilEp7J1u6BmULpMA0xVoW/f4Ekqhl8RTrJrhEBkonKn5k3bUc5Xt+qDayA6iDX0jyUh3AbZjB/l0tw==" + }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", diff --git a/client/package.json b/client/package.json index 4c3cc58..b237b9f 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "web-console-client", - "version": "2.5.0", + "version": "2.7.0", "scripts": { "ng": "ng", "start": "ng serve", @@ -28,6 +28,7 @@ "@ngx-translate/core": "^14.0.0", "@ngx-translate/http-loader": "^7.0.0", "@popperjs/core": "^2.10.2", + "ansi_up": "^6.0.2", "bootstrap": "^5.1.3", "rxjs": "~7.5.0", "tslib": "^2.3.0", diff --git a/client/src/app/content/console/console.component.ts b/client/src/app/content/console/console.component.ts index 4bd3b61..803ffbf 100644 --- a/client/src/app/content/console/console.component.ts +++ b/client/src/app/content/console/console.component.ts @@ -19,6 +19,7 @@ import { WebSocketResponse } from 'src/app/_dto/response/WebSocketResponse'; import { ServerDto } from 'src/app/_dto/ServerDto'; import { SettingsEnum, StorageService } from 'src/app/_services/storage.service'; import { WebconsoleService } from 'src/app/_services/webconsole.service'; +import { AnsiUp } from "ansi_up" @Component({ selector: 'app-console', @@ -211,26 +212,7 @@ export class ConsoleComponent implements OnInit, AfterViewInit, OnDestroy { msg = msg.replace(/"); - //Color filter for Windows (thanks to SuperPykkon) - msg = msg.replace(/\[0;30;22m/g, ""); //&0 - msg = msg.replace(/\[0;34;22m/g, ""); //&1 - msg = msg.replace(/\[0;32;22m/g, ""); //&2 - msg = msg.replace(/\[0;36;22m/g, ""); //&3 - msg = msg.replace(/\[0;31;22m/g, ""); //&4 - msg = msg.replace(/\[0;35;22m/g, ""); //&5 - msg = msg.replace(/\[0;33;22m/g, ""); //&6 - msg = msg.replace(/\[0;37;22m/g, ""); //&7 - msg = msg.replace(/\[0;30;1m/g, ""); //&8 - msg = msg.replace(/\[0;34;1m/g, ""); //&9 - msg = msg.replace(/\[0;32;1m/g, ""); //&a - msg = msg.replace(/\[0;36;1m/g, ""); //&b - msg = msg.replace(/\[0;31;1m/g, ""); //&c - msg = msg.replace(/\[0;35;1m/g, ""); //&d - msg = msg.replace(/\[0;33;1m/g, ""); //&e - msg = msg.replace(/\[0;37;1m/g, ""); //&f - msg = msg.replace(/\[m/g, ""); //&f - - //Color filter for UNIX (This is easier!) + //Color filter for MC codes. msg = msg.replace(/§0/g, ""); //&0 msg = msg.replace(/§1/g, ""); //&1 msg = msg.replace(/§2/g, ""); //&2 @@ -280,6 +262,10 @@ export class ConsoleComponent implements OnInit, AfterViewInit, OnDestroy { msg = msg.replace(/r/g, ""); //&r + // ANSI Processing + var ansi_up = new AnsiUp(); + msg = ansi_up.ansi_to_html(msg); + //Append datetime if enabled if (this.storageService.getSetting(SettingsEnum.DateTimePrefix)) { if (typeof time !== 'undefined' && time !== null) //if time is present and not null diff --git a/client/src/app/core/layout/layout.component.html b/client/src/app/core/layout/layout.component.html index 54c4c0c..d21331c 100644 --- a/client/src/app/core/layout/layout.component.html +++ b/client/src/app/core/layout/layout.component.html @@ -16,7 +16,7 @@