Highly ambitious ATProtocol AppView service and sdks

fix mixed content errors when wrapping urls with URL constructor

Changed files
+18 -29
frontend-v2
server
+18 -29
frontend-v2/server/routes.ts
··· 44 44 console.error("OAuth authorize error:", error); 45 45 46 46 return Response.redirect( 47 - new URL( 48 - "/login?error=" + 49 - encodeURIComponent("Please check your handle and try again."), 50 - req.url, 51 - ), 47 + "/login?error=" + 48 + encodeURIComponent("Please check your handle and try again."), 52 49 302, 53 50 ); 54 51 } ··· 78 75 79 76 if (!code || !state) { 80 77 return Response.redirect( 81 - new URL( 82 - "/login?error=" + encodeURIComponent("Invalid OAuth callback"), 83 - req.url, 84 - ), 78 + "/login?error=" + encodeURIComponent("Invalid OAuth callback"), 85 79 302, 86 80 ); 87 81 } ··· 92 86 93 87 if (!sessionId) { 94 88 return Response.redirect( 95 - new URL( 96 - "/login?error=" + encodeURIComponent("Failed to create session"), 97 - req.url, 98 - ), 89 + "/login?error=" + encodeURIComponent("Failed to create session"), 99 90 302, 100 91 ); 101 92 } ··· 121 112 ? "already_on_waitlist" 122 113 : "invite_required"; 123 114 return Response.redirect( 124 - new URL(`/waitlist?error=${errorCode}`, req.url), 115 + `/waitlist?error=${errorCode}`, 125 116 302, 126 117 ); 127 118 } ··· 140 131 return new Response(null, { 141 132 status: 302, 142 133 headers: { 143 - Location: new URL("/", req.url).toString(), 134 + Location: "/", 144 135 "Set-Cookie": sessionCookie, 145 136 }, 146 137 }); 147 138 } catch (error) { 148 139 console.error("OAuth callback error:", error); 149 140 return Response.redirect( 150 - new URL( 151 - "/login?error=" + encodeURIComponent("Authentication failed"), 152 - req.url, 153 - ), 141 + "/login?error=" + encodeURIComponent("Authentication failed"), 154 142 302, 155 143 ); 156 144 } ··· 168 156 return new Response(null, { 169 157 status: 302, 170 158 headers: { 171 - Location: new URL("/login", req.url).toString(), 159 + Location: "/login", 172 160 "Set-Cookie": clearCookie, 173 161 }, 174 162 }); ··· 210 198 } catch (error) { 211 199 console.error("Waitlist initiate error:", error); 212 200 return Response.redirect( 213 - new URL("/waitlist?error=authorization_failed", req.url), 201 + "/waitlist?error=authorization_failed", 214 202 302, 215 203 ); 216 204 } ··· 224 212 225 213 if (!code || !state) { 226 214 return Response.redirect( 227 - new URL("/waitlist?error=invalid_callback", req.url), 215 + "/waitlist?error=invalid_callback", 228 216 302, 229 217 ); 230 218 } ··· 260 248 261 249 if (!userInfo) { 262 250 return Response.redirect( 263 - new URL("/waitlist?error=no_user_info", req.url), 251 + "/waitlist?error=no_user_info", 264 252 302, 265 253 ); 266 254 } ··· 270 258 if (!sliceUri) { 271 259 console.error("Missing VITE_SLICE_URI environment variable"); 272 260 return Response.redirect( 273 - new URL("/waitlist?error=waitlist_failed", req.url), 261 + "/waitlist?error=waitlist_failed", 274 262 302, 275 263 ); 276 264 } ··· 358 346 359 347 // Redirect back to waitlist page with success parameter 360 348 const handle = userInfo.name || waitlistData.handle || "user"; 361 - const redirectUrl = new URL("/waitlist", req.url); 362 - redirectUrl.searchParams.set("waitlist", "success"); 363 - redirectUrl.searchParams.set("handle", handle); 364 - return Response.redirect(redirectUrl.toString(), 302); 349 + const params = new URLSearchParams({ 350 + waitlist: "success", 351 + handle, 352 + }); 353 + return Response.redirect(`/waitlist?${params.toString()}`, 302); 365 354 } catch (error) { 366 355 console.error("Waitlist callback error:", error); 367 356 return Response.redirect( 368 - new URL("/waitlist?error=waitlist_failed", req.url), 357 + "/waitlist?error=waitlist_failed", 369 358 302, 370 359 ); 371 360 }