mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 15:17:36 +00:00
chore: Convert all files to LF endings (#400)
* Convert to LF? * Modify gitattributes * Force LF * Git --renormalize * Update .gitattributes to enforce eol=lf * Redo CRLF -> LF on remaining files
This commit is contained in:
parent
a8bc7521f6
commit
cee42e7a88
65 changed files with 5697 additions and 5697 deletions
|
|
@ -1,39 +1,39 @@
|
|||
import Core from './core.js'
|
||||
|
||||
export default class mumble extends Core {
|
||||
async run (state) {
|
||||
const json = await this.withTcp(async socket => {
|
||||
return await this.tcpSend(socket, 'json', (buffer) => {
|
||||
if (buffer.length < 10) return
|
||||
const str = buffer.toString()
|
||||
let json
|
||||
try {
|
||||
json = JSON.parse(str)
|
||||
} catch (e) {
|
||||
// probably not all here yet
|
||||
return
|
||||
}
|
||||
return json
|
||||
})
|
||||
})
|
||||
|
||||
state.raw = json
|
||||
state.name = json.name
|
||||
state.gamePort = json.x_gtmurmur_connectport || 64738
|
||||
|
||||
let channelStack = [state.raw.root]
|
||||
while (channelStack.length) {
|
||||
const channel = channelStack.shift()
|
||||
channel.description = this.cleanComment(channel.description)
|
||||
channelStack = channelStack.concat(channel.channels)
|
||||
for (const user of channel.users) {
|
||||
user.comment = this.cleanComment(user.comment)
|
||||
state.players.push(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanComment (str) {
|
||||
return str.replace(/<.*>/g, '')
|
||||
}
|
||||
}
|
||||
import Core from './core.js'
|
||||
|
||||
export default class mumble extends Core {
|
||||
async run (state) {
|
||||
const json = await this.withTcp(async socket => {
|
||||
return await this.tcpSend(socket, 'json', (buffer) => {
|
||||
if (buffer.length < 10) return
|
||||
const str = buffer.toString()
|
||||
let json
|
||||
try {
|
||||
json = JSON.parse(str)
|
||||
} catch (e) {
|
||||
// probably not all here yet
|
||||
return
|
||||
}
|
||||
return json
|
||||
})
|
||||
})
|
||||
|
||||
state.raw = json
|
||||
state.name = json.name
|
||||
state.gamePort = json.x_gtmurmur_connectport || 64738
|
||||
|
||||
let channelStack = [state.raw.root]
|
||||
while (channelStack.length) {
|
||||
const channel = channelStack.shift()
|
||||
channel.description = this.cleanComment(channel.description)
|
||||
channelStack = channelStack.concat(channel.channels)
|
||||
for (const user of channel.users) {
|
||||
user.comment = this.cleanComment(user.comment)
|
||||
state.players.push(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanComment (str) {
|
||||
return str.replace(/<.*>/g, '')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue