diff --git a/projects/Infrastructure/Data/EfDbContext.cs b/projects/Infrastructure/Data/EfDbContext.cs index ca6c9abf..f25b7dc9 100644 --- a/projects/Infrastructure/Data/EfDbContext.cs +++ b/projects/Infrastructure/Data/EfDbContext.cs @@ -11,7 +11,10 @@ namespace Infrastructure.Data { public class EfDbContext : DbContext { - public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); + public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => + { + //builder.AddConsole(); + }); public EfDbContext(DbContextOptions options) : base(options) { diff --git a/projects/Infrastructure/Infrastructure.csproj b/projects/Infrastructure/Infrastructure.csproj index 28d5daee..e2f0e669 100644 --- a/projects/Infrastructure/Infrastructure.csproj +++ b/projects/Infrastructure/Infrastructure.csproj @@ -16,8 +16,6 @@ - - diff --git a/projects/Infrastructure/Web/BaseStartup.cs b/projects/Infrastructure/Web/BaseStartup.cs index 5786c338..d0015af1 100644 --- a/projects/Infrastructure/Web/BaseStartup.cs +++ b/projects/Infrastructure/Web/BaseStartup.cs @@ -44,6 +44,7 @@ namespace Infrastructure.Web private readonly bool _useMiniProfiler; private string _connectionString; private bool _useSqlite; + private readonly string _origins = "AllowAllHeaders"; public BaseStartup(IConfiguration configuration, IWebHostEnvironment env) { @@ -55,11 +56,7 @@ namespace Infrastructure.Web public virtual void ConfigureServices(IServiceCollection services) { services.AddSingleton(_cfg as IConfigurationRoot); - if (this._useMiniProfiler) - { - services.AddMiniProfiler(o => o.RouteBasePath = "/profiler").AddEntityFramework(); - } - services.AddCors(options => options.AddPolicy("CorsPolicy", + services.AddCors(options => options.AddPolicy(_origins, builder => { builder.SetIsOriginAllowed(o => true) @@ -216,18 +213,14 @@ namespace Infrastructure.Web app.UseExceptionHandler("/Error"); app.UseStatusCodePagesWithReExecute("/Error"); } - if (this._useMiniProfiler) - { - app.UseMiniProfiler(); - } app.UseStaticFiles(); app.UseRouting(); + app.UseCors(_origins); var localizationOption = app.ApplicationServices.GetService>(); app.UseRequestLocalization(localizationOption.Value); app.UseSession(); this.UseAuthentication(app); this.UseSwagger(app); - app.UseCors("CorsPolicy"); this.UseScheduler(app); app.UseEndpoints(endpoints => { diff --git a/projects/IoTCenter/Controllers/AppController.cs b/projects/IoTCenter/Controllers/AppController.cs index 77752d8e..a1bcd378 100644 --- a/projects/IoTCenter/Controllers/AppController.cs +++ b/projects/IoTCenter/Controllers/AppController.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; -using Newtonsoft.Json; +using Microsoft.Extensions.Hosting; using System; using System.Collections.Generic; using System.IO; @@ -23,6 +23,7 @@ namespace IoTCenter.Controllers [Device] public class AppController : Controller { + private readonly IHostEnvironment _env; private readonly IConfiguration _configuration; private readonly IJwtHelper _jwtHelper; private readonly IRepository _categoryRepo; @@ -35,7 +36,9 @@ namespace IoTCenter.Controllers private readonly IRepository _liveRecordRepo; private readonly IHubContext _hub; - public AppController(IConfiguration configuration, + public AppController( + IHostEnvironment env, + IConfiguration configuration, IJwtHelper jwtHelper, IRepository categoryRepo, IRepository productRepo, @@ -47,6 +50,7 @@ namespace IoTCenter.Controllers IRepository liveRecordRepo, IHubContext hub) { + this._env = env; this._configuration = configuration; this._jwtHelper = jwtHelper; this._categoryRepo = categoryRepo; @@ -114,6 +118,12 @@ namespace IoTCenter.Controllers return Json(model); } + public IActionResult GetTemplate(string template) + { + return Content(System.IO.File.ReadAllText(Path.Combine(this._env.ContentRootPath, "wwwroot", template))); + } + + // public IActionResult GetSceneList(string token) { var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString(); diff --git a/projects/IoTCenter/appsettings.Development.json b/projects/IoTCenter/appsettings.Development.json index 24378348..4b4f5614 100644 --- a/projects/IoTCenter/appsettings.Development.json +++ b/projects/IoTCenter/appsettings.Development.json @@ -5,6 +5,5 @@ "System": "Information", "Microsoft": "Warning" } - }, - "UseMiniProfiler": false + } } \ No newline at end of file diff --git a/projects/IoTCenter/appsettings.json b/projects/IoTCenter/appsettings.json index 7a438f4e..fedd9adc 100644 --- a/projects/IoTCenter/appsettings.json +++ b/projects/IoTCenter/appsettings.json @@ -6,7 +6,6 @@ "Microsoft": "Warning" } }, - "UseMiniProfiler": false, "ConnectionStrings": { "database.mysql.connection": "Server=127.0.0.1;Port=3306;Database=iotcenter;Uid=root;Pwd=root;", "database.sqlite.connection": "Data Source=iotcenter.db" diff --git a/projects/IoTCenter/iotcenter.db b/projects/IoTCenter/iotcenter.db index 1d15477e..1eb5e4d9 100644 Binary files a/projects/IoTCenter/iotcenter.db and b/projects/IoTCenter/iotcenter.db differ diff --git a/projects/IoTCenter/wwwroot/node.mobile.html b/projects/IoTCenter/wwwroot/node.mobile.html new file mode 100644 index 00000000..0620a8a1 --- /dev/null +++ b/projects/IoTCenter/wwwroot/node.mobile.html @@ -0,0 +1 @@ +//复制移动端node.html的template节点内容到此,作为修改的基础 \ No newline at end of file diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/images.meta b/projects/IoTClient/Assets/StreamingAssets/wwwroot/images.meta deleted file mode 100644 index 5ac512d2..00000000 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/images.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 312c27f5d95ac3b43a5743a8f9429113 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/admin-lte.meta b/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/admin-lte.meta deleted file mode 100644 index 0e5348c5..00000000 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/admin-lte.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 894e429dfa5e1b249896a9ae637fc67b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/bootstrap.meta b/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/bootstrap.meta deleted file mode 100644 index 0826b82f..00000000 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/bootstrap.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 932b2ebc2bdf493478f3277c9c6214f0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html b/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html index ea564d77..9d7c77fb 100644 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html +++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html @@ -22,98 +22,100 @@
- + -