mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-05-04 13:24:36 -04:00
Refactor (#541)
This commit is contained in:
@@ -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 }}"
|
||||
|
||||
@@ -138,7 +138,7 @@ const CredentialsList: React.FC = () => {
|
||||
</div>
|
||||
|
||||
{credentials.length > 0 ? (
|
||||
<input
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search credentials..."
|
||||
value={searchTerm}
|
||||
|
||||
@@ -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 navigation
|
||||
|
||||
@@ -93,6 +93,9 @@ const Settings: React.FC = () => {
|
||||
}));
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggle global popup.
|
||||
*/
|
||||
const toggleGlobalPopup = async () : Promise<void> => {
|
||||
const newGloballyEnabled = !settings.isGloballyEnabled;
|
||||
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -33,14 +33,15 @@ public static class AppInfo
|
||||
public 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.
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user