Skip to content

Commit

Permalink
Release: null
Browse files Browse the repository at this point in the history
  • Loading branch information
hwellmann committed Aug 2, 2024
1 parent 6cdf083 commit 3cc216a
Show file tree
Hide file tree
Showing 38 changed files with 887 additions and 660 deletions.
1,059 changes: 537 additions & 522 deletions tunebook/3rdpartylicenses.txt

Large diffs are not rendered by default.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
34 changes: 34 additions & 0 deletions tunebook/browser/index.html

Large diffs are not rendered by default.

178 changes: 178 additions & 0 deletions tunebook/browser/main-S2SEIVZD.js

Large diffs are not rendered by default.

94 changes: 62 additions & 32 deletions tunebook/ngsw-worker.js → tunebook/browser/ngsw-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
return this.cache.delete(this.request(key), this.cacheQueryOptions);
}
keys() {
return this.cache.keys().then((requests) => requests.map((req) => req.url.substr(1)));
return this.cache.keys().then((requests) => requests.map((req) => req.url.slice(1)));
}
read(key) {
return this.cache.match(this.request(key), this.cacheQueryOptions).then((res) => {
Expand Down Expand Up @@ -331,17 +331,19 @@ ${error.stack}`;
return UpdateCacheStatus.CACHED;
}
async getCacheNames() {
const [cache, metadata] = await Promise.all([
this.cache,
this.metadata
]);
const [cache, metadata] = await Promise.all([this.cache, this.metadata]);
return [cache.name, metadata.cacheName];
}
async handleFetch(req, _event) {
const url = this.adapter.normalizeUrl(req.url);
if (this.urls.indexOf(url) !== -1 || this.patterns.some((pattern) => pattern.test(url))) {
const cache = await this.cache;
const cachedResponse = await cache.match(req, this.config.cacheQueryOptions);
let cachedResponse;
try {
cachedResponse = await cache.match(req, this.config.cacheQueryOptions);
} catch (error) {
throw new SwCriticalError(`Cache is throwing while looking for a match: ${error}`);
}
if (cachedResponse !== void 0) {
if (this.hashes.has(url)) {
return cachedResponse;
Expand All @@ -354,7 +356,7 @@ ${error.stack}`;
return cachedResponse;
}
}
const res = await this.fetchAndCacheOnce(this.adapter.newRequest(req.url));
const res = await this.fetchAndCacheOnce(this.newRequestWithMetadata(req.url, req));
return res.clone();
} else {
return null;
Expand Down Expand Up @@ -451,7 +453,7 @@ ${error.stack}`;
if (redirectLimit === 0) {
throw new SwCriticalError(`Response hit redirect limit (fetchFromNetwork): request redirected too many times, next is ${res.url}`);
}
return this.fetchFromNetwork(this.adapter.newRequest(res.url), redirectLimit - 1);
return this.fetchFromNetwork(this.newRequestWithMetadata(res.url, req), redirectLimit - 1);
}
return res;
}
Expand All @@ -466,7 +468,7 @@ ${error.stack}`;
makeCacheBustedRequest = fetchedHash !== canonicalHash;
}
if (makeCacheBustedRequest) {
const cacheBustReq = this.adapter.newRequest(this.cacheBust(req.url));
const cacheBustReq = this.newRequestWithMetadata(this.cacheBust(req.url), req);
response = await this.safeFetch(cacheBustReq);
if (response.ok) {
const cacheBustedHash = sha1Binary(await response.clone().arrayBuffer());
Expand Down Expand Up @@ -495,6 +497,9 @@ ${error.stack}`;
}
return false;
}
newRequestWithMetadata(url, options) {
return this.adapter.newRequest(url, { headers: options.headers });
}
cacheBust(url) {
return url + (url.indexOf("?") === -1 ? "?" : "&") + "ngsw-cache-bust=" + Math.random();
}
Expand All @@ -515,7 +520,12 @@ ${error.stack}`;
await this.urls.reduce(async (previous, url) => {
await previous;
const req = this.adapter.newRequest(url);
const alreadyCached = await cache.match(req, this.config.cacheQueryOptions) !== void 0;
let alreadyCached = false;
try {
alreadyCached = await cache.match(req, this.config.cacheQueryOptions) !== void 0;
} catch (error) {
throw new SwCriticalError(`Cache is throwing while looking for a match in a PrefetchAssetGroup: ${error}`);
}
if (alreadyCached) {
return;
}
Expand Down Expand Up @@ -552,7 +562,12 @@ ${error.stack}`;
await this.urls.reduce(async (previous, url) => {
await previous;
const req = this.adapter.newRequest(url);
const alreadyCached = await cache.match(req, this.config.cacheQueryOptions) !== void 0;
let alreadyCached = false;
try {
alreadyCached = await cache.match(req, this.config.cacheQueryOptions) !== void 0;
} catch (error) {
throw new SwCriticalError(`Cache is throwing while looking for a match in a LazyAssetGroup: ${error}`);
}
if (alreadyCached) {
return;
}
Expand Down Expand Up @@ -709,12 +724,14 @@ ${error.stack}`;
}
}
async handleFetchWithPerformance(req, event, lru) {
var _a;
const okToCacheOpaque = (_a = this.config.cacheOpaqueResponses) != null ? _a : false;
let res = null;
const fromCache = await this.loadFromCache(req, lru);
if (fromCache !== null) {
res = fromCache.res;
if (this.config.refreshAheadMs !== void 0 && fromCache.age >= this.config.refreshAheadMs) {
event.waitUntil(this.safeCacheResponse(req, this.safeFetch(req), lru));
event.waitUntil(this.safeCacheResponse(req, this.safeFetch(req), lru, okToCacheOpaque));
}
}
if (res !== null) {
Expand All @@ -724,13 +741,15 @@ ${error.stack}`;
res = await timeoutFetch;
if (res === void 0) {
res = this.adapter.newResponse(null, { status: 504, statusText: "Gateway Timeout" });
event.waitUntil(this.safeCacheResponse(req, networkFetch, lru));
event.waitUntil(this.safeCacheResponse(req, networkFetch, lru, okToCacheOpaque));
} else {
await this.safeCacheResponse(req, res, lru);
await this.safeCacheResponse(req, res, lru, okToCacheOpaque);
}
return res;
}
async handleFetchWithFreshness(req, event, lru) {
var _a;
const okToCacheOpaque = (_a = this.config.cacheOpaqueResponses) != null ? _a : true;
const [timeoutFetch, networkFetch] = this.networkFetchWithTimeout(req);
let res;
try {
Expand All @@ -739,11 +758,11 @@ ${error.stack}`;
res = void 0;
}
if (res === void 0) {
event.waitUntil(this.safeCacheResponse(req, networkFetch, lru, true));
event.waitUntil(this.safeCacheResponse(req, networkFetch, lru, okToCacheOpaque));
const fromCache = await this.loadFromCache(req, lru);
res = fromCache !== null ? fromCache.res : null;
} else {
await this.safeCacheResponse(req, res, lru, true);
await this.safeCacheResponse(req, res, lru, okToCacheOpaque);
}
if (res !== null) {
return res;
Expand Down Expand Up @@ -865,6 +884,9 @@ ${error.stack}`;
{ positive: false, regex: "^/.*__" }
];
var AppVersion = class {
get okay() {
return this._okay;
}
constructor(scope2, adapter2, database, idle, debugHandler, manifest, manifestHash) {
this.scope = scope2;
this.adapter = adapter2;
Expand All @@ -873,8 +895,8 @@ ${error.stack}`;
this.manifest = manifest;
this.manifestHash = manifestHash;
this.hashTable = /* @__PURE__ */ new Map();
this.indexUrl = this.adapter.normalizeUrl(this.manifest.index);
this._okay = true;
this.indexUrl = this.adapter.normalizeUrl(this.manifest.index);
Object.keys(manifest.hashTable).forEach((url) => {
this.hashTable.set(adapter2.normalizeUrl(url), manifest.hashTable[url]);
});
Expand All @@ -896,9 +918,6 @@ ${error.stack}`;
exclude: excludeUrls.map((spec) => new RegExp(spec.regex))
};
}
get okay() {
return this._okay;
}
async initializeFully(updateFrom) {
try {
await this.assetGroups.reduce(async (previous, group) => {
Expand Down Expand Up @@ -943,14 +962,14 @@ ${error.stack}`;
return null;
}
isNavigationRequest(req) {
if (req.mode !== "navigate") {
if (req.method !== "GET" || req.mode !== "navigate") {
return false;
}
if (!this.acceptsTextHtml(req)) {
return false;
}
const urlPrefix = this.scope.registration.scope.replace(/\/$/, "");
const url = req.url.startsWith(urlPrefix) ? req.url.substr(urlPrefix.length) : req.url;
const url = req.url.startsWith(urlPrefix) ? req.url.slice(urlPrefix.length) : req.url;
const urlWithoutQueryOrHash = url.replace(/[?#].*$/, "");
return this.navigationUrls.include.some((regex) => regex.test(urlWithoutQueryOrHash)) && !this.navigationUrls.exclude.some((regex) => regex.test(urlWithoutQueryOrHash));
}
Expand Down Expand Up @@ -1010,7 +1029,7 @@ ${error.stack}`;
};

// bazel-out/darwin_arm64-fastbuild-ST-2e5f3376adb5/bin/packages/service-worker/worker/src/debug.mjs
var SW_VERSION = "13.3.10";
var SW_VERSION = "18.1.3";
var DEBUG_LOG_BUFFER_SIZE = 100;
var DebugHandler = class {
constructor(driver, adapter2) {
Expand Down Expand Up @@ -1215,8 +1234,8 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
this.lastUpdateCheck = null;
this.scheduledNavUpdateCheck = false;
this.loggedInvalidOnlyIfCachedRequest = false;
this.ngswStatePath = this.adapter.parseUrl("ngsw/state", this.scope.registration.scope).path;
this.controlTable = this.db.open("control");
this.ngswStatePath = this.adapter.parseUrl("ngsw/state", this.scope.registration.scope).path;
this.scope.addEventListener("install", (event) => {
event.waitUntil(this.scope.skipWaiting());
});
Expand Down Expand Up @@ -1366,6 +1385,10 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
}
break;
}
case "sendRequest": {
await this.scope.fetch(urlToOpen);
break;
}
default:
break;
}
Expand Down Expand Up @@ -1403,12 +1426,6 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
this.clientVersionMap.set(client.id, this.latestHash);
await this.sync();
const current = this.versions.get(this.latestHash);
const notice = {
type: "UPDATE_ACTIVATED",
previous,
current: this.mergeHashWithAppData(current.manifest, this.latestHash)
};
client.postMessage(notice);
return true;
}
async handleFetch(event) {
Expand Down Expand Up @@ -1505,7 +1522,6 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
await this.scheduleInitialization(this.versions.get(hash));
} catch (err) {
this.debugger.log(err, `initialize: schedule init of ${hash}`);
return false;
}
}));
}
Expand Down Expand Up @@ -1628,6 +1644,7 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
}
hash = hashManifest(manifest);
if (this.versions.has(hash)) {
await this.notifyClientsAboutNoNewVersionDetected(manifest, hash);
return false;
}
await this.notifyClientsAboutVersionDetected(manifest, hash);
Expand Down Expand Up @@ -1736,6 +1753,16 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
});
}));
}
async notifyClientsAboutNoNewVersionDetected(manifest, hash) {
await this.initialized;
const clients = await this.scope.clients.matchAll();
await Promise.all(clients.map(async (client) => {
client.postMessage({
type: "NO_NEW_VERSION_DETECTED",
version: this.mergeHashWithAppData(manifest, hash)
});
}));
}
async notifyClientsAboutVersionDetected(manifest, hash) {
await this.initialized;
const clients = await this.scope.clients.matchAll();
Expand All @@ -1744,7 +1771,10 @@ ${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }
if (version === void 0) {
return;
}
client.postMessage({ type: "VERSION_DETECTED", version: this.mergeHashWithAppData(manifest, hash) });
client.postMessage({
type: "VERSION_DETECTED",
version: this.mergeHashWithAppData(manifest, hash)
});
}));
}
async notifyClientsAboutVersionReady(manifest, hash) {
Expand Down
30 changes: 12 additions & 18 deletions tunebook/ngsw.json → tunebook/browser/ngsw.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"configVersion": 1,
"timestamp": 1722368758399,
"timestamp": 1722588292166,
"index": "/tunebook/index.html",
"assetGroups": [
{
Expand All @@ -13,18 +13,17 @@
"urls": [
"/tunebook/favicon.ico",
"/tunebook/index.html",
"/tunebook/main.21b2f721b23706d6.js",
"/tunebook/polyfills.d727d0f4a0f55c80.js",
"/tunebook/runtime.814b142fdf5fd5d5.js",
"/tunebook/main-S2SEIVZD.js",
"/tunebook/polyfills-MH5IBZ74.js",
"/tunebook/site.webmanifest",
"/tunebook/styles.9796e5d75264acce.css",
"/tunebook/transcriber.43f70c157407fdb3.js"
"/tunebook/styles-SVNXQOMR.css",
"/tunebook/worker-AFAHVE77.js"
],
"patterns": []
},
{
"name": "assets",
"installMode": "lazy",
"installMode": "prefetch",
"updateMode": "prefetch",
"cacheQueryOptions": {
"ignoreVary": true
Expand All @@ -45,9 +44,7 @@
"/tunebook/assets/tunebook-collection.json",
"/tunebook/assets/tunebooks.json",
"/tunebook/favicon-16x16.png",
"/tunebook/favicon-32x32.png",
"/tunebook/irishuncialfabeta-bold-webfont.5de5aab652b242e1.woff",
"/tunebook/irishuncialfabeta-bold-webfont.af950bef0b7893ca.woff2"
"/tunebook/favicon-32x32.png"
],
"patterns": []
}
Expand All @@ -71,15 +68,12 @@
"/tunebook/favicon-16x16.png": "60ae12fec505dace727150c4757598f2b4d5f2f7",
"/tunebook/favicon-32x32.png": "f14b1f5f197f692eca78cea7951ab8e82d5c4d8b",
"/tunebook/favicon.ico": "c7cc37b24ac2e037be5b3d3c1f80563d33c92966",
"/tunebook/index.html": "876668f26a2ee7f07594fcfdd6ca4b9d2b186ffa",
"/tunebook/irishuncialfabeta-bold-webfont.5de5aab652b242e1.woff": "7b4f62411f52233f2de8be6e01c947120986be68",
"/tunebook/irishuncialfabeta-bold-webfont.af950bef0b7893ca.woff2": "e04fa53e407ed9bd2bc6472b8e2ac04f4590a738",
"/tunebook/main.21b2f721b23706d6.js": "b26fee69b62bb6ae664bffeaec5a857ef9446307",
"/tunebook/polyfills.d727d0f4a0f55c80.js": "5bb14b9c2c37a7eea0a3d23099f15529dccf5563",
"/tunebook/runtime.814b142fdf5fd5d5.js": "67f2870bb5eae708eab38c00f1840c10b2f8ce34",
"/tunebook/index.html": "5da6b58d7a2bb44b6969d0e9a01c612d0a7c2e98",
"/tunebook/main-S2SEIVZD.js": "5984fdec84f59eaee5f3eed2d289065d6a2c1530",
"/tunebook/polyfills-MH5IBZ74.js": "c7fdbc7259367a3112d05e61e33c04c4b2efa9b4",
"/tunebook/site.webmanifest": "d179e36f83872017fb7585f6adf21b6143568469",
"/tunebook/styles.9796e5d75264acce.css": "d6883670f3f437ca89355b05ee8604c949c7c035",
"/tunebook/transcriber.43f70c157407fdb3.js": "8d08751d3f3539a3f78e9df966f4c6325207d7f1"
"/tunebook/styles-SVNXQOMR.css": "893468e14a43448cbb9ace24e47e13e7a3bc5b90",
"/tunebook/worker-AFAHVE77.js": "d3a53fc04e710f1254fcb192eb6f3fec8e964a1d"
},
"navigationUrls": [
{
Expand Down
2 changes: 2 additions & 0 deletions tunebook/browser/polyfills-MH5IBZ74.js

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions tunebook/browser/safety-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

// tslint:disable:no-console

self.addEventListener('install', (event) => {
self.skipWaiting();
});

self.addEventListener('activate', (event) => {
event.waitUntil(self.clients.claim());

event.waitUntil(
self.registration.unregister().then(() => {
console.log('NGSW Safety Worker - unregistered old service worker');
}),
);

event.waitUntil(
caches.keys().then((cacheNames) => {
const ngswCacheNames = cacheNames.filter((name) => /^ngsw:/.test(name));
return Promise.all(ngswCacheNames.map((name) => caches.delete(name)));
}),
);
});
File renamed without changes.
1 change: 1 addition & 0 deletions tunebook/browser/styles-SVNXQOMR.css

Large diffs are not rendered by default.

Loading

0 comments on commit 3cc216a

Please sign in to comment.