From 022f89c36e17afa5c3d2a6d759675f58d46a3c4b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 16 Jul 2025 22:29:46 +0800 Subject: [PATCH] :sparkles: Pass service provide recaptcha --- .../Startup/ApplicationBuilderExtensions.cs | 1 - DysonNetwork.Pass/Client/public/favicon.ico | Bin 4286 -> 0 bytes DysonNetwork.Pass/Client/src/router/index.ts | 5 + .../Client/src/views/captcha.vue | 98 ++++++++++++++++++ DysonNetwork.Pass/DysonNetwork.Pass.csproj | 1 + .../Pages/Data/CaptchaPageData.cs | 20 ++++ DysonNetwork.Pass/Program.cs | 1 + .../Startup/ApplicationConfiguration.cs | 1 - .../Startup/ApplicationConfiguration.cs | 1 - DysonNetwork.Shared/Proto/GrpcClientHelper.cs | 4 +- .../Startup/ApplicationConfiguration.cs | 1 - 11 files changed, 127 insertions(+), 6 deletions(-) delete mode 100644 DysonNetwork.Pass/Client/public/favicon.ico create mode 100644 DysonNetwork.Pass/Client/src/views/captcha.vue create mode 100644 DysonNetwork.Pass/Pages/Data/CaptchaPageData.cs diff --git a/DysonNetwork.Drive/Startup/ApplicationBuilderExtensions.cs b/DysonNetwork.Drive/Startup/ApplicationBuilderExtensions.cs index 698dabe..ef2896b 100644 --- a/DysonNetwork.Drive/Startup/ApplicationBuilderExtensions.cs +++ b/DysonNetwork.Drive/Startup/ApplicationBuilderExtensions.cs @@ -15,7 +15,6 @@ public static class ApplicationBuilderExtensions app.UseSwaggerUI(); } - app.UseHttpsRedirection(); app.UseAuthorization(); app.MapControllers(); diff --git a/DysonNetwork.Pass/Client/public/favicon.ico b/DysonNetwork.Pass/Client/public/favicon.ico deleted file mode 100644 index df36fcfb72584e00488330b560ebcf34a41c64c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S diff --git a/DysonNetwork.Pass/Client/src/router/index.ts b/DysonNetwork.Pass/Client/src/router/index.ts index 4e83c8c..413ea9b 100644 --- a/DysonNetwork.Pass/Client/src/router/index.ts +++ b/DysonNetwork.Pass/Client/src/router/index.ts @@ -8,6 +8,11 @@ const router = createRouter({ name: 'index', component: () => import('../views/index.vue'), }, + { + path: '/captcha', + name: 'captcha', + component: () => import('../views/captcha.vue'), + } ], }) diff --git a/DysonNetwork.Pass/Client/src/views/captcha.vue b/DysonNetwork.Pass/Client/src/views/captcha.vue new file mode 100644 index 0000000..f30d490 --- /dev/null +++ b/DysonNetwork.Pass/Client/src/views/captcha.vue @@ -0,0 +1,98 @@ + + + diff --git a/DysonNetwork.Pass/DysonNetwork.Pass.csproj b/DysonNetwork.Pass/DysonNetwork.Pass.csproj index b2d23cc..872b9d3 100644 --- a/DysonNetwork.Pass/DysonNetwork.Pass.csproj +++ b/DysonNetwork.Pass/DysonNetwork.Pass.csproj @@ -149,6 +149,7 @@ + diff --git a/DysonNetwork.Pass/Pages/Data/CaptchaPageData.cs b/DysonNetwork.Pass/Pages/Data/CaptchaPageData.cs new file mode 100644 index 0000000..d9a382f --- /dev/null +++ b/DysonNetwork.Pass/Pages/Data/CaptchaPageData.cs @@ -0,0 +1,20 @@ +using DysonNetwork.Shared.PageData; + +namespace DysonNetwork.Pass.Pages.Data; + +public class CaptchaPageData(IConfiguration configuration) : IPageDataProvider +{ + public bool CanHandlePath(PathString path) => path == "/captcha"; + + public Task> GetAppDataAsync(HttpContext context) + { + var provider = configuration.GetSection("Captcha")["Provider"]?.ToLower(); + var apiKey = configuration.GetSection("Captcha")["ApiKey"]; + + return Task.FromResult>(new Dictionary + { + ["Provider"] = provider, + ["ApiKey"] = apiKey + }); + } +} \ No newline at end of file diff --git a/DysonNetwork.Pass/Program.cs b/DysonNetwork.Pass/Program.cs index e571f69..2b32e21 100644 --- a/DysonNetwork.Pass/Program.cs +++ b/DysonNetwork.Pass/Program.cs @@ -34,6 +34,7 @@ builder.Services.AddAppBusinessServices(builder.Configuration); builder.Services.AddAppScheduledJobs(); builder.Services.AddTransient(); +builder.Services.AddTransient(); var app = builder.Build(); diff --git a/DysonNetwork.Pass/Startup/ApplicationConfiguration.cs b/DysonNetwork.Pass/Startup/ApplicationConfiguration.cs index da69c11..d9fa82e 100644 --- a/DysonNetwork.Pass/Startup/ApplicationConfiguration.cs +++ b/DysonNetwork.Pass/Startup/ApplicationConfiguration.cs @@ -33,7 +33,6 @@ public static class ApplicationConfiguration app.UseWebSockets(); app.UseRateLimiter(); - app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); app.UseMiddleware(); diff --git a/DysonNetwork.Pusher/Startup/ApplicationConfiguration.cs b/DysonNetwork.Pusher/Startup/ApplicationConfiguration.cs index eacf9fa..7dc3f30 100644 --- a/DysonNetwork.Pusher/Startup/ApplicationConfiguration.cs +++ b/DysonNetwork.Pusher/Startup/ApplicationConfiguration.cs @@ -28,7 +28,6 @@ public static class ApplicationConfiguration app.UseWebSockets(); app.UseRateLimiter(); - app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); diff --git a/DysonNetwork.Shared/Proto/GrpcClientHelper.cs b/DysonNetwork.Shared/Proto/GrpcClientHelper.cs index 05b3213..172fe05 100644 --- a/DysonNetwork.Shared/Proto/GrpcClientHelper.cs +++ b/DysonNetwork.Shared/Proto/GrpcClientHelper.cs @@ -93,7 +93,7 @@ public static class GrpcClientHelper string? clientCertPassword = null ) { - var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.File"); + var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.Drive"); return new FileService.FileServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath, clientCertPassword)); } @@ -105,7 +105,7 @@ public static class GrpcClientHelper string? clientCertPassword = null ) { - var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.FileReference"); + var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.Drive"); return new FileReferenceService.FileReferenceServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath, clientCertPassword)); } diff --git a/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs b/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs index ee62b91..32a5e2b 100644 --- a/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs +++ b/DysonNetwork.Sphere/Startup/ApplicationConfiguration.cs @@ -31,7 +31,6 @@ public static class ApplicationConfiguration app.UseWebSockets(); app.UseRateLimiter(); - app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); app.UseMiddleware();