logger
diff --git a/Components/TemplateSelector.razor b/Components/TemplateSelector.razor
index 1fe4340..4239a27 100644
--- a/Components/TemplateSelector.razor
+++ b/Components/TemplateSelector.razor
@@ -1,6 +1,7 @@
-@using IDIS.Models
-@inject Services.IDIS_TemplateService templateService
+@inject IDIS_TemplateService TemplateService
@using Cysharp.Threading.Tasks
+@using global::CAICT.IDIS.Service
+@using global::CAICT.IDIS
@using BITKit
选择标识模板
@@ -56,7 +57,7 @@
severity = Severity.Info;
try
{
- templates = await templateService.ToArrayAsync();
+ templates = await TemplateService.ToArrayAsync();
currentMessage = "模板刷新完成";
severity = Severity.Info;
diff --git a/Components/_Imports.razor b/Components/_Imports.razor
index 63bec85..4fea4ca 100644
--- a/Components/_Imports.razor
+++ b/Components/_Imports.razor
@@ -7,7 +7,8 @@
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
-@using IDIS.Client.Web
-@using IDIS.Client.Web.Components
+@using CAICT.IDIS
+@using CAICT.IDIS.Components
+@using CAICT.IDIS.Service
@using MudBlazor
@using MudBlazor.Services
diff --git a/Data/OneClickRegister.cs b/Data/OneClickRegister.cs
deleted file mode 100644
index 80c01cd..0000000
--- a/Data/OneClickRegister.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.ComponentModel;
-using System.ComponentModel.DataAnnotations;
-using System.Diagnostics.CodeAnalysis;
-using System.Globalization;
-using System.Net;
-using System.Reflection.Metadata;
-using System.Text.RegularExpressions;
-using BITKit;
-using Cysharp.Threading.Tasks;
-using IDIS.Models;
-using IDIS.Services;
-using IDIS.Services.Models;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
-using Org.BouncyCastle.Security;
-
-namespace IDIS.Client.Web.Data;
-
-public record OneClickRegisterData
-{
- public string Name;
- public string Prefix;
- public Dictionary Dictionary;
-}
-
-public class OneClickRegister:DbContext
-{
- [Keyless]
- public class Info
- {
- public string Name { get; set; }
- public string Json { get; set; }
- }
- [Keyless]
- public class SavedInfo:Info
- {
-
- }
- private readonly IDIS_Service _service;
-
- public OneClickRegister(IDIS_Service service)
- {
- _service = service;
- }
- public DbSet oneClickTemplates { get; set; }
- public DbSet oneClickRegisters { get; set; }
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- var connectionString = BITKit.Data.Get("DefaultConnection");
-
- optionsBuilder.UseMySQL(connectionString);
- }
- public async UniTask> GetAllTemplate()
- {
- var array = await oneClickTemplates.ToArrayAsync();
- return array.ToDictionary(info => info.Name, info => JsonConvert.DeserializeObject(info.Json)!);
- }
- public async UniTask CreateTemplate(string name,string prefix,Dictionary dictionary)
- {
- var _all =await GetAllTemplate();
- if(_all.ContainsKey(name))
- throw new ArgumentException("模板已存在");
- oneClickTemplates.Add(new Info{Name = name,Json = JsonConvert.SerializeObject(new OneClickRegisterData{Name = name,Prefix = prefix,Dictionary = dictionary})});
- await SaveChangesAsync();
- }
- public async UniTask DeleteTemplate(string name)
- {
- oneClickTemplates.RemoveRange(oneClickTemplates.Where(x => x.Name == name));
- await SaveChangesAsync();
- }
- public async UniTask Register(string templateName,string name)
- {
- if (string.IsNullOrEmpty(name))
- {
- name = DateTime.Now.ToString(CultureInfo.InvariantCulture);
- }
- var _all =await GetAllTemplate();
- if(_all.TryGetValue(templateName,out var template) is false)
- throw new ArgumentException($"未找到模板:{templateName}");
- var tick = DateTime.Now.Ticks;
- var export = new OneClickRegisterData
- {
- Name = name,
- Prefix = template.Prefix,
- Dictionary = new(),
- };
- foreach (var (entryName,templateVersion) in template.Dictionary)
- {
- var handle = $"{template.Prefix}/{tick++}";
- await _service.RegisterAsync(handle,templateVersion,Array.Empty());
- export.Dictionary.Add(entryName,handle);
- }
-
- await oneClickRegisters.AddAsync(new SavedInfo{Name = name,Json = JsonConvert.SerializeObject(export)});
- await SaveChangesAsync();
-
- return export;
- }
-}
\ No newline at end of file
diff --git a/Program.cs b/Program.cs
index 34e32bc..8b8cf05 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,12 +1,8 @@
using BITKit;
-using IDIS_Server_SIM.Data;
-using Microsoft.AspNetCore.Components.Authorization;
+using CAICT.IDIS.Components;
using Microsoft.AspNetCore.Identity;
-using Microsoft.EntityFrameworkCore;
-using IDIS.Client.Web.Components;
-using IDIS.Client.Web.Data;
-using IDIS.Models;
-using IDIS.Services;
+using CAICT.IDIS.Service;
+using CN.CAICT.IDIS;
using MudBlazor.Services;
await BITAppForNet.InitializeAsync("IDIS");
@@ -29,13 +25,12 @@ builder.Services.AddMudServices();
builder.Services.AddCascadingAuthenticationState();
-builder.Services.AddTransient();
-builder.Services.AddTransient();
-builder.Services.AddTransient();
-builder.Services.AddTransient();
-builder.Services.AddTransient();
-builder.Services.AddTransient();
-builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+builder.Services.AddTransient();
+
+builder.Services.AddControllers();
builder.Services.AddAuthentication(options =>
{
@@ -48,15 +43,14 @@ builder.Services.AddAuthentication(options =>
var app = builder.Build();
-app.Services.GetRequiredService();
-
-
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// 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.MapControllers();
+
app.UseStaticFiles();
app.UseAntiforgery();
diff --git a/appsettings.json b/appsettings.json
index c16cd66..2dc69b9 100644
--- a/appsettings.json
+++ b/appsettings.json
@@ -5,11 +5,10 @@
"Microsoft.AspNetCore": "Warning"
}
},
- "DefaultConnection":"server=server.bitfall.icu;port=3306;database=ifactory;uid=ifactory;password=JdBfKR2dxhm76Ss2;",
- "Urls":"http://+:5150",
+ "Urls": "http://+:5150",
+ "AllowedHosts": "*",
"Signature": {
"DefaultHandle": "88.123.99/638514755153927653",
"DefaultType": "base64"
- },
- "AllowedHosts": "*"
+ }
}