castle-web-cli 0.4.145 → 0.4.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.d.ts CHANGED
@@ -21,6 +21,7 @@ export interface MeProfile {
21
21
  userId: string;
22
22
  username: string;
23
23
  isAnonymous: boolean;
24
+ isAdmin: boolean;
24
25
  photo?: {
25
26
  url?: string;
26
27
  } | null;
package/dist/api.js CHANGED
@@ -58,7 +58,7 @@ export async function pollForCLILogin(pollToken) {
58
58
  }
59
59
  export async function me() {
60
60
  try {
61
- const data = await graphql(`query { me { userId username isAnonymous photo { url } photoFrame { frameUrl } } }`);
61
+ const data = await graphql(`query { me { userId username isAnonymous isAdmin photo { url } photoFrame { frameUrl } } }`);
62
62
  return pickData(data, 'me');
63
63
  }
64
64
  catch {
package/dist/serve.js CHANGED
@@ -234,7 +234,9 @@ function castlePlugin(security, ideServer, agentServer, configuredHost) {
234
234
  return html.replace(/<head(\s[^>]*)?>/i, (match) => `${match}${favicon}\n <script>
235
235
  window.CastleEmbed={edit:true,host:'dev'};
236
236
  window.__castleShellOrigin=(function(){
237
- var h=location.hostname.toLowerCase(),m=/^1[ep]([0-9a-z]{1,4})-([a-z0-9]{14})-/.exec(h);
237
+ var h=location.hostname.toLowerCase();
238
+ if(h.endsWith('.sandboxes.castle.xyz')||h.endsWith('.sandboxes-staging.castle.xyz'))return location.origin;
239
+ var m=/^1[ep]([0-9a-z]{1,4})-([a-z0-9]{14})-/.exec(h);
238
240
  if(!m)return null;
239
241
  var p=parseInt(m[1],36),sid=m[2];
240
242
  if(h.endsWith('.sandboxes-staging.castlexyz.com'))return 'https://'+p+'-'+sid+'.sandboxes-staging.castle.xyz';
@@ -135,6 +135,15 @@ window.fetch=function(input,init){
135
135
  contentOrigins(req) {
136
136
  const host = hostWithoutPort(req.headers.host || 'localhost');
137
137
  const cloud = host.match(/^\d+-([a-z0-9]{14})\.(sandboxes(?:-staging)?\.castle\.xyz)$/);
138
+ // Compatibility rollback: the released iOS WebView only permits castle.xyz
139
+ // origins, so a sandboxes.castlexyz.com iframe is rejected before the deck
140
+ // can load. Keep the isolated-origin implementation available for explicit
141
+ // staging/device testing, but make ordinary cloud images use the existing
142
+ // shell origin until a compatible native release is in production.
143
+ if (cloud && process.env.CASTLE_ISOLATED_CONTENT_ORIGINS !== '1') {
144
+ const origin = requestOrigin(req);
145
+ return { editOrigin: origin, playOrigin: origin };
146
+ }
138
147
  const sandboxId = cloud?.[1] || 'localdev000000';
139
148
  const contentHeader = req.headers['x-castle-content-domain'];
140
149
  const contentDomain = typeof contentHeader === 'string' &&