Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor (#541)
Leendert de Borst887e91f4c681
diff --git a/.github/workflows/sonarcloud-code-analysis.yml b/.github/workflows/sonarcloud-code-analysis.ymlindex 623367a3e..f3daef115 100644--- a/.github/workflows/sonarcloud-code-analysis.yml+++ b/.github/workflows/sonarcloud-code-analysis.yml@@ -63,10 +63,10 @@ jobs:shell: powershellrun: |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 builddotnet 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.tsxindex 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 = () => {</div>{credentials.length > 0 ? (- <input+ <inputtype="text"placeholder="Search credentials..."value={searchTerm}diff --git a/browser-extensions/chrome/src/app/pages/EmailDetails.tsx b/browser-extensions/chrome/src/app/pages/EmailDetails.tsxindex bf728cc0d..87abb7b0a 100644--- a/browser-extensions/chrome/src/app/pages/EmailDetails.tsx+++ b/browser-extensions/chrome/src/app/pages/EmailDetails.tsx@@ -25,11 +25,11 @@ const EmailDetails: React.FC = () => {/*** 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 navigationdiff --git a/browser-extensions/chrome/src/app/pages/Settings.tsx b/browser-extensions/chrome/src/app/pages/Settings.tsxindex 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<void> => {const newGloballyEnabled = !settings.isGloballyEnabled;diff --git a/browser-extensions/chrome/src/contentScript/Form.ts b/browser-extensions/chrome/src/contentScript/Form.tsindex 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 iconicon.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.tsindex 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 bytesconst 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 sourcediff --git a/src/Shared/AliasVault.Shared.Core/AppInfo.cs b/src/Shared/AliasVault.Shared.Core/AppInfo.csindex 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 AppInfopublic const int VersionPatch = 1;/// <summary>- /// 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./// </summary>- public static readonly Dictionary<string, string> MinimumClientVersions = new()+ public static IReadOnlyDictionary<string, string> MinimumClientVersions { get; } = new Dictionary<string, string>{{ "chrome", "0.12.0" },{ "web", "0.12.0" },- };+ }.AsReadOnly();/// <summary>/// 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.csindex 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");+ });}}