Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
825d8af
apply Bswup improvements #12408
msynk May 31, 2026
c646784
further improvements
msynk Jun 1, 2026
733a05a
resolve review comments
msynk Jun 2, 2026
de9c330
resolve review comments II
msynk Jun 4, 2026
23b29b3
resolve review comments III
msynk Jun 5, 2026
088c6d1
resolve review comments IV
msynk Jun 6, 2026
c161919
Merge branch 'develop' into 12408-bswup-improvements
msynk Jun 6, 2026
8c11506
resovle review comments V
msynk Jun 6, 2026
ea3d330
resolve review comments VI
msynk Jun 6, 2026
a71d04f
remove json serializer
msynk Jun 6, 2026
ddd6829
fix progress component
msynk Jun 6, 2026
9d73fbf
resolve local review findimgs
msynk Jun 14, 2026
6c96a71
Merge branch '12408-bswup-improvements' of https://github.com/msynk/b…
msynk Jun 14, 2026
ce3cd61
Merge branch 'develop' into 12408-bswup-improvements
msynk Jun 16, 2026
5377236
resolve review comments V
msynk Jun 21, 2026
a450c91
Merge branch 'develop' into 12408-bswup-improvements
msynk Jun 21, 2026
d6f1bd1
resolve review comments VI
msynk Jun 22, 2026
bd800d8
resolve review comments VII
msynk Jun 27, 2026
3623e25
Merge branch 'develop' into 12408-bswup-improvements
msynk Jun 27, 2026
754eb63
resolve review comments VIII
msynk Jun 27, 2026
70d385e
fix build issues
msynk Jun 28, 2026
a1ee5c5
resolve review comments IX
msynk Jun 28, 2026
f92cdaa
resolve review comments X
msynk Jun 28, 2026
20addce
resolve review comments XI
msynk Jun 28, 2026
73401e9
fix variable definition issue
msynk Jun 28, 2026
7721833
restructure demo projects
msynk Jun 29, 2026
3e6197a
improve FullDemo
msynk Jun 30, 2026
021176a
Merge branch 'develop' into 12408-bswup-improvements
msynk Jun 30, 2026
571f537
resolve review comments XII
msynk Jul 3, 2026
968fc99
resolve review comments XIII
msynk Jul 3, 2026
4a55113
Merge branch 'develop' into 12408-bswup-improvements
msynk Jul 6, 2026
3431b3c
add regex support for asset urls
msynk Jul 7, 2026
dea4803
Merge branch 'develop' into 12408-bswup-improvements
msynk Jul 20, 2026
4bd6741
fix local findings
msynk Jul 20, 2026
11c8887
add tests
msynk Jul 20, 2026
49b8e8e
add fetch resiliency
msynk Jul 21, 2026
e07870b
resolve local review findings
msynk Jul 23, 2026
4ee615c
resolve local review findings II
msynk Jul 24, 2026
6dd9fb9
resolve local findings in loop
msynk Jul 24, 2026
ae73eb8
resolve local loop findings
msynk Jul 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/bit.ci.Bswup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ jobs:

- name: dotnet build
run: dotnet build src/Bswup/Bit.Bswup.slnx

# Runs against Bit.Bswup/wwwroot/*.js, which the build above produces, so this also covers
# the build step itself (e.g. the minifier re-introducing downleveled syntax).
- name: JS tests (service worker, page script, progress UI)
run: |
cd src/Bswup/Tests/bit-bswup-js
npm ci || npm install
npm test
2 changes: 1 addition & 1 deletion src/Bswup/Bit.Bswup.Demo/Pages/HomePage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PageTitle>Home</PageTitle>

<h1>222</h1>
<h1>111</h1>
Comment thread
msynk marked this conversation as resolved.

<h1>Hello, world!</h1>

Expand Down
33 changes: 29 additions & 4 deletions src/Bswup/Bit.Bswup.Demo/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,24 @@
case BswupMessage.activate: return console.log('new version activated:', data.version);

case BswupMessage.downloadStarted:
// A background update downloads behind the running app - only a first
// install owns the screen (firstInstall rides on every message).
if (data?.firstInstall === false) return console.log('downloading update assets started:', data?.version);
appEl.style.display = 'none';
bswupEl.style.display = 'block';
return console.log('downloading assets started:', data?.version);

case BswupMessage.downloadProgress:
// Built with textContent (not innerHTML) so asset names can never be
// parsed as markup - the same hardening as the bundled progress script.
const li = document.createElement('li');
li.innerHTML = `${data.index}: <b>${data.asset.url}</b>: ${data.asset.hash}`
const urlEl = document.createElement('b');
urlEl.textContent = data.asset.url;
li.append(`${data.index}: `, urlEl, `: ${data.asset.hash}`);
assetsUl.prepend(li);
const percent = Math.round(data.percent);
progressBar.style.width = `${percent}%`;
percentLabel.innerHTML = `${percent} %`;
percentLabel.textContent = `${percent} %`;
return console.log('asset downloaded:', data);

