From aed71fbf96f51fad9b961e1b8cb13c76b44bc8a1 Mon Sep 17 00:00:00 2001 From: Pavel Vesely Date: Thu, 4 Jun 2020 07:10:45 +0200 Subject: [PATCH 01/24] Add possibility to switch off swagger on production. --- Oqtane.Server/Startup.cs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Oqtane.Server/Startup.cs b/Oqtane.Server/Startup.cs index 183547d2..b9f001bc 100644 --- a/Oqtane.Server/Startup.cs +++ b/Oqtane.Server/Startup.cs @@ -29,7 +29,8 @@ namespace Oqtane public IConfigurationRoot Configuration { get; } private string _webRoot; private Runtime _runtime; - + private bool _useSwagger; + public Startup(IWebHostEnvironment env) { var builder = new ConfigurationBuilder() @@ -37,9 +38,12 @@ namespace Oqtane .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); Configuration = builder.Build(); - _runtime = (Configuration.GetSection("Runtime").Value == "WebAssembly") ? Runtime.WebAssembly : Runtime.Server; + _runtime = (Configuration.GetSection("Runtime").Value == "WebAssembly") ? Runtime.WebAssembly : Runtime.Server; + + //add possibility to switch off swagger on production. + _useSwagger = Configuration.GetSection("UseSwagger").Value != "false"; - _webRoot = env.WebRootPath; + _webRoot = env.WebRootPath; AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(env.ContentRootPath, "Data")); } @@ -47,7 +51,6 @@ namespace Oqtane // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { - services.AddServerSideBlazor(); // setup HttpClient for server side in a client side compatible fashion ( with auth cookie ) @@ -59,7 +62,7 @@ namespace Oqtane var navigationManager = s.GetRequiredService(); var httpContextAccessor = s.GetRequiredService(); var authToken = httpContextAccessor.HttpContext.Request.Cookies[".AspNetCore.Identity.Application"]; - var client = new HttpClient(new HttpClientHandler { UseCookies = false }); + var client = new HttpClient(new HttpClientHandler {UseCookies = false}); if (authToken != null) { client.DefaultRequestHeaders.Add("Cookie", ".AspNetCore.Identity.Application=" + authToken); @@ -121,7 +124,7 @@ namespace Oqtane .AddEntityFrameworkStores() .AddSignInManager() .AddDefaultTokenProviders(); - + services.Configure(options => { // Password settings @@ -199,14 +202,12 @@ namespace Oqtane services.AddMvc() .AddNewtonsoftJson() .AddOqtaneApplicationParts() // register any Controllers from custom modules - .ConfigureOqtaneMvc(); // any additional configuration from IStart classes. + .ConfigureOqtaneMvc(); // any additional configuration from IStart classes. - services.AddSwaggerGen(c => + if (_useSwagger) { - c.SwaggerDoc("v1", new OpenApiInfo { Title = "Oqtane", Version = "v1" }); - }); - - + services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo {Title = "Oqtane", Version = "v1"}); }); + } } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -230,11 +231,11 @@ namespace Oqtane app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); - app.UseSwagger(); - app.UseSwaggerUI(c => + if (_useSwagger) { - c.SwaggerEndpoint("/swagger/v1/swagger.json", "Oqtane V1"); - }); + app.UseSwagger(); + app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Oqtane V1"); }); + } app.UseEndpoints(endpoints => { @@ -242,7 +243,6 @@ namespace Oqtane endpoints.MapControllers(); endpoints.MapFallbackToPage("/_Host"); }); - } } } From 6f6f2b77d7151bebe5355d1e3574dee6109e9a7d Mon Sep 17 00:00:00 2001 From: Cody Date: Thu, 4 Jun 2020 21:11:24 -0700 Subject: [PATCH 02/24] '...' added, Reply Removed --- .../Modules/Admin/UserProfile/Index.razor | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor index b47eb3fe..4579d138 100644 --- a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor +++ b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor @@ -126,7 +126,14 @@ else - @(context.Body.Length > 100 ? context.Body.Substring(0, 100) : context.Body) + + @{ + string input = "---"; + if (context.Body.Contains(input)){ + context.Body = context.Body.Split(input)[0]; + } } + @(context.Body.Length > 100 ? (context.Body.Substring(0, 97) + "...") : context.Body) + } @@ -149,7 +156,14 @@ else - @(context.Body.Length > 100 ? context.Body.Substring(0, 100) : context.Body) + + @{ + string input = "---"; + if (context.Body.Contains(input)){ + context.Body = context.Body.Split(input)[0]; + } } + @(context.Body.Length > 100 ? (context.Body.Substring(0, 97) + "...") : context.Body) + } From 7b9cd39cb7163a530b5c8d7a6938bbb26d58bc3c Mon Sep 17 00:00:00 2001 From: Cody Date: Thu, 4 Jun 2020 21:20:48 -0700 Subject: [PATCH 03/24] To/From Fields enabled/disabled, reply message fix --- .../Modules/Admin/UserProfile/View.razor | 86 +++++++++++++------ 1 file changed, 61 insertions(+), 25 deletions(-) diff --git a/Oqtane.Client/Modules/Admin/UserProfile/View.razor b/Oqtane.Client/Modules/Admin/UserProfile/View.razor index 5d5a43f5..39fb13d3 100644 --- a/Oqtane.Client/Modules/Admin/UserProfile/View.razor +++ b/Oqtane.Client/Modules/Admin/UserProfile/View.razor @@ -1,15 +1,9 @@ -@namespace Oqtane.Modules.Admin.UserProfile -@inherits ModuleBase -@inject NavigationManager NavigationManager -@inject IUserService UserService -@inject INotificationService NotificationService - -@if (PageState.User != null) +@if (PageState.User != null) { + @if (title == "From") + { + + } + @if (title == "To") + { + + } + @if (title == "From") { + + } + @if (title == "From") + { + + +
- + @@ -17,47 +11,85 @@
- +
+ + + +
- + - + +
+ + +