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'
|
||||
|
||||
@ -84,7 +84,6 @@ export class ServerRegistration {
|
||||
isFavorite = false
|
||||
rankIndex
|
||||
lastRecordData
|
||||
lastVersions = []
|
||||
lastPeakData
|
||||
|
||||
constructor (app, serverId, data) {
|
||||
@ -175,21 +174,14 @@ export class ServerRegistration {
|
||||
// Otherwise the ping value is pushed into the graphData when already present
|
||||
this.handlePing(ping, !isInitialUpdate)
|
||||
|
||||
// Compare against a cached value to avoid empty updates
|
||||
// Allow undefined ping.versions inside the if statement for text reset handling
|
||||
if (ping.versions && !isArrayEqual(ping.versions, this.lastVersions)) {
|
||||
this.lastVersions = ping.versions
|
||||
|
||||
if (ping.versions) {
|
||||
const versionsElement = document.getElementById('version_' + this.serverId)
|
||||
|
||||
versionsElement.style.display = 'block'
|
||||
versionsElement.innerText = formatMinecraftVersions(ping.versions, minecraftVersions[this.data.type]) || ''
|
||||
}
|
||||
|
||||
// Compare against a cached value to avoid empty updates
|
||||
if (ping.recordData !== undefined && !isObjectEqual(ping.recordData, this.lastRecordData, ['playerCount', 'timestamp'])) {
|
||||
this.lastRecordData = ping.recordData
|
||||
|
||||
if (ping.recordData) {
|
||||
// Always set label once any record data has been received
|
||||
const recordLabelElement = document.getElementById('record_' + this.serverId)
|
||||
|
||||
@ -206,6 +198,8 @@ export class ServerRegistration {
|
||||
} else {
|
||||
recordValueElement.innerText = formatNumber(recordData.playerCount)
|
||||
}
|
||||
|
||||
this.lastRecordData = recordData
|
||||
}
|
||||
|
||||
if (ping.graphPeakData) {
|
||||
|
@ -135,20 +135,6 @@ export function isArrayEqual (a, b) {
|
||||
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/
|
||||
export function isMobileBrowser () {
|
||||
var check = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user