Skip to content

Commit

Permalink
Merge pull request #124 from sebagomez/feature/basepath
Browse files Browse the repository at this point in the history
BasePath not allowed thanks to the BASEPATH environment variable
  • Loading branch information
sebagomez authored Oct 20, 2023
2 parents ab0c438 + e288b52 commit 691199c
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 42 deletions.
11 changes: 6 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/AzureWebStorageExplorer/bin/Debug/net6.0/AzureWebStorageExplorer.dll",
"program": "${workspaceFolder}/src/AzureWebStorageExplorer/bin/Debug/net7.0/AzureWebStorageExplorer.dll",
"args": [],
"cwd": "${workspaceFolder}/src/AzureWebStorageExplorer",
"stopAtEntry": false,
Expand All @@ -30,7 +30,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/wasm/bin/Debug/net6.0/wasm.dll",
"program": "${workspaceFolder}/src/wasm/bin/Debug/net7.0/wasm.dll",
"args": [],
"cwd": "${workspaceFolder}/src/wasm",
"stopAtEntry": false,
Expand All @@ -50,7 +50,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/web/bin/Debug/net6.0/web.dll",
"program": "${workspaceFolder}/src/web/bin/Debug/net7.0/web.dll",
"args": [],
"cwd": "${workspaceFolder}/src/web",
"stopAtEntry": false,
Expand All @@ -70,7 +70,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/web/bin/Debug/net6.0/web.dll",
"program": "${workspaceFolder}/src/web/bin/Debug/net7.0/web.dll",
"args": [],
"cwd": "${workspaceFolder}/src/web",
"stopAtEntry": false,
Expand All @@ -81,7 +81,8 @@
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"MOCK": "true",
"APPVERSION": "MOCK"
"APPVERSION": "MOCK",
"BASEPATH": "app"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
Expand Down
2 changes: 1 addition & 1 deletion src/StorageLibrary/StorageLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<Version>2.3.1</Version>
<Authors>Sebastián Gómez</Authors>
<Copyright>(C) 2018-2022 @sebagomez. All rights reserved.</Copyright>
<Copyright>(C) 2018-2023 @sebagomez. All rights reserved.</Copyright>
<RepositoryUrl>https://github.com/sebagomez/azurestorageexplorer</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/web/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AzureStorageWebExplorerVersion>2.13.9</AzureStorageWebExplorerVersion>
<AzureStorageWebExplorerVersion>2.14.0</AzureStorageWebExplorerVersion>
</PropertyGroup>
</Project>
5 changes: 1 addition & 4 deletions src/web/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
@inherits web.Pages.BaseComponent

<BaseComponent Selected="Home"/>

<a href="https://github.com/sebagomez/azurestorageexplorer">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png">
</a>
<ForkMe/>
<p></p>
<p></p>
<p>Welcome to the revamped version of Azure Storage web explorer</p>
Expand Down
5 changes: 2 additions & 3 deletions src/web/Pages/Login.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
@page "/"
@page "/login"

<a href="https://github.com/sebagomez/azurestorageexplorer">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png">
</a>
<ForkMe/>

<h1 class="azure parent">Azure Storage web explorer</h1>
<p></p>
<div class="parent">
Expand Down
2 changes: 1 addition & 1 deletion src/web/Pages/Login.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private async Task SignIn()

await cred.SaveAsync(SessionStorage!);

NavManager!.NavigateTo("/home");
NavManager!.NavigateTo("home");
}
catch (Exception ex)
{
Expand Down
51 changes: 33 additions & 18 deletions src/web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,44 @@
using Microsoft.AspNetCore.Components.Web;
using web.Data;

var builder = WebApplication.CreateBuilder(args);
internal class Program
{
private static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();

var app = builder.Build();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
string? basePath = Environment.GetEnvironmentVariable("BASEPATH");
if (basePath is not null && !string.IsNullOrWhiteSpace(basePath))
{
if (!basePath.StartsWith("/"))
basePath = $"/{basePath}";

app.UsePathBase(basePath);
}

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseHttpsRedirection();

app.UseStaticFiles();
app.UseStaticFiles();

app.UseRouting();
app.UseRouting();

app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
app.Run();
}
}
3 changes: 3 additions & 0 deletions src/web/Shared/ForkMe.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<a href="https://github.com/sebagomez/azurestorageexplorer">
<img decoding="async" width="149" height="149" style="position: absolute; top: 0; right: 0; border: 0;" src="https://github.blog/wp-content/uploads/2008/12/forkme_right_red_aa0000.png?resize=149%2C149" class="attachment-full size-full" alt="Fork me on GitHub" loading="lazy" data-recalc-dims="1">
</a>
16 changes: 8 additions & 8 deletions src/web/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@


<div class="ui pointing menu">
<a class="item" href="/">
<img src="/res/AzureExplorerLogo.png" class="logo" alt="Azure Web Storage Explorer Logo">
<a class="item" href="./">
<img src="res/AzureExplorerLogo.png" class="logo" alt="Azure Web Storage Explorer Logo">
</a>
<a class="item" href="/home">
<a class="item" href="home">
<h4 class="azure">Azure Storage web explorer</h4>
</a>
<a class="item" href="/containers">
<a class="item" href="containers">
<div @attributes="this.BlobAtts">Blobs</div>
</a>
<a class="item" href="/queues">
<a class="item" href="queues">
<div @attributes="this.QueueAtts">Queues</div>
</a>
<a class="item" href="/tables">
<a class="item" href="tables">
<div @attributes="this.TableAtts">Tables</div>
</a>
<a class="item" href="/fileshares">
<a class="item" href="fileshares">
<div @attributes="this.FileAtts">File Shares</div>
</a>
<div class="menu">
Expand All @@ -42,7 +42,7 @@
public async Task LogOut()
{
await Credentials.ClearAsync(SessionStorage!);
NavManager!.NavigateTo("/login");
NavManager!.NavigateTo("login");
}

private Dictionary<string, object> BlobAtts = new Dictionary<string, object>();
Expand Down
2 changes: 1 addition & 1 deletion src/web/Utils/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Util
public static StorageFactory GetStorageFactory(Credentials cred)
{
string? mock = Environment.GetEnvironmentVariable("MOCK");
if (!(mock is null) && mock.ToLower() == bool.TrueString.ToLower())
if (mock is not null && mock.ToLower() == bool.TrueString.ToLower())
return new StorageFactory();

return new StorageFactory(cred.Account, cred.Key, cred.Endpoint);
Expand Down

0 comments on commit 691199c

Please sign in to comment.