Closed moshetanzer closed 4 months ago
The recent updates focus on streamlining domain validation and navigation across the server-side API and the client-side Vue application. The changes aim to enhance user experience by ensuring proper domain handling and improving code readability and maintainability.
File Path | Change Summary |
---|---|
app.vue |
Updated to handle domain validation and navigation based on import.meta.server and import.meta.client . Modified template structure for better styling and layout. Adjusted text content for Lighthouse APIs. |
server/api/crux/[domain].get.ts server/api/run/[domain].get.ts |
Refactored domain validation logic to a separate function validateDomain for better clarity and maintainability. Updated API logic to call validateDomain for domain validation before processing. |
server/utils/redirect.ts |
Introduced redirect.ts with validateDomain function for comprehensive domain validation, including checking invalid characters and handling redirects. Returns the validated domain or host. |
π°β¨
In the code where bits do play,
A rabbit hopped and found its way.
"Let's validate domains," it said,
And in the logic, new paths were led.
With each change, and every line,
It made the web a place so fine.
π₯π
server/utils/redirect.ts (1)
`3-21`: Ensure efficient handling of domain validations, especially in high-traffic scenarios. Consider implementing caching mechanisms or other optimizations to reduce the overhead of network requests in the `validateDomain` function.server/api/run/[domain].get.ts (1)
`2-9`: Centralization of domain validation logic enhances maintainability. Good job on centralizing the domain validation logic in the `validateDomain` function. This change improves code readability and maintainability.server/api/crux/[domain].get.ts (1)
`1-7`: > :memo: **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [4-20] Centralization of domain validation logic enhances maintainability. Good job on centralizing the domain validation logic in the `validateDomain` function. This change improves code readability and maintainability.app.vue (1)
`32-44`: Efficient handling of domain redirections enhances user experience. Good job on handling domain redirections efficiently in the Vue component. This change improves user experience by ensuring that users are navigated to the validated domain.
@danielroe any thoughts on this?
Thank you so much! :heart:
I made a few changes but maybe you have some ideas to improve further π
Hi @danielroe
Good to see meet you around here againπ. Will take a look - haven't managed to look at changes yet. Think biggest thing will be to speed up time to lighthouse test when no crux - seem to be significantly slower on a brief test on phone.
Hi @danielroe,
Intrested to get some good criticism and feedback.
To me biggest issue is that we shouldn't be checking domain redirect twice π. (We can't move to front end because of cors, if was a way to implement in middleware would run twice I think π€..) and making it into a function.
Also think we might need to update cache to be more efficient (in case where there is redirect).
Also, couldn't get it to work with $fetch, doesn't seem like it returns redirect like fetch - should I open an issue on ofetch - or is this on purpose. Could have done a manual if..else to check if final url was equal to inputted, though this was a better option.
Not sure if you want to put the redirect message at the bottom with other info (else we need to move it closer to input field, didnt want to start adding slots in domain form or negative margins).
resolves https://github.com/danielroe/page-speed.dev/issues/9 Thanks for your work!
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Improvements