File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ int projectId
184184 }
185185
186186 // If the game is Minecraft Bedrock, we do an additional check if MCPEDL has the mod available through a slug lookup.
187- if ( mod . GameId == 78022 )
187+ if ( mod . GameId == 78022 && mod . AllowModDistribution . HasValue && mod . AllowModDistribution . Value )
188188 {
189189 var client = httpClientFactory . CreateClient ( ) ;
190190 client . DefaultRequestHeaders . TryAddWithoutValidation ( "User-Agent" , "CFLookup Discord Bot/1.0; (+cflookup@itssimple.se)" ) ;
Original file line number Diff line number Diff line change 33@using Microsoft .AspNetCore .Html
44@using Microsoft .AspNetCore .Http .Extensions
55@using Newtonsoft .Json
6+ @inject IHttpClientFactory httpClientFactory
67@model IndexModel
78@{
89 ViewData [" Title" ] = " What?" ;
3738 {
3839 foundLinks .Add (" Source" , Model .FoundMod .Links .SourceUrl );
3940 }
41+
42+ // If the game is Minecraft Bedrock, we do an additional check if MCPEDL has the mod available through a slug lookup.
43+ if (Model .FoundMod .GameId == 78022 && Model .FoundMod .AllowModDistribution .HasValue && Model .FoundMod .AllowModDistribution .Value )
44+ {
45+ var client = httpClientFactory .CreateClient ();
46+ client .DefaultRequestHeaders .TryAddWithoutValidation (" User-Agent" , " CFLookup Discord Bot/1.0; (+cflookup@itssimple.se)" );
47+ client .BaseAddress = new Uri (" https://mcpedl.com/" );
48+
49+ var res = await client .GetAsync (Model .FoundMod .Slug );
50+
51+ if (res != null && res .IsSuccessStatusCode && ! res .RequestMessage ! .RequestUri ! .ToString ().Contains (" notfound" ))
52+ {
53+ foundLinks .Add (" MCPEDL" , $" https://mcpedl.com/{Model .FoundMod .Slug }" );
54+ }
55+ }
4056 }
4157}
4258
You can’t perform that action at this time.
0 commit comments