@payloadcms/figma 0.0.1-alpha.70 → 0.0.1-alpha.71
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.
|
@@ -86,9 +86,13 @@ export const DefaultLoginButton = ({ disabled, endpointSlug })=>{
|
|
|
86
86
|
// unspoofable) where supported; undefined on browsers that don't implement
|
|
87
87
|
// the non-standard Location.ancestorOrigins (older Firefox, pre-148).
|
|
88
88
|
const ancestorOrigins = window.location.ancestorOrigins;
|
|
89
|
+
// encodeURIComponent is required on Coder devbox: there a proxy hop rewrites
|
|
90
|
+
// an unencoded `serverURL=https://<host>` to http before it reaches the
|
|
91
|
+
// server, which then flows into state.serverURL / the OAuth redirect_uri and
|
|
92
|
+
// breaks login with an https→http navigation. Encoding the `://` avoids it.
|
|
89
93
|
const cleanup = setupIframeAutoLogin({
|
|
90
94
|
doFetch: window.fetch.bind(window),
|
|
91
|
-
metaUrl: `${serverURL}${api}/${userSlug}/${endpointSlug}/meta?serverURL=${window.location.origin}`,
|
|
95
|
+
metaUrl: `${serverURL}${api}/${userSlug}/${endpointSlug}/meta?serverURL=${encodeURIComponent(window.location.origin)}`,
|
|
92
96
|
navigate: (url)=>{
|
|
93
97
|
window.location.href = url;
|
|
94
98
|
},
|
|
@@ -130,7 +134,8 @@ export const DefaultLoginButton = ({ disabled, endpointSlug })=>{
|
|
|
130
134
|
return;
|
|
131
135
|
}
|
|
132
136
|
const getAuthorizeURL = async ()=>{
|
|
133
|
-
|
|
137
|
+
// Encoded for the same reason as the auto-login metaUrl above.
|
|
138
|
+
const serverURLFromWindow = encodeURIComponent(window.location.origin);
|
|
134
139
|
const data = await fetch(`${serverURL}${api}/${userSlug}/${endpointSlug}/meta?serverURL=${serverURLFromWindow}`).then((res)=>res.json());
|
|
135
140
|
setAuthorizeURL(data.authorizeURL);
|
|
136
141
|
};
|
|
@@ -45,7 +45,7 @@ export const LogoutButton = ({ disabled, endpointSlug })=>{
|
|
|
45
45
|
className: baseClass,
|
|
46
46
|
children: /*#__PURE__*/ _jsx("a", {
|
|
47
47
|
"aria-label": "Logout",
|
|
48
|
-
href: `${serverURL}${api}/${userSlug}/${endpointSlug}/logout?redirect=${redirect}`,
|
|
48
|
+
href: `${serverURL}${api}/${userSlug}/${endpointSlug}/logout?redirect=${encodeURIComponent(redirect)}`,
|
|
49
49
|
children: /*#__PURE__*/ _jsxs("svg", {
|
|
50
50
|
className: "icon icon--logout",
|
|
51
51
|
fill: "none",
|