-
Notifications
You must be signed in to change notification settings - Fork 0
v2.3.1 #105
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
v2.3.1 #105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,24 +56,40 @@ const DomainSettings: React.FC = () => { | |
| const loadDomainConfig = async () => { | ||
| try { | ||
| const response = await apiFetch('/v1/panel/settings/domain'); | ||
| if (response.ok) { | ||
| const data = await response.json(); | ||
| if (data.customDomain) { | ||
| setCustomDomain(data.customDomain); | ||
| setDomainStatus(data.status); | ||
| } | ||
| setAccessingFromCustomDomain(data.accessingFromCustomDomain || false); | ||
| setModlSubdomainUrl(data.modlSubdomainUrl || ''); | ||
| setCanManageCustomDomain(Boolean(data.canManageCustomDomain)); | ||
| if (!response.ok) { | ||
| toast({ | ||
| title: t('toast.error'), | ||
| description: t('settings.domain.loadFailed'), | ||
| variant: "destructive", | ||
| }); | ||
| return; | ||
| } | ||
| const data = await response.json(); | ||
| if (data.customDomain) { | ||
| setCustomDomain(data.customDomain); | ||
| setDomainStatus(data.status); | ||
| } | ||
| setAccessingFromCustomDomain(data.accessingFromCustomDomain || false); | ||
| setModlSubdomainUrl(data.modlSubdomainUrl || ''); | ||
| setCanManageCustomDomain(Boolean(data.canManageCustomDomain)); | ||
| } catch (error) { | ||
| // Domain configuration may not exist yet | ||
| toast({ | ||
| title: t('toast.error'), | ||
| description: t('settings.domain.loadFailed'), | ||
| variant: "destructive", | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| const validateDomain = (domain: string): boolean => { | ||
| const domainRegex = /^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](?:\.[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])*$/; | ||
| return domainRegex.test(domain) && domain.length <= 253; | ||
| const normalized = domain.trim(); | ||
| if (normalized.length === 0 || normalized.length > 253) { | ||
| return false; | ||
| } | ||
| if (!normalized.includes('.')) { | ||
| return false; | ||
| } | ||
| return !/\s/.test(normalized); | ||
| }; | ||
|
Comment on lines
84
to
93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new validation accepts any dotted, whitespace-free string, including invalid hostnames such as Rule Used: This is a React frontend project on React 19 with ... (source) Prompt To Fix With AIThis is a comment left during a code review.
Path: client/src/components/settings/DomainSettings.tsx
Line: 84-93
Comment:
**Domain validation accepts malformed hosts**
The new validation accepts any dotted, whitespace-free string, including invalid hostnames such as `a..b`, `a_.example.com`, and `-panel.example.com`, so these values produce unnecessary configuration requests and defer basic validation to the API or DNS provider.
**Rule Used:** This is a React frontend project on React 19 with ... ([source](https://app.greptile.com/modl-gg/-/custom-context?memory=b7532101-0c9e-4ab6-b168-353a105ba593))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||
|
|
||
| const handleDomainSubmit = async () => { | ||
|
|
@@ -104,15 +120,6 @@ const DomainSettings: React.FC = () => { | |
| return; | ||
| } | ||
|
|
||
| if (domainStatus?.domain && domainStatus.domain.toLowerCase() === customDomain.trim().toLowerCase()) { | ||
| toast({ | ||
| title: t('settings.domain.alreadyConfigured'), | ||
| description: t('settings.domain.alreadyConfiguredDesc'), | ||
| variant: "destructive", | ||
| }); | ||
| return; | ||
| } | ||
|
|
||
| setIsLoading(true); | ||
| try { | ||
| const response = await apiFetch('/v1/panel/settings/domain', { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user selects the new pretty-date option, profile autosave submits
MMM D, YYYY, but the backend allowlist accepts only the three legacy formats, so the displayed selection is not persisted and reverts after the profile is refreshed.Context Used: Ensure all code meets SOLID, DRY, and KISS softwar... (source)
Artifacts
Repro: executable focused client-to-backend persistence contract harness
Repro: before-change legacy selection PATCH and profile reload responses
Repro: after-change pretty selection PATCH and reverted profile reload responses
Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!