Archived
Private
Public Access
1
0

v0.0.1 (download not working)

This commit is contained in:
2023-04-30 20:50:39 +02:00
parent 227af36c05
commit 4f6c0a00be
116 changed files with 1460 additions and 356 deletions

View File

@@ -12,7 +12,7 @@ public class IServController : ControllerBase {
[HttpPost("login")]
public async Task<ActionResult<AuthKeys>> GetAuthKeysV2([FromBody] Credentials credentials) {
await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true });
await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true, Args = new []{"--no-sandbox"} });
await using var page = await browser.NewPageAsync();
await page.GoToAsync($"https://{credentials.Domain}/iserv/auth/login");
@@ -21,7 +21,7 @@ public class IServController : ControllerBase {
await page.Keyboard.PressAsync("Tab");
await page.Keyboard.TypeAsync(credentials.Password);
await page.ClickAsync("body > div > main > div > div.panel-body > form > div.row > div:nth-child(1) > button");
await Task.Delay(500);
await Task.Delay(2000);
var authKeys = new AuthKeys();
var cookies = await page.GetCookiesAsync();

View File

@@ -68,7 +68,7 @@ public class MailController : ControllerBase {
Subject = message.Subject.Replace("(Aspose.Email Evaluation)", ""),
Time = message.Date,
Read = true,
Message = message.Body.Replace("EVALUATION ONLY. CREATED WITH ASPOSE.EMAIL FOR .NET. COPYRIGHT 2002-2022 ASPOSE PTY LTD. \r\n http://www.aspose.com/corporate/purchase/end-user-license-agreement.aspx: View EULA Online\r\n", ""),
Message = message.Body.Split("View EULA")[1],
Attachments = message.Attachments.Select(a => a.Name).ToArray()
};

View File

@@ -3,12 +3,29 @@ WORKDIR /app
EXPOSE 80
EXPOSE 443
#####################
#PUPPETEER RECIPE
#####################
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update && apt-get -f install && apt-get -y install wget gnupg2 apt-utils
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
#####################
#END PUPPETEER RECIPE
#####################
ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-unstable"
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["BetterIServ.Backend/BetterIServ.Backend.csproj", "BetterIServ.Backend/"]
RUN dotnet restore "BetterIServ.Backend/BetterIServ.Backend.csproj"
COPY ["BetterIServ.Backend.csproj", ""]
RUN dotnet restore "BetterIServ.Backend.csproj"
COPY . .
WORKDIR "/src/BetterIServ.Backend"
WORKDIR "/src"
RUN dotnet build "BetterIServ.Backend.csproj" -c Release -o /app/build
FROM build AS publish

View File

@@ -1,11 +1,11 @@
namespace BetterIServ.Backend.Entities;
public struct AuthKeys {
public string Session { get; set; }
public string Sat { get; set; }
public string AuthSid { get; set; }
public string SatId { get; set; }
public string AuthSession { get; set; }
public string? Session { get; set; }
public string? Sat { get; set; }
public string? AuthSid { get; set; }
public string? SatId { get; set; }
public string? AuthSession { get; set; }
public string ToCookieString() {
return $"IServSession={Session}; IServSAT={Sat}; IServAuthSID={AuthSid}; IServSATId={SatId}; IServAuthSession={AuthSession}";

View File

@@ -1,10 +1,13 @@
using PuppeteerSharp;
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddCors(options => {
options.AddPolicy("BetterIserv", policy => {
policy.WithOrigins("http://localhost", "http://localhost:8100")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
@@ -19,12 +22,7 @@ if (app.Environment.IsDevelopment()) {
app.UseSwaggerUI();
}
app.UseCors(options => {
options.WithOrigins("http://localhost:8100");
options.AllowCredentials();
options.AllowAnyHeader();
options.AllowAnyMethod();
});
app.UseCors("BetterIserv");
app.UseAuthorization();