Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion server/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ function util.cooldownLeft(cid, key, ms)
if type(cid) ~= 'string' or cid == '' then return 0 end
local b = buckets[cid .. '\0c\0' .. tostring(key)]
if not b then return 0 end
local left = (tonumber(ms) or 0) - (GetGameTimer() - b.last)
local since = GetGameTimer() - b.last
if since < 0 then return 0 end
local left = (tonumber(ms) or 0) - since
return left > 0 and math.floor(left) or 0
end

Expand Down
6 changes: 3 additions & 3 deletions web/src/apps/_games/useOnlineLobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export function useOnlineLobby(game: string, options: UseOnlineLobbyOptions): On
const inHub = options.inLobbyScreen && !lobby && active;
useEffect(() => {
if (!inHub) return;
void lobbiesApi(game).then(setLobbies);
const timer = setInterval(() => { void lobbiesApi(game).then(setLobbies); }, 3000);
void lobbiesApi(game).then(setLobbies).catch(() => {});
const timer = setInterval(() => { void lobbiesApi(game).then(setLobbies).catch(() => {}); }, 3000);
return () => clearInterval(timer);
}, [inHub, game]);

Expand Down Expand Up @@ -228,7 +228,7 @@ export function useOnlineLobby(game: string, options: UseOnlineLobbyOptions): On
setReadyApi(r);
}, []);

const refresh = useCallback(() => { void lobbiesApi(game).then(setLobbies); }, [game]);
const refresh = useCallback(() => { void lobbiesApi(game).then(setLobbies).catch(() => {}); }, [game]);

const returnToLobby = useCallback(() => {
void returnToLobbyApi(game).then(r => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/lib/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function copyToClipboard(text: string): boolean {
ok = false;
}

try { void navigator.clipboard?.writeText(text); } catch { /* ignore */ }
try { void navigator.clipboard?.writeText(text).catch(() => {}); } catch { /* ignore */ }

return ok;
}