Skip to content

Commit bfa24eb

Browse files
committed
exoclick verification
1 parent dcd31fd commit bfa24eb

6 files changed

Lines changed: 110 additions & 71 deletions

File tree

src/app.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
<link rel="icon" href="%sveltekit.assets%/ccported_logo.webp" />
1818
<meta name="viewport" content="width=device-width, initial-scale=1" />
1919
<link rel="stylesheet" href="%sveltekit.assets%/main.css" />
20-
20+
21+
<!-- exoclick verification -->
22+
<meta name="6a97888e-site-verification" content="90256ef2817c47f4922d837cdf49fedc">
23+
2124
<title>CCPorted</title>
2225
%sveltekit.head%
2326

src/lib/loadCards.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ScanCommand } from "@aws-sdk/client-dynamodb";
2-
import { SessionState } from "./state.js";
2+
import { SessionState, State } from "./state.js";
33
import { unmarshall } from "@aws-sdk/util-dynamodb";
44
import type { Game } from "./types/game.js";
55

@@ -22,11 +22,10 @@ export async function loadGames(): Promise<Game[]> {
2222

2323
const response = await SessionState.dynamoDBClient.send(command);
2424
const items = response.Items ? response.Items.map(item => unmarshall(item)) : [];
25-
26-
const games: Game[] = [];
25+
State.games = [];
2726
for (const item of items) {
2827
if (item.gameID && item.fName && item.thumbPath) {
29-
games.push({
28+
State.games.push({
3029
gameID: item.gameID,
3130
thumbPath: item.thumbPath,
3231
fName: item.fName,
@@ -38,6 +37,7 @@ export async function loadGames(): Promise<Game[]> {
3837
});
3938
}
4039
}
41-
SessionState.plays = games.reduce((a, v) => a + v.clicks, 0);
42-
return games;
40+
SessionState.plays = State.games.reduce((a, v) => a + v.clicks, 0);
41+
State.games = State.games;
42+
return State.games;
4343
}

src/lib/state.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { Game } from "./types/game.js";
66
import { browser } from '$app/environment';
77
import { S3Client } from "@aws-sdk/client-s3";
88
import { detectAdBlockEnabled } from "./helpers.js";
9+
import { page } from "$app/state";
910

1011
export const SessionState = {
1112
awsReady: false,
@@ -55,14 +56,14 @@ function createState(initial: StateType): StateType {
5556
}
5657

5758
export const State = createState({
58-
version: "2.0.0.2025.09.09",
59+
version: "2.0.0.9.11.25",
5960
servers: Servers,
6061
aHosts: AHosts,
6162
currentServer: Servers[0],
6263
homeView: "grid",
6364
pinnedGames: [],
6465
games: [],
65-
isAHost: () => (AHosts.some((h): boolean => browser && h.hostname === window.location.hostname)),
66+
isAHost: () => (AHosts.some((h): boolean => browser && h.hostname === new URL(page.url).hostname)),
6667
localPlays: 0
6768
});
6869

src/routes/+page.svelte

Lines changed: 87 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77
import type { PageData } from "./$types.js";
88
import { browser } from "$app/environment";
99
import { page } from "$app/state";
10+
import { loadGames } from "$lib/loadCards.js";
1011
11-
const { data }: { data: PageData } = $props();
12-
13-
const { games } = data;
1412
let isAHost = $state(State.isAHost());
1513
let devMode = $state(true);
1614
let adblockEnabled = $state(SessionState.adBlockEnabled);
1715
let adsEnabled = $state(SessionState.adsEnabled);
18-
let sResponses = $state(SessionState.serverResponses)
16+
let sResponses = $state(SessionState.serverResponses);
17+
let games = $state(State.games);
1918
onMount(async () => {
2019
await initializeTooling();
2120
isAHost = State.isAHost();
21+
22+
await loadGames();
2223
devMode = SessionState.devMode;
2324
adblockEnabled = SessionState.adBlockEnabled;
2425
adsEnabled = SessionState.adsEnabled;
@@ -33,7 +34,7 @@
3334
/>
3435
</svelte:head>
3536

36-
{#if isAHost || devMode}
37+
{#if isAHost}
3738
<div class="container">
3839
<div class="background"></div>
3940
<Navigation />
@@ -69,49 +70,71 @@
6970
</p>
7071
<div class="information">
7172
<!-- none of this information is statefull, therefore none of it will update. this is intended behavior -->
72-
<b>Running Information:</b><br>
73+
<b>Running Information:</b><br />
7374
Browser: {browser ? navigator.userAgent : "<SSR_HOST>"}<br />
7475
Host: {browser ? window.location.hostname : "<SSR_HOST>"}<br />
7576
DevMode: {SessionState.devMode}<br />
7677
AdBlock Enabled: {adblockEnabled}<br />
7778
Ads Enabled: {adsEnabled}<br />
7879
Current Server: {State.currentServer.name} (Loaded {State.servers
7980
.length})<br />
80-
<table style="width:100%; margin: 10px 0; border-collapse: collapse; font-size: 12px;">
81+
<table
82+
style="width:100%; margin: 10px 0; border-collapse: collapse; font-size: 12px;"
83+
>
8184
<thead>
82-
<tr>
83-
<th style="border-bottom: 1px solid #ccc; text-align: left;">Server</th>
84-
<th style="border-bottom: 1px solid #ccc; text-align: left;">Status</th>
85-
<th style="border-bottom: 1px solid #ccc; text-align: left;">Ping (ms)</th>
86-
<th style="border-bottom: 1px solid #ccc; text-align: left;">Check</th>
87-
</tr>
88-
</thead>
89-
<tbody>
90-
{#each sResponses as r}
9185
<tr>
92-
<td>{r.server.name}</td>
93-
<td>{r.success ? "Success" : "Failed"}</td>
94-
<td>{r.time.toFixed(2)}</td>
95-
<td>{r.reason}</td>
86+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
87+
>Server</th
88+
>
89+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
90+
>Status</th
91+
>
92+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
93+
>Ping (ms)</th
94+
>
95+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
96+
>Check</th
97+
>
9698
</tr>
97-
{/each}
99+
</thead>
100+
<tbody>
101+
{#each sResponses as r}
102+
<tr>
103+
<td>{r.server.name}</td>
104+
<td>{r.success ? "Success" : "Failed"}</td>
105+
<td>{r.time.toFixed(2)}</td>
106+
<td>{r.reason}</td>
107+
</tr>
108+
{/each}
98109
</tbody>
99110
</table>
100111
AHost: {State.isAHost()} (Loaded {State.aHosts.length})<br />
101-
<table style="width:100%; margin: 10px 0; border-collapse: collapse; font-size: 12px;">
112+
<table
113+
style="width:100%; margin: 10px 0; border-collapse: collapse; font-size: 12px;"
114+
>
102115
<thead>
103-
<tr>
104-
<th style="border-bottom: 1px solid #ccc; text-align: left;">AHost Hostname</th>
105-
<th style="border-bottom: 1px solid #ccc; text-align: left;">ACode</th>
106-
</tr>
107-
</thead>
108-
<tbody>
109-
{#each State.aHosts as h}
110116
<tr>
111-
<td>{h.hostname}{(h.hostname && browser && h.hostname == page.url.hostname) ? " (Active)" : " (Inactive)"}</td>
112-
<td>{h.acode}</td>
117+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
118+
>AHost Hostname</th
119+
>
120+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
121+
>ACode</th
122+
>
113123
</tr>
114-
{/each}
124+
</thead>
125+
<tbody>
126+
{#each State.aHosts as h}
127+
<tr>
128+
<td
129+
>{h.hostname}{h.hostname &&
130+
browser &&
131+
h.hostname == page.url.hostname
132+
? " (Active)"
133+
: " (Inactive)"}</td
134+
>
135+
<td>{h.acode}</td>
136+
</tr>
137+
{/each}
115138
</tbody>
116139
</table>
117140
<br />
@@ -120,22 +143,41 @@
120143
Version: {State.version}<br />
121144
Logged In: {SessionState.loggedIn}<br />
122145
SSR: {SessionState.ssr}<br />
123-
<table style="width:100%; margin: 10px 0; border-collapse: collapse; font-size: 12px;">
146+
<table
147+
style="width:100%; margin: 10px 0; border-collapse: collapse; font-size: 12px;"
148+
>
124149
<thead>
125-
<tr>
126-
<th style="border-bottom: 1px solid #ccc; text-align: left;">AWS Ready</th>
127-
<th style="border-bottom: 1px solid #ccc; text-align: left;">Identity ID</th>
128-
<th style="border-bottom: 1px solid #ccc; text-align: left;">Access Key ID</th>
129-
<th style="border-bottom: 1px solid #ccc; text-align: left;">Credentials Expires</th>
130-
</tr>
150+
<tr>
151+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
152+
>AWS Ready</th
153+
>
154+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
155+
>Identity ID</th
156+
>
157+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
158+
>Access Key ID</th
159+
>
160+
<th style="border-bottom: 1px solid #ccc; text-align: left;"
161+
>Credentials Expires</th
162+
>
163+
</tr>
131164
</thead>
132165
<tbody>
133-
<tr>
134-
<td>{SessionState.awsReady ? "Yes" : "No"}</td>
135-
<td title={SessionState.credentials?.identityId || "-"}>{SessionState.credentials?.identityId.slice(0, 10) + "..." || "-"}</td>
136-
<td title={SessionState.credentials?.accessKeyId || "-"}>{SessionState.credentials?.accessKeyId.slice(0, 6) + "..." || "-"}</td>
137-
<td>{SessionState.credentials?.expiration?.toLocaleTimeString() || "-"}</td>
138-
</tr>
166+
<tr>
167+
<td>{SessionState.awsReady ? "Yes" : "No"}</td>
168+
<td title={SessionState.credentials?.identityId || "-"}
169+
>{SessionState.credentials?.identityId.slice(0, 10) +
170+
"..." || "-"}</td
171+
>
172+
<td title={SessionState.credentials?.accessKeyId || "-"}
173+
>{SessionState.credentials?.accessKeyId.slice(0, 6) +
174+
"..." || "-"}</td
175+
>
176+
<td
177+
>{SessionState.credentials?.expiration?.toLocaleTimeString() ||
178+
"-"}</td
179+
>
180+
</tr>
139181
</tbody>
140182
</table>
141183
Plays: {SessionState.plays.toLocaleString()} ({State.localPlays.toLocaleString()}
@@ -159,5 +201,4 @@
159201
text-align: left;
160202
font-family: "Courier New", Courier, monospace;
161203
}
162-
163204
</style>

src/routes/+page.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/routes/play/+page.svelte

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
import { page } from "$app/state";
1313
import { detectAdBlockEnabled, trackClick } from "$lib/helpers.js";
1414
import { browser } from "$app/environment";
15+
import Locked from "$lib/components/Locked.svelte";
1516
1617
let game: Game | null = $state(null);
1718
let adblock = $state(false);
1819
let error: string | null = $state(null);
1920
let withoutSupportingTimer = $state(5);
2021
let continued = $state(false);
21-
22+
let isAHost = $state(false);
23+
2224
async function fetchGameData() {
2325
console.log("Fetching game data");
2426
if (!browser) {
@@ -31,7 +33,7 @@
3133
error = "Missing gameID query parameter";
3234
return;
3335
}
34-
console.log("Game ID:", gameID);
36+
isAHost = State.isAHost();
3537
const dbparams = {
3638
TableName: "games_list",
3739
Key: {
@@ -40,7 +42,7 @@
4042
};
4143
const getItemCommand = new GetItemCommand(dbparams);
4244
if (!SessionState.dynamoDBClient) {
43-
console.log("Need to wait for tooling")
45+
console.log("Need to wait for tooling");
4446
await waitForTooling();
4547
}
4648
if (!SessionState.dynamoDBClient) {
@@ -252,6 +254,7 @@
252254
{game ? `Playing ${game.fName}` : "Loading..."} | CCPorted
253255
</title>
254256
</svelte:head>
257+
{#if isAHost }
255258
{#if adblock && !continued}
256259
<div class="container">
257260
<div class="adblock-warning">
@@ -287,10 +290,13 @@
287290
<p>{error}</p>
288291
</div>
289292
{:else}
290-
<div class="container">
293+
<div class= "container">
291294
<h2>Loading...</h2>
292295
</div>
293296
{/if}
297+
{:else}
298+
<Locked />
299+
{/if}
294300

295301
<style>
296302
.container {

0 commit comments

Comments
 (0)