remove frontend diffing behavior since the protocol does this now
This commit is contained in:
parent
0e19904c39
commit
7d47e9b5f8
@ -1,4 +1,4 @@
|
|||||||
import { formatNumber, formatTimestamp, formatDate, formatMinecraftServerAddress, formatMinecraftVersions, isArrayEqual, isObjectEqual } from './util'
|
import { formatNumber, formatTimestamp, formatDate, formatMinecraftServerAddress, formatMinecraftVersions } from './util'
|
||||||
|
|
||||||
import MISSING_FAVICON from '../images/missing_favicon.svg'
|
import MISSING_FAVICON from '../images/missing_favicon.svg'
|
||||||
|
|
||||||
@ -84,7 +84,6 @@ export class ServerRegistration {
|
|||||||
isFavorite = false
|
isFavorite = false
|
||||||
rankIndex
|
rankIndex
|
||||||
lastRecordData
|
lastRecordData
|
||||||
lastVersions = []
|
|
||||||
lastPeakData
|
lastPeakData
|
||||||
|
|
||||||
constructor (app, serverId, data) {
|
constructor (app, serverId, data) {
|
||||||
@ -175,21 +174,14 @@ export class ServerRegistration {
|
|||||||
// Otherwise the ping value is pushed into the graphData when already present
|
// Otherwise the ping value is pushed into the graphData when already present
|
||||||
this.handlePing(ping, !isInitialUpdate)
|
this.handlePing(ping, !isInitialUpdate)
|
||||||
|
|
||||||
// Compare against a cached value to avoid empty updates
|
if (ping.versions) {
|
||||||
// Allow undefined ping.versions inside the if statement for text reset handling
|
|
||||||
if (ping.versions && !isArrayEqual(ping.versions, this.lastVersions)) {
|
|
||||||
this.lastVersions = ping.versions
|
|
||||||
|
|
||||||
const versionsElement = document.getElementById('version_' + this.serverId)
|
const versionsElement = document.getElementById('version_' + this.serverId)
|
||||||
|
|
||||||
versionsElement.style.display = 'block'
|
versionsElement.style.display = 'block'
|
||||||
versionsElement.innerText = formatMinecraftVersions(ping.versions, minecraftVersions[this.data.type]) || ''
|
versionsElement.innerText = formatMinecraftVersions(ping.versions, minecraftVersions[this.data.type]) || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare against a cached value to avoid empty updates
|
if (ping.recordData) {
|
||||||
if (ping.recordData !== undefined && !isObjectEqual(ping.recordData, this.lastRecordData, ['playerCount', 'timestamp'])) {
|
|
||||||
this.lastRecordData = ping.recordData
|
|
||||||
|
|
||||||
// Always set label once any record data has been received
|
// Always set label once any record data has been received
|
||||||
const recordLabelElement = document.getElementById('record_' + this.serverId)
|
const recordLabelElement = document.getElementById('record_' + this.serverId)
|
||||||
|
|
||||||
@ -206,6 +198,8 @@ export class ServerRegistration {
|
|||||||
} else {
|
} else {
|
||||||
recordValueElement.innerText = formatNumber(recordData.playerCount)
|
recordValueElement.innerText = formatNumber(recordData.playerCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.lastRecordData = recordData
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ping.graphPeakData) {
|
if (ping.graphPeakData) {
|
||||||
|
@ -135,20 +135,6 @@ export function isArrayEqual (a, b) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isObjectEqual (a, b, props) {
|
|
||||||
if (typeof a === 'undefined' || typeof a !== typeof b) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for (let i = 0; i < props.length; i++) {
|
|
||||||
const prop = props[i]
|
|
||||||
|
|
||||||
if (typeof a[prop] === 'undefined' || typeof a[prop] !== typeof b[prop] || a[prop] !== b[prop]) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// From http://detectmobilebrowsers.com/
|
// From http://detectmobilebrowsers.com/
|
||||||
export function isMobileBrowser () {
|
export function isMobileBrowser () {
|
||||||
var check = false;
|
var check = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user