feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
36
engine/misc/dist/html/editor.html
vendored
36
engine/misc/dist/html/editor.html
vendored
|
|
@ -363,24 +363,28 @@ window.addEventListener('load', () => {
|
|||
btn.style.display = '';
|
||||
}
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('service.worker.js').then(function (reg) {
|
||||
if (reg.waiting) {
|
||||
notifyUpdate(reg.waiting);
|
||||
}
|
||||
reg.addEventListener('updatefound', function () {
|
||||
const update = reg.installing;
|
||||
update.addEventListener('statechange', function () {
|
||||
if (update.state === 'installed') {
|
||||
// It's a new install, claim and perform aggressive caching.
|
||||
if (!reg.active) {
|
||||
update.postMessage('claim');
|
||||
} else {
|
||||
notifyUpdate(update);
|
||||
try {
|
||||
navigator.serviceWorker.register('service.worker.js').then(function (reg) {
|
||||
if (reg.waiting) {
|
||||
notifyUpdate(reg.waiting);
|
||||
}
|
||||
reg.addEventListener('updatefound', function () {
|
||||
const update = reg.installing;
|
||||
update.addEventListener('statechange', function () {
|
||||
if (update.state === 'installed') {
|
||||
// It's a new install, claim and perform aggressive caching.
|
||||
if (!reg.active) {
|
||||
update.postMessage('claim');
|
||||
} else {
|
||||
notifyUpdate(update);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('Error while registering service worker:', e);
|
||||
}
|
||||
}
|
||||
|
||||
const missing = Engine.getMissingFeatures({
|
||||
|
|
@ -706,7 +710,7 @@ function startEditor(zip) {
|
|||
} else if (typeof err === 'string') {
|
||||
setStatusNotice(err);
|
||||
} else {
|
||||
setStatusNotice('An unknown error occured');
|
||||
setStatusNotice('An unknown error occurred.');
|
||||
}
|
||||
setStatusMode('notice');
|
||||
initializing = false;
|
||||
|
|
|
|||
35
engine/misc/dist/html/full-size.html
vendored
35
engine/misc/dist/html/full-size.html
vendored
|
|
@ -38,7 +38,7 @@ body {
|
|||
}
|
||||
|
||||
#status {
|
||||
background-color: #242424;
|
||||
background-color: $GODOT_SPLASH_COLOR;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
|
@ -52,6 +52,20 @@ body {
|
|||
margin: auto;
|
||||
}
|
||||
|
||||
#status-splash.show-image--false {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#status-splash.fullsize--true {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
#status-splash.use-filter--false {
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
#status-progress, #status-notice {
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -88,7 +102,7 @@ body {
|
|||
</noscript>
|
||||
|
||||
<div id="status">
|
||||
<img id="status-splash" src="$GODOT_SPLASH" alt="">
|
||||
<img id="status-splash" class="$GODOT_SPLASH_CLASSES" src="$GODOT_SPLASH" alt="">
|
||||
<progress id="status-progress"></progress>
|
||||
<div id="status-notice"></div>
|
||||
</div>
|
||||
|
|
@ -140,7 +154,7 @@ const engine = new Engine(GODOT_CONFIG);
|
|||
} else if (typeof err === 'string') {
|
||||
setStatusNotice(err);
|
||||
} else {
|
||||
setStatusNotice('An unknown error occured');
|
||||
setStatusNotice('An unknown error occurred.');
|
||||
}
|
||||
setStatusMode('notice');
|
||||
initializing = false;
|
||||
|
|
@ -152,9 +166,15 @@ const engine = new Engine(GODOT_CONFIG);
|
|||
|
||||
if (missing.length !== 0) {
|
||||
if (GODOT_CONFIG['serviceWorker'] && GODOT_CONFIG['ensureCrossOriginIsolationHeaders'] && 'serviceWorker' in navigator) {
|
||||
let serviceWorkerRegistrationPromise;
|
||||
try {
|
||||
serviceWorkerRegistrationPromise = navigator.serviceWorker.getRegistration();
|
||||
} catch (err) {
|
||||
serviceWorkerRegistrationPromise = Promise.reject(new Error('Service worker registration failed.'));
|
||||
}
|
||||
// There's a chance that installing the service worker would fix the issue
|
||||
Promise.race([
|
||||
navigator.serviceWorker.getRegistration().then((registration) => {
|
||||
serviceWorkerRegistrationPromise.then((registration) => {
|
||||
if (registration != null) {
|
||||
return Promise.reject(new Error('Service worker already exists.'));
|
||||
}
|
||||
|
|
@ -164,10 +184,11 @@ const engine = new Engine(GODOT_CONFIG);
|
|||
new Promise((resolve) => {
|
||||
setTimeout(() => resolve(), 2000);
|
||||
}),
|
||||
]).catch((err) => {
|
||||
console.error('Error while registering service worker:', err);
|
||||
}).then(() => {
|
||||
]).then(() => {
|
||||
// Reload if there was no error.
|
||||
window.location.reload();
|
||||
}).catch((err) => {
|
||||
console.error('Error while registering service worker:', err);
|
||||
});
|
||||
} else {
|
||||
// Display the message as usual
|
||||
|
|
|
|||
12
engine/misc/dist/html/service-worker.js
vendored
12
engine/misc/dist/html/service-worker.js
vendored
|
|
@ -17,8 +17,8 @@ const ENSURE_CROSSORIGIN_ISOLATION_HEADERS = ___GODOT_ENSURE_CROSSORIGIN_ISOLATI
|
|||
const CACHED_FILES = ___GODOT_CACHE___;
|
||||
// Files that we might not want the user to preload, and will only be cached on first load.
|
||||
/** @type {string[]} */
|
||||
const CACHABLE_FILES = ___GODOT_OPT_CACHE___;
|
||||
const FULL_CACHE = CACHED_FILES.concat(CACHABLE_FILES);
|
||||
const CACHEABLE_FILES = ___GODOT_OPT_CACHE___;
|
||||
const FULL_CACHE = CACHED_FILES.concat(CACHEABLE_FILES);
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(CACHED_FILES)));
|
||||
|
|
@ -99,8 +99,8 @@ self.addEventListener(
|
|||
const referrer = event.request.referrer || '';
|
||||
const base = referrer.slice(0, referrer.lastIndexOf('/') + 1);
|
||||
const local = url.startsWith(base) ? url.replace(base, '') : '';
|
||||
const isCachable = FULL_CACHE.some((v) => v === local) || (base === referrer && base.endsWith(CACHED_FILES[0]));
|
||||
if (isNavigate || isCachable) {
|
||||
const isCacheable = FULL_CACHE.some((v) => v === local) || (base === referrer && base.endsWith(CACHED_FILES[0]));
|
||||
if (isNavigate || isCacheable) {
|
||||
event.respondWith((async () => {
|
||||
// Try to use cache first
|
||||
const cache = await caches.open(CACHE_NAME);
|
||||
|
|
@ -112,7 +112,7 @@ self.addEventListener(
|
|||
if (missing) {
|
||||
try {
|
||||
// Try network if some cached file is missing (so we can display offline page in case).
|
||||
const response = await fetchAndCache(event, cache, isCachable);
|
||||
const response = await fetchAndCache(event, cache, isCacheable);
|
||||
return response;
|
||||
} catch (e) {
|
||||
// And return the hopefully always cached offline page in case of network failure.
|
||||
|
|
@ -129,7 +129,7 @@ self.addEventListener(
|
|||
return cached;
|
||||
}
|
||||
// Try network if don't have it in cache.
|
||||
const response = await fetchAndCache(event, cache, isCachable);
|
||||
const response = await fetchAndCache(event, cache, isCacheable);
|
||||
return response;
|
||||
})());
|
||||
} else if (ENSURE_CROSSORIGIN_ISOLATION_HEADERS) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue