Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update API and admin apps to be able to run under subdirectories (#364)

Leendert de Borst2545e1204fde
diff --git a/.github/workflows/docker-compose-build.yml b/.github/workflows/docker-compose-build.yml
index 5c92d0d32..8f81ebe32 100644
--- a/.github/workflows/docker-compose-build.yml
+++ b/.github/workflows/docker-compose-build.yml
@@ -40,35 +40,35 @@ jobs:
command: |
http_code=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost:443)
if [ "$http_code" -ne 200 ]; then
- echo "Service did not respond with 200 OK. Check if client app is configured correctly."
+ echo "Service did not respond with 200 OK. Check if client app and/or nginx is configured correctly."
exit 1
else
echo "Service responded with 200 OK"
fi
- - name: Test if localhost:4430 (WebApi) responds
+ - name: Test if localhost:443/api (WebApi) responds
uses: nick-fields/retry@v3
with:
timeout_minutes: 2
max_attempts: 3
command: |
- http_code=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost:4430)
+ http_code=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost:443/api)
if [ "$http_code" -ne 200 ]; then
- echo "Service did not respond with expected 200 OK. Check if WebApi is configured correctly."
+ echo "Service did not respond with expected 200 OK. Check if WebApi and/or nginx is configured correctly."
exit 1
else
echo "Service responded with $http_code"
fi
- - name: Test if localhost:4431 (Admin) responds
+ - name: Test if localhost:443/admin (Admin) responds
uses: nick-fields/retry@v3
with:
timeout_minutes: 2
max_attempts: 3
command: |
- http_code=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost:4431/user/login)
+ http_code=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost:443/admin/user/login)
if [ "$http_code" -ne 200 ]; then
- echo "Service did not respond with expected 200 OK. Check if admin app is configured correctly."
+ echo "Service did not respond with expected 200 OK. Check if admin app and/or nginx is configured correctly."
exit 1
else
echo "Service responded with $http_code"
diff --git a/nginx.conf b/nginx.conf
index 5e798eec6..d6b5c7e0f 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -75,13 +75,11 @@ http {
# API endpoints
location /api {
- rewrite ^/api(.*)$ $1 break;
proxy_pass http://api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Prefix /api;
}
}
}
\ No newline at end of file
diff --git a/src/AliasVault.Api/Controllers/Abstracts/AuthenticatedRequestController.cs b/src/AliasVault.Api/Controllers/Abstracts/AuthenticatedRequestController.cs
index 35d6b0f0c..904057023 100644
--- a/src/AliasVault.Api/Controllers/Abstracts/AuthenticatedRequestController.cs
+++ b/src/AliasVault.Api/Controllers/Abstracts/AuthenticatedRequestController.cs
@@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Mvc;
/// Base controller that concrete controllers can extend from if all requests require authentication.
/// </summary>
/// <param name="userManager">UserManager instance.</param>
-[Route("api/v{version:apiVersion}/[controller]")]
+[Route("v{version:apiVersion}/[controller]")]
[ApiController]
[Authorize]
public abstract class AuthenticatedRequestController(UserManager<AliasVaultUser> userManager) : ControllerBase
diff --git a/src/AliasVault.Api/Controllers/AuthController.cs b/src/AliasVault.Api/Controllers/AuthController.cs
index 8d760285f..731e2d489 100644
--- a/src/AliasVault.Api/Controllers/AuthController.cs
+++ b/src/AliasVault.Api/Controllers/AuthController.cs
@@ -39,7 +39,7 @@ using SecureRemotePassword;
/// <param name="cache">IMemoryCache instance for persisting SRP values during multistep login process.</param>
/// <param name="timeProvider">ITimeProvider instance. This returns the time which can be mutated for testing.</param>
/// <param name="authLoggingService">AuthLoggingService instance. This is used to log auth attempts to the database.</param>
-[Route("api/v{version:apiVersion}/[controller]")]
+[Route("v{version:apiVersion}/[controller]")]
[ApiController]
[ApiVersion("1")]
public class AuthController(IDbContextFactory<AliasServerDbContext> dbContextFactory, UserManager<AliasVaultUser> userManager, SignInManager<AliasVaultUser> signInManager, IConfiguration configuration, IMemoryCache cache, ITimeProvider timeProvider, AuthLoggingService authLoggingService) : ControllerBase
diff --git a/src/AliasVault.Api/Controllers/Security/SecurityController.cs b/src/AliasVault.Api/Controllers/Security/SecurityController.cs
index 316d327a9..8f96db246 100644
--- a/src/AliasVault.Api/Controllers/Security/SecurityController.cs
+++ b/src/AliasVault.Api/Controllers/Security/SecurityController.cs
@@ -21,7 +21,7 @@ using Microsoft.EntityFrameworkCore;
/// </summary>
/// <param name="dbContextFactory">AliasServerDbContext instance.</param>
/// <param name="userManager">UserManager instance.</param>
-[Route("api/v{version:apiVersion}/[controller]")]
+[Route("v{version:apiVersion}/[controller]")]
[ApiController]
[ApiVersion("1")]
public class SecurityController(IDbContextFactory<AliasServerDbContext> dbContextFactory, UserManager<AliasVaultUser> userManager) : AuthenticatedRequestController(userManager)
diff --git a/src/AliasVault.Api/Controllers/Security/TwoFactorAuthController.cs b/src/AliasVault.Api/Controllers/Security/TwoFactorAuthController.cs
index 8e978326e..2921d711b 100644
--- a/src/AliasVault.Api/Controllers/Security/TwoFactorAuthController.cs
+++ b/src/AliasVault.Api/Controllers/Security/TwoFactorAuthController.cs
@@ -24,7 +24,7 @@ using Microsoft.EntityFrameworkCore;
/// <param name="urlEncoder">UrlEncoder instance.</param>
/// <param name="authLoggingService">AuthLoggingService instance. This is used to log auth attempts to the database.</param>
/// <param name="userManager">UserManager instance.</param>
-[Route("api/v{version:apiVersion}/[controller]")]
+[Route("v{version:apiVersion}/[controller]")]
[ApiController]
[ApiVersion("1")]
public class TwoFactorAuthController(IDbContextFactory<AliasServerDbContext> dbContextFactory, UrlEncoder urlEncoder, AuthLoggingService authLoggingService, UserManager<AliasVaultUser> userManager) : AuthenticatedRequestController(userManager)
diff --git a/src/AliasVault.Api/Program.cs b/src/AliasVault.Api/Program.cs
index 0369019d6..ee5721c2d 100644
--- a/src/AliasVault.Api/Program.cs
+++ b/src/AliasVault.Api/Program.cs
@@ -157,6 +157,12 @@ if (app.Environment.IsDevelopment())
app.UseCors("CorsPolicy");
+// If the ASPNETCORE_PATHBASE environment variable is set, use it as the path base
+if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNETCORE_PATHBASE")))
+{
+ app.UsePathBase(Environment.GetEnvironmentVariable("ASPNETCORE_PATHBASE"));
+}
+
app.UseAuthentication();
app.UseAuthorization();
diff --git a/src/AliasVault.Client/Auth/Pages/Login.razor b/src/AliasVault.Client/Auth/Pages/Login.razor
index 1585a60c3..9c3fc623d 100644
--- a/src/AliasVault.Client/Auth/Pages/Login.razor
+++ b/src/AliasVault.Client/Auth/Pages/Login.razor
@@ -207,7 +207,7 @@ else
var username = _loginModel.Username.ToLowerInvariant().Trim();
// Send request to server with username to get server ephemeral public key.
- var result = await Http.PostAsJsonAsync("api/v1/Auth/login", new LoginInitiateRequest(username));
+ var result = await Http.PostAsJsonAsync("v1/Auth/login", new LoginInitiateRequest(username));
var responseContent = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode)
@@ -238,7 +238,7 @@ else
username);
// 4. Client sends proof of session key to server.
- result = await Http.PostAsJsonAsync("api/v1/Auth/validate", new ValidateLoginRequest(username, _loginModel.RememberMe, _clientEphemeral.Public, _clientSession.Proof));
+ result = await Http.PostAsJsonAsync("v1/Auth/validate", new ValidateLoginRequest(username, _loginModel.RememberMe, _clientEphemeral.Public, _clientSession.Proof));
responseContent = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode)
@@ -280,7 +280,7 @@ else
var username = _loginModel.Username.ToLowerInvariant().Trim();
// Validate 2-factor auth code auth and login
- var result = await Http.PostAsJsonAsync("api/v1/Auth/validate-recovery-code", new ValidateLoginRequestRecoveryCode(username, _loginModel.RememberMe, _clientEphemeral.Public, _clientSession.Proof, _loginModelRecoveryCode.RecoveryCode));
+ var result = await Http.PostAsJsonAsync("v1/Auth/validate-recovery-code", new ValidateLoginRequestRecoveryCode(username, _loginModel.RememberMe, _clientEphemeral.Public, _clientSession.Proof, _loginModelRecoveryCode.RecoveryCode));
var responseContent = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode)
@@ -338,7 +338,7 @@ else
var username = _loginModel.Username.ToLowerInvariant().Trim();
// Validate 2-factor auth code auth and login
- var result = await Http.PostAsJsonAsync("api/v1/Auth/validate-2fa", new ValidateLoginRequest2Fa(username, _loginModel.RememberMe, _clientEphemeral.Public, _clientSession.Proof, _loginModel2Fa.TwoFactorCode ?? 0));
+ var result = await Http.PostAsJsonAsync("v1/Auth/validate-2fa", new ValidateLoginRequest2Fa(username, _loginModel.RememberMe, _clientEphemeral.Public, _clientSession.Proof, _loginModel2Fa.TwoFactorCode ?? 0));
var responseContent = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode)
diff --git a/src/AliasVault.Client/Auth/Pages/Setup/Components/UsernameStep.razor b/src/AliasVault.Client/Auth/Pages/Setup/Components/UsernameStep.razor
index 9ceb5a0f0..44a80dbfd 100644
--- a/src/AliasVault.Client/Auth/Pages/Setup/Components/UsernameStep.razor
+++ b/src/AliasVault.Client/Auth/Pages/Setup/Components/UsernameStep.razor
@@ -169,7 +169,7 @@
try
{
- var response = await Http.PostAsJsonAsync("api/v1/Auth/validate-username", new { Username });
+ var response = await Http.PostAsJsonAsync("v1/Auth/validate-username", new { Username });
if (response.IsSuccessStatusCode)
{
diff --git a/src/AliasVault.Client/Auth/Pages/Unlock.razor b/src/AliasVault.Client/Auth/Pages/Unlock.razor
index ce33287fb..6bf15d316 100644
--- a/src/AliasVault.Client/Auth/Pages/Unlock.razor
+++ b/src/AliasVault.Client/Auth/Pages/Unlock.razor
@@ -123,7 +123,7 @@ else
await StatusCheck();
// Send request to server with email to get user salt.
- var result = await Http.PostAsJsonAsync("api/v1/Auth/login", new LoginInitiateRequest(Username!));
+ var result = await Http.PostAsJsonAsync("v1/Auth/login", new LoginInitiateRequest(Username!));
var responseContent = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode)
@@ -234,7 +234,7 @@ else
// If user has no valid authentication an automatic redirect to login page will take place.
try
{
- await Http.GetAsync("api/v1/Auth/status");
+ await Http.GetAsync("v1/Auth/status");
}
catch (Exception ex)
{
diff --git a/src/AliasVault.Client/Dockerfile b/src/AliasVault.Client/Dockerfile
index bb62a9ed6..63e5d0696 100644
--- a/src/AliasVault.Client/Dockerfile
+++ b/src/AliasVault.Client/Dockerfile
@@ -35,7 +35,10 @@ FROM nginx:1.24.0 AS final
WORKDIR /usr/share/nginx/html
COPY --from=publish /app/publish/wwwroot .
COPY /src/AliasVault.Client/nginx.conf /etc/nginx/nginx.conf
+COPY /src/AliasVault.Client/entrypoint.sh /app/entrypoint.sh
+
+RUN chmod +x /app/entrypoint.sh
EXPOSE 3000
ENV ASPNETCORE_URLS=http://+:3000
-CMD ["nginx", "-g", "daemon off;"]
+ENTRYPOINT ["/app/entrypoint.sh"]
diff --git a/src/AliasVault.Client/Main/Components/Email/EmailModal.razor b/src/AliasVault.Client/Main/Components/Email/EmailModal.razor
index 05b4d7d60..aabf71c95 100644
--- a/src/AliasVault.Client/Main/Components/Email/EmailModal.razor
+++ b/src/AliasVault.Client/Main/Components/Email/EmailModal.razor
@@ -147,7 +147,7 @@
try
{
- var response = await HttpClient.DeleteAsync($"api/v1/Email/{Email.Id}");
+ var response = await HttpClient.DeleteAsync($"v1/Email/{Email.Id}");
if (response.IsSuccessStatusCode)
{
GlobalNotificationService.AddSuccessMessage("Email deleted successfully", true);
diff --git a/src/AliasVault.Client/Main/Components/Email/RecentEmails.razor b/src/AliasVault.Client/Main/Components/Email/RecentEmails.razor
index fe8a308e3..6ff06473f 100644
--- a/src/AliasVault.Client/Main/Components/Email/RecentEmails.razor
+++ b/src/AliasVault.Client/Main/Components/Email/RecentEmails.razor
@@ -285,7 +285,7 @@
/// </summary>
private async Task LoadAliasVaultEmails()
{
- var request = new HttpRequestMessage(HttpMethod.Get, $"api/v1/EmailBox/{EmailAddress}");
+ var request = new HttpRequestMessage(HttpMethod.Get, $"v1/EmailBox/{EmailAddress}");
try
{
var response = await HttpClient.SendAsync(request);
@@ -351,7 +351,7 @@
/// </summary>
private async Task ShowAliasVaultEmailInModal(int emailId)
{
- EmailApiModel? mail = await HttpClient.GetFromJsonAsync<EmailApiModel>($"api/v1/Email/{emailId}");
+ EmailApiModel? mail = await HttpClient.GetFromJsonAsync<EmailApiModel>($"v1/Email/{emailId}");
if (mail != null)
{
// Decrypt the email content locally.
diff --git a/src/AliasVault.Client/Main/Pages/Emails/Home.razor b/src/AliasVault.Client/Main/Pages/Emails/Home.razor
index ae0a549e3..7bba7875c 100644
--- a/src/AliasVault.Client/Main/Pages/Emails/Home.razor
+++ b/src/AliasVault.Client/Main/Pages/Emails/Home.razor
@@ -138,7 +138,7 @@ else
Addresses = emailClaimList,
};
- var request = new HttpRequestMessage(HttpMethod.Post, $"api/v1/EmailBox/bulk");
+ var request = new HttpRequestMessage(HttpMethod.Post, $"v1/EmailBox/bulk");
request.Content = new StringContent(JsonSerializer.Serialize(requestModel), Encoding.UTF8, "application/json");
try
@@ -245,7 +245,7 @@ else
/// </summary>
private async Task ShowAliasVaultEmailInModal(int emailId)
{
- EmailApiModel? mail = await HttpClient.GetFromJsonAsync<EmailApiModel>($"api/v1/Email/{emailId}");
+ EmailApiModel? mail = await HttpClient.GetFromJsonAsync<EmailApiModel>($"v1/Email/{emailId}");
if (mail != null)
{
// Decrypt the email content locally.
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Security/ChangePassword.razor b/src/AliasVault.Client/Main/Pages/Settings/Security/ChangePassword.razor
index 52b8b9e65..76f643587 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Security/ChangePassword.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Security/ChangePassword.razor
@@ -108,7 +108,7 @@ else
if (firstRender)
{
// Get the QR code and secret for the authenticator app.
- var response = await Http.GetFromJsonAsync<PasswordChangeInitiateResponse>("api/v1/Auth/change-password/initiate");
+ var response = await Http.GetFromJsonAsync<PasswordChangeInitiateResponse>("v1/Auth/change-password/initiate");
if (response == null)
{
@@ -191,7 +191,7 @@ else
PasswordChangeModel = new PasswordChangeModel();
// 4. Client sends proof of session key to server.
- var response = await Http.PostAsJsonAsync("api/v1/Vault/change-password", vaultPasswordChangeObject);
+ var response = await Http.PostAsJsonAsync("v1/Vault/change-password", vaultPasswordChangeObject);
var responseContent = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor
index 8aa81b54f..0d4572459 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor
@@ -70,7 +70,7 @@
{
IsLoading = true;
StateHasChanged();
- var sessionsResponse = await Http.GetFromJsonAsync<List<RefreshTokenModel>>("api/v1/Security/sessions");
+ var sessionsResponse = await Http.GetFromJsonAsync<List<RefreshTokenModel>>("v1/Security/sessions");
if (sessionsResponse is not null)
{
Sessions = sessionsResponse;
@@ -89,7 +89,7 @@
{
try
{
- var response = await Http.DeleteAsync($"api/v1/Security/sessions/{id}");
+ var response = await Http.DeleteAsync($"v1/Security/sessions/{id}");
if (response.IsSuccessStatusCode)
{
GlobalNotificationService.AddSuccessMessage("Session revoked successfully.", true);
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/RecentAuthLogsSection.razor b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/RecentAuthLogsSection.razor
index 56d2aeb4a..9c540dde6 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/RecentAuthLogsSection.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/RecentAuthLogsSection.razor
@@ -73,7 +73,7 @@
{
IsLoading = true;
StateHasChanged();
- var authlogResponse = await Http.GetFromJsonAsync<List<AuthLogModel>>("api/v1/Security/authlogs");
+ var authlogResponse = await Http.GetFromJsonAsync<List<AuthLogModel>>("v1/Security/authlogs");
if (authlogResponse is not null)
{
AuthLogs = authlogResponse;
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/TwoFactorAuthenticationSection.razor b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/TwoFactorAuthenticationSection.razor
index 86a7c0b4c..2496be2d6 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/TwoFactorAuthenticationSection.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/TwoFactorAuthenticationSection.razor
@@ -47,7 +47,7 @@
IsLoading = true;
StateHasChanged();
- var twoFactorResponse = await Http.GetFromJsonAsync<TwoFactorEnabledResult>("api/v1/TwoFactorAuth/status");
+ var twoFactorResponse = await Http.GetFromJsonAsync<TwoFactorEnabledResult>("v1/TwoFactorAuth/status");
if (twoFactorResponse is not null)
{
TwoFactorEnabled = twoFactorResponse.TwoFactorEnabled;
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Security/Disable2Fa.razor b/src/AliasVault.Client/Main/Pages/Settings/Security/Disable2Fa.razor
index a65862c40..21991adff 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Security/Disable2Fa.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Security/Disable2Fa.razor
@@ -48,7 +48,7 @@ else
// Check on server if 2FA is enabled
if (firstRender)
{
- var response = await Http.GetFromJsonAsync<TwoFactorEnabledResult>("api/v1/TwoFactorAuth/status");
+ var response = await Http.GetFromJsonAsync<TwoFactorEnabledResult>("v1/TwoFactorAuth/status");
if (response is not null && !response.TwoFactorEnabled)
{
GlobalNotificationService.AddErrorMessage("Two-factor authentication is not enabled.");
@@ -63,7 +63,7 @@ else
private async Task DisableTwoFactor()
{
- var response = await Http.PostAsync("api/v1/TwoFactorAuth/disable", null);
+ var response = await Http.PostAsync("v1/TwoFactorAuth/disable", null);
if (response.IsSuccessStatusCode)
{
GlobalNotificationService.AddSuccessMessage("Two-factor authentication is now successfully disabled.");
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor b/src/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor
index 2c360051f..a66b241f7 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor
@@ -74,7 +74,7 @@ else
if (firstRender)
{
// Get the QR code and secret for the authenticator app.
- var response = await Http.PostAsync("api/v1/TwoFactorAuth/enable", null);
+ var response = await Http.PostAsync("v1/TwoFactorAuth/enable", null);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadFromJsonAsync<TwoFactorSetupResult>();
@@ -100,7 +100,7 @@ else
private async Task VerifySetup()
{
- var response = await Http.PostAsJsonAsync("api/v1/TwoFactorAuth/verify", VerifyModel.Code);
+ var response = await Http.PostAsJsonAsync("v1/TwoFactorAuth/verify", VerifyModel.Code);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadFromJsonAsync<TwoFactorVerifyResult>();
diff --git a/src/AliasVault.Client/Main/Pages/Test/Test1.razor b/src/AliasVault.Client/Main/Pages/Test/Test1.razor
index e82467dd0..8a3736b99 100644
--- a/src/AliasVault.Client/Main/Pages/Test/Test1.razor
+++ b/src/AliasVault.Client/Main/Pages/Test/Test1.razor
@@ -35,7 +35,7 @@ else
private async Task MakeWebApiCall()
{
- await HttpClient.GetAsync("api/v1/Test");
+ await HttpClient.GetAsync("v1/Test");
IsLoading = false;
StateHasChanged();
diff --git a/src/AliasVault.Client/Main/Pages/Test/Test2.razor b/src/AliasVault.Client/Main/Pages/Test/Test2.razor
index a633ec842..d8453fd63 100644
--- a/src/AliasVault.Client/Main/Pages/Test/Test2.razor
+++ b/src/AliasVault.Client/Main/Pages/Test/Test2.razor
@@ -35,7 +35,7 @@ else
private async Task MakeWebApiCall()
{
- await HttpClient.GetAsync("api/v1/Test");
+ await HttpClient.GetAsync("v1/Test");
IsLoading = false;
StateHasChanged();
diff --git a/src/AliasVault.Client/Services/Auth/AuthService.cs b/src/AliasVault.Client/Services/Auth/AuthService.cs
index 111116c48..f8f6fbbde 100644
--- a/src/AliasVault.Client/Services/Auth/AuthService.cs
+++ b/src/AliasVault.Client/Services/Auth/AuthService.cs
@@ -46,7 +46,7 @@ public sealed class AuthService(HttpClient httpClient, ILocalStorageService loca
var accessToken = await GetAccessTokenAsync();
var refreshToken = await GetRefreshTokenAsync();
var tokenInput = new TokenModel { Token = accessToken, RefreshToken = refreshToken };
- using var request = new HttpRequestMessage(HttpMethod.Post, "api/v1/Auth/refresh")
+ using var request = new HttpRequestMessage(HttpMethod.Post, "v1/Auth/refresh")
{
Content = JsonContent.Create(tokenInput),
};
@@ -319,7 +319,7 @@ public sealed class AuthService(HttpClient httpClient, ILocalStorageService loca
RefreshToken = await GetRefreshTokenAsync(),
};
- using var request = new HttpRequestMessage(HttpMethod.Post, "api/v1/Auth/revoke")
+ using var request = new HttpRequestMessage(HttpMethod.Post, "v1/Auth/revoke")
{
Content = JsonContent.Create(tokenInput),
};
diff --git a/src/AliasVault.Client/Services/Auth/UserRegistrationService.cs b/src/AliasVault.Client/Services/Auth/UserRegistrationService.cs
index bf5c7d157..3bbb23910 100644
--- a/src/AliasVault.Client/Services/Auth/UserRegistrationService.cs
+++ b/src/AliasVault.Client/Services/Auth/UserRegistrationService.cs
@@ -50,7 +50,7 @@ public class UserRegistrationService(HttpClient httpClient, AuthenticationStateP
var srpSignup = Srp.PasswordChangeAsync(client, salt, username, passwordHashString);
var registerRequest = new RegisterRequest(srpSignup.Username, srpSignup.Salt, srpSignup.Verifier, encryptionType, encryptionSettings);
- var result = await httpClient.PostAsJsonAsync("api/v1/Auth/register", registerRequest);
+ var result = await httpClient.PostAsJsonAsync("v1/Auth/register", registerRequest);
var responseContent = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode)
diff --git a/src/AliasVault.Client/Services/CredentialService.cs b/src/AliasVault.Client/Services/CredentialService.cs
index a9edf4920..109738f95 100644
--- a/src/AliasVault.Client/Services/CredentialService.cs
+++ b/src/AliasVault.Client/Services/CredentialService.cs
@@ -375,7 +375,7 @@ public sealed class CredentialService(HttpClient httpClient, DbService dbService
try
{
var apiReturn =
- await httpClient.GetFromJsonAsync<FaviconExtractModel>($"api/v1/Favicon/Extract?url={url}");
+ await httpClient.GetFromJsonAsync<FaviconExtractModel>($"v1/Favicon/Extract?url={url}");
if (apiReturn?.Image is not null)
{
credentialObject.Service.Logo = apiReturn.Image;
diff --git a/src/AliasVault.Client/Services/Database/DbService.cs b/src/AliasVault.Client/Services/Database/DbService.cs
index 4fd30eb8e..791decf6b 100644
--- a/src/AliasVault.Client/Services/Database/DbService.cs
+++ b/src/AliasVault.Client/Services/Database/DbService.cs
@@ -106,7 +106,7 @@ public sealed class DbService : IDisposable
{
try
{
- var vaultsToMerge = await _httpClient.GetFromJsonAsync<VaultMergeResponse>($"api/v1/Vault/merge?currentRevisionNumber={_vaultRevisionNumber}");
+ var vaultsToMerge = await _httpClient.GetFromJsonAsync<VaultMergeResponse>($"v1/Vault/merge?currentRevisionNumber={_vaultRevisionNumber}");
if (vaultsToMerge == null || vaultsToMerge.Vaults.Count == 0)
{
// No vaults to merge found, set error state.
@@ -558,7 +558,7 @@ public sealed class DbService : IDisposable
// Load from webapi.
try
{
- var response = await _httpClient.GetFromJsonAsync<VaultGetResponse>("api/v1/Vault");
+ var response = await _httpClient.GetFromJsonAsync<VaultGetResponse>("v1/Vault");
if (response is not null)
{
if (response.Status == VaultStatus.MergeRequired)
@@ -621,7 +621,7 @@ public sealed class DbService : IDisposable
try
{
- var response = await _httpClient.PostAsJsonAsync("api/v1/Vault", vaultObject);
+ var response = await _httpClient.PostAsJsonAsync("v1/Vault", vaultObject);
// Ensure the request was successful
response.EnsureSuccessStatusCode();
diff --git a/src/AliasVault.Client/entrypoint.sh b/src/AliasVault.Client/entrypoint.sh
index 6da3fa605..117cce869 100755
--- a/src/AliasVault.Client/entrypoint.sh
+++ b/src/AliasVault.Client/entrypoint.sh
@@ -26,7 +26,7 @@ if [ ! -f /etc/nginx/ssl/nginx.crt ] || [ ! -f /etc/nginx/ssl/nginx.key ]; then
fi
# Replace the default URL with the actual API URL constructed from hostname
-sed -i "s|http://localhost:5092|https://${HOSTNAME}/api|g" /usr/share/nginx/html/appsettings.json
+sed -i "s|http://localhost:5092|https://${HOSTNAME}|g" /usr/share/nginx/html/appsettings.json
# Convert comma-separated list to JSON array
json_array=$(echo $PRIVATE_EMAIL_DOMAINS | awk '{split($0,a,","); printf "["; for(i=1;i<=length(a);i++) {printf "\"%s\"", a[i]; if(i<length(a)) printf ","} printf "]"}')
diff --git a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiLoggingTests.cs b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiLoggingTests.cs
index d33995180..6cc0abcbb 100644
--- a/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiLoggingTests.cs
+++ b/src/Tests/AliasVault.E2ETests/Tests/Client/Shard1/ApiLoggingTests.cs
@@ -38,7 +38,7 @@ public class ApiLoggingTests : ClientPlaywrightTest
// Read from database to check if the log entry was created.
var logEntry = await ApiDbContext.Logs.Where(x => x.Application == "AliasVault.Api").OrderByDescending(x => x.Id).FirstOrDefaultAsync();
- Assert.That(logEntry, Is.Not.Null, "Log entry for triggered exception not found in database. Check Serilog configuration and /api/v1/Test/Error endpoint.");
+ Assert.That(logEntry, Is.Not.Null, "Log entry for triggered exception not found in database. Check Serilog configuration and /v1/Test/Error endpoint.");
Assert.That(logEntry.Exception, Does.Contain("Test error"), "Log entry in database does not contain expected message. Check exception and Serilog configuration.");
}
}