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
|
||||
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 VANILLA_PROTOCOL_VERSION: Readonly<number> = f(47)
|
||||
|
|
|
@ -35,9 +35,9 @@ export function auth(): EventEmitter {
|
|||
const emitter = new EventEmitter()
|
||||
const userIdentifier = randomUUID()
|
||||
const flow = new Authflow(userIdentifier, ({ username, cacheName }) => new InMemoryCache(), {
|
||||
authTitle: Titles.MinecraftNintendoSwitch,
|
||||
flow: 'live',
|
||||
deviceType: "Nintendo"
|
||||
authTitle: Titles.MinecraftJava,
|
||||
flow: 'sisu',
|
||||
deviceType: "Win32"
|
||||
}, code => {
|
||||
console.log = () => {}
|
||||
emitter.emit('code', code)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "EaglerProxy as a Service",
|
||||
"id": "eagpaas",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"entry_point": "index.js",
|
||||
"requirements": [{
|
||||
"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', {
|
||||
message: JSON.stringify({ text: msg }),
|
||||
message: JSON.stringify({ text: msg, ...json }),
|
||||
position: 1
|
||||
})
|
||||
}
|
||||
|
@ -223,6 +223,7 @@ export async function onConnect(client: ClientState) {
|
|||
client.lastStatusUpdate = Date.now()
|
||||
updateState(client.gameClient, 'SERVER')
|
||||
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
|
||||
while (true) {
|
||||
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 {
|
||||
host = parsed[1]
|
||||
if (parsed.length > 3) port = parseInt(parsed[2])
|
||||
if (parsed.length >= 3) port = parseInt(parsed[2])
|
||||
port = port ?? 25565
|
||||
break
|
||||
}
|
||||
}
|
||||
try {
|
||||
await PLUGIN_MANAGER.proxy.players.get(client.gameClient.username).switchServers({
|
||||
host: host,
|
||||
port: port,
|
||||
version: "1.8.8",
|
||||
username: savedAuth.selectedProfile.name,
|
||||
auth: 'mojang',
|
||||
keepAlive: false,
|
||||
session: {
|
||||
accessToken: savedAuth.accessToken,
|
||||
clientToken: savedAuth.selectedProfile.id,
|
||||
selectedProfile: {
|
||||
id: savedAuth.selectedProfile.id,
|
||||
name: savedAuth.selectedProfile.name
|
||||
|
||||
try {
|
||||
await PLUGIN_MANAGER.proxy.players.get(client.gameClient.username).switchServers({
|
||||
host: host,
|
||||
port: port,
|
||||
version: "1.8.8",
|
||||
username: savedAuth.selectedProfile.name,
|
||||
auth: 'mojang',
|
||||
keepAlive: false,
|
||||
session: {
|
||||
accessToken: savedAuth.accessToken,
|
||||
clientToken: savedAuth.selectedProfile.id,
|
||||
selectedProfile: {
|
||||
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,
|
||||
hideErrors: true
|
||||
})
|
||||
} catch (err) {
|
||||
if (!client.gameClient.ended) {
|
||||
client.gameClient.end(Enums.ChatColor.RED + `Something went wrong whilst switching servers: ${err.message}`)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user