- | {communityText('Date')} | {communityText('Uploads')} | {communityText('Updates')} | {communityText('Users')} | {communityText('Sessions')} | {communityText('Loads')} | {communityText('Average load')} | {communityText('Samples')} | {communityText('Starts')} | {communityText('Crashes')} |
+ | {communityText('Date')} | {communityText('Uploads')} | {communityText('Updates')} | {communityText('Users')} | {communityText('Sessions')} | {communityText('Loads')} | {communityText('95th percentile load')} | {communityText('Samples')} | {communityText('Starts')} | {communityText('Crashes')} |
{dailyRows.map(row => (
- | {row.date} | {num(row.projects)} | {num(row.updates)} | {num(row.users)} | {num(row.sessions)} | {num(row.loads)} | {row.loadSamples ? formatLoadTime(row.averageLoadMs) : communityText('No sample')} | {num(row.loadSamples)} | {num(row.starts)} | {num(row.crashes)} |
+ {row.date} | {num(row.projects)} | {num(row.updates)} | {num(row.users)} | {num(row.sessions)} | {num(row.loads)} | {row.loadSamples ? formatLoadTime(row.p95LoadMs) : communityText('No sample')} | {num(row.loadSamples)} | {num(row.starts)} | {num(row.crashes)} |
))}
diff --git a/src/community/pages/project/ProjectPreview.jsx b/src/community/pages/project/ProjectPreview.jsx
index cc61be36d8b..4fb45da3837 100644
--- a/src/community/pages/project/ProjectPreview.jsx
+++ b/src/community/pages/project/ProjectPreview.jsx
@@ -18,10 +18,10 @@ const ProjectPreview = ({project}) => {
const bridged = playing ? project : null;
useEmbedFetchBridge(bridged, frame);
useEmbedStorageBridge(bridged, frame);
- const {id, projectJsonUrl, assetsBase} = project;
+ const {id, projectJsonUrl, assetsBase, assetsMirrorBase} = project;
const src = useMemo(
() => (playing ? embedUrl(project, {applyProjectTheme: false, persistStorage: true}) : ''),
- [playing, id, projectJsonUrl, assetsBase]
+ [playing, id, projectJsonUrl, assetsBase, assetsMirrorBase]
);
useEffect(() => {
if (!playing) return;
@@ -78,6 +78,7 @@ const ProjectPreview = ({project}) => {
ProjectPreview.propTypes = {
project: PropTypes.shape({
assetsBase: PropTypes.string,
+ assetsMirrorBase: PropTypes.string,
hasContent: PropTypes.bool,
id: PropTypes.string,
projectJsonUrl: PropTypes.string,
diff --git a/src/community/pages/project/use-embed-bridges.js b/src/community/pages/project/use-embed-bridges.js
index 17ecc21eaa6..646fa48e2f3 100644
--- a/src/community/pages/project/use-embed-bridges.js
+++ b/src/community/pages/project/use-embed-bridges.js
@@ -1,16 +1,40 @@
import {useEffect} from 'react';
-import {cachedFetchBuffer, preloadContent} from '../../../lib/community/cached-fetch.js';
+import {cachedFetchBuffer, isContentAddressedFile, preloadContent} from '../../../lib/community/cached-fetch.js';
import {clearProjectStorage, EMBED_STORAGE_PREFIX, isBlockedProjectStorageKey} from './embed-helpers.js';
import {local} from '../../../modules/storage';
+const parseUrl = url => {
+ if (typeof url !== 'string' || !url) return null;
+ try {
+ return new URL(url);
+ } catch (e) {
+ return null;
+ }
+};
+
// Serves the project file and its assets to the player frame from this page's cache.
export const useEmbedFetchBridge = (project, stageFrame) => {
useEffect(() => {
if (!project || !project.projectJsonUrl) return;
preloadContent(project.projectJsonUrl).catch(() => null);
- const assetsBase = project.assetsBase ? `${project.assetsBase.replace(/\/+$/, '')}/` : null;
- const allowed = url => typeof url === 'string' &&
- (url === project.projectJsonUrl || (assetsBase && url.startsWith(assetsBase)));
+ const assetBases = [project.assetsBase, project.assetsMirrorBase]
+ .map(parseUrl)
+ .filter(Boolean)
+ .map(base => ({origin: base.origin, path: `${base.pathname.replace(/\/+$/, '')}/`}));
+ const assetFile = url => {
+ const parsed = parseUrl(url);
+ if (!parsed) return null;
+ const file = parsed.pathname.split('/').pop();
+ const inBase = assetBases.some(base => parsed.origin === base.origin &&
+ parsed.pathname === `${base.path}${file}`);
+ return inBase && file ? file : null;
+ };
+ const isAsset = url => assetFile(url) !== null;
+ const isImmutableAsset = url => {
+ const file = assetFile(url);
+ return Boolean(file) && !parseUrl(url).search && isContentAddressedFile(file);
+ };
+ const allowed = url => typeof url === 'string' && (url === project.projectJsonUrl || isAsset(url));
const onMessage = event => {
const frame = stageFrame.current;
if (!frame || event.source !== frame.contentWindow) return;
@@ -33,7 +57,7 @@ export const useEmbedFetchBridge = (project, stageFrame) => {
.catch(() => null);
return;
}
- if (data.type !== 'mw:fetch' || !allowed(data.url)) return;
+ if (data.type !== 'mw:fetch') return;
const reply = (message, transfer) => {
try {
event.source.postMessage(message, '*', transfer);
@@ -41,7 +65,11 @@ export const useEmbedFetchBridge = (project, stageFrame) => {
// ignore
}
};
- cachedFetchBuffer(data.url)
+ if (!allowed(data.url)) {
+ reply({type: 'mw:fetch-result', id: data.id});
+ return;
+ }
+ cachedFetchBuffer(data.url, {immutable: isImmutableAsset(data.url)})
.then(buffer => {
const copy = buffer.slice(0);
reply({type: 'mw:fetch-result', id: data.id, buffer: copy}, [copy]);
diff --git a/src/community/translations/_sources.json b/src/community/translations/_sources.json
index 62570009226..3f5612e8a9d 100644
--- a/src/community/translations/_sources.json
+++ b/src/community/translations/_sources.json
@@ -12,8 +12,8 @@
"src/community/api-errors.js:31",
"src/community/components/ui/EmptyState.jsx:36",
"src/community/rotur.js:59",
- "src/community/rotur.js:148",
- "src/community/rotur.js:155"
+ "src/community/rotur.js:149",
+ "src/community/rotur.js:156"
],
"You don't have permission to do that.": [
"src/community/api-errors.js:32"
@@ -319,7 +319,7 @@
"src/community/pages/ClassroomSchool.jsx:230",
"src/community/pages/ManageProject.jsx:101",
"src/community/pages/ManageProject.jsx:810",
- "src/community/pages/ManageProject.jsx:845",
+ "src/community/pages/ManageProject.jsx:846",
"src/community/pages/Profile.jsx:902",
"src/community/pages/Wallet.jsx:232",
"src/community/pages/admin/StatsOverview.jsx:155",
@@ -775,7 +775,7 @@
"src/community/pages/ManageProject.jsx:645",
"src/community/pages/ManageProject.jsx:702",
"src/community/pages/ManageProject.jsx:777",
- "src/community/pages/ManageProject.jsx:992",
+ "src/community/pages/ManageProject.jsx:993",
"src/community/pages/ManageSpace.jsx:692",
"src/community/pages/ManageSpace.jsx:705",
"src/community/pages/ManageSpace.jsx:754",
@@ -934,7 +934,7 @@
"src/community/components/ui/ConfirmModal.jsx:22",
"src/community/pages/Classroom.jsx:93",
"src/community/pages/Classroom.jsx:348",
- "src/community/pages/ManageProject.jsx:1072",
+ "src/community/pages/ManageProject.jsx:1073",
"src/community/pages/ManageSpace.jsx:798",
"src/community/pages/MyStuff.jsx:1298",
"src/community/pages/News.jsx:293",
@@ -1094,7 +1094,7 @@
"src/community/pages/ManageSpace.jsx:822",
"src/community/pages/MyStuff.jsx:1325",
"src/community/pages/MyStuff.jsx:1341",
- "src/community/pages/Project.jsx:724",
+ "src/community/pages/Project.jsx:725",
"src/community/pages/Settings.jsx:1003",
"src/community/pages/Settings.jsx:1018",
"src/community/pages/Theme.jsx:239",
@@ -1260,8 +1260,8 @@
],
"Bounties": [
"src/community/components/ExploreNav.jsx:21",
- "src/community/pages/ManageProject.jsx:890",
- "src/community/pages/ManageProject.jsx:1004",
+ "src/community/pages/ManageProject.jsx:891",
+ "src/community/pages/ManageProject.jsx:1005",
"src/community/pages/project/ProjectActivity.jsx:39",
"src/community/pages/project/ProjectBounties.jsx:47"
],
@@ -1352,7 +1352,7 @@
"Editor": [
"src/community/components/Footer.jsx:65",
"src/community/components/SharedProjects.jsx:18",
- "src/community/pages/ManageProject.jsx:941",
+ "src/community/pages/ManageProject.jsx:942",
"src/community/pages/Roadmap.jsx:497"
],
"My stuff": [
@@ -2218,7 +2218,7 @@
"src/community/components/MyStuffProjects.jsx:230",
"src/community/components/ReportModal.jsx:105",
"src/community/components/classroom/CredentialsResult.jsx:48",
- "src/community/pages/ManageProject.jsx:875",
+ "src/community/pages/ManageProject.jsx:876",
"src/community/pages/Roadmap.jsx:34",
"src/community/pages/project/IssueThread.jsx:208"
],
@@ -2450,7 +2450,7 @@
"src/community/components/classroom/ClassSettings.jsx:266",
"src/community/pages/ClassroomSchool.jsx:96",
"src/community/pages/Commit.jsx:542",
- "src/community/pages/ManageProject.jsx:971",
+ "src/community/pages/ManageProject.jsx:972",
"src/community/pages/ManageSpace.jsx:743"
],
"Create a theme": [
@@ -2735,7 +2735,7 @@
"Updated {value1}": [
"src/community/components/NewsItem.jsx:205",
"src/community/pages/NewsPost.jsx:136",
- "src/community/pages/Project.jsx:824",
+ "src/community/pages/Project.jsx:825",
"src/community/pages/ProjectCode.jsx:118"
],
"Post analytics": [
@@ -3498,8 +3498,8 @@
],
"Team": [
"src/community/components/ProjectInfoPanel.jsx:217",
- "src/community/pages/ManageProject.jsx:890",
- "src/community/pages/ManageProject.jsx:1004"
+ "src/community/pages/ManageProject.jsx:891",
+ "src/community/pages/ManageProject.jsx:1005"
],
"person": [
"src/community/components/ProjectInfoPanel.jsx:222"
@@ -3518,7 +3518,7 @@
"Contributor": [
"src/community/components/ProjectInfoPanel.jsx:230",
"src/community/components/SharedProjects.jsx:20",
- "src/community/pages/ManageProject.jsx:943"
+ "src/community/pages/ManageProject.jsx:944"
],
"name or MistWarp username": [
"src/community/components/ProjectInfoPanel.jsx:262"
@@ -3773,7 +3773,7 @@
],
"Maintainer": [
"src/community/components/SharedProjects.jsx:19",
- "src/community/pages/ManageProject.jsx:942"
+ "src/community/pages/ManageProject.jsx:943"
],
"Edit, publish, and manage changes.": [
"src/community/components/SharedProjects.jsx:19"
@@ -3783,7 +3783,7 @@
],
"Tester": [
"src/community/components/SharedProjects.jsx:21",
- "src/community/pages/ManageProject.jsx:944"
+ "src/community/pages/ManageProject.jsx:945"
],
"Open and test private drafts.": [
"src/community/components/SharedProjects.jsx:21"
@@ -4397,7 +4397,7 @@
"src/community/pages/Commit.jsx:554",
"src/community/pages/Commit.jsx:555",
"src/community/pages/ManageProject.jsx:801",
- "src/community/pages/ManageProject.jsx:924",
+ "src/community/pages/ManageProject.jsx:925",
"src/community/pages/ManageSpace.jsx:679",
"src/community/pages/Support.jsx:137"
],
@@ -4541,7 +4541,7 @@
"src/community/components/classroom/ClassStudents.jsx:223",
"src/community/pages/Admin.jsx:161",
"src/community/pages/Admin.jsx:177",
- "src/community/pages/ManageProject.jsx:920",
+ "src/community/pages/ManageProject.jsx:921",
"src/community/pages/admin/AdminsSection.jsx:18"
],
"Last sign-in": [
@@ -4682,7 +4682,7 @@
"src/community/components/classroom/PresentControls.jsx:147",
"src/community/components/classroom/StudentHome.jsx:64",
"src/community/components/classroom/StudentHome.jsx:221",
- "src/community/pages/ManageProject.jsx:873",
+ "src/community/pages/ManageProject.jsx:874",
"src/community/pages/PullRequest.jsx:738",
"src/community/pages/admin/ErrorManager.jsx:212",
"src/community/pages/admin/UserDetailCard.jsx:66",
@@ -5434,7 +5434,7 @@
],
"Could not load bounties.": [
"src/community/pages/Bounties.jsx:64",
- "src/community/pages/ManageProject.jsx:1033"
+ "src/community/pages/ManageProject.jsx:1034"
],
"Funded improvements open across public MistWarp projects.": [
"src/community/pages/Bounties.jsx:98"
@@ -6318,7 +6318,7 @@
"Feedback": [
"src/community/pages/ClassroomAssignment.jsx:53",
"src/community/pages/ManageProject.jsx:812",
- "src/community/pages/ManageProject.jsx:847"
+ "src/community/pages/ManageProject.jsx:848"
],
"Grade": [
"src/community/pages/ClassroomAssignment.jsx:57"
@@ -6551,7 +6551,7 @@
],
"Role": [
"src/community/pages/ClassroomSchool.jsx:69",
- "src/community/pages/ManageProject.jsx:932"
+ "src/community/pages/ManageProject.jsx:933"
],
"Remove admin": [
"src/community/pages/ClassroomSchool.jsx:93"
@@ -6911,8 +6911,8 @@
],
"Collaboration": [
"src/community/pages/ManageProject.jsx:100",
- "src/community/pages/ManageProject.jsx:888",
- "src/community/pages/ManageProject.jsx:1002",
+ "src/community/pages/ManageProject.jsx:889",
+ "src/community/pages/ManageProject.jsx:1003",
"src/community/pages/Roadmap.jsx:497"
],
"Ownership": [
@@ -7148,15 +7148,15 @@
],
"Review player feedback and recent runtime health.": [
"src/community/pages/ManageProject.jsx:810",
- "src/community/pages/ManageProject.jsx:845"
+ "src/community/pages/ManageProject.jsx:846"
],
"Diagnostics": [
"src/community/pages/ManageProject.jsx:812",
- "src/community/pages/ManageProject.jsx:847"
+ "src/community/pages/ManageProject.jsx:848"
],
"Activity sections": [
"src/community/pages/ManageProject.jsx:818",
- "src/community/pages/ManageProject.jsx:853"
+ "src/community/pages/ManageProject.jsx:854"
],
"Player diagnostics": [
"src/community/pages/ManageProject.jsx:821"
@@ -7175,80 +7175,83 @@
"{value1} ms": [
"src/community/pages/ManageProject.jsx:827"
],
- "Average load": [
+ "95th percentile load": [
"src/community/pages/ManageProject.jsx:827",
"src/community/pages/admin/StatsOverview.jsx:527"
],
+ "Timed loads": [
+ "src/community/pages/ManageProject.jsx:828"
+ ],
"Loading diagnostics…": [
- "src/community/pages/ManageProject.jsx:831"
+ "src/community/pages/ManageProject.jsx:832"
],
"Recent errors": [
- "src/community/pages/ManageProject.jsx:835"
+ "src/community/pages/ManageProject.jsx:836"
],
"Tracked feedback": [
- "src/community/pages/ManageProject.jsx:856"
+ "src/community/pages/ManageProject.jsx:857"
],
"Loading feedback…": [
- "src/community/pages/ManageProject.jsx:857"
+ "src/community/pages/ManageProject.jsx:858"
],
"No feedback yet": [
- "src/community/pages/ManageProject.jsx:860"
+ "src/community/pages/ManageProject.jsx:861"
],
"Feedback players send from inside the project will show up here.": [
- "src/community/pages/ManageProject.jsx:861"
+ "src/community/pages/ManageProject.jsx:862"
],
"Working": [
- "src/community/pages/ManageProject.jsx:874"
+ "src/community/pages/ManageProject.jsx:875"
],
"Dismissed": [
- "src/community/pages/ManageProject.jsx:876"
+ "src/community/pages/ManageProject.jsx:877"
],
"Manage project access and funded work.": [
- "src/community/pages/ManageProject.jsx:888",
- "src/community/pages/ManageProject.jsx:1002"
+ "src/community/pages/ManageProject.jsx:889",
+ "src/community/pages/ManageProject.jsx:1003"
],
"Collaboration sections": [
- "src/community/pages/ManageProject.jsx:896",
- "src/community/pages/ManageProject.jsx:1010"
+ "src/community/pages/ManageProject.jsx:897",
+ "src/community/pages/ManageProject.jsx:1011"
],
"Project team": [
- "src/community/pages/ManageProject.jsx:902"
+ "src/community/pages/ManageProject.jsx:903"
],
"Give other people access without sharing your account.": [
- "src/community/pages/ManageProject.jsx:903"
+ "src/community/pages/ManageProject.jsx:904"
],
"Add teammate": [
- "src/community/pages/ManageProject.jsx:912"
+ "src/community/pages/ManageProject.jsx:913"
],
"Sale share": [
- "src/community/pages/ManageProject.jsx:949"
+ "src/community/pages/ManageProject.jsx:950"
],
"No teammates yet": [
- "src/community/pages/ManageProject.jsx:983"
+ "src/community/pages/ManageProject.jsx:984"
],
"Add someone when you are ready to work together.": [
- "src/community/pages/ManageProject.jsx:984"
+ "src/community/pages/ManageProject.jsx:985"
],
"Save team": [
- "src/community/pages/ManageProject.jsx:995"
+ "src/community/pages/ManageProject.jsx:996"
],
"Bounty cancelled and refunded.": [
- "src/community/pages/ManageProject.jsx:1044"
+ "src/community/pages/ManageProject.jsx:1045"
],
"Could not cancel the bounty.": [
- "src/community/pages/ManageProject.jsx:1047"
+ "src/community/pages/ManageProject.jsx:1048"
],
"Create a bounty": [
- "src/community/pages/ManageProject.jsx:1056"
+ "src/community/pages/ManageProject.jsx:1057"
],
"New bounties are paused while MistWarp moves payments to Rotur. Bounties already funded still pay out when you merge a linked pull request, and you can cancel them for a refund.": [
- "src/community/pages/ManageProject.jsx:1058"
+ "src/community/pages/ManageProject.jsx:1059"
],
"Project bounties": [
- "src/community/pages/ManageProject.jsx:1063"
+ "src/community/pages/ManageProject.jsx:1064"
],
"No bounties yet": [
- "src/community/pages/ManageProject.jsx:1078"
+ "src/community/pages/ManageProject.jsx:1079"
],
"Curators": [
"src/community/pages/ManageSpace.jsx:35",
@@ -8427,42 +8430,42 @@
"src/community/pages/Project.jsx:604"
],
"Delete project?": [
- "src/community/pages/Project.jsx:721",
+ "src/community/pages/Project.jsx:722",
"src/community/pages/admin/ProjectManager.jsx:68",
"src/community/pages/admin/UserDetailCard.jsx:253"
],
"Delete project": [
- "src/community/pages/Project.jsx:722",
+ "src/community/pages/Project.jsx:723",
"src/community/pages/admin/ProjectManager.jsx:70",
"src/community/pages/admin/UserDetailCard.jsx:255",
"src/community/pages/project/ProjectHeader.jsx:361"
],
"{value1} will be deleted permanently. This cannot be undone.": [
- "src/community/pages/Project.jsx:728"
+ "src/community/pages/Project.jsx:729"
],
"Run custom extensions without the sandbox?": [
- "src/community/pages/Project.jsx:734"
+ "src/community/pages/Project.jsx:735"
],
"Keep sandbox": [
- "src/community/pages/Project.jsx:735"
+ "src/community/pages/Project.jsx:736"
],
"Run anyway": [
- "src/community/pages/Project.jsx:736"
+ "src/community/pages/Project.jsx:737"
],
"This gives the project full access to your MistWarp account. It could read your login session, act as you, or change your data. Continue only if you trust the creator.": [
- "src/community/pages/Project.jsx:739"
+ "src/community/pages/Project.jsx:740"
],
"Shared {value1}": [
- "src/community/pages/Project.jsx:816",
+ "src/community/pages/Project.jsx:817",
"src/community/pages/admin/UserDetailCard.jsx:323",
"src/community/pages/project/ProjectHeader.jsx:97"
],
"Uploaded {value1}": [
- "src/community/pages/Project.jsx:817",
+ "src/community/pages/Project.jsx:818",
"src/community/pages/project/ProjectHeader.jsx:98"
],
"{value1} blocks": [
- "src/community/pages/Project.jsx:830"
+ "src/community/pages/Project.jsx:831"
],
"About this project": [
"src/community/pages/ProjectCode.jsx:75"
@@ -10601,7 +10604,7 @@
"{value1} of {value2} projects": [
"src/community/pages/admin/StatsOverview.jsx:398"
],
- "Average load, {value1} days": [
+ "95th percentile load, {value1} days": [
"src/community/pages/admin/StatsOverview.jsx:401"
],
"{value1} completed samples": [
@@ -10658,10 +10661,10 @@
"Dashed lines estimate today's UTC close from its current pace and the prior seven days.": [
"src/community/pages/admin/StatsOverview.jsx:454"
],
- "Average project load time": [
+ "Project load time, 95th percentile": [
"src/community/pages/admin/StatsOverview.jsx:458"
],
- "{value1} completed player loads in this period. Days without a sample appear as gaps.": [
+ "95% of timed player loads each day finished within this time. Days without a sample appear as gaps.": [
"src/community/pages/admin/StatsOverview.jsx:459"
],
"Milliseconds": [
@@ -10704,7 +10707,7 @@
"Daily data": [
"src/community/pages/admin/StatsOverview.jsx:510"
],
- "Exact values behind the charts. Load averages only use completed loads with a recorded duration.": [
+ "Exact values behind the charts. Load times only use completed loads with a recorded duration.": [
"src/community/pages/admin/StatsOverview.jsx:511"
],
"Hide data": [
@@ -11639,7 +11642,7 @@
],
"MistWarp needs your permission on Rotur to do this.": [
"src/community/rotur.js:52",
- "src/community/rotur.js:157"
+ "src/community/rotur.js:158"
],
"This remix changed while it was syncing. Sync again to include the new changes.": [
"src/community/use-remix-sync.js:47"
diff --git a/src/community/translations/en.json b/src/community/translations/en.json
index 44a3016a458..d684938c7f5 100644
--- a/src/community/translations/en.json
+++ b/src/community/translations/en.json
@@ -428,7 +428,6 @@
"Recorded playtime": "Recorded playtime",
"Trends": "Trends",
"Dashed lines estimate today's UTC close from its current pace and the prior seven days.": "Dashed lines estimate today's UTC close from its current pace and the prior seven days.",
- "Average project load time": "Average project load time",
"Project uploads": "Project uploads",
"Projects created each day, including shared and unshared projects.": "Projects created each day, including shared and unshared projects.",
"Project updates": "Project updates",
@@ -440,7 +439,6 @@
"Current sessions by sign-in date": "Current sessions by sign-in date",
"Unexpired sign-in sessions only. MistWarp removes sessions after seven days.": "Unexpired sign-in sessions only. MistWarp removes sessions after seven days.",
"Daily data": "Daily data",
- "Exact values behind the charts. Load averages only use completed loads with a recorded duration.": "Exact values behind the charts. Load averages only use completed loads with a recorded duration.",
"Hide data": "Hide data",
"View data": "View data",
"Download CSV": "Download CSV",
@@ -448,7 +446,6 @@
"Updates": "Updates",
"Sessions": "Sessions",
"Loads": "Loads",
- "Average load": "Average load",
"Samples": "Samples",
"Starts": "Starts",
"Crashes": "Crashes",
@@ -1350,8 +1347,6 @@
"{value1} composition": "{value1} composition",
"Estimated end of today: {value1}": "Estimated end of today: {value1}",
"{value1} days": "{value1} days",
- "Average load, {value1} days": "Average load, {value1} days",
- "{value1} completed player loads in this period. Days without a sample appear as gaps.": "{value1} completed player loads in this period. Days without a sample appear as gaps.",
"by @{value1} · {value2}": "by @{value1} · {value2}",
"{value1} of {value2}": "{value1} of {value2}",
"{value1}–{value2} of {value3}": "{value1}–{value2} of {value3}",
@@ -3839,5 +3834,11 @@
"Only an admin of @{org} can move this space out of the organisation.": "Only an admin of @{org} can move this space out of the organisation.",
"Could not load your organisations, so this space will be yours.": "Could not load your organisations, so this space will be yours.",
"Transfer \"{space}\" to @{owner}? The organisation will no longer own it.": "Transfer \"{space}\" to @{owner}? The organisation will no longer own it.",
- "The new owner receives this {value1}. The organisation will no longer own it.": "The new owner receives this {value1}. The organisation will no longer own it."
+ "The new owner receives this {value1}. The organisation will no longer own it.": "The new owner receives this {value1}. The organisation will no longer own it.",
+ "95th percentile load": "95th percentile load",
+ "95th percentile load, {value1} days": "95th percentile load, {value1} days",
+ "Project load time, 95th percentile": "Project load time, 95th percentile",
+ "Exact values behind the charts. Load times only use completed loads with a recorded duration.": "Exact values behind the charts. Load times only use completed loads with a recorded duration.",
+ "95% of timed player loads each day finished within this time. Days without a sample appear as gaps.": "95% of timed player loads each day finished within this time. Days without a sample appear as gaps.",
+ "Timed loads": "Timed loads"
}
diff --git a/src/lib/community/cached-fetch.js b/src/lib/community/cached-fetch.js
index 7979e860012..02bd28a64fc 100644
--- a/src/lib/community/cached-fetch.js
+++ b/src/lib/community/cached-fetch.js
@@ -42,7 +42,7 @@ const readProjectResponse = async response => {
return buffer;
};
-const fetchAndStore = async url => {
+const fetchAndStore = async (url, immutable) => {
const generation = cacheGeneration;
const cache = await openCache();
let cachedHit = null;
@@ -58,7 +58,7 @@ const fetchAndStore = async url => {
throw new Error('Discarding cached HTML project response');
}
const at = Number(getHeader(hit.headers, CACHED_AT_HEADER));
- if (at && Date.now() - at < TTL) {
+ if (immutable || (at && Date.now() - at < TTL)) {
return buffer;
}
storedEtag = getHeader(hit.headers, ETAG_HEADER) || getHeader(hit.headers, 'etag');
@@ -138,10 +138,10 @@ const fetchAndStore = async url => {
return buffer;
};
-const sharedFetch = url => {
+const sharedFetch = (url, immutable = false) => {
let promise = inflight.get(url);
if (!promise) {
- promise = fetchAndStore(url);
+ promise = fetchAndStore(url, immutable);
inflight.set(url, promise);
const remove = () => {
if (inflight.get(url) === promise) inflight.delete(url);
@@ -151,7 +151,7 @@ const sharedFetch = url => {
return promise;
};
-const cachedFetchBuffer = url => {
+const cachedFetchBuffer = (url, {immutable = false} = {}) => {
const warmed = preloaded.get(url);
if (warmed && Date.now() - warmed.at < PRELOAD_TTL) {
preloaded.delete(url);
@@ -160,9 +160,13 @@ const cachedFetchBuffer = url => {
if (warmed) preloaded.delete(url);
// Project consumers treat the downloaded bytes as immutable. Returning the
// shared buffer avoids copying the entire project before JSZip reads it.
- return sharedFetch(url);
+ return sharedFetch(url, immutable);
};
+const CONTENT_ADDRESSED_FILE = /^[a-f0-9]{32}\.[a-z0-9]+$/i;
+
+const isContentAddressedFile = file => typeof file === 'string' && CONTENT_ADDRESSED_FILE.test(file);
+
const cachedFetchJson = url => sharedFetch(url)
.then(buffer => JSON.parse(new TextDecoder().decode(buffer)));
@@ -194,4 +198,4 @@ const clearContentCache = () => {
}
};
-export {cachedFetchBuffer, cachedFetchJson, preloadContent, clearContentCache};
+export {cachedFetchBuffer, cachedFetchJson, clearContentCache, isContentAddressedFile, preloadContent};
diff --git a/src/lib/components/project-fetcher-hoc.jsx b/src/lib/components/project-fetcher-hoc.jsx
index a507452f351..5cbf8d0225b 100644
--- a/src/lib/components/project-fetcher-hoc.jsx
+++ b/src/lib/components/project-fetcher-hoc.jsx
@@ -113,7 +113,8 @@ const clearProjectSourceFromUrl = () => {
const params = new URLSearchParams(location.search);
let changed = false;
const sourceKeys = [
- 'clone', 'project_url', 'platform_project', 'mw_assets', 'mw_te', 'starter', 'restore', 'from'
+ 'clone', 'project_url', 'platform_project', 'mw_assets', 'mw_assets_mirror', 'mw_te', 'starter', 'restore',
+ 'from'
];
for (const key of sourceKeys) {
if (params.has(key)) {
@@ -338,8 +339,10 @@ const ProjectFetcherHOC = function (WrappedComponent) {
location.hash.match(/^#mw-([\w-]+)/);
const hashProjectId = hashMatch && hashMatch[1];
const mistwarpAssets = !student && searchParams && searchParams.get('mw_assets');
+ const mirrorParam = mistwarpAssets && searchParams.get('mw_assets_mirror');
+ const assetsMirror = mirrorParam && isHttpUrl(mirrorParam) ? mirrorParam : null;
if (mistwarpAssets && isHttpUrl(mistwarpAssets)) {
- storage.addMistWarpAssetStore(mistwarpAssets);
+ storage.addMistWarpAssetStore(mistwarpAssets, assetsMirror);
}
let projectUrl = searchParams && searchParams.get('project_url');
if (student && !isGallerySampleUrl(projectUrl)) projectUrl = null;
@@ -351,7 +354,8 @@ const ProjectFetcherHOC = function (WrappedComponent) {
const source = this.props.isEmbedded && platformProject && !hashProjectId && projectUrl ? {
id,
projectJsonUrl: projectUrl,
- assetsBase: mistwarpAssets
+ assetsBase: mistwarpAssets,
+ assetsMirrorBase: assetsMirror
} : null;
assetPromise = loadPlatformProject(id, source);
} else if (cloneUrl) {
@@ -429,7 +433,10 @@ const ProjectFetcherHOC = function (WrappedComponent) {
if (projectAsset.platformProject) {
const project = projectAsset.platformProject;
if (project.assetsBase && isHttpUrl(project.assetsBase)) {
- storage.addMistWarpAssetStore(project.assetsBase);
+ const mirror = project.assetsMirrorBase && isHttpUrl(project.assetsMirrorBase) ?
+ project.assetsMirrorBase :
+ null;
+ storage.addMistWarpAssetStore(project.assetsBase, mirror);
}
rememberPlatformProject(project, {resetSaveBase: true});
await deleteRepo();
diff --git a/src/lib/persistence/storage.js b/src/lib/persistence/storage.js
index 89d350e00b6..26210b88147 100644
--- a/src/lib/persistence/storage.js
+++ b/src/lib/persistence/storage.js
@@ -2,7 +2,7 @@ import ScratchStorage from '@turbowarp/scratch-storage';
import defaultProject from '../default-project';
import {hasBridge, bridgeFetch} from '../community/embed-bridge';
-import {cachedFetchBuffer} from '../community/cached-fetch';
+import {cachedFetchBuffer, isContentAddressedFile} from '../community/cached-fetch';
/**
* Wrapper for ScratchStorage which adds default web sources.
@@ -42,30 +42,31 @@ class Storage extends ScratchStorage {
this.getAssetCreateConfig.bind(this)
);
}
- addMistWarpAssetStore (assetsBase) {
+ addMistWarpAssetStore (assetsBase, mirrorBase) {
const base = assetsBase.replace(/\/+$/, '');
- if (this.mistwarpAssetsBase === base) {
- return;
- }
+ const mirror = mirrorBase ? mirrorBase.replace(/\/+$/, '') : null;
if (this.mistwarpAssetsBase) {
this.mistwarpAssetsBase = base;
+ this.mistwarpAssetsMirror = mirror;
return;
}
this.mistwarpAssetsBase = base;
- if (hasBridge()) {
- this.addHelper({
- load: (assetType, assetId, dataFormat) =>
- bridgeFetch(`${this.mistwarpAssetsBase}/${assetId}.${dataFormat}`)
- .then(buffer => this.createAsset(assetType, dataFormat, new Uint8Array(buffer), assetId))
- });
- } else {
- this.addHelper({
- load: (assetType, assetId, dataFormat) =>
- cachedFetchBuffer(`${this.mistwarpAssetsBase}/${assetId}.${dataFormat}`)
- .then(buffer => this.createAsset(assetType, dataFormat, new Uint8Array(buffer), assetId))
- .catch(() => null)
- });
- }
+ this.mistwarpAssetsMirror = mirror;
+ const fetchAsset = hasBridge() ?
+ url => bridgeFetch(url) :
+ (url, file) => cachedFetchBuffer(url, {immutable: isContentAddressedFile(file)});
+ const fetchFromStores = file => {
+ const primary = `${this.mistwarpAssetsBase}/${file}`;
+ if (!this.mistwarpAssetsMirror) return fetchAsset(primary, file);
+ return fetchAsset(`${this.mistwarpAssetsMirror}/${file}`, file).catch(() => fetchAsset(primary, file));
+ };
+ const loading = (assetType, assetId, dataFormat) => fetchFromStores(`${assetId}.${dataFormat}`)
+ .then(buffer => this.createAsset(assetType, dataFormat, new Uint8Array(buffer), assetId));
+ this.addHelper({
+ load: hasBridge() ?
+ loading :
+ (assetType, assetId, dataFormat) => loading(assetType, assetId, dataFormat).catch(() => null)
+ });
this.addWebStore(
[
this.AssetType.ImageVector,
diff --git a/src/lib/workspace-state.js b/src/lib/workspace-state.js
index fbf27b7e57c..74b875469c0 100644
--- a/src/lib/workspace-state.js
+++ b/src/lib/workspace-state.js
@@ -9,7 +9,10 @@ const detachWorkspace = vm => {
detachProjectSession(vm);
const url = new URL(window.location.href);
url.hash = '';
- for (const key of ['clone', 'project_url', 'platform_project', 'mw_assets', 'mw_te', 'starter', 'restore']) {
+ const sourceKeys = [
+ 'clone', 'project_url', 'platform_project', 'mw_assets', 'mw_assets_mirror', 'mw_te', 'starter', 'restore'
+ ];
+ for (const key of sourceKeys) {
url.searchParams.delete(key);
}
window.history.replaceState(null, '', url);
diff --git a/src/playground/embed.jsx b/src/playground/embed.jsx
index 854287a0722..589c8bda535 100644
--- a/src/playground/embed.jsx
+++ b/src/playground/embed.jsx
@@ -44,6 +44,11 @@ window.addEventListener('message', applyEmbedThemeMessage);
const urlParams = new URLSearchParams(location.search);
const projectId = urlParams.get('platform_project') || getProjectId();
const sessionStartedAt = performance.now();
+let hiddenDuringLoad = document.visibilityState === 'hidden';
+const noteHiddenDuringLoad = () => {
+ if (document.visibilityState === 'hidden') hiddenDuringLoad = true;
+};
+document.addEventListener('visibilitychange', noteHiddenDuringLoad);
let playing = false;
const LINK_BACK_REFS = new Set(['embed', 'oembed']);
const linkBack = urlParams.get('mw_public') === '1' ? document.createElement('a') : null;
@@ -117,9 +122,10 @@ const onVmInit = _vm => {
};
const onProjectLoaded = () => {
+ document.removeEventListener('visibilitychange', noteHiddenDuringLoad);
reportDiagnostic({
type: 'load',
- loadMs: Math.round(performance.now() - sessionStartedAt),
+ loadMs: hiddenDuringLoad ? 0 : Math.round(performance.now() - sessionStartedAt),
device: matchMedia('(pointer: coarse)').matches ? 'touch' : 'desktop'
});
if (window.parent !== window && vm && vm.runtime) {
@@ -162,6 +168,7 @@ const resolvePublicEmbed = async () => {
const params = new URLSearchParams();
params.set('project_url', project.projectJsonUrl);
params.set('mw_assets', project.assetsBase);
+ if (project.assetsMirrorBase) params.set('mw_assets_mirror', project.assetsMirrorBase);
params.set('platform_project', project.id);
if (project.shared === true && project.visibility === 'public') params.set('mw_public', '1');
if (project.canRemix === true) params.set('mw_remix', '1');
diff --git a/test/unit/community-cached-fetch.test.js b/test/unit/community-cached-fetch.test.js
index 7fd53618839..81f0a2fab30 100644
--- a/test/unit/community-cached-fetch.test.js
+++ b/test/unit/community-cached-fetch.test.js
@@ -195,4 +195,31 @@ describe('community project content cache', () => {
expect(loaded).toBe(buffer);
expect(cache.put).toHaveBeenCalledTimes(1);
});
+
+ test('uses a cached immutable file without revalidating it', async () => {
+ const assetUrl = 'https://assets.example/0123456789abcdef0123456789abcdef.png';
+ const cached = new Uint8Array([7, 8, 9]).buffer;
+ const tenMinutesAgo = String(Date.now() - (10 * 60 * 1000));
+ global.caches.open = jest.fn(() => Promise.resolve({
+ match: jest.fn(() => Promise.resolve({
+ arrayBuffer: async () => cached,
+ headers: {get: name => (name === 'x-mw-cached-at' ? tenMinutesAgo : null)}
+ })),
+ put: jest.fn(() => Promise.resolve()),
+ delete: jest.fn(() => Promise.resolve())
+ }));
+
+ await expect(cachedFetchBuffer(assetUrl, {immutable: true})).resolves.toBe(cached);
+ expect(global.fetch).not.toHaveBeenCalled();
+
+ clearContentCache();
+ global.fetch.mockResolvedValue({
+ ok: true,
+ status: 200,
+ headers: {get: () => null},
+ arrayBuffer: async () => cached
+ });
+ await cachedFetchBuffer(assetUrl);
+ expect(global.fetch).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/test/unit/community-embed-fetch-bridge.test.jsx b/test/unit/community-embed-fetch-bridge.test.jsx
index 8c2b59d731f..2eae5334a13 100644
--- a/test/unit/community-embed-fetch-bridge.test.jsx
+++ b/test/unit/community-embed-fetch-bridge.test.jsx
@@ -6,10 +6,16 @@ import {cachedFetchBuffer} from '../../src/lib/community/cached-fetch.js';
jest.mock('../../src/lib/community/cached-fetch.js', () => ({
cachedFetchBuffer: jest.fn(),
+ isContentAddressedFile: jest.requireActual('../../src/lib/community/cached-fetch.js').isContentAddressedFile,
preloadContent: jest.fn(() => Promise.resolve(null))
}));
-const project = {id: '1', projectJsonUrl: 'https://cdn.test/project.sb3'};
+const project = {
+ id: '1',
+ projectJsonUrl: 'https://cdn.test/project.sb3',
+ assetsBase: 'https://api.test/blobs/assets',
+ assetsMirrorBase: 'https://r2.test/assets'
+};
const Bridge = ({frame}) => {
const ref = useRef(frame);
@@ -42,3 +48,54 @@ test('sends the player a copy of the cached project, not the cached buffer itsel
expect(transfer).toEqual([message.buffer]);
wrapper.unmount();
});
+
+const requestThroughBridge = async (frame, url) => {
+ await act(async () => {
+ window.dispatchEvent(new MessageEvent('message', {
+ source: frame.contentWindow,
+ data: {type: 'mw:fetch', id: 9, url}
+ }));
+ await Promise.resolve();
+ await Promise.resolve();
+ });
+};
+
+test('serves mirrored and API assets from the cache without revalidating them', async () => {
+ cachedFetchBuffer.mockReset();
+ cachedFetchBuffer.mockResolvedValue(new Uint8Array([1]).buffer);
+ const postMessage = jest.fn();
+ const frame = {contentWindow: {postMessage}};
+ const wrapper = mount(
);
+
+ await requestThroughBridge(frame, 'https://r2.test/assets/0123456789abcdef0123456789abcdef.png');
+ await requestThroughBridge(frame, 'https://api.test/blobs/assets/0123456789abcdef0123456789abcdef.png');
+ await requestThroughBridge(frame, project.projectJsonUrl);
+ await requestThroughBridge(frame, 'https://elsewhere.test/assets/0123456789abcdef0123456789abcdef.png');
+
+ expect(cachedFetchBuffer.mock.calls).toEqual([
+ ['https://r2.test/assets/0123456789abcdef0123456789abcdef.png', {immutable: true}],
+ ['https://api.test/blobs/assets/0123456789abcdef0123456789abcdef.png', {immutable: true}],
+ [project.projectJsonUrl, {immutable: false}]
+ ]);
+ wrapper.unmount();
+});
+
+test('refuses paths that climb out of the asset folders and only treats md5 files as immutable', async () => {
+ cachedFetchBuffer.mockReset();
+ cachedFetchBuffer.mockResolvedValue(new Uint8Array([1]).buffer);
+ const postMessage = jest.fn();
+ const frame = {contentWindow: {postMessage}};
+ const wrapper = mount(
);
+
+ await requestThroughBridge(frame, 'https://r2.test/assets/../projects/p1/project.json');
+ await requestThroughBridge(frame, 'https://r2.test/assets-evil/0123456789abcdef0123456789abcdef.png');
+ await requestThroughBridge(frame, 'https://api.test/blobs/assets/custom-asset.bin');
+
+ expect(cachedFetchBuffer.mock.calls).toEqual([
+ ['https://api.test/blobs/assets/custom-asset.bin', {immutable: false}]
+ ]);
+ const refusals = postMessage.mock.calls.filter(([message]) => !message.buffer);
+ expect(refusals).toHaveLength(2);
+ expect(refusals.every(([message]) => message.type === 'mw:fetch-result')).toBe(true);
+ wrapper.unmount();
+});
diff --git a/test/unit/community-embed-url.test.js b/test/unit/community-embed-url.test.js
index 97d8c7e8beb..c78b415ca92 100644
--- a/test/unit/community-embed-url.test.js
+++ b/test/unit/community-embed-url.test.js
@@ -21,3 +21,20 @@ test('project embeds never carry a trusted extension list in the URL', () => {
}), window.location.origin);
expect(url.searchParams.has('mw_te')).toBe(false);
});
+
+test('project embeds pass the asset mirror when the API offers one', () => {
+ const withMirror = new URL(embedUrl({
+ id: 'project-1',
+ projectJsonUrl: 'https://api.example/project.json',
+ assetsBase: 'https://api.example/assets',
+ assetsMirrorBase: 'https://cdn.example/assets'
+ }), window.location.origin);
+ expect(withMirror.searchParams.get('mw_assets_mirror')).toBe('https://cdn.example/assets');
+
+ const withoutMirror = new URL(embedUrl({
+ id: 'project-1',
+ projectJsonUrl: 'https://api.example/project.json',
+ assetsBase: 'https://api.example/assets'
+ }), window.location.origin);
+ expect(withoutMirror.searchParams.has('mw_assets_mirror')).toBe(false);
+});
diff --git a/test/unit/mistwarp-asset-mirror.test.js b/test/unit/mistwarp-asset-mirror.test.js
new file mode 100644
index 00000000000..50365dafeae
--- /dev/null
+++ b/test/unit/mistwarp-asset-mirror.test.js
@@ -0,0 +1,65 @@
+import storage from '../../src/lib/persistence/storage';
+import {cachedFetchBuffer} from '../../src/lib/community/cached-fetch';
+
+jest.mock('../../src/lib/community/cached-fetch', () => ({
+ cachedFetchBuffer: jest.fn(),
+ isContentAddressedFile: jest.requireActual('../../src/lib/community/cached-fetch').isContentAddressedFile
+}));
+
+jest.mock('../../src/lib/community/embed-bridge', () => ({
+ hasBridge: () => false,
+ bridgeFetch: jest.fn()
+}));
+
+const assetId = '0123456789abcdef0123456789abcdef';
+const bytes = new Uint8Array([137, 80, 78, 71]).buffer;
+
+const loadAsset = () => storage.load(storage.AssetType.ImageBitmap, assetId, 'png');
+
+beforeEach(() => {
+ cachedFetchBuffer.mockReset();
+});
+
+test('loads assets from the mirror without asking the API', async () => {
+ storage.addMistWarpAssetStore('https://api.test/blobs/assets', 'https://r2.test/assets/');
+ cachedFetchBuffer.mockResolvedValue(bytes);
+
+ const asset = await loadAsset();
+
+ expect(asset.assetId).toBe(assetId);
+ expect(cachedFetchBuffer).toHaveBeenCalledTimes(1);
+ expect(cachedFetchBuffer).toHaveBeenCalledWith(`https://r2.test/assets/${assetId}.png`, {immutable: true});
+});
+
+test('falls back to the API when the mirror does not have the asset yet', async () => {
+ storage.addMistWarpAssetStore('https://api.test/blobs/assets', 'https://r2.test/assets');
+ cachedFetchBuffer
+ .mockRejectedValueOnce(Object.assign(new Error('Request returned status 404'), {status: 404}))
+ .mockResolvedValueOnce(bytes);
+
+ const asset = await loadAsset();
+
+ expect(asset.assetId).toBe(assetId);
+ expect(cachedFetchBuffer.mock.calls.map(call => call[0])).toEqual([
+ `https://r2.test/assets/${assetId}.png`,
+ `https://api.test/blobs/assets/${assetId}.png`
+ ]);
+});
+
+test('uses only the API when no mirror is offered', async () => {
+ storage.addMistWarpAssetStore('https://api.test/blobs/assets', null);
+ cachedFetchBuffer.mockResolvedValue(bytes);
+
+ await loadAsset();
+
+ expect(cachedFetchBuffer.mock.calls.map(call => call[0])).toEqual([`https://api.test/blobs/assets/${assetId}.png`]);
+});
+
+test('only caches md5-named assets as immutable', async () => {
+ storage.addMistWarpAssetStore('https://api.test/blobs/assets', null);
+ cachedFetchBuffer.mockResolvedValue(bytes);
+
+ await storage.load(storage.AssetType.ImageBitmap, 'hand-made-id', 'png');
+
+ expect(cachedFetchBuffer).toHaveBeenCalledWith('https://api.test/blobs/assets/hand-made-id.png', {immutable: false});
+});
diff --git a/test/unit/student-project-sources.test.jsx b/test/unit/student-project-sources.test.jsx
index 0eb2aff9d53..99cf446a630 100644
--- a/test/unit/student-project-sources.test.jsx
+++ b/test/unit/student-project-sources.test.jsx
@@ -63,6 +63,11 @@ const makeFetcher = ({isEmbedded = false} = {}) => {
return {instance, onFetchedProjectData, onError, vm};
};
+const releaseHandoff = vm => {
+ const handoff = takeLoadHandoff(vm);
+ if (handoff && typeof handoff.release === 'function') handoff.release();
+};
+
describe('project sources for class accounts', () => {
let originalLoad;
let originalAddStore;
@@ -135,6 +140,44 @@ describe('project sources for class accounts', () => {
takeLoadHandoff(vm).release();
});
+ test('an embed passes the asset mirror from the URL to storage', async () => {
+ window.history.replaceState({}, '', '/embed?platform_project=p1' +
+ '&project_url=https://api.mistwarp.org/p1.json&mw_assets=https://api.mistwarp.org/assets' +
+ '&mw_assets_mirror=https://assets.mistwarp.org/assets');
+ const {instance, vm} = makeFetcher({isEmbedded: true});
+ await instance.fetchProject('0', LoadingState.FETCHING_WITH_ID);
+ expect(storage.addMistWarpAssetStore).toHaveBeenCalledWith(
+ 'https://api.mistwarp.org/assets',
+ 'https://assets.mistwarp.org/assets'
+ );
+ releaseHandoff(vm);
+ });
+
+ test('an asset mirror that is not a web address is ignored', async () => {
+ window.history.replaceState({}, '', '/embed?platform_project=p1' +
+ '&project_url=https://api.mistwarp.org/p1.json&mw_assets=https://api.mistwarp.org/assets' +
+ '&mw_assets_mirror=javascript:alert(1)');
+ const {instance, vm} = makeFetcher({isEmbedded: true});
+ await instance.fetchProject('0', LoadingState.FETCHING_WITH_ID);
+ expect(storage.addMistWarpAssetStore).toHaveBeenCalledWith('https://api.mistwarp.org/assets', null);
+ releaseHandoff(vm);
+ });
+
+ test('a student ignores an asset mirror in the URL', async () => {
+ localStorage.setItem(STUDENT_KEY, '1');
+ getEditorProject.mockResolvedValue({project: {
+ id: 'p1', title: 'Class project', projectJsonUrl: 'https://api.mistwarp.org/p1.json'
+ }});
+ window.history.replaceState({}, '', '/embed?platform_project=p1' +
+ '&project_url=https://tracker.example/p1.json&mw_assets=https://tracker.example/assets/' +
+ '&mw_assets_mirror=https://tracker.example/mirror/');
+ const {instance, vm} = makeFetcher({isEmbedded: true});
+ await instance.fetchProject('0', LoadingState.FETCHING_WITH_ID);
+ const mirrors = storage.addMistWarpAssetStore.mock.calls.map(call => call[1]);
+ expect(mirrors).not.toContain('https://tracker.example/mirror/');
+ takeLoadHandoff(vm).release();
+ });
+
test('a student cannot open Scratch projects by number', async () => {
localStorage.setItem(STUDENT_KEY, '1');
await expect(fetchProjectMeta('123')).rejects.toThrow('class accounts');