Skip to content

Commit

Permalink
extended localhost list
Browse files Browse the repository at this point in the history
  • Loading branch information
shukriadams committed Jan 31, 2025
1 parent f5e1fb5 commit cc15b81
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Tetrifact.Web/Controllers/ArchivesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ public ActionResult GetArchive(string packageId, [FromQuery(Name = "ticket")] st
if (!_indexReader.PackageExists(packageId))
throw new PackageNotFoundException(packageId);

string[] localhosts = new string[] {
"localhost",
"127.0.0.1",
"0.0.0.0"
};

// enforce ticket if queue enabled
RequestHeaders headers = Request.GetTypedHeaders();
bool isLocal = headers.Host.Host.ToLower() == "localhost";
bool isLocal = localhosts.Contains(headers.Host.Host.ToLower());

// local (this website) downloads always allowed.
if (!isLocal && _settings.MaximumSimultaneousDownloads.HasValue)
Expand Down

0 comments on commit cc15b81

Please sign in to comment.