-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitdiff.txt
More file actions
381 lines (360 loc) · 10.7 KB
/
Copy pathgitdiff.txt
File metadata and controls
381 lines (360 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
diff --git a/Backend/__pycache__/config.cpython-314.pyc b/Backend/__pycache__/config.cpython-314.pyc
new file mode 100644
index 0000000..4acc2c6
Binary files /dev/null and b/Backend/__pycache__/config.cpython-314.pyc differ
diff --git a/Backend/server.py b/Backend/server.py
index 0d6b03a..a4cf335 100644
--- a/Backend/server.py
+++ b/Backend/server.py
@@ -1,14 +1,48 @@
+
import http.server
import socketserver
+import sys
import urllib.parse
import json
import re
import secrets
from pathlib import Path
+import subprocess
import os
+import socket
from config import ROOT_DIR
-PORT = int(os.environ.get('PORT', 5000))
+# ---------------------------------------------------------------------------
+# Start server
+# ---------------------------------------------------------------------------
+
+def free_port(port):
+ """Kill any process listening on the given port (macOS/Linux)."""
+ import subprocess, os, signal, time
+ try:
+ result = subprocess.run(
+ ['lsof', '-ti', f':{port}'],
+ capture_output=True, text=True, timeout=5
+ )
+ pids = result.stdout.strip().splitlines()
+ for pid in pids:
+ pid = pid.strip()
+ if pid and pid.isdigit():
+ os.kill(int(pid), signal.SIGKILL)
+ print(f"Killed process {pid} on port {port}")
+ time.sleep(0.5)
+ except Exception:
+ # lsof not available, or no process
+ pass
+
+class ReusableTCPServer(socketserver.TCPServer):
+ allow_reuse_address = True
+
+ def server_bind(self):
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ super().server_bind()
+
+PORT = int(os.environ.get('PORT', 5001))
BASE_DIR = ROOT_DIR
# Simple .env reader (no external package)
@@ -1085,9 +1119,22 @@ class AdminHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
pass
-socketserver.TCPServer.allow_reuse_address = True
-with socketserver.TCPServer(("0.0.0.0", PORT), AdminHTTPRequestHandler) as httpd:
- print(f"Serving HTTP on 0.0.0.0 port {PORT}...")
- httpd.serve_forever()
+if __name__ == '__main__':
+ import time
+ free_port(PORT)
+ for attempt in range(5):
+ try:
+ with ReusableTCPServer(("0.0.0.0", PORT), AdminHTTPRequestHandler) as httpd:
+ print(f"Serving HTTP on 0.0.0.0 port {PORT}...")
+ httpd.serve_forever()
+ except OSError as e:
+ if e.errno == 48:
+ print(f"Port {PORT} still in use ({attempt+1}/5). Waiting 2 seconds...")
+ time.sleep(2)
+ else:
+ raise
+ else:
+ print(f"Failed to bind to port {PORT} after 5 attempts.")
+ sys.exit(1)
diff --git a/KnowFlux Summer Updates/Week 3/day14notes.md b/KnowFlux Summer Updates/Week 3/day14notes.md
new file mode 100644
index 0000000..e69de29
diff --git a/css/base.css b/css/base.css
index f0581e8..6c59007 100644
--- a/css/base.css
+++ b/css/base.css
@@ -26,6 +26,7 @@ h2 {
font-size: 30px;
}
+
.spacer.v10 {
height: 10px;
}
diff --git a/css/omni-dex.css b/css/omni-dex.css
index 7e4e59e..114b78f 100644
--- a/css/omni-dex.css
+++ b/css/omni-dex.css
@@ -204,14 +204,14 @@ body.omni-dex[data-universe="exploded"] {
}
/* =========================================================
- Omni‑Dex Modal – KnowFlux Codex Design
+ Omni‑Dex Modal – Nintendo KnowFlux Style
========================================================= */
-/* Full-screen overlay */
+/* Full-screen overlay – saturated blue instead of dark grey */
.omni-modal {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
- background: rgba(0,0,0,0.7);
+ background: rgba(67, 146, 241, 0.55);
display: flex;
align-items: center;
justify-content: center;
@@ -225,17 +225,30 @@ body.omni-dex[data-universe="exploded"] {
pointer-events: auto;
}
-/* Modal body */
+/* Modal body – white background, thick black border, chunky coloured shadow */
.omni-modal-content {
- background: #1a1a2e;
- border: 3px solid var(--omni-dex-accent);
- border-radius: 12px;
+ background: #ffffff;
+ border: 4px solid #000;
+ border-radius: 0;
width: 90%;
max-width: 560px;
display: flex;
flex-direction: column;
padding: 20px 16px 16px;
- box-shadow: 0 0 30px rgba(0,0,0,0.5);
+ box-shadow: 8px 8px 0 var(--omni-dex-accent);
+ transform: scale(0.92);
+ transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
+}
+.omni-modal.visible .omni-modal-content {
+ transform: scale(1);
+}
+
+/* Per-universe shadow colouring */
+.omni-modal-content[data-universe="exploded"] {
+ box-shadow: 8px 8px 0 #D4A017;
+}
+.omni-modal-content[data-universe="pinnacle"] {
+ box-shadow: 8px 8px 0 #4392F1;
}
/* Screen area */
@@ -249,35 +262,42 @@ body.omni-dex[data-universe="exploded"] {
}
.omni-modal-titlebar {
- border-bottom: 2px solid var(--omni-dex-accent);
- padding: 0 0 8px;
+ border-bottom: 4px solid #F46036;
+ padding: 0 8px 8px 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.omni-modal-title {
- font-family: 'Courier New', monospace;
+ font-family: 'Anton', cursive;
font-weight: normal;
- font-size: 1.2rem;
- color: var(--omni-dex-accent);
- letter-spacing: 0.5px;
+ font-size: 1.5rem;
+ color: #333;
+ text-transform: uppercase;
+ letter-spacing: 1px;
}
-/* Stats toggle button in titlebar */
+/* Stats toggle button – chunky Nintendo-style */
.omni-modal-stats-btn {
- background: transparent;
- border: 1px solid var(--omni-dex-accent);
- color: var(--omni-dex-accent);
- font-family: 'Courier New', monospace;
- font-size: 0.8rem;
- padding: 4px 10px;
- border-radius: 4px;
+ background: #4392F1;
+ color: #fff;
+ border: 3px solid #000;
+ font-family: 'Anton', cursive;
+ font-size: 0.9rem;
+ padding: 6px 14px;
+ box-shadow: 4px 4px 0 #000;
+ text-transform: uppercase;
+ letter-spacing: 1px;
cursor: pointer;
- transition: background 0.2s, color 0.2s;
+ transition: transform 0.1s, box-shadow 0.1s;
}
.omni-modal-stats-btn:hover {
- background: var(--omni-dex-accent);
- color: #ffffff;
+ transform: translate(2px, 2px);
+ box-shadow: 2px 2px 0 #000;
+}
+.omni-modal-stats-btn:active {
+ transform: translate(4px, 4px);
+ box-shadow: 0 0 0 #000;
}
/* Body wrapper: holds content and sidebar */
@@ -291,7 +311,7 @@ body.omni-dex[data-universe="exploded"] {
.omni-modal-body {
padding: 12px 0;
overflow-y: auto;
- color: #e0e0e0;
+ color: #333;
font-family: 'Open Sans', sans-serif;
line-height: 1.7;
flex: 1;
@@ -301,17 +321,18 @@ body.omni-dex[data-universe="exploded"] {
margin: 0 0 0.8rem;
}
-/* Stats sidebar – slides in from right, overlays content */
+/* Stats sidebar – white with chunky black border and orange accent */
.omni-modal-stats-sidebar {
position: absolute;
top: 0;
right: -320px;
width: 300px;
height: 100%;
- background: #0f171e;
- border-left: 2px solid var(--omni-dex-accent);
+ background: #fff;
+ border-left: 4px solid #000;
+ box-shadow: -4px 0 0 #F46036;
padding: 12px;
- padding-top: 30px; /* extra space so tooltips near top are fully visible */
+ padding-top: 30px;
overflow-y: auto;
transition: right 0.3s ease;
box-sizing: border-box;
@@ -324,34 +345,37 @@ body.omni-dex[data-universe="exploded"] {
margin-right: 0;
}
-/* Stat items inside sidebar – reuse existing .omni-stat styles but adjust colors */
+/* Stat items inside sidebar – dark text on white */
.omni-modal-stats-sidebar .omni-stat-label {
- color: #aaaaaa;
+ color: #333;
cursor: pointer;
width: 150px;
overflow-wrap: break-word;
word-break: break-word;
}
.omni-modal-stats-sidebar .omni-stat-value {
- color: #e0e0e0;
+ color: #333;
}
.omni-modal-stats-sidebar .omni-stat-bar {
- background: #2a2a2a;
+ background: #e0e0e0;
+}
+.omni-modal-stats-sidebar .omni-stat-fill {
+ background: var(--omni-dex-accent);
}
-/* Tooltip that appears when a stat is clicked — positioned below the stat bar */
+/* Tooltip that appears when a stat is clicked */
.omni-stat-tooltip {
position: absolute;
top: 100%;
left: 0;
right: 0;
- background: #333;
- color: #e0e0e0;
+ background: #fff;
+ color: #333;
font-family: 'Open Sans', sans-serif;
font-size: 0.75rem;
padding: 4px 8px;
- border-radius: 4px;
- border: 1px solid var(--omni-dex-accent);
+ border: 3px solid #000;
+ box-shadow: 4px 4px 0 #F46036;
z-index: 20;
pointer-events: auto;
word-wrap: break-word;
@@ -372,33 +396,38 @@ body.omni-dex[data-universe="exploded"] {
padding: 0;
}
-/* Flat buttons */
+/* Chunky square buttons */
.omni-modal-btn {
- padding: 8px 18px;
- font-family: 'Open Sans', sans-serif;
+ padding: 10px 22px;
+ font-family: 'Anton', cursive;
font-size: 0.9rem;
- font-weight: 600;
- border: none;
- border-radius: 6px;
+ text-transform: uppercase;
+ letter-spacing: 1px;
+ border: 3px solid #000;
+ border-radius: 0;
cursor: pointer;
- transition: background 0.2s, transform 0.1s;
+ transition: transform 0.1s, box-shadow 0.1s;
+ box-shadow: 4px 4px 0 #000;
}
.omni-modal-btn:active {
- transform: scale(0.97);
+ transform: translate(2px, 2px);
+ box-shadow: 2px 2px 0 #000;
}
.omni-modal-btn-close {
- background: #555;
- color: white;
+ background: #F46036;
+ color: #fff;
}
.omni-modal-btn-close:hover {
- background: #777;
+ transform: translate(2px, 2px);
+ box-shadow: 2px 2px 0 #000;
}
.omni-modal-btn-next {
- background: var(--omni-dex-accent);
- color: white;
+ background: #4392F1;
+ color: #fff;
}
.omni-modal-btn-next:hover {
- filter: brightness(1.1);
+ transform: translate(2px, 2px);
+ box-shadow: 2px 2px 0 #000;
}
/* Status messages */
diff --git a/js/omni-dex.js b/js/omni-dex.js
index 89f0fb0..cc2a6fd 100644
--- a/js/omni-dex.js
+++ b/js/omni-dex.js
@@ -19,6 +19,7 @@
const modalBodyWrapper = modal.querySelector('.omni-modal-body-wrapper');
const body = document.body;
const modalScreen = modal.querySelector('.omni-modal-screen');
+ const modalContentOuter = modal.querySelector('.omni-modal-content');
// ── State ──
let allEntries = [];
@@ -187,6 +188,9 @@
modalTitle.textContent = entry.title;
modalContent.innerHTML = entry.content || '<p>No further details available.</p>';
+ // Set data-universe on outer modal content for per-universe theming
+ modalContentOuter.dataset.universe = entry.universe || 'pinnacle';
+
// Populate stats sidebar
if (entry.stats) {
modalStatsContent.innerHTML = renderStats(entry.stats);
diff --git a/requirements.txt b/requirements.txt
index 20781e7..eac0850 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
-# None needed.
\ No newline at end of file
+# No external Python packages required – all dependencies are in the standard library.
\ No newline at end of file