case BswupMessage.downloadFinished:
Expand All @@ -137,16 +144,34 @@
reloadButton.style.display = 'block';
reloadButton.onclick = data.reload;
return console.log('new update ready.');

case BswupMessage.error:
// This demo deliberately ships a 404ing external asset (see the dev
// service-worker.js), so non-fatal errors are expected here: under the
// default lax tolerance the install continues and the asset lazy-fills.
console.error('installation error:', data);
if (data.fatal === false) return;
// A fatal failure during a background update leaves the running app
// untouched - the previous worker keeps serving it.
if (data.firstInstall === false) return;
// Fatal first-install failure: bit-bswup.js force-starts Blazor from the
// network; reveal the app instead of leaving it booted behind the splash.
descriptionLabel.textContent = 'Install failed; starting without offline support...';
appEl.style.display = 'block';
bswupEl.style.display = 'none';
return;
}
}
</script>
<script src="_framework/blazor.webassembly.js" autostart=false></script>
<!-- blazorScript is omitted on purpose: both default entry scripts
(blazor.web.js / blazor.webassembly.js) are auto-detected, fingerprints and
query strings included - the attribute is only needed for non-default paths. -->
<script src="_content/Bit.Bswup/bit-bswup.js"
scope="/"
log="none"
sw="service-worker.js"
handler="bitBswupHandler"
blazorScript="_framework/blazor.webassembly.js"></script>
handler="bitBswupHandler"></script>
</body>

</html>
4 changes: 3 additions & 1 deletion src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

self.assetsExclude = [/\.scp\.css$/, /weather\.json$/];
self.caseInsensitiveUrl = true;
self.precachedAssetsInclude = [/favicon\.ico$/, /icon-512\.png$/, /bit-bw-64\.png$/];

self.externalAssets = [
{
"url": "not-found/script.file.js"
}
];
// 'lax' is already the default; it is spelled out here because the demo intentionally
// references a non-existent asset to exercise the progress / error reporting UI, and under
// 'strict' that would abort the install. See README.md > errorTolerance.
self.errorTolerance = 'lax';

self.importScripts('_content/Bit.Bswup/bit-bswup.sw.js');
9 changes: 7 additions & 2 deletions src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

self.assetsExclude = [/\.scp\.css$/, /weather\.json$/];
self.caseInsensitiveUrl = true;
self.precachedAssetsInclude = [/favicon\.ico$/, /icon-512\.png$/, /bit-bw-64\.png$/];

//self.externalAssets = [
// {
// "url": "not-found/script.file.js"
// }
//];
//self.errorTolerance = 'lax';

//// Resiliency knobs (see the Bswup README for details):
//self.errorTolerance = 'strict'; // abort the install if any asset fails ('lax' = best-effort lazy-fill, the default)
//self.maxRetries = 2; // extra download attempts on transient failures (408/429/5xx, dropped connections)
//self.retryDelay = 300; // base backoff in ms between those retries (exponential, with jitter)
//self.enableIntegrityCheck = true; // attach SRI hashes so tampered assets are rejected (requires byte-identical serving)
//self.cacheVersion = '2026.07.24-abc1234'; // pin/bump the cache bucket independently of the asset manifest

self.importScripts('_content/Bit.Bswup/bit-bswup.sw.js');

Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions src/Bswup/Bit.Bswup.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<File Path="README.md" />
</Folder>
<Folder Name="/FullDemo/">
<Project Path="FullDemo/Client/Bit.Bswup.Demo.Client.csproj" />
<Project Path="FullDemo/Server/Bit.Bswup.Demo.Server.csproj" />
<Project Path="FullDemo/Client/Bit.Bswup.FullDemo.Client.csproj" />
<Project Path="FullDemo/Server/Bit.Bswup.FullDemo.Server.csproj" />
</Folder>
<Folder Name="/NewDemo/">
<Project Path="Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/Bit.Bswup.NewDemo.Client.csproj" />
<Project Path="Bit.Bswup.NewDemo/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.csproj" />
<Project Path="NewDemo/Bit.Bswup.NewDemo.Client/Bit.Bswup.NewDemo.Client.csproj" />
<Project Path="NewDemo/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.csproj" />
Comment thread
coderabbitai[bot] marked this conversation as resolved.
</Folder>
<Project Path="Bit.Bswup.Demo/Bit.Bswup.Demo.csproj" />
<Project Path="Bit.Bswup/Bit.Bswup.csproj" />
Expand Down
Loading
Loading