Compare commits
No commits in common. "95b3ac9695044a767c5f0059dea4539ae7de26cd" and "47069f5ece85b76685c933cc9c4d11c87c5afb2f" have entirely different histories.
95b3ac9695
...
47069f5ece
@ -1,9 +1,3 @@
|
|||||||
using NetBarcode;
|
|
||||||
using SixLabors.ImageSharp;
|
|
||||||
using SixLabors.ImageSharp.Formats.Png;
|
|
||||||
using SixLabors.ImageSharp.Processing;
|
|
||||||
using Type = System.Type;
|
|
||||||
|
|
||||||
namespace OliverBooth.Data.Web;
|
namespace OliverBooth.Data.Web;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -22,16 +16,4 @@ internal sealed class Book : IBook
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Title { get; }
|
public string Title { get; }
|
||||||
|
|
||||||
public string GetBarcode()
|
|
||||||
{
|
|
||||||
var barcode = new Barcode(Isbn, NetBarcode.Type.EAN13);
|
|
||||||
using var image = barcode.GetImage();
|
|
||||||
int width = image.Width;
|
|
||||||
int height = image.Height;
|
|
||||||
image.Mutate(i => i.Pad(width + 10, height + 10, Color.White));
|
|
||||||
image.Mutate(i => i.Resize(i.GetCurrentSize() / 4 * 3));
|
|
||||||
|
|
||||||
return image.ToBase64String(PngFormat.Instance);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,3 @@
|
|||||||
using SixLabors.ImageSharp;
|
|
||||||
|
|
||||||
namespace OliverBooth.Data.Web;
|
namespace OliverBooth.Data.Web;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -30,11 +28,4 @@ public interface IBook
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The title of the book.</value>
|
/// <value>The title of the book.</value>
|
||||||
string Title { get; }
|
string Title { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generates the barcode for this book.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The EAN-13 barcode encoded as PNG in Base64.</returns>
|
|
||||||
/// <remarks>This value should be disposed.</remarks>
|
|
||||||
string GetBarcode();
|
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
RUN apt install -y libc6-dev libgdiplus
|
|
||||||
|
|
||||||
FROM node:20-alpine as build-deps
|
FROM node:20-alpine as build-deps
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
@ -12,7 +11,7 @@ RUN npm i
|
|||||||
COPY . ./
|
COPY . ./
|
||||||
RUN gulp
|
RUN gulp
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||||
COPY --from=build-deps /src/OliverBooth/wwwroot /src/OliverBooth/wwwroot
|
COPY --from=build-deps /src/OliverBooth/wwwroot /src/OliverBooth/wwwroot
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["OliverBooth/OliverBooth.csproj", "OliverBooth/"]
|
COPY ["OliverBooth/OliverBooth.csproj", "OliverBooth/"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
@ -12,23 +12,22 @@
|
|||||||
<PackageReference Include="AspNetCore.ReCaptcha" Version="1.7.0" />
|
<PackageReference Include="AspNetCore.ReCaptcha" Version="1.7.0" />
|
||||||
<PackageReference Include="BCrypt.Net-Core" Version="1.6.0"/>
|
<PackageReference Include="BCrypt.Net-Core" Version="1.6.0"/>
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.14.1"/>
|
<PackageReference Include="Humanizer.Core" Version="2.14.1"/>
|
||||||
<PackageReference Include="MailKit" Version="4.3.0"/>
|
<PackageReference Include="MailKit" Version="4.1.0"/>
|
||||||
<PackageReference Include="MailKitSimplified.Sender" Version="2.8.0"/>
|
<PackageReference Include="MailKitSimplified.Sender" Version="2.5.2"/>
|
||||||
<PackageReference Include="Markdig" Version="0.34.0"/>
|
<PackageReference Include="Markdig" Version="0.32.0"/>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.10"/>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0"/>
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="7.0.10"/>
|
||||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.0"/>
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.10"/>
|
||||||
<PackageReference Include="NetBarcode" Version="1.7.0"/>
|
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0"/>
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0"/>
|
||||||
<PackageReference Include="Serilog" Version="3.1.1"/>
|
<PackageReference Include="Serilog" Version="3.0.1"/>
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0"/>
|
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0"/>
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0"/>
|
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0"/>
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1"/>
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0"/>
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0"/>
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0"/>
|
||||||
<PackageReference Include="SmartFormat.NET" Version="3.3.0"/>
|
<PackageReference Include="SmartFormat.NET" Version="3.2.2"/>
|
||||||
<PackageReference Include="X10D" Version="3.3.1"/>
|
<PackageReference Include="X10D" Version="3.2.2"/>
|
||||||
<PackageReference Include="X10D.Hosting" Version="3.3.1"/>
|
<PackageReference Include="X10D.Hosting" Version="3.2.2"/>
|
||||||
<PackageReference Include="ZString" Version="2.5.1"/>
|
<PackageReference Include="ZString" Version="2.5.0"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
@page
|
@page
|
||||||
@using NetBarcode
|
|
||||||
@using OliverBooth.Data.Web
|
@using OliverBooth.Data.Web
|
||||||
@using SixLabors.ImageSharp
|
|
||||||
@using SixLabors.ImageSharp.Formats.Png
|
|
||||||
@using SixLabors.ImageSharp.Processing
|
|
||||||
@using Type = NetBarcode.Type
|
|
||||||
@model OliverBooth.Pages.Books
|
@model OliverBooth.Pages.Books
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Reading List";
|
ViewData["Title"] = "Reading List";
|
||||||
@ -38,7 +33,7 @@
|
|||||||
@book.Title.Trim()
|
@book.Title.Trim()
|
||||||
</td>
|
</td>
|
||||||
<td>@book.Author.Trim()</td>
|
<td>@book.Author.Trim()</td>
|
||||||
<td style="font-family: monospace">@book.Isbn.Trim()<br><img src="@book.GetBarcode()" alt="@book.Isbn"></td>
|
<td>@book.Isbn.Trim()</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -63,7 +58,7 @@
|
|||||||
@book.Title.Trim()
|
@book.Title.Trim()
|
||||||
</td>
|
</td>
|
||||||
<td>@book.Author.Trim()</td>
|
<td>@book.Author.Trim()</td>
|
||||||
<td style="font-family: monospace">@book.Isbn.Trim()<br><img src="@book.GetBarcode()" alt="@book.Isbn"></td>
|
<td>@book.Isbn.Trim()</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -88,7 +83,7 @@
|
|||||||
@book.Title.Trim()
|
@book.Title.Trim()
|
||||||
</td>
|
</td>
|
||||||
<td>@book.Author.Trim()</td>
|
<td>@book.Author.Trim()</td>
|
||||||
<td style="font-family: monospace">@book.Isbn.Trim()<br><img src="@book.GetBarcode()" alt="@book.Isbn"></td>
|
<td>@book.Isbn.Trim()</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
Reference in New Issue
Block a user