-
Notifications
You must be signed in to change notification settings - Fork 91
Document TanStack migration and drop legacy Next.js app routes #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedToo many files! 77 files out of 227 files are above the max files limit of 150. You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Too many files changed for review. ( |
| return { status: "invalid", message }; | ||
| } | ||
|
|
||
| if (normalizedUrl.includes("orlandosentinel.com")) { |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
orlandosentinel.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 8 days ago
In general, instead of using String.prototype.includes on the entire URL, we should parse the URL, extract its hostname, and then compare that hostname against an explicit rule: either an exact-match list or a clear “domain + subdomains” check. This avoids being fooled by the same substring appearing in the path, query, or as part of another hostname.
For this concrete code, the best minimally invasive fix is:
- Parse
normalizedUrlusing the standardURLclass, which is available in modern browsers and Node, to geturl.hostname. - Decide what to block. A reasonable interpretation is “block
orlandosentinel.comand any of its subdomains.” That can be implemented by checking:hostname === "orlandosentinel.com"(exact domain), orhostname.endsWith(".orlandosentinel.com")(subdomains, likewww.orlandosentinel.com).
- Replace the substring check on
normalizedUrlwith a hostname-based check.
Concretely, in src/routes/shared/proxy-route.tsx, around line 138:
- Introduce a
URLinstance:const url = new URL(normalizedUrl); - Extract the hostname:
const hostname = url.hostname; - Replace
if (normalizedUrl.includes("orlandosentinel.com"))with a condition onhostnameas described above. - Wrap the parsing in a
try/catchblock to avoid runtime errors ifnormalizeUrlever produced an invalid URL (defensive coding). If parsing fails, we can conservatively not block for this specific reason and let the rest of the loader logic handle the error state as it already does for invalid URLs; since we’ve just passednormalizeUrl, parse failures should be rare.
No new imports are needed because URL is a built-in global. Existing functionality is preserved: URLs that truly point to orlandosentinel.com or its subdomains remain blocked, while unrelated URLs that only contain that substring in non-host components are no longer blocked.
-
Copy modified lines R138-R146
| @@ -135,8 +135,15 @@ | ||
| return { status: "invalid", message }; | ||
| } | ||
|
|
||
| if (normalizedUrl.includes("orlandosentinel.com")) { | ||
| return { status: "blocked" }; | ||
| try { | ||
| const url = new URL(normalizedUrl); | ||
| const hostname = url.hostname; | ||
|
|
||
| if (hostname === "orlandosentinel.com" || hostname.endsWith(".orlandosentinel.com")) { | ||
| return { status: "blocked" }; | ||
| } | ||
| } catch { | ||
| // If parsing fails here, fall through and let later logic handle the URL. | ||
| } | ||
|
|
||
| const metadata = (await fetchArticleMetadata(normalizedUrl)) ?? buildFallbackMetadata(normalizedUrl); |
- Replace `.cursor/rules` content with a TanStack Start migration guide - Document recent fixes: router/i18n migrations, image and link updates - Remove obsolete Next.js `app/` directory pages superseded by TanStack - Fix all ESLint errors properly (nullish coalescing, type safety, etc.) - Fix conditional React Hook call in i18n/navigation.tsx - Update tsconfig to include config files and Node types - Add underscore pattern to @typescript-eslint/no-unused-vars rule Co-Authored-By: Claude Opus 4.5 <[email protected]>
f3bb782 to
9eac0e2
Compare
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary
.cursor/rulescontent with a TanStack Start migration guide and changelogapp/directory pages and layouts now superseded by TanStack Start routingTest plan
bun run build🤖 Generated with Claude Code