mirror of
https://github.com/WorldEditAxe/eaglerproxy.git
synced 2024-11-23 22:16:04 -08:00
fix EaglerProxyAAS + bump to v1.0.1
This commit is contained in:
parent
1f37152843
commit
82f28aa8d0
|
@ -5,7 +5,7 @@ export const BRIDGE_VERSION: Readonly<number> = f(1)
|
||||||
|
|
||||||
// adapter meta
|
// adapter meta
|
||||||
export const PROXY_BRANDING: Readonly<string> = f("EaglerProxy")
|
export const PROXY_BRANDING: Readonly<string> = f("EaglerProxy")
|
||||||
export const PROXY_VERSION: Readonly<string> = f("1.0.6")
|
export const PROXY_VERSION: Readonly<string> = f("1.0.7")
|
||||||
|
|
||||||
export const NETWORK_VERSION: Readonly<number> = f(0x03)
|
export const NETWORK_VERSION: Readonly<number> = f(0x03)
|
||||||
export const VANILLA_PROTOCOL_VERSION: Readonly<number> = f(47)
|
export const VANILLA_PROTOCOL_VERSION: Readonly<number> = f(47)
|
||||||
|
|
|
@ -35,9 +35,9 @@ export function auth(): EventEmitter {
|
||||||
const emitter = new EventEmitter()
|
const emitter = new EventEmitter()
|
||||||
const userIdentifier = randomUUID()
|
const userIdentifier = randomUUID()
|
||||||
const flow = new Authflow(userIdentifier, ({ username, cacheName }) => new InMemoryCache(), {
|
const flow = new Authflow(userIdentifier, ({ username, cacheName }) => new InMemoryCache(), {
|
||||||
authTitle: Titles.MinecraftNintendoSwitch,
|
authTitle: Titles.MinecraftJava,
|
||||||
flow: 'live',
|
flow: 'sisu',
|
||||||
deviceType: "Nintendo"
|
deviceType: "Win32"
|
||||||
}, code => {
|
}, code => {
|
||||||
console.log = () => {}
|
console.log = () => {}
|
||||||
emitter.emit('code', code)
|
emitter.emit('code', code)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "EaglerProxy as a Service",
|
"name": "EaglerProxy as a Service",
|
||||||
"id": "eagpaas",
|
"id": "eagpaas",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"entry_point": "index.js",
|
"entry_point": "index.js",
|
||||||
"requirements": [{
|
"requirements": [{
|
||||||
"id": "eaglerproxy",
|
"id": "eaglerproxy",
|
||||||
|
|
|
@ -84,9 +84,9 @@ export function awaitCommand(client: Client, filter: (msg: string) => boolean):
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendMessage(client: Client, msg: string) {
|
export function sendMessage(client: Client, msg: string, json?: any) {
|
||||||
client.write('chat', {
|
client.write('chat', {
|
||||||
message: JSON.stringify({ text: msg }),
|
message: JSON.stringify({ text: msg, ...json }),
|
||||||
position: 1
|
position: 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -223,6 +223,7 @@ export async function onConnect(client: ClientState) {
|
||||||
client.lastStatusUpdate = Date.now()
|
client.lastStatusUpdate = Date.now()
|
||||||
updateState(client.gameClient, 'SERVER')
|
updateState(client.gameClient, 'SERVER')
|
||||||
sendMessage(client.gameClient, `Provide a server to join. ${Enums.ChatColor.GOLD}/join <ip> [port]${Enums.ChatColor.RESET}.`)
|
sendMessage(client.gameClient, `Provide a server to join. ${Enums.ChatColor.GOLD}/join <ip> [port]${Enums.ChatColor.RESET}.`)
|
||||||
|
sendMessage(client.gameClient, "(providing a custom port to a SRV record server domain may potentially cause issues)", { color: "gray" })
|
||||||
let host: string, port: number
|
let host: string, port: number
|
||||||
while (true) {
|
while (true) {
|
||||||
const msg = await awaitCommand(client.gameClient, msg => msg.startsWith("/join")), parsed = msg.split(/ /gi, 3)
|
const msg = await awaitCommand(client.gameClient, msg => msg.startsWith("/join")), parsed = msg.split(/ /gi, 3)
|
||||||
|
@ -230,33 +231,37 @@ export async function onConnect(client: ClientState) {
|
||||||
else if (parsed.length > 3 && isNaN(parseInt(parsed[2]))) sendMessage(client.gameClient, `A valid port number has to be passed! ${Enums.ChatColor.GOLD}/join <ip> [port]${Enums.ChatColor.RESET}.`)
|
else if (parsed.length > 3 && isNaN(parseInt(parsed[2]))) sendMessage(client.gameClient, `A valid port number has to be passed! ${Enums.ChatColor.GOLD}/join <ip> [port]${Enums.ChatColor.RESET}.`)
|
||||||
else {
|
else {
|
||||||
host = parsed[1]
|
host = parsed[1]
|
||||||
if (parsed.length > 3) port = parseInt(parsed[2])
|
if (parsed.length >= 3) port = parseInt(parsed[2])
|
||||||
port = port ?? 25565
|
port = port ?? 25565
|
||||||
break
|
|
||||||
}
|
try {
|
||||||
}
|
await PLUGIN_MANAGER.proxy.players.get(client.gameClient.username).switchServers({
|
||||||
try {
|
host: host,
|
||||||
await PLUGIN_MANAGER.proxy.players.get(client.gameClient.username).switchServers({
|
port: port,
|
||||||
host: host,
|
version: "1.8.8",
|
||||||
port: port,
|
username: savedAuth.selectedProfile.name,
|
||||||
version: "1.8.8",
|
auth: 'mojang',
|
||||||
username: savedAuth.selectedProfile.name,
|
keepAlive: false,
|
||||||
auth: 'mojang',
|
session: {
|
||||||
keepAlive: false,
|
accessToken: savedAuth.accessToken,
|
||||||
session: {
|
clientToken: savedAuth.selectedProfile.id,
|
||||||
accessToken: savedAuth.accessToken,
|
selectedProfile: {
|
||||||
clientToken: savedAuth.selectedProfile.id,
|
id: savedAuth.selectedProfile.id,
|
||||||
selectedProfile: {
|
name: savedAuth.selectedProfile.name
|
||||||
id: savedAuth.selectedProfile.id,
|
}
|
||||||
name: savedAuth.selectedProfile.name
|
},
|
||||||
|
skipValidation: true,
|
||||||
|
hideErrors: true
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
if (!client.gameClient.ended) {
|
||||||
|
sendMessage(client.gameClient, `Something went wrong whilst switching servers: ${err.message}.`, { color: "red" })
|
||||||
|
if (err.code == "ENOTFOUND") {
|
||||||
|
sendMessage(client.gameClient, `Please check that the provided IP/hostname is correct, and try again.`, { color: "red" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
skipValidation: true,
|
break
|
||||||
hideErrors: true
|
|
||||||
})
|
|
||||||
} catch (err) {
|
|
||||||
if (!client.gameClient.ended) {
|
|
||||||
client.gameClient.end(Enums.ChatColor.RED + `Something went wrong whilst switching servers: ${err.message}`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user