a Startup

This commit is contained in:
Paul Schneider
2023-03-20 21:48:32 +00:00
parent c4b7a5c48d
commit ff2a72f112
19 changed files with 90 additions and 107 deletions

View File

@ -19,6 +19,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Models.Calendar
{

View File

@ -19,6 +19,8 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Models.Calendar
{
public interface IScheduledEvent
@ -31,4 +33,4 @@ namespace Yavsc.Models.Calendar
Period Period { get; set; }
}
}
}

View File

@ -0,0 +1,9 @@
using Yavsc.Models.Calendar;
namespace Yavsc.Server.Models.Calendar
{
public class Availability : List<Period>
{
}
}

View File

@ -22,7 +22,7 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Calendar
namespace Yavsc.Server.Models.Calendar
{
/// <summary>
/// Hollydays.

View File

@ -19,7 +19,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace Yavsc.Models.Calendar
namespace Yavsc.Server.Models.Calendar
{
/// <summary>
/// Periodicity.

View File

@ -21,9 +21,10 @@
namespace Yavsc.Models.Calendar
using Yavsc.Models.Relationship;
namespace Yavsc.Server.Models.Calendar
{
using Models.Relationship;
/// <summary>
/// Position and keyphrase.
/// </summary>

View File

@ -21,6 +21,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Models.Calendar
{
@ -42,4 +43,4 @@ namespace Yavsc.Models.Calendar
set;
}
}
}
}

View File

@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Attributes.Validation;
using Yavsc.Models;
using Yavsc.Models.Calendar;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.Server.Models.EMailing
{

View File

@ -1,6 +1,6 @@
using System;
using Yavsc.Models.Calendar;
using Yavsc.Server.Models.Calendar;
namespace Yavsc.ViewModels.Calendar
{

View File

@ -1,27 +1,20 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
using Microsoft.AspNetCore;
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
namespace Yavsc
{
app.UseExceptionHandler("/Home/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();
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) {
return WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build();
}
}
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();

View File

@ -42,7 +42,7 @@ namespace Yavsc
static IAuthorizationService AuthorizationService { get; set; }
public void ConfigureFileServerApp(IApplicationBuilder app,
SiteSettings siteSettings, Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
SiteSettings siteSettings, IWebHostEnvironment env,
IAuthorizationService authorizationService)
{
AuthorizationService = authorizationService;

View File

@ -9,7 +9,7 @@ namespace Yavsc
public partial class Startup
{
public void CheckApp(Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
public void CheckApp(IWebHostEnvironment env,
ILoggerFactory loggerFactory)
{

View File

@ -89,6 +89,7 @@ namespace Yavsc
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSignalR();
// Database connection
@ -241,26 +242,21 @@ namespace Yavsc
options.ResourcesPath = "Resources";
});
}
static ApplicationDbContext _dbContext;
private UserManager<ApplicationUser> _usermanager;
public static IServiceProvider Services { get; private set; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(
IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
ApplicationDbContext dbContext, IOptions<SiteSettings> siteSettings,
IOptions<RequestLocalizationOptions> localizationOptions,
IApplicationBuilder app,
IOptions<SiteSettings> siteSettings,
IAuthorizationService authorizationService,
IOptions<PayPalSettings> payPalSettings,
IOptions<GoogleAuthSettings> googleSettings,
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
UserManager<ApplicationUser> usermanager,
ILoggerFactory loggerFactory)
ILoggerFactory loggerFactory,
IWebHostEnvironment env)
{
Services = app.ApplicationServices;
_dbContext = dbContext;
_usermanager = usermanager;
GoogleSettings = googleSettings.Value;
ResourcesHelpers.GlobalLocalizer = localizer;
SiteSetup = siteSettings.Value;
@ -319,7 +315,7 @@ namespace Yavsc
// before fixing the security protocol, let beleive our lib it's done with it.
var cxmgr = PayPal.Manager.ConnectionManager.Instance;
// then, fix it.
ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xC00; // Tls12, required by PayPal
// ServicePointManager.SecurityProtocol = (SecurityProtocolType)0xC00; // Tls12, required by PayPal
app.UseSession();
@ -335,35 +331,13 @@ namespace Yavsc
_logger.LogInformation("LocalApplicationData: " + Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify));
CheckApp(env, loggerFactory);
}
// Entry point for the application.
public static void Main(string[] args) {
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
app.UseEndpoints(endpoints =>
{
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.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.MapHub<ChatHub>("/chatHub");
app.Run();
endpoints.MapHub<ChatHub>("/chat");
});
}
}
}
//

View File

@ -16,6 +16,7 @@
<PackageReference Include="MimeKit" Version="3.6.0" />
<PackageReference Include="pazof.rules" Version="1.1.3" />
<PackageReference Include="RazorEngine.NetCore" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
</ItemGroup>