Prepare beta release

This commit is contained in:
Myx
2024-10-16 02:12:47 +02:00
parent e7866fbee0
commit 9b0f494bcb
8 changed files with 61 additions and 9 deletions

View File

@@ -0,0 +1,6 @@
namespace bytefy.image;
public class CorsSettings
{
public string[] AllowedOrigins { get; set; }
}

View File

@@ -3,13 +3,17 @@ using ImageMagick;
using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Antiforgery;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAntiforgery(options => options.HeaderName = "2311d8d8-607d-4747-8939-1bde65643254"); builder.Services.AddAntiforgery(options => options.HeaderName = "2311d8d8-607d-4747-8939-1bde65643254");
builder.Services.AddSingleton<ConversionQueueService>(); builder.Services.AddSingleton<ConversionQueueService>();
builder.Services.AddHostedService(provider => provider.GetRequiredService<ConversionQueueService>()); builder.Services.AddHostedService(provider => provider.GetRequiredService<ConversionQueueService>());
var corsSettings = builder.Configuration.GetSection("Cors").Get<CorsSettings>();
builder.Services.AddCors(options => builder.Services.AddCors(options =>
{ {
options.AddPolicy("AllowSpecificOrigin", options.AddPolicy("AllowSpecificOrigin",
builder => builder.WithOrigins("http://localhost:4200") builder => builder.WithOrigins(corsSettings.AllowedOrigins)
.AllowAnyMethod() .AllowAnyMethod()
.AllowAnyHeader() .AllowAnyHeader()
.AllowCredentials()); .AllowCredentials());

View File

@@ -2,8 +2,14 @@
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning", "Microsoft.AspNetCore": "Warning"
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*",
"Cors": {
"AllowedOrigins": [
"http://localhost:4200",
"https://localhost:4200"
]
}
} }

View File

@@ -5,5 +5,10 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"AllowedHosts": "*" "Cors": {
"AllowedOrigins": [
"http://bytefy.net",
"https://bytefy.net"
]
}
} }

View File

@@ -28,7 +28,8 @@
"inlineStyleLanguage": "scss", "inlineStyleLanguage": "scss",
"assets": [ "assets": [
"src/favicon.ico", "src/favicon.ico",
"src/assets" "src/assets",
"src/web.config"
], ],
"styles": [ "styles": [
"src/styles.scss" "src/styles.scss"
@@ -54,7 +55,13 @@
"development": { "development": {
"optimization": false, "optimization": false,
"extractLicenses": false, "extractLicenses": false,
"sourceMap": true "sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
} }
}, },
"defaultConfiguration": "production" "defaultConfiguration": "production"
@@ -88,7 +95,8 @@
"inlineStyleLanguage": "scss", "inlineStyleLanguage": "scss",
"assets": [ "assets": [
"src/favicon.ico", "src/favicon.ico",
"src/assets" "src/assets",
"src/web.config"
], ],
"styles": [ "styles": [
"src/styles.scss" "src/styles.scss"

View File

@@ -0,0 +1,4 @@
export const environment = {
production: false,
uploadServiceBaseUrl: 'http://localhost:1337'
};

View File

@@ -1,4 +1,4 @@
export const environment = { export const environment = {
production: false, production: true,
uploadServiceBaseUrl: 'http://localhost:1337' uploadServiceBaseUrl: 'http://image.bytefy.net'
}; };

19
tools/src/web.config Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="./index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>