Skip to content

Commit

Permalink
update deps, fixes package control, workload packages too
Browse files Browse the repository at this point in the history
  • Loading branch information
0xF6 committed Aug 3, 2024
1 parent a71b5bf commit 9ae3433
Show file tree
Hide file tree
Showing 16 changed files with 298 additions and 354 deletions.
127 changes: 67 additions & 60 deletions registry.sln
Original file line number Diff line number Diff line change
@@ -1,60 +1,67 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.31903.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "core", "src\core.csproj", "{849C4D38-8366-49A8-96DA-A37866C4BFCB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vein", "vein", "{4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vein.common", "vein-lang\runtime\common\vein.common.csproj", "{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vein.project", "vein-lang\lib\projectsystem\vein.project.csproj", "{286ECD4A-748F-42C5-B7A6-97D561FE01A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vein.ast", "vein-lang\lib\ast\vein.ast.csproj", "{A608826A-8742-4C22-A34F-CB54E5361DAC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DD0CEB81-0426-403F-9FDB-531F3E5EC321}"
ProjectSection(SolutionItems) = preProject
.dockerignore = .dockerignore
.editorconfig = .editorconfig
.gcloudignore = .gcloudignore
.gitignore = .gitignore
.gitmodules = .gitmodules
Dockerfile = Dockerfile
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Release|Any CPU.Build.0 = Release|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Release|Any CPU.Build.0 = Release|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Release|Any CPU.Build.0 = Release|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F} = {4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}
{286ECD4A-748F-42C5-B7A6-97D561FE01A4} = {4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}
{A608826A-8742-4C22-A34F-CB54E5361DAC} = {4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FA44E4F3-7C78-47F7-9ECC-08293CE00B83}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.31903.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "core", "src\core.csproj", "{849C4D38-8366-49A8-96DA-A37866C4BFCB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vein", "vein", "{4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vein.common", "vein-lang\runtime\common\vein.common.csproj", "{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vein.project", "vein-lang\lib\projectsystem\vein.project.csproj", "{286ECD4A-748F-42C5-B7A6-97D561FE01A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vein.ast", "vein-lang\lib\ast\vein.ast.csproj", "{A608826A-8742-4C22-A34F-CB54E5361DAC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DD0CEB81-0426-403F-9FDB-531F3E5EC321}"
ProjectSection(SolutionItems) = preProject
.dockerignore = .dockerignore
.editorconfig = .editorconfig
.gcloudignore = .gcloudignore
.gitignore = .gitignore
.gitmodules = .gitmodules
Dockerfile = Dockerfile
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "capi", "vein-lang\lib\capi\capi.csproj", "{7D9F04CE-15B6-4990-AC3A-2B81775E09D7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{849C4D38-8366-49A8-96DA-A37866C4BFCB}.Release|Any CPU.Build.0 = Release|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F}.Release|Any CPU.Build.0 = Release|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{286ECD4A-748F-42C5-B7A6-97D561FE01A4}.Release|Any CPU.Build.0 = Release|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A608826A-8742-4C22-A34F-CB54E5361DAC}.Release|Any CPU.Build.0 = Release|Any CPU
{7D9F04CE-15B6-4990-AC3A-2B81775E09D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D9F04CE-15B6-4990-AC3A-2B81775E09D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D9F04CE-15B6-4990-AC3A-2B81775E09D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D9F04CE-15B6-4990-AC3A-2B81775E09D7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F6C95774-E75F-4DA8-99FA-F81DCE13C11F} = {4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}
{286ECD4A-748F-42C5-B7A6-97D561FE01A4} = {4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}
{A608826A-8742-4C22-A34F-CB54E5361DAC} = {4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}
{7D9F04CE-15B6-4990-AC3A-2B81775E09D7} = {4E1FB4B5-787A-4A10-B23C-08FF1F5DF8FE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FA44E4F3-7C78-47F7-9ECC-08293CE00B83}
EndGlobalSection
EndGlobal
4 changes: 3 additions & 1 deletion registry.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=firestore/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=firestore/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=prerelease/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=traceparent/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
var builder = WebApplication.CreateBuilder(args);

