mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix: resolve SonarQube findings and Next.js Image warnings
SonarQube/SonarLint fixes:
- Remove unused imports (useMemo, PROVIDER_ENDPOINTS, updateSettings, APP_CONFIG)
- Add PropTypes validation to all components receiving props
- Fix accessibility issues (semantic buttons, ARIA attributes, form labels)
- Replace array index keys with stable identifiers
- Extract duplicate getStatusDisplay function in providers page
- Fix negated conditions for better readability
- Add node: prefix to Node.js imports in localDb.js
- Fix optional chaining in pricing lookup
- Add explanatory comments to empty catch blocks
- Consolidate duplicate OAuth flow branches
- Change parseInt to Number.parseInt
- Disable false positive rules in VS Code settings
Next.js Image fixes:
- Add style={{ width: "auto", height: "auto" }} to all Image components
- Resolves aspect ratio warnings without triggering lint issues
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
decolua
co-authored by
Claude Opus 4.5
parent
d9b8e48725
commit
7058b062e7
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect, useRef, useCallback } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Modal, Button, Input } from "@/shared/components";
|
||||
import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard";
|
||||
|
||||
@@ -151,12 +152,12 @@ export default function OAuthModal({ isOpen, provider, providerInfo, onSuccess,
|
||||
|
||||
setAuthData({ ...data, redirectUri });
|
||||
|
||||
// For Codex, always use manual input since it requires fixed port 1455
|
||||
if (provider === "codex") {
|
||||
// For Codex or non-localhost: use manual input mode
|
||||
if (provider === "codex" || !isLocalhost) {
|
||||
setStep("input");
|
||||
window.open(data.authUrl, "_blank");
|
||||
} else if (isLocalhost) {
|
||||
// Other providers on localhost: Open popup and wait for message
|
||||
} else {
|
||||
// Localhost (non-Codex): Open popup and wait for message
|
||||
setStep("waiting");
|
||||
popupRef.current = window.open(data.authUrl, "oauth_popup", "width=600,height=700");
|
||||
|
||||
@@ -164,10 +165,6 @@ export default function OAuthModal({ isOpen, provider, providerInfo, onSuccess,
|
||||
if (!popupRef.current) {
|
||||
setStep("input");
|
||||
}
|
||||
} else {
|
||||
// Remote: Show manual input
|
||||
setStep("input");
|
||||
window.open(data.authUrl, "_blank");
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err.message);
|
||||
@@ -256,7 +253,9 @@ export default function OAuthModal({ isOpen, provider, providerInfo, onSuccess,
|
||||
localStorage.removeItem("oauth_callback");
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch {
|
||||
// localStorage may be unavailable or data may be malformed - ignore silently
|
||||
}
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("message", handleMessage);
|
||||
@@ -430,3 +429,13 @@ export default function OAuthModal({ isOpen, provider, providerInfo, onSuccess,
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
OAuthModal.propTypes = {
|
||||
isOpen: PropTypes.bool.isRequired,
|
||||
provider: PropTypes.string,
|
||||
providerInfo: PropTypes.shape({
|
||||
name: PropTypes.string,
|
||||
}),
|
||||
onSuccess: PropTypes.func,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user