propro-utils 1.6.4 → 1.6.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -101,7 +101,17 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
101
101
  // Domain configuration
102
102
  let domain;
103
103
  try {
104
- domain = appUrl ? new URL(appUrl).hostname : undefined;
104
+ // Handle URLs that don't include the protocol
105
+ let processedAppUrl = appUrl;
106
+ if (
107
+ appUrl &&
108
+ !appUrl.startsWith("http://") &&
109
+ !appUrl.startsWith("https://")
110
+ ) {
111
+ processedAppUrl = `https://${appUrl}`;
112
+ }
113
+
114
+ domain = processedAppUrl ? new URL(processedAppUrl).hostname : undefined;
105
115
  if (domain?.includes("mapmap.app")) {
106
116
  domain = ".mapmap.app";
107
117
  }
@@ -211,7 +221,17 @@ const setAuthCookies = async (res, tokens, account, user, appUrl) => {
211
221
  const clearAuthCookies = async (res, appUrl) => {
212
222
  let domain;
213
223
  try {
214
- domain = appUrl ? new URL(appUrl).hostname : undefined;
224
+ // Handle URLs that don't include the protocol
225
+ let processedAppUrl = appUrl;
226
+ if (
227
+ appUrl &&
228
+ !appUrl.startsWith("http://") &&
229
+ !appUrl.startsWith("https://")
230
+ ) {
231
+ processedAppUrl = `https://${appUrl}`;
232
+ }
233
+
234
+ domain = processedAppUrl ? new URL(processedAppUrl).hostname : undefined;
215
235
  if (domain?.includes("mapmap.app")) {
216
236
  domain = ".mapmap.app";
217
237
  }