builder.WebHost
.UseUrls($"http://*.*.*.*:{Environment.GetEnvironmentVariable("PORT") ?? "8080"}");
.UseUrls($"http://*.*.*.*:{Environment.GetEnvironmentVariable("PORT") ?? "8080"}", "http://*.*.*.*:5062");
builder.WebHost.UseSentry(o =>
{
o.Dsn = Environment.GetEnvironmentVariable("VEIN_SENTRY_DNS") ?? "";
Expand Down
2 changes: 1 addition & 1 deletion src/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Development",
"GOOGLE_APPLICATION_CREDENTIALS": "C:\\git\\keys\\vein-lang.json"
},
"applicationUrl": "https://localhost:8080;http://localhost:5062",
"applicationUrl": "http://localhost:5062",
"dotnetRunMessages": true
},
"Docker": {
Expand Down
19 changes: 5 additions & 14 deletions src/controllers/MeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,17 @@ namespace core.controllers;

[Authorize]
[ApiController]
public class MeController : Controller
public class MeController(IUserService _userService, IPackageService packageService) : Controller
{
private readonly IUserService _userService;
private readonly IPackageService _packageService;

public MeController(IUserService _userService, IPackageService packageService)
{
this._userService = _userService;
this._packageService = packageService;
}

[HttpGet("@/me")]
public async Task<IActionResult> GetMe()
=> Json(await _userService.GetMeAsync());
public async Task<IActionResult> GetMe(CancellationToken token)
=> Json(await _userService.GetMeAsync(token));

[HttpGet("@/me/packages")]
public async Task<IActionResult> GetMePackages(CancellationToken token)
{
var me = await _userService.GetMeAsync();
var packages = await _packageService.GetLatestPackagesByUserAsync(me, token);
var me = await _userService.GetMeAsync(token);
var packages = await packageService.GetLatestPackagesByUserAsync(me, token);
return Json(packages);
}

Expand Down
37 changes: 17 additions & 20 deletions src/controllers/PackageContentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,23 @@ namespace core.controllers;

[AllowAnonymous]
[ApiController]
public class PackageContentController : Controller
public class PackageContentController(
IPackageContentService content,
MarkdownService markdownService,
IMemoryCache cache)
: Controller
{
private readonly IPackageContentService _content;
private readonly MarkdownService _markdownService;
private readonly IMemoryCache _cache;

public PackageContentController(IPackageContentService content, MarkdownService markdownService, IMemoryCache cache)
=> (_content, _markdownService, _cache) = (content, markdownService, cache);

[HttpGet("@/packages/{id}/version.json")]
public async Task<ActionResult<PackageVersionsResponse>> GetPackageVersionsAsync(string id, CancellationToken cancellationToken)
{
if (_cache.TryGetValue($"@/packages/{id}/version.json", out PackageVersionsResponse resut))
return Json(resut);
if (cache.TryGetValue($"@/packages/{id}/version.json", out PackageVersionsResponse result))
return Json(result);

var versions = await _content.GetPackageVersionsOrNullAsync(id, cancellationToken);
var versions = await content.GetPackageVersionsOrNullAsync(id, cancellationToken);
if (versions == null)
return NotFound();

_cache.Set($"@/packages/{id}/version.json", versions, TimeSpan.FromMinutes(15));
cache.Set($"@/packages/{id}/version.json", versions, TimeSpan.FromMinutes(15));

return Json(versions);
}
Expand All @@ -42,7 +39,7 @@ public async Task<IActionResult> DownloadPackageAsync(string id, string version,
not null => NuGetVersion.Parse(version)
};

var packageStream = await _content.GetPackageContentStreamOrNullAsync(id, ver, cancellationToken);
var packageStream = await content.GetPackageContentStreamOrNullAsync(id, ver, cancellationToken);
if (packageStream == null)
return NotFound();

Expand All @@ -59,7 +56,7 @@ public async Task<IActionResult> DownloadVeinSpecAsync(string id, string version
not null => NuGetVersion.Parse(version)
};

var nuspecStream = await _content.GetPackageManifestStreamOrNullAsync(id, ver, cancellationToken);
var nuspecStream = await content.GetPackageManifestStreamOrNullAsync(id, ver, cancellationToken);
if (nuspecStream == null)
return NotFound();

Expand All @@ -69,16 +66,16 @@ public async Task<IActionResult> DownloadVeinSpecAsync(string id, string version
[HttpGet("@/packages/{id}/{version}/readme")]
public async Task<IActionResult> DownloadReadmeAsync(string id, string version, CancellationToken cancellationToken)
{
if (_cache.TryGetValue($"@/packages/{id}/{version}/readme", out string md))
return Content(_markdownService.GetHtmlFromMarkdown(md).Content, "text/html");
if (cache.TryGetValue($"@/packages/{id}/{version}/readme", out string md))
return Content(markdownService.GetHtmlFromMarkdown(md).Content, "text/html");
var ver = version switch
{
"latest" or null => new (0, 0, 0, 0, "", "latest"),
"next" => new (0, 0, 0, 0, "", "next"),
not null => NuGetVersion.Parse(version)
};

var readmeStream = await _content.GetPackageReadmeStreamOrNullAsync(id, ver, cancellationToken);
var readmeStream = await content.GetPackageReadmeStreamOrNullAsync(id, ver, cancellationToken);

if (readmeStream == null)
return NotFound();
Expand All @@ -87,10 +84,10 @@ public async Task<IActionResult> DownloadReadmeAsync(string id, string version,

var result = await reader.ReadToEndAsync(cancellationToken);

_cache.Set($"@/packages/{id}/{version}/readme", result,
cache.Set($"@/packages/{id}/{version}/readme", result,
ver.HasMetadata ? TimeSpan.FromMinutes(15) : TimeSpan.FromHours(6));

return Content(_markdownService.GetHtmlFromMarkdown(result).Content, "text/html");
return Content(markdownService.GetHtmlFromMarkdown(result).Content, "text/html");
}

[HttpGet("@/packages/{id}/{version}/icon")]
Expand All @@ -103,7 +100,7 @@ public async Task<IActionResult> DownloadIconAsync(string id, string version, Ca
not null => NuGetVersion.Parse(version)
};

var iconStream = await _content.GetPackageIconStreamOrNullAsync(id, ver, cancellationToken);
var iconStream = await content.GetPackageIconStreamOrNullAsync(id, ver, cancellationToken);
if (iconStream == null)
return NotFound();
return File(iconStream, "image/png");
Expand Down
Loading

0 comments on commit 9ae3433

Please sign in to comment.