@@ -25,7 +25,6 @@ import OperatorModeContainer from '@cardstack/host/components/operator-mode/cont
25
25
26
26
import Preview from ' @cardstack/host/components/preview' ;
27
27
import { Submodes } from ' @cardstack/host/components/submode-switcher' ;
28
- import ENV from ' @cardstack/host/config/environment' ;
29
28
30
29
import CardController from ' @cardstack/host/controllers/card' ;
31
30
@@ -39,6 +38,7 @@ import MessageService from '@cardstack/host/services/message-service';
39
38
import OperatorModeStateService , {
40
39
SerializedState as OperatorModeSerializedState ,
41
40
} from ' @cardstack/host/services/operator-mode-state-service' ;
41
+ import Realm from ' @cardstack/host/services/realm' ;
42
42
import RealmInfoService from ' @cardstack/host/services/realm-info-service' ;
43
43
44
44
import type { CardDef } from ' https://cardstack.com/base/card-api' ;
@@ -56,7 +56,7 @@ interface CardRouteSignature {
56
56
model: CardModel | null ;
57
57
};
58
58
}
59
- const { ownRealmURL } = ENV ;
59
+
60
60
@keyResponder
61
61
class CardRouteComponent extends Component <CardRouteSignature > {
62
62
isolatedCardComponent: ComponentLike | undefined ;
@@ -66,6 +66,7 @@ class CardRouteComponent extends Component<CardRouteSignature> {
66
66
@service declare router: RouterService ;
67
67
@service declare operatorModeStateService: OperatorModeStateService ;
68
68
@service declare messageService: MessageService ;
69
+ @service declare realm: Realm ;
69
70
@service declare realmInfoService: RealmInfoService ;
70
71
71
72
constructor (owner : Owner , args : CardRouteSignature [' Args' ]) {
@@ -128,7 +129,7 @@ class CardRouteComponent extends Component<CardRouteSignature> {
128
129
// Users are not allowed to open guest mode
129
130
// if realm is not publicly readable
130
131
let isPublicReadableRealm = await this .realmInfoService .isPublicReadable (
131
- new URL (ownRealmURL ),
132
+ new URL (this . realm . userDefaultRealm . path ),
132
133
);
133
134
if (! isPublicReadableRealm && this .args .controller .operatorModeEnabled ) {
134
135
return ;
@@ -169,7 +170,9 @@ class CardRouteComponent extends Component<CardRouteSignature> {
169
170
private fetchIsPublicReadableStatus = trackedFunction (
170
171
this ,
171
172
async () =>
172
- await this .realmInfoService .isPublicReadable (new URL (ownRealmURL )),
173
+ await this .realmInfoService .isPublicReadable (
174
+ new URL (this .realm .userDefaultRealm .path ),
175
+ ),
173
176
);
174
177
175
178
<template >
0 commit comments