Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/robotui.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class RobotUI {
renderer: 'zelos', // rounded, chunky blocks that are easy for small hands
theme: Blockly.Themes.Zelos || undefined,
sounds: false,
media: './vendor/media/', // bundled icons: Blockly would otherwise fetch them from Google's servers
});
if (this.savedState) {
try { Blockly.serialization.workspaces.load(this.savedState, this.ws); } catch { this.setProgram([]); }
Expand Down
4 changes: 2 additions & 2 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Service worker: caches the whole game so it works offline once loaded.
// Bump VERSION whenever files change so players get the update.
const VERSION = 'minicrafter-v19';
const VERSION = 'minicrafter-v20';
const CORE = [
'./', './index.html', './style.css', './manifest.webmanifest', './site-config.json',
'./icons/icon-192.png', './icons/icon-512.png', './icons/icon-maskable-512.png', './icons/apple-touch-icon.png', './icons/favicon-32.png',
'./vendor/three.module.js', './vendor/blockly.min.js',
'./vendor/three.module.js', './vendor/blockly.min.js', './vendor/media/sprites.png',
'./src/adventure.js',
'./src/audio.js',
'./src/blocks.js',
Expand Down
10 changes: 10 additions & 0 deletions tests/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ const browser = await chromium.launch({
args: ['--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist'],
});

// Privacy: the game must never contact a host outside the one serving it (no CDN, fonts, analytics).
const outside = new Set();
const trackOutside = (page) => page.on('request', (rq) => {
const u = new URL(rq.url());
if (/^(https?|wss?):$/.test(u.protocol) && !['localhost', '127.0.0.1'].includes(u.hostname)) outside.add(u.origin);
});

async function openGame(query = '', at = base) {
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });
trackOutside(page);
const errors = [];
page.on('pageerror', (e) => errors.push(`pageerror: ${e.message}`));
page.on('console', (m) => { if (m.type() === 'error') errors.push(`console: ${m.text()}`); });
Expand Down Expand Up @@ -325,5 +333,7 @@ try {
server.close();
}

ok(outside.size === 0, 'privacy: the game never contacts an outside host', [...outside].join(', ') || 'same-origin only');

console.log(failures ? `\n${failures} check(s) failed` : '\nAll smoke checks passed');
process.exit(failures ? 1 : 0);
2 changes: 2 additions & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ These are copied here so MiniCrafter works offline. They are unmodified copies f
| `three.module.js` | [three.js](https://threejs.org/) | 0.160.0 | MIT, see `LICENSE-three.txt` |
| `blockly.min.js` | [Blockly](https://developers.google.com/blockly) (core, blocks, English messages, JS generator) | 10.4.3 | Apache License 2.0, © Google LLC: https://www.apache.org/licenses/LICENSE-2.0 |

`media/sprites.png` is Blockly's icon sheet (trash can and zoom buttons) from `blockly@10.4.3/media/`. The game points Blockly at it with the `media` option, because the default would load it from Google's servers.

To update one, download the new version from `https://unpkg.com/<package>@<version>/...`, replace the file, update this table, and bump `VERSION` in `sw.js`.
Binary file added vendor/media/sprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading