Skip to content

Commit f3164b8

Browse files
committed
feat: add web.phcode.dev as the production web domain
web.phcode.dev becomes the new home for the hosted web app, with phcode.dev deprecated shortly after. Most of the app is origin-relative and boots on a new host unchanged (service worker scope, VFS base URL, PWA manifest, CSP). What needed fixing are the places that compare against a hardcoded list of known origins: - Phoenix.TRUSTED_ORIGINS in src/index.html and test/SpecRunner.html, which is also serialized into live preview pages as TRUSTED_ORIGINS_EMBED. - The duplicate list in live-preview-loader.html. This page also lacked the TRUSTED_ORIGINS[location.origin] = true self-add that the other two copies have, so it is the one origin list that could not adapt to a new host on its own. Added. - loggableURLS in loggerSetup.js. This is a startsWith prefix match, so https://web.phcode.dev/ did not match https://phcode.dev and Bugsnag would have been silently disabled on the new domain. Same for the safeStarts list, which decides whether our own URLs survive path redaction in error reports. Deprecation of phcode.dev: - The dev/staging interstitial now redirects to web.phcode.dev instead of the domain being retired. web.phcode.dev is deliberately not added to that gated-hostname list, it is production. - og:url, twitter:url, the robots.txt sitemap line and sitemap-phcode.xml point at the new home. Both domains serve the same artifact during the overlap, so this consolidates SEO and link previews. Analytics for the prod web build move to a new GA property and core-analytics app name so the retired endpoint stops accruing data. Desktop GA, desktop app name and MixPanel are unchanged, the desktop app is not moving origins. Note that phcode.live must allowlist the new origin in its own docs/trustedOrigins.js, and account.phcode.dev needs CORS for it with Allow-Credentials, otherwise login and live preview fail silently.
1 parent 7f188d1 commit f3164b8

7 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/brackets.config.dist.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"googleAnalyticsID" : "G-FBK9RP5YK2",
2+
"googleAnalyticsID" : "G-G3DTS3ZR09",
33
"googleAnalyticsIDDesktop": "G-M7MX9BYZZ3",
44
"mixPanelID" : "8cb6814f733e37c05cc59b4adad26407",
55
"coreAnalyticsID" : "phoenix",
6-
"coreAnalyticsAppName" : "phoenix-prod",
6+
"coreAnalyticsAppName" : "phoenix-web",
77
"coreAnalyticsAppNameDesktop" : "desktop-prod",
88
"environment" : "production",
99
"buildtype" : "production",

src/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@
4747

4848
<!-- Open Graph / Facebook -->
4949
<meta property="og:type" content="website" />
50-
<meta property="og:url" content="https://phcode.dev/" />
50+
<meta property="og:url" content="https://web.phcode.dev/" />
5151
<meta property="og:title" content="Phoenix Code | Code Creatively" />
5252
<meta property="og:description" content="A text editor designed to make coding as intuitive and fun as playing a video game - specially crafted for web developers, designers, and students." />
5353
<meta property="og:image" content="assets/images/socialcard.png" />
5454

