fix: complete logical clock wall-time isolation

This commit is contained in:
2026-08-04 20:37:56 +09:00
committed by Hide_D
parent 5d9512ced7
commit fc6f84ce23
67 changed files with 689 additions and 231 deletions
+13 -5
View File
@@ -42,8 +42,12 @@ type CardItem = {
type GeneralPoolResponse = {
result: true,
pick: CardItem[],
validUntil: string,
}
validUntil: string,
validForSeconds: number,
clockMode: "realtime" | "manual",
}
let logicalClockRunning = true;
declare const characterInfo: Record<string, { name: string, info: string }>;
declare const hasGeneralID: number;
@@ -185,7 +189,10 @@ async function buildGeneral(e: JQuery.Event) {
location.href = './';
}
function updateOutdateTimer() {
function updateOutdateTimer() {
if (!logicalClockRunning) {
return;
}
const $validUntilText = $('#valid_until_text');
const now = Date.now();
const validUntil = $validUntilText.data('until');
@@ -204,10 +211,11 @@ function updateOutdateTimer() {
setTimeout(updateOutdateTimer, 1000);
}
function printGenerals(value: GeneralPoolResponse) {
function printGenerals(value: GeneralPoolResponse) {
logicalClockRunning = value.clockMode === "realtime";
$('.card_holder').empty();
$('#valid_until').show();
$('#valid_until_text').html(value.validUntil).data('until', (new Date(value.validUntil)).getTime()).css('color', 'white');
$('#valid_until_text').html(value.validUntil).data('until', Date.now() + value.validForSeconds * 1000).css('color', 'white');
$('#outdate_token').hide();
const pick = value.pick.map(v => v);//XXX: 의도가 뭐였지? clone?