Add playground-redirect.html back to avoid HTTP 404

This commit is contained in:
fisker committed 2025-02-27 01:36:39 +08:00
1 parent 25bbce9e1f
commit af6e7215ce
1 file changed
+36
+36
View File
@@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Redirecting…</title>
</head>
<body>
<h1>Redirecting…</h1>
<p>
Redirecting you to the appropriate playground. If the redirect doesn’t
work, <a href="javascript:history.back()">go back to the PR</a> and click
the appropriate link:<br />
<img
src="https://cdn.netlify.com/f0b93f3003d5669924b6e73540bbfe07bc3d8d95/34c5d/img/blog/deploy-preview-workflow.gif"
alt="click on the link next to 'deploy/netlify'"
/>
</p>
<script>
const match =
/^https:\/\/github\.com\/prettier\/prettier\/pull\/(\d+)/.exec(
document.referrer,
);
if (match != null) {
const [, /* url */ pr] = match;
location.replace(
`https://deploy-preview-${pr}--prettier.netlify.app/playground`,
);
} else {
const el = document.createElement("p");
el.textContent = `The referrer URL (${document.referrer}) was not recognized. Sorry :(`;
document.body.appendChild(el);
}
</script>
</body>
</html>
<!-- TODO: Remove this once PRs not linked to this page -->