5555
<!-- Twitter -->
5656
<meta property="twitter:card" content="summary_large_image" />
57-
<meta property="twitter:url" content="https://phcode.dev/" />
57+
<meta property="twitter:url" content="https://web.phcode.dev/" />
5858
<meta property="twitter:title" content="Phoenix Code | Code Creatively" />
5959
<meta property="twitter:description" content="A text editor designed to make coding as intuitive and fun as playing a video game - specially crafted for web developers, designers, and students." />
6060
<meta property="twitter:image" content="assets/images/socialcard.png" />
@@ -73,10 +73,10 @@
7373
<script>
7474
if(["dev.phcode.dev", "staging.phcode.dev"].includes(location.hostname)
7575
&& localStorage.getItem("devDomainsEnabled") !== "true"){
76-
alert("Hello explorer, you have reached a development version of phcode.dev that is not for general use and could be very unstable." +
76+
alert("Hello explorer, you have reached a development version of Phoenix Code that is not for general use and could be very unstable." +
7777
`\n\nIf you know what you are doing and what to visit the dev site, please go to https://${location.hostname}/devEnable.html to enable dev site and visit again.` +
78-
"\n\nYou will now be redirected to phcode.dev.");
79-
window.location = "https://phcode.dev";
78+
"\n\nYou will now be redirected to web.phcode.dev.");
79+
window.location = "https://web.phcode.dev";
8080
}
8181
if(window.electronAppAPI) {
8282
window.__ELECTRON__ = true;
@@ -446,6 +446,7 @@
446446
'https://phcode.live': true, // phcode prod live preview server
447447
'https://ai-panel-onboarding.phcode.dev': true, // Ai panel onboarding iframes
448448
'https://phcode.dev': true,
449+
'https://web.phcode.dev': true, // prod web
449450
'https://dev.phcode.dev': true,
450451
'https://staging.phcode.dev': true,
451452
'https://create.phcode.dev': true

src/live-preview-loader.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@
9494
'http://127.0.0.1:5000': true, // playwright tests
9595
'https://phcode.live': true, // phcode prod live preview server
9696
'https://phcode.dev': true,
97+
'https://web.phcode.dev': true, // prod web
9798
'https://dev.phcode.dev': true,
9899
'https://staging.phcode.dev': true,
99100
'https://create.phcode.dev': true
100101
};
102+
// this page is always served from the phoenix origin, so trust it whichever domain that is.
103+
// keeps the loader working on any new phoenix host without another edit here.
104+
TRUSTED_ORIGINS[location.origin] = true;
101105
let okMessageTemplate;
102106

103107
function isTrustedURL(url) {

src/loggerSetup.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"phtauri://localhost", // mac or linux desktop
2929
"https://phtauri.localhost", //windows desktop
3030
"https://phcode.dev", // prod
31+
"https://web.phcode.dev", // prod web
3132
"https://create.phcode.dev", // extension authoring prod
3233
"https://dev.phcode.dev", // dev url
3334
"https://staging.phcode.dev" // staging url
@@ -236,8 +237,8 @@
236237
function _isSafePathForLogging(pathText) {
237238
const lower = pathText.toLowerCase();
238239
const safeStarts = ["phtauri://", "https://phtauri.localhost", "http://localhost",
239-
"https://localhost", "https://phcode.dev", "https://create.phcode.dev",
240-
"https://dev.phcode.dev", "https://staging.phcode.dev",
240+
"https://localhost", "https://phcode.dev", "https://web.phcode.dev",
241+
"https://create.phcode.dev", "https://dev.phcode.dev", "https://staging.phcode.dev",
241242
"/usr/", "/lib/", "/lib64/", "/opt/", "/snap/", "/bin/", "/sbin/", "/etc/",
242243
"/system/", "/applications/", "c:\\program files", "c:\\windows"];
243244
for(let prefix of safeStarts){

src/robots.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Disallow: /assets/
3737
Disallow: /test/
3838

3939
# XML sitemaps
40-
Sitemap: https://phcode.dev/sitemap-phcode.xml
40+
Sitemap: https://web.phcode.dev/sitemap-phcode.xml
4141
Sitemap: https://sitemaps.phcode.io/sitemap-phcode.xml
4242

4343
# more sitemap urls can be given here, but just 1 for now.

src/sitemap-phcode.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
33
<!-- Please also modify the file at sitemaps.phcode.io/sitemap-phcode.xml if modifying this file-->
44
<url>
5-
<loc>https://phcode.dev/download/</loc>
5+
<loc>https://web.phcode.dev/download/</loc>
66
<changefreq>daily</changefreq>
77
</url>
88
<url>
99
<loc>https://phcode.io/</loc>
1010
<changefreq>daily</changefreq>
1111
</url>
1212
<url>
13-
<loc>https://phcode.dev/</loc>
13+
<loc>https://web.phcode.dev/</loc>
1414
<changefreq>daily</changefreq>
1515
</url>
1616
<url>

test/SpecRunner.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
'https://phcode.live': true, // phcode prod live preview server
364364
'https://ai-panel-onboarding.phcode.dev': true, // Ai panel onboarding iframes
365365
'https://phcode.dev': true,
366+
'https://web.phcode.dev': true, // prod web
366367
'https://dev.phcode.dev': true,
367368
'https://staging.phcode.dev': true,
368369
'https://create.phcode.dev': true

0 commit comments

Comments
 (0)