File size: 16,468 Bytes
b34d3b4 cd070e6 be562f1 cd070e6 e25df20 cd070e6 cf78d72 e25df20 7366e94 b34d3b4 e25df20 cf78d72 65ad326 be562f1 6864d4c c388698 c9e432f be562f1 cc00440 6ade058 c9e432f 6ade058 cc00440 6ade058 cc00440 cf44a9b 6ade058 c9e432f b34d3b4 cc00440 c9e432f cc00440 c9e432f cc00440 b34d3b4 cc00440 cf78d72 cf44a9b b34d3b4 cf78d72 cc00440 f71e221 cf78d72 f71e221 cc00440 b34d3b4 cc00440 b34d3b4 cc00440 4465557 cc00440 6ade058 cc00440 6ade058 cc00440 6ade058 cf44a9b 6ade058 cf44a9b 6ade058 cf44a9b c9e432f cf44a9b f71e221 c9e432f cf44a9b 6ade058 cc00440 6ade058 cf44a9b 6ade058 cf44a9b cc00440 c9e432f cf44a9b 6ade058 cf44a9b 6ade058 cf44a9b 6ade058 f71e221 b34d3b4 cf44a9b c9e432f 6864d4c cf44a9b c9e432f 6864d4c cf44a9b 6864d4c cf44a9b 6ade058 b34d3b4 f71e221 b34d3b4 f71e221 b34d3b4 f71e221 b34d3b4 cc00440 6ade058 6864d4c cc00440 6864d4c 6ade058 cc00440 6ade058 cf44a9b 6864d4c f71e221 6864d4c c9e432f cf44a9b 6864d4c cc00440 c9e432f cf44a9b 6ade058 c9e432f 6ade058 f71e221 cc00440 c9e432f 6ade058 cf44a9b 6864d4c f71e221 b34d3b4 6ade058 cc00440 6864d4c f71e221 cf78d72 cc00440 b34d3b4 6864d4c f71e221 c9e432f 6ade058 cc00440 cf44a9b cc00440 6ade058 cf44a9b be562f1 4465557 cc00440 6ade058 cc00440 4465557 cc00440 be562f1 6ade058 cc00440 cf44a9b cc00440 cf44a9b b34d3b4 be562f1 6ade058 b34d3b4 be562f1 cf44a9b 6864d4c f71e221 6864d4c cf44a9b cc00440 c9e432f be562f1 6ade058 be562f1 cf44a9b 6ade058 cf44a9b cc00440 cf44a9b cc00440 cf44a9b cc00440 cf44a9b b34d3b4 cf44a9b b34d3b4 cf44a9b b34d3b4 cf44a9b b34d3b4 cf44a9b cc00440 cf44a9b b34d3b4 cf44a9b cc00440 cf44a9b cc00440 cf44a9b cc00440 cf44a9b 7366e94 cf44a9b cc00440 cf44a9b cc00440 b34d3b4 cf44a9b b34d3b4 cf44a9b f71e221 6ade058 cc00440 cf44a9b cc00440 f71e221 cc00440 c9e432f cf44a9b 6ade058 cc00440 c9e432f 6ade058 cf44a9b b34d3b4 cf44a9b cc00440 cf44a9b cc00440 cf44a9b cc00440 cf44a9b f71e221 cf44a9b 6ade058 f71e221 cf44a9b 6ade058 cc00440 cf44a9b 6ade058 cc00440 f71e221 6ade058 f71e221 cf44a9b f71e221 6864d4c 6ade058 f71e221 7366e94 f71e221 cf44a9b cc00440 cf44a9b 7366e94 cc00440 7366e94 f71e221 cc00440 f71e221 be562f1 65ad326 be562f1 cc00440 65ad326 be562f1 cc00440 65ad326 7366e94 cd070e6 b167788 | 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 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | from flask import Flask, jsonify
import os
app = Flask(__name__)
LINKS_FILE = "links.txt"
state = {"status": "idle", "images": []}
def load_links():
links = []
if os.path.exists(LINKS_FILE):
with open(LINKS_FILE, 'r', encoding='utf-8') as f:
for line in f:
line = line.strip()
if line and not line.startswith('#'):
links.append(line)
return links
def init_images():
global state
links = load_links()
state = {"status": "complete" if links else "error", "images": links}
HTML_PAGE = '''<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="referrer" content="no-referrer">
<title>EPSTEIN FILES</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #0a0a0a;
font-family: 'Courier New', monospace;
color: #fff;
}
#header {
background: #000;
color: #fff;
text-align: center;
padding: 20px;
font-size: 24px;
font-weight: 800;
letter-spacing: 10px;
position: sticky;
top: 0;
z-index: 100;
border-bottom: 3px solid #fff;
}
.banner {
background: #fff;
color: #000;
text-align: center;
padding: 6px;
font-size: 10px;
font-weight: 700;
letter-spacing: 3px;
}
#loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: calc(100vh - 120px);
}
.spinner {
width: 40px;
height: 40px;
border: 3px solid #333;
border-top-color: #fff;
border-radius: 50%;
animation: spin 0.6s linear infinite;
margin-bottom: 15px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text {
color: #888;
font-size: 12px;
letter-spacing: 2px;
}
.error { color: #f44 !important; }
#gallery {
display: none;
padding: 15px;
}
.gallery-header {
text-align: center;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px solid #333;
}
.gallery-header h2 {
font-size: 28px;
letter-spacing: 3px;
}
.gallery-header span {
color: #666;
font-size: 12px;
}
.gallery-header p {
color: #555;
font-size: 10px;
margin-top: 8px;
letter-spacing: 1px;
}
#grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 10px;
}
.item {
aspect-ratio: 1;
background: #111;
border: 2px solid #333;
position: relative;
cursor: pointer;
overflow: hidden;
}
.item img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.item .num {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,0.85);
color: #fff;
font-size: 9px;
padding: 4px;
text-align: center;
font-weight: 700;
}
.item .placeholder {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
color: #333;
font-size: 10px;
}
#load-trigger {
height: 60px;
display: flex;
align-items: center;
justify-content: center;
}
#load-text {
color: #555;
font-size: 10px;
letter-spacing: 2px;
}
#scroll-top {
position: fixed;
bottom: 15px;
right: 15px;
background: #000;
border: 2px solid #fff;
color: #fff;
width: 40px;
height: 40px;
font-size: 16px;
cursor: pointer;
z-index: 50;
display: none;
align-items: center;
justify-content: center;
}
#scroll-top.show { display: flex; }
#lightbox {
position: fixed;
inset: 0;
background: #000;
z-index: 300;
display: none;
flex-direction: column;
}
#lightbox.open { display: flex; }
.lb-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
border-bottom: 2px solid #fff;
}
.lb-counter {
font-size: 14px;
font-weight: 700;
letter-spacing: 2px;
}
.lb-nav { display: flex; gap: 8px; }
.lb-btn {
background: none;
border: 2px solid #fff;
color: #fff;
padding: 6px 12px;
font-size: 14px;
cursor: pointer;
font-family: inherit;
}
.lb-body {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
position: relative;
}
#lb-img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
border: 2px solid #fff;
}
#lb-loader {
position: absolute;
color: #666;
font-size: 12px;
}
@media (max-width: 600px) {
#header { font-size: 16px; letter-spacing: 5px; padding: 15px; }
.banner { font-size: 8px; padding: 4px; }
#grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery-header h2 { font-size: 22px; }
.item .num { font-size: 8px; padding: 3px; }
.lb-btn { padding: 5px 10px; font-size: 12px; }
}
@media (max-width: 380px) {
#grid { grid-template-columns: repeat(2, 1fr); }
}
</style>
</head>
<body>
<div id="header">EPSTEIN FILES</div>
<div class="banner">★ ALL IMAGES ★</div>
<div id="loading">
<div class="spinner"></div>
<div id="loading-text">Loading...</div>
</div>
<div id="gallery">
<div class="gallery-header">
<h2 id="total-count">0</h2>
<span>IMAGES</span>
<p>Click to enlarge</p>
</div>
<div id="grid"></div>
<div id="load-trigger">
<div id="load-text">SCROLL FOR MORE</div>
</div>
</div>
<button id="scroll-top">▲</button>
<div id="lightbox">
<div class="lb-header">
<div class="lb-counter" id="lb-counter">1 / 1</div>
<div class="lb-nav">
<button class="lb-btn" id="lb-prev">◄</button>
<button class="lb-btn" id="lb-next">►</button>
<button class="lb-btn" id="lb-close">✕</button>
</div>
</div>
<div class="lb-body" id="lb-body">
<div id="lb-loader">Loading...</div>
<img id="lb-img" src="" alt="" referrerpolicy="no-referrer">
</div>
</div>
<script>
let allImages = [];
let loadedCount = 0;
let currentIdx = 0;
let isLoading = false;
const BATCH = 60;
const BUFFER = 800; // pixels above/below viewport to keep loaded
const grid = document.getElementById('grid');
const lightbox = document.getElementById('lightbox');
const lbImg = document.getElementById('lb-img');
const lbLoader = document.getElementById('lb-loader');
const scrollBtn = document.getElementById('scroll-top');
const loadText = document.getElementById('load-text');
// Load a batch of items
function loadBatch() {
if (isLoading || loadedCount >= allImages.length) return;
isLoading = true;
const end = Math.min(loadedCount + BATCH, allImages.length);
const frag = document.createDocumentFragment();
for (let i = loadedCount; i < end; i++) {
const div = document.createElement('div');
div.className = 'item';
div.dataset.idx = i;
div.dataset.src = allImages[i];
div.innerHTML = '<div class="placeholder">#' + (i + 1) + '</div><div class="num">#' + (i + 1) + '</div>';
frag.appendChild(div);
}
grid.appendChild(frag);
loadedCount = end;
isLoading = false;
loadText.textContent = loadedCount >= allImages.length ?
'ALL ' + allImages.length + ' LOADED' :
loadedCount + ' / ' + allImages.length;
manageImages();
}
// Load/unload images based on viewport
function manageImages() {
const viewTop = window.scrollY - BUFFER;
const viewBottom = window.scrollY + window.innerHeight + BUFFER;
const items = grid.querySelectorAll('.item');
items.forEach(item => {
const rect = item.getBoundingClientRect();
const itemTop = rect.top + window.scrollY;
const itemBottom = itemTop + rect.height;
const inView = itemBottom > viewTop && itemTop < viewBottom;
const hasImg = item.querySelector('img');
if (inView && !hasImg) {
// Load image
const img = document.createElement('img');
img.referrerPolicy = 'no-referrer';
img.src = item.dataset.src;
item.insertBefore(img, item.querySelector('.num'));
} else if (!inView && hasImg) {
// Unload image to free memory
hasImg.remove();
}
});
}
// Scroll handler
let ticking = false;
function onScroll() {
if (ticking) return;
ticking = true;
requestAnimationFrame(() => {
ticking = false;
// Show/hide scroll button
scrollBtn.classList.toggle('show', window.scrollY > 400);
// Load more if near bottom
const trigger = document.getElementById('load-trigger');
if (trigger.getBoundingClientRect().top < window.innerHeight + 500) {
loadBatch();
}
// Manage which images are loaded
manageImages();
});
}
window.addEventListener('scroll', onScroll, { passive: true });
scrollBtn.onclick = () => window.scrollTo({ top: 0, behavior: 'smooth' });
// Grid click
grid.addEventListener('click', e => {
const item = e.target.closest('.item');
if (item) {
currentIdx = parseInt(item.dataset.idx);
openLightbox();
}
});
// Lightbox
const imgCache = new Set();
function openLightbox() {
lightbox.classList.add('open');
document.body.style.overflow = 'hidden';
showImage();
}
function closeLightbox() {
lightbox.classList.remove('open');
document.body.style.overflow = '';
}
function showImage() {
const url = allImages[currentIdx];
document.getElementById('lb-counter').textContent = (currentIdx + 1) + ' / ' + allImages.length;
if (imgCache.has(url)) {
lbLoader.style.display = 'none';
lbImg.src = url;
} else {
lbLoader.style.display = 'block';
lbImg.style.opacity = '0';
const tmp = new Image();
tmp.onload = () => {
imgCache.add(url);
lbImg.src = url;
lbImg.style.opacity = '1';
lbLoader.style.display = 'none';
preloadNearby();
};
tmp.src = url;
}
}
function preloadNearby() {
for (let d = -2; d <= 2; d++) {
if (d === 0) continue;
const i = currentIdx + d;
if (i >= 0 && i < allImages.length) {
const url = allImages[i];
if (!imgCache.has(url)) {
const img = new Image();
img.onload = () => imgCache.add(url);
img.src = url;
}
}
}
}
function nav(d) {
currentIdx = (currentIdx + d + allImages.length) % allImages.length;
showImage();
}
document.getElementById('lb-close').onclick = closeLightbox;
document.getElementById('lb-prev').onclick = () => nav(-1);
document.getElementById('lb-next').onclick = () => nav(1);
document.getElementById('lb-body').onclick = e => {
if (e.target.id === 'lb-body') closeLightbox();
};
document.addEventListener('keydown', e => {
if (!lightbox.classList.contains('open')) return;
if (e.key === 'Escape') closeLightbox();
if (e.key === 'ArrowLeft') nav(-1);
if (e.key === 'ArrowRight') nav(1);
});
// Touch swipe
let touchX = 0;
document.getElementById('lb-body').addEventListener('touchstart', e => {
touchX = e.touches[0].clientX;
}, { passive: true });
document.getElementById('lb-body').addEventListener('touchend', e => {
const diff = touchX - e.changedTouches[0].clientX;
if (Math.abs(diff) > 50) nav(diff > 0 ? 1 : -1);
}, { passive: true });
// Init
fetch('/status')
.then(r => r.json())
.then(data => {
if (data.status === 'complete' && data.images.length) {
allImages = data.images;
document.getElementById('total-count').textContent = allImages.length;
document.getElementById('loading').style.display = 'none';
document.getElementById('gallery').style.display = 'block';
loadBatch();
} else {
document.getElementById('loading-text').textContent = 'NO IMAGES';
document.getElementById('loading-text').classList.add('error');
}
})
.catch(() => {
document.getElementById('loading-text').textContent = 'ERROR';
document.getElementById('loading-text').classList.add('error');
});
</script>
</body>
</html>'''
@app.route('/')
def index():
return HTML_PAGE, 200, {'Referrer-Policy': 'no-referrer'}
@app.route('/status')
def get_status():
return jsonify(state), 200, {'Referrer-Policy': 'no-referrer'}
init_images()
if __name__ == "__main__":
app.run(host="0.0.0.0", port=7860, threaded=True) |