-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathindex.html
More file actions
206 lines (188 loc) 路 6.8 KB
/
Copy pathindex.html
File metadata and controls
206 lines (188 loc) 路 6.8 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>__TITLE__</title>
<link rel="manifest" href="manifest.json" crossorigin="use-credentials" />
<link rel="icon" href="img/favicon.svg" />
<link rel="stylesheet" href="./packages/design-system/src/styles/tailwind.css" />
<script>
// Apply background color early to prevent a white flash on dark theme before theme loading finishes.
function applyInitialThemeBackground() {
var themeIsDarkStorageKey = 'oc_currentThemeIsDark'
var storedThemeIsDark = null
try {
storedThemeIsDark = localStorage.getItem(themeIsDarkStorageKey)
} catch (error) {
// Ignore storage access errors and fall back to system preference.
}
var isDark = storedThemeIsDark === 'true'
var prefersDark =
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
var shouldUseDark = storedThemeIsDark !== null ? isDark : prefersDark
var themeName = shouldUseDark ? 'dark' : 'light'
var backgroundColor = shouldUseDark ? '#1d2021' : '#f6f8fa'
document.documentElement.style.colorScheme = themeName
document.documentElement.dataset.colorScheme = themeName
document.documentElement.style.backgroundColor = backgroundColor
}
applyInitialThemeBackground()
</script>
<script type="module" src="./packages/web-runtime/src/index.ts"></script>
<script type="module">
// Fix Buffer usage in production (!)
// If single file downloads work in production after removing this, it can probably be removed permanently
import { Buffer } from 'buffer'
window.Buffer = Buffer
</script>
<style>
html,
body {
height: 100%;
}
.splash-banner {
padding: 0.5rem;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.splash-hide {
display: none;
}
/* Mirrors the OcSpinner component (size large) */
#loading {
position: relative;
display: inline-block;
width: 32px;
height: 32px;
animation: spin 1s linear infinite;
}
#loading::after {
content: '';
position: relative;
display: block;
width: 100%;
height: 100%;
box-sizing: border-box;
background-color: transparent;
border: 1px solid currentColor;
border-bottom-color: transparent;
border-radius: 9999px;
}
#splash-incompatible button {
margin: 30px 0;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div id="splash-incompatible" class="splash-banner splash-hide">
<div class="oc-card border rounded-sm w-lg text-center">
<div class="oc-card-header">
<div class="flex items-center justify-center">
<span class="mr-2 oc-icon oc-icon-m oc-icon-warning">
<svg
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
focusable="false"
>
<g xmlns="http://www.w3.org/2000/svg">
<path fill="none" d="M0 0h24v24H0z"></path>
<path
d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM11 7h2v2h-2V7zm0 4h2v6h-2v-6z"
></path>
</g>
</svg>
</span>
<h2>Your browser is not supported</h2>
</div>
</div>
<div class="oc-card-body oc-link-resolve-error-message">
<p>Your browser version is considered old and might not work correctly.</p>
<p>We recommend you update to a newer version.</p>
</div>
</div>
<button
class="oc-button oc-button-primary oc-button-primary-filled rounded-sm"
onclick="forceOldBrowser()"
>
I want to continue anyway
</button>
</div>
<div id="splash-loading" class="splash-banner splash-hide">
<span id="loading" aria-hidden="true" tabindex="-1"></span>
</div>
<div id="opencloud"></div>
<noscript>
<div class="splash-banner"><h3>Please enable JavaScript</h3></div>
</noscript>
<script>
// Disable Zod's JIT compilation probe to prevent CSP 'unsafe-eval' console errors.
globalThis.__zod_globalConfig = { jitless: true }
function runtimeLoaded() {}
var loader = document.getElementById('splash-loading')
var browserError = document.getElementById('splash-incompatible')
var loaderTimer = setTimeout(function () {
loader.classList.remove('splash-hide')
}, 500)
function displayError() {
loader.classList.remove('splash-hide')
loader.innerHTML = '<h3>Oops. Something went wrong.</h3>'
}
function displayBrowserError() {
clearTimeout(loaderTimer)
removeLoadingSpinner()
browserError.classList.remove('splash-hide')
}
function forceOldBrowser() {
localStorage.setItem(
'forceAllowOldBrowser',
JSON.stringify({ expiry: new Date().getTime() + 30 * 24 * 60 * 60 * 1000 })
)
browserError.classList.add('splash-hide')
init()
}
function removeLoadingSpinner() {
if (!loader.classList.contains('splash-hide')) {
loader.classList.add('splash-hide')
}
}
function init() {
window.runtimeLoaded = function (runtime) {
clearTimeout(loaderTimer)
runtime.bootstrapApp('config.json', removeLoadingSpinner).catch((error) => {
removeLoadingSpinner()
runtime.bootstrapErrorApp(error)
})
}
}
const supportedBrowsers = __SUPPORTED_BROWSERS__
const forceAllowOldBrowser = localStorage.getItem('forceAllowOldBrowser') || false
const validForceAllowOldBrowser =
forceAllowOldBrowser &&
JSON.parse(localStorage.getItem('forceAllowOldBrowser')).expiry > new Date().getTime()
if (forceAllowOldBrowser && !validForceAllowOldBrowser)
localStorage.removeItem('forceAllowOldBrowser')
if (!validForceAllowOldBrowser && !supportedBrowsers.test(navigator.userAgent)) {
displayBrowserError()
} else {
init()
}
var scriptTags = document.getElementsByTagName('script')
for (let i = 0; i < scriptTags.length; i++) {
if (scriptTags[i].src) {
scriptTags[i].onerror = displayError
}
}
</script>
</body>
</html>