use telemetry created at instead
This commit is contained in:
parent
36ca321a8c
commit
616e0d6c6c
13
src/main.tsx
13
src/main.tsx
@ -1,6 +1,6 @@
|
||||
import Fastify from 'fastify'
|
||||
import { Database } from './database.js';
|
||||
import { MatchResponse, PlayerResponse, PubgApi } from './pubg-api.js';
|
||||
import { Asset, MatchResponse, PlayerResponse, PubgApi } from './pubg-api.js';
|
||||
import { Mutex } from 'async-mutex';
|
||||
import { render, renderToStringAsync } from 'preact-render-to-string';
|
||||
import { h, Fragment } from 'preact';
|
||||
@ -57,8 +57,12 @@ function getBotCount(match: MatchResponse) {
|
||||
return { playerCount, botCount, humanCount: playerCount - botCount };
|
||||
}
|
||||
|
||||
function getChickenDinnerUrl(match: MatchResponse, player: PlayerResponse['data'][0]) {
|
||||
function getTelemetry(match: MatchResponse) {
|
||||
const asset = match.included.find(i => i.type === 'asset')!;
|
||||
return asset!;
|
||||
}
|
||||
|
||||
function getChickenDinnerUrl(asset: Asset, player: PlayerResponse['data'][0]) {
|
||||
const url = asset.attributes.URL.substring('https://telemetry-cdn.pubg.com/bluehole-pubg/'.length).replace('-telemetry.json', '');
|
||||
return `https://chickendinner.gg/${url}?follow=${player.attributes.name}`;
|
||||
}
|
||||
@ -101,7 +105,8 @@ li a { padding: 0 5px; }
|
||||
var map = PubgApi.mapName(m.data.attributes.mapName);
|
||||
var rank = getRank(m, player.id);
|
||||
var count = getBotCount(m);
|
||||
const date = dayjs(m.data.attributes.createdAt).add(m.data.attributes.duration, 's');
|
||||
const telemetry = getTelemetry(m);
|
||||
const date = dayjs(telemetry.attributes.createdAt);
|
||||
|
||||
return <div>
|
||||
<ul>
|
||||
@ -113,7 +118,7 @@ li a { padding: 0 5px; }
|
||||
<li>Links:
|
||||
<a href={`/match/${match.id}`}>Raw</a>
|
||||
<a href={`https://pubglookup.com/players/steam/${player.attributes.name.toLowerCase()}/matches/${match.id}`}>PUBGLookup</a>
|
||||
<a href={getChickenDinnerUrl(m, player)}>map replay</a>
|
||||
<a href={getChickenDinnerUrl(telemetry, player)}>map replay</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user