diff --git a/.github/workflows/sonarcloud-code-analysis.yml b/.github/workflows/sonarcloud-code-analysis.yml index 623367a3e..f3daef115 100644 --- a/.github/workflows/sonarcloud-code-analysis.yml +++ b/.github/workflows/sonarcloud-code-analysis.yml @@ -63,10 +63,10 @@ jobs: shell: powershell run: | if ('${{ github.event_name }}' -eq 'pull_request_target') { - .\.sonar\scanner\dotnet-sonarscanner begin /k:"lanedirt_AliasVault" /o:"lanedirt" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.pullrequest.key=${{ github.event.pull_request.number }} /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.coverage.exclusions="**Tests*.cs" + .\.sonar\scanner\dotnet-sonarscanner begin /k:"lanedirt_AliasVault" /o:"lanedirt" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.pullrequest.key=${{ github.event.pull_request.number }} /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.coverage.exclusions="**Tests*.cs" } else { - .\.sonar\scanner\dotnet-sonarscanner begin /k:"lanedirt_AliasVault" /o:"lanedirt" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.coverage.exclusions="**Tests*.cs" + .\.sonar\scanner\dotnet-sonarscanner begin /k:"lanedirt_AliasVault" /o:"lanedirt" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.coverage.exclusions="**Tests*.cs" } dotnet build dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutput=coverage /p:CoverletOutputFormat=opencover --filter 'FullyQualifiedName!~AliasVault.E2ETests' - .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" diff --git a/browser-extensions/chrome/src/app/pages/CredentialsList.tsx b/browser-extensions/chrome/src/app/pages/CredentialsList.tsx index 892104205..89a1d5a1c 100644 --- a/browser-extensions/chrome/src/app/pages/CredentialsList.tsx +++ b/browser-extensions/chrome/src/app/pages/CredentialsList.tsx @@ -138,7 +138,7 @@ const CredentialsList: React.FC = () => { {credentials.length > 0 ? ( - { /** * Make sure the initial loading state is set to false when this component is loaded itself. */ - useEffect(() => { - if (!isLoading) { - setIsInitialLoading(false); - } - }, [setIsInitialLoading, isLoading]); + useEffect(() => { + if (!isLoading) { + setIsInitialLoading(false); + } + }, [setIsInitialLoading, isLoading]); useEffect(() => { // For popup windows, ensure we have proper history state for navigation diff --git a/browser-extensions/chrome/src/app/pages/Settings.tsx b/browser-extensions/chrome/src/app/pages/Settings.tsx index 162c8b04b..60c63f1a4 100644 --- a/browser-extensions/chrome/src/app/pages/Settings.tsx +++ b/browser-extensions/chrome/src/app/pages/Settings.tsx @@ -93,6 +93,9 @@ const Settings: React.FC = () => { })); }; + /** + * Toggle global popup. + */ const toggleGlobalPopup = async () : Promise => { const newGloballyEnabled = !settings.isGloballyEnabled; diff --git a/browser-extensions/chrome/src/contentScript/Form.ts b/browser-extensions/chrome/src/contentScript/Form.ts index b6ae6b9e5..2b6150daf 100644 --- a/browser-extensions/chrome/src/contentScript/Form.ts +++ b/browser-extensions/chrome/src/contentScript/Form.ts @@ -256,8 +256,10 @@ export function injectIcon(input: HTMLInputElement): void { // Enable pointer events just for the icon icon.style.pointerEvents = 'auto'; - // Function to update icon position - const updateIconPosition = () => { + /** + * Update position of the icon. + */ + const updateIconPosition = () : void => { const rect = input.getBoundingClientRect(); icon.style.position = 'fixed'; icon.style.top = `${rect.top + (rect.height - 24) / 2}px`; @@ -285,7 +287,9 @@ export function injectIcon(input: HTMLInputElement): void { icon.style.opacity = '1'; }); - // Remove the icon when the input loses focus + /** + * Remove the icon when the input loses focus. + */ const handleBlur = (): void => { icon.style.opacity = '0'; setTimeout(() => { diff --git a/browser-extensions/chrome/src/contentScript/Popup.ts b/browser-extensions/chrome/src/contentScript/Popup.ts index 6e7753034..a1d927624 100644 --- a/browser-extensions/chrome/src/contentScript/Popup.ts +++ b/browser-extensions/chrome/src/contentScript/Popup.ts @@ -273,7 +273,9 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden // Extract favicon from page and get the bytes const faviconBytes = await getFaviconBytes(document); - // Take URL from current page but without querystring params, validating the URL + /** + * Get a valid service URL from the current page. + */ const getValidServiceUrl = (): string | null => { try { // Check if we're in an iframe with invalid/null source diff --git a/src/Shared/AliasVault.Shared.Core/AppInfo.cs b/src/Shared/AliasVault.Shared.Core/AppInfo.cs index 66427d1f4..8361817a1 100644 --- a/src/Shared/AliasVault.Shared.Core/AppInfo.cs +++ b/src/Shared/AliasVault.Shared.Core/AppInfo.cs @@ -33,14 +33,15 @@ public static class AppInfo public const int VersionPatch = 1; /// - /// List of minimum supported client versions. If client version is lower than the minimum supported version, - /// the client will be shown a message to update to the minimum supported version. + /// Gets a dictionary of minimum supported client versions that the WebApi supports. + /// If client version is lower than the minimum supported version, the client will show a message + /// to update to the minimum supported version. /// - public static readonly Dictionary MinimumClientVersions = new() + public static IReadOnlyDictionary MinimumClientVersions { get; } = new Dictionary { { "chrome", "0.12.0" }, { "web", "0.12.0" }, - }; + }.AsReadOnly(); /// /// Gets the build number, typically used in CI/CD pipelines. diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiTests.cs index 65d848ef9..a31dd7e62 100644 --- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiTests.cs +++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiTests.cs @@ -79,8 +79,11 @@ public class ApiTests : ClientPlaywrightTest .FirstOrDefaultAsync(x => x.Id == refreshToken.Id); // Assert dates match up to the minute (ignoring seconds and milliseconds) - Assert.That(retrievedToken, Is.Not.Null, "Refresh token not found in database"); - Assert.That(retrievedToken.ExpireDate.ToString("yyyy-MM-dd HH:mm"), Is.EqualTo(testDate.ToString("yyyy-MM-dd HH:mm")), "ExpireDate was modified during storage/retrieval"); - Assert.That(retrievedToken.CreatedAt.ToString("yyyy-MM-dd HH:mm"), Is.EqualTo(testDate.ToString("yyyy-MM-dd HH:mm")), "CreatedAt was modified during storage/retrieval"); + Assert.Multiple(() => + { + Assert.That(retrievedToken, Is.Not.Null, "Refresh token not found in database"); + Assert.That(retrievedToken?.ExpireDate.ToString("yyyy-MM-dd HH:mm"), Is.EqualTo(testDate.ToString("yyyy-MM-dd HH:mm")), "ExpireDate was modified during storage/retrieval"); + Assert.That(retrievedToken?.CreatedAt.ToString("yyyy-MM-dd HH:mm"), Is.EqualTo(testDate.ToString("yyyy-MM-dd HH:mm")), "CreatedAt was modified during storage/retrieval"); + }); } }