Compare commits

...

4 Commits

Author SHA1 Message Date
q13x
a543a8d62b Handle failure to import jimp 2024-05-24 01:50:16 -07:00
q13x
8c151fbd8b fix: print out internal server IP rather than port for placeholder 2024-05-24 01:49:13 -07:00
q13x
71f43f4597 make config more descriptive for certain setting entries 2024-05-24 01:48:47 -07:00
q13x
8bd1ed9e8d attempted fix for #33 2024-05-24 01:48:08 -07:00
4 changed files with 19 additions and 7 deletions

View File

@ -9,6 +9,9 @@ export const config: Config = {
bindHost: "0.0.0.0", bindHost: "0.0.0.0",
bindPort: 8080, bindPort: 8080,
maxConcurrentClients: 20, maxConcurrentClients: 20,
// set this to false if you are unable to install sharp due to either the use of a platform that does not support native modules
// or if you are unable to install the required dependencies. this will cause the proxy to use jimp instead of sharp, which may
// degrade your proxy's performance.
useNatives: true, useNatives: true,
skinServer: { skinServer: {
skinUrlWhitelist: undefined, skinUrlWhitelist: undefined,
@ -20,12 +23,12 @@ export const config: Config = {
}, },
}, },
motd: true motd: true
? "FORWARD" ? "FORWARD" // "FORWARD" regularly polls the server for the MOTD
: { : {
iconURL: "motd.png", iconURL: "motd.png", // must be a valid file path
l1: "yes", l1: "yes",
l2: "no", l2: "no",
}, }, // providing an object as such will allow you to supply your own MOTD
ratelimits: { ratelimits: {
lockout: 10, lockout: 10,
limits: { limits: {

View File

@ -25,7 +25,7 @@ hushConsole();
const logger = new Logger("EaglerProxyAAS"); const logger = new Logger("EaglerProxyAAS");
logger.info(`Starting ${metadata.name} v${metadata.version}...`); logger.info(`Starting ${metadata.name} v${metadata.version}...`);
logger.info(`(internal server port: ${config.bindInternalServerPort}, internal server IP: ${config.bindInternalServerPort})`); logger.info(`(internal server port: ${config.bindInternalServerPort}, internal server IP: ${config.bindInternalServerIp})`);
logger.info("Starting internal server..."); logger.info("Starting internal server...");
let server = createServer({ let server = createServer({

View File

@ -26,7 +26,6 @@ import { CSChannelMessagePacket } from "./packets/channel/CSChannelMessage.js";
import { Constants, UPGRADE_REQUIRED_RESPONSE } from "./Constants.js"; import { Constants, UPGRADE_REQUIRED_RESPONSE } from "./Constants.js";
import { PluginManager } from "./pluginLoader/PluginManager.js"; import { PluginManager } from "./pluginLoader/PluginManager.js";
import ProxyRatelimitManager from "./ratelimit/ProxyRatelimitManager.js"; import ProxyRatelimitManager from "./ratelimit/ProxyRatelimitManager.js";
import { ChatColor } from "../plugins/EagProxyAAS/types.js";
import { SkinServer } from "./skins/SkinServer.js"; import { SkinServer } from "./skins/SkinServer.js";
let instanceCount = 0; let instanceCount = 0;
@ -149,7 +148,7 @@ export class Proxy extends EventEmitter {
}); });
process.on("beforeExit", () => { process.on("beforeExit", () => {
this._logger.info("Cleaning up before exiting..."); this._logger.info("Cleaning up before exiting...");
this.players.forEach((plr) => plr.disconnect(ChatColor.YELLOW + "Proxy is shutting down.")); this.players.forEach((plr) => plr.disconnect(Enums.ChatColor.YELLOW + "Proxy is shutting down."));
}); });
this.ratelimit = new ProxyRatelimitManager(this.config.ratelimits); this.ratelimit = new ProxyRatelimitManager(this.config.ratelimits);
this.pluginManager.emit("proxyFinishLoading", this, this.pluginManager); this.pluginManager.emit("proxyFinishLoading", this, this.pluginManager);

View File

@ -1,3 +1,4 @@
import { Logger } from "../../logger.js";
import { Constants } from "../Constants.js"; import { Constants } from "../Constants.js";
import { Enums } from "../Enums.js"; import { Enums } from "../Enums.js";
import { MineProtocol } from "../Protocol.js"; import { MineProtocol } from "../Protocol.js";
@ -17,7 +18,16 @@ export namespace ImageEditor {
if (loadedLibraries) return; if (loadedLibraries) return;
if (native) sharp = (await import("sharp")).default; if (native) sharp = (await import("sharp")).default;
else { else {
// Jimp = (await import("jimp")).default; try {
Jimp = (await import("jimp")).default;
} catch (err) {
const logger = new Logger("ImageEditor.js");
logger.fatal("**** ERROR: UNABLE TO LOAD JIMP!");
logger.fatal("Please ensure that Jimp is installed by running 'npm install jimp' in the terminal.");
logger.fatal("If you'd like to use the faster native image editor, please set the 'useNatives' option in the config to true.");
logger.fatal(`Error: ${err.stack}`);
process.exit(1);
}
Jimp.appendConstructorOption( Jimp.appendConstructorOption(
"Custom Bitmap Constructor", "Custom Bitmap Constructor",
(args) => args[0] && args[0].width != null && args[0].height != null && args[0].data != null, (args) => args[0] && args[0].width != null && args[0].height != null && args[0].data != null,