-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathcache.html
More file actions
88 lines (77 loc) · 3.66 KB
/
Copy pathcache.html
File metadata and controls
88 lines (77 loc) · 3.66 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title>WebKitty - Caching</title>
<meta name="author" content="ArabPixel">
<link rel="stylesheet" href="includes/css/colors/default.css">
<link rel="stylesheet" href="includes/css/layouts/index.css">
<link rel="stylesheet" href="includes/css/cache.css">
</head>
<body class="bg-gray-900 text-white">
<main class="mainContainer">
<section class="cache-screen">
<div class="cache-title">Caching WebKitty</div>
<div class="progress-bar-wrap">
<div class="progress-bar-fill" id="progressFill"></div>
</div>
<div class="cache-subtitle" id="cacheStatus">Preparing...</div>
</section>
<div class="absolute bottom-10 text-center w-full">Firmware-Based Caching System</div>
</main>
<iframe id="cacheFrame" src="about:blank"></iframe>
<script src="includes/js/checkFw.js"></script>
<script>
var fwVersion = getPs4FwVersion(navigator.userAgent);
var targetPage = '';
if (fwVersion >= 6.70 && fwVersion <= 6.72) {
targetPage = 'includes/caches/cache67x.html';
} else if (fwVersion >= 7.00 && fwVersion <= 8.52) {
targetPage = 'includes/caches/cache7-8xx.html';
} else if (fwVersion >= 9.00 && fwVersion <= 9.60) {
targetPage = 'includes/caches/cache9xx.html';
} else if (fwVersion >= 10.00 && fwVersion <= 11.02) {
targetPage = 'includes/caches/cache10-1102.html';
} else {
// Unsupported firmware / payloads only
targetPage = 'includes/caches/cachePayloads.html';
}
var statusEl = document.getElementById('cacheStatus');
var fillEl = document.getElementById('progressFill');
var frame = document.getElementById('cacheFrame');
// Listen for postMessages from the iframe (iframe_cache.js)
window.addEventListener('message', function (event) {
var data = event.data;
if (!data || !data.type) return;
if (data.type === 'CACHE_PROGRESS') {
if (data.percent >= 0) {
fillEl.style.width = data.percent + '%';
statusEl.textContent = 'Downloading... ' + data.percent + '%';
} else {
statusEl.textContent = 'Downloading... (' + data.loaded + ' of ' + data.total + ')';
}
} else if (data.type === 'CACHE_COMPLETE' || data.type === 'CACHE_EXISTS') {
fillEl.style.width = '100%';
statusEl.textContent = data.type === 'CACHE_EXISTS' ? 'Already cached! Redirecting...' : 'Done! Redirecting...';
setTimeout(function () {
window.location.replace('./');
}, 1000);
} else if (data.type === 'CACHE_CHECKING') {
statusEl.textContent = 'Checking cache...';
} else if (data.type === 'CACHE_DOWNLOADING') {
statusEl.textContent = 'Caching files...';
} else if (data.type === 'CACHE_ERROR') {
var reason = data.reason || 'Unknown error';
statusEl.textContent = 'Cache error: ' + reason;
setTimeout(function () {
window.location.replace('./');
}, 3000);
}
}, false);
// Load the firmware-based cache page into the hidden iframe
statusEl.textContent = 'Starting cache for firmware ' + (fwVersion || 'unknown') + '...';
frame.src = targetPage;
</script>
</body>
</html>