Skip to content

Commit

Permalink
Merge pull request #69 from CivPlatform/mojang-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Huskydog9988 authored Aug 13, 2023
2 parents cd9cb26 + 4876f15 commit 1c32275
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf
5 changes: 5 additions & 0 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ async function fetchHasJoined(args: {
clientIp?: string
}) {
const { username, shaHex, clientIp } = args

// if auth is disabled, return a "usable" item
if ('DISABLE_AUTH' in process.env)
return { name: username, uuid: `AUTH-DISABLED-${username}` }

let url = `https://sessionserver.mojang.com/session/minecraft/hasJoined?username=${username}&serverId=${shaHex}`
if (clientIp) url += `&ip=${clientIp}`
const res = await fetch(url)
Expand Down

0 comments on commit 1c32275

Please sign in to comment.