Compare commits
No commits in common. "main" and "1.0.0" have entirely different histories.
79 changed files with 759 additions and 2532 deletions
22
.gitignore
vendored
22
.gitignore
vendored
|
|
@ -1,8 +1,24 @@
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
bin/
|
/src/isnd/bin/
|
||||||
obj/
|
/src/isnd/obj/
|
||||||
|
/src/isn/obj
|
||||||
|
/src/isn/bin
|
||||||
|
/src/isn/.vscode/
|
||||||
|
/test/isnd.tests/obj/
|
||||||
|
/test/isnd.tests/bin/
|
||||||
|
/packages/
|
||||||
bower_components/
|
bower_components/
|
||||||
appsettings.*.json
|
/test/isn.tests/bin
|
||||||
|
/test/isn.tests/obj/
|
||||||
|
appsettings.Testing.json
|
||||||
|
appsettings.Development.json
|
||||||
|
/wwwroot/.sass-cache/
|
||||||
|
/src/isnd/wwwroot/.sass-cache/
|
||||||
|
/src/isn.abst/bin
|
||||||
|
/src/isn.abst/obj
|
||||||
|
/src/isnd/packages/
|
||||||
|
/test/data/test-isn/bin/
|
||||||
|
/test/data/test-isn/obj
|
||||||
.fake
|
.fake
|
||||||
/artifacts/
|
/artifacts/
|
||||||
/.vs/
|
/.vs/
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<Project>
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
|
||||||
<IsPackable>true</IsPackable>
|
|
||||||
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
|
||||||
<Version>1.0.8</Version>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<UserSecretsId>85fd766d-5d23-4476-aed1-463b2942e86a</UserSecretsId>
|
|
||||||
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
||||||
5
GitVersion.yml
Normal file
5
GitVersion.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
mode: Mainline
|
||||||
|
branches: {}
|
||||||
|
ignore:
|
||||||
|
sha: []
|
||||||
|
merge-message-formats: {}
|
||||||
17
README.md
17
README.md
|
|
@ -12,7 +12,7 @@ isnd&
|
||||||
|
|
||||||
# get an api-key from <http://localhost:5000/ApkKeys>
|
# get an api-key from <http://localhost:5000/ApkKeys>
|
||||||
|
|
||||||
isn push -k <lame-api-key> -s http://localhost:5000/api/v3/index.json your-lame-versionned.nupkg
|
isn push -k <lame-api-key> -s http://localhost:5000/index.json your-lame-versionned.nupkg
|
||||||
wget http://localhost:5000/package/index.json?q=your&prerelease=true&semVerLevel=2.0.0
|
wget http://localhost:5000/package/index.json?q=your&prerelease=true&semVerLevel=2.0.0
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
@ -55,8 +55,8 @@ sudo systemctl enable isnd
|
||||||
|
|
||||||
````bash
|
````bash
|
||||||
sudo mkdir /usr/local/lib/isn
|
sudo mkdir /usr/local/lib/isn
|
||||||
sudo cp -a src/isn/bin/Release/net10.0/* /usr/local/lib/isn
|
sudo cp -a src/isn/bin/Release/net6.0/* /usr/local/lib/isn
|
||||||
sudo chown -R root:root /usr/local/lib/isn
|
sudo chown -R root.root /usr/local/lib/isn
|
||||||
sudo ln -s /usr/local/lib/isn/isn /usr/local/bin/isn
|
sudo ln -s /usr/local/lib/isn/isn /usr/local/bin/isn
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
@ -66,15 +66,12 @@ sudo ln -s /usr/local/lib/isn/isn /usr/local/bin/isn
|
||||||
set -e
|
set -e
|
||||||
# compiler tout
|
# compiler tout
|
||||||
dotnet build -c Release
|
dotnet build -c Release
|
||||||
# publier
|
dotnet publish -c Release -f net7.0 src/isnd
|
||||||
dotnet publish -c Release src/isnd
|
|
||||||
dotnet publish -c Release src/isn
|
|
||||||
|
|
||||||
# MAJ du serveur
|
# MAJ du serveur
|
||||||
sudo systemctl stop isnd
|
sudo systemctl stop isnd
|
||||||
sudo cp -a src/isnd/bin/Release/net10.0/publish/* /srv/www/isnd
|
sudo cp -a src/isnd/bin/Release/net7.0/publish/* /srv/www/isnd
|
||||||
sudo systemctl start isnd
|
sudo systemctl start isnd
|
||||||
# MAJ du client
|
# MAJ du client
|
||||||
sudo cp -a src/isn/bin/Release/net10.0/* /usr/local/lib/isn
|
sudo cp -a src/isn/bin/Release/net7.0/* /usr/local/lib/isn
|
||||||
sudo chown -R root:root /usr/local/lib/isn
|
sudo chown -R root.root /usr/local/lib/isn
|
||||||
````
|
````
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
nuget install -Verbosity detailed -Source http://localhost:5000/index.json -Prerelease Yavsc.Abstract
|
||||||
|
nuget locals all -clear
|
||||||
4
contrib/testinstnuget/urls.adoc
Normal file
4
contrib/testinstnuget/urls.adoc
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
= URL's
|
||||||
|
|
||||||
|
<http://localhost:5000/v3.4.0/registration/yavsc.abstract/index.json>
|
||||||
|
|
||||||
|
|
@ -3,14 +3,11 @@ set -e
|
||||||
|
|
||||||
# compiler tout
|
# compiler tout
|
||||||
dotnet build -c Release
|
dotnet build -c Release
|
||||||
dotnet publish -c Release src/isnd
|
dotnet publish -c Release -f netcoreapp2.1 src/isnd
|
||||||
dotnet publish -c Release src/isn
|
|
||||||
# MAJ du serveur
|
# MAJ du serveur
|
||||||
sudo systemctl stop isnd
|
sudo systemctl stop isnd
|
||||||
sudo cp -a src/isnd/bin/Release/net10.0/publish/* /srv/www/isnd
|
sudo cp -a src/isnd/bin/Release/netcoreapp2.1/publish/* /srv/www/isnd
|
||||||
sudo systemctl start isnd
|
sudo systemctl start isnd
|
||||||
# MAJ du client
|
# MAJ du client
|
||||||
sudo cp -a src/isn/bin/Release/net10.0/* /usr/local/lib/isn
|
sudo cp -a src/isn/bin/Release/netcoreapp2.1/* /usr/local/lib/isn
|
||||||
sudo chown -R root:root /usr/local/lib/isn
|
sudo chown -R root.root /usr/local/lib/isn
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
202
isn.sln
202
isn.sln
|
|
@ -1,101 +1,101 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.6.30114.105
|
VisualStudioVersion = 16.6.30114.105
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3C312E42-9A47-4BED-8265-A405FCA6AFFF}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3C312E42-9A47-4BED-8265-A405FCA6AFFF}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isnd.tests", "test\isnd.tests\isnd.tests.csproj", "{9D758F00-17FF-433D-B088-F9C2D97C9BD1}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isnd.tests", "test\isnd.tests\isnd.tests.csproj", "{9D758F00-17FF-433D-B088-F9C2D97C9BD1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8A2DF68-847A-4D88-B002-64FB666F696C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8A2DF68-847A-4D88-B002-64FB666F696C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isnd", "src\isnd\isnd.csproj", "{468DB0E4-6221-4E01-BEFF-F452865E59C1}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isnd", "src\isnd\isnd.csproj", "{468DB0E4-6221-4E01-BEFF-F452865E59C1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn", "src\isn\isn.csproj", "{910E800A-59AE-46C4-B7C7-879986179246}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn", "src\isn\isn.csproj", "{910E800A-59AE-46C4-B7C7-879986179246}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.tests", "test\isn.tests\isn.tests.csproj", "{305F640E-11BA-44F9-95E0-C6882E9CD151}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.tests", "test\isn.tests\isn.tests.csproj", "{305F640E-11BA-44F9-95E0-C6882E9CD151}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.abstract", "src\isn.abstract\isn.abstract.csproj", "{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.abst", "src\isn.abst\isn.abst.csproj", "{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
HideSolutionNode = FALSE
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
EndGlobalSection
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.Build.0 = Debug|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.Build.0 = Debug|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.ActiveCfg = Release|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.Build.0 = Release|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.ActiveCfg = Release|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.Build.0 = Release|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.Build.0 = Debug|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.Build.0 = Debug|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.Build.0 = Release|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.ActiveCfg = Release|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.Build.0 = Release|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.ActiveCfg = Release|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.Build.0 = Release|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x64.Build.0 = Debug|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x86.Build.0 = Debug|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|Any CPU.Build.0 = Release|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x64.ActiveCfg = Release|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x64.Build.0 = Release|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x86.ActiveCfg = Release|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x86.Build.0 = Release|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x64.Build.0 = Debug|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x86.Build.0 = Debug|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|Any CPU.Build.0 = Release|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x64.ActiveCfg = Release|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x64.Build.0 = Release|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.ActiveCfg = Release|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.Build.0 = Release|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Debug|x64.Build.0 = Debug|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Debug|x86.Build.0 = Debug|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Release|x64.ActiveCfg = Release|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Release|x64.Build.0 = Release|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Release|x86.ActiveCfg = Release|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2}.Release|x86.Build.0 = Release|Any CPU
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
EndGlobalSection
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x64.Build.0 = Release|Any CPU
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
HideSolutionNode = FALSE
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF}
|
{9D758F00-17FF-433D-B088-F9C2D97C9BD1} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF}
|
||||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
{468DB0E4-6221-4E01-BEFF-F452865E59C1} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
||||||
{910E800A-59AE-46C4-B7C7-879986179246} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
{910E800A-59AE-46C4-B7C7-879986179246} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
||||||
{305F640E-11BA-44F9-95E0-C6882E9CD151} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF}
|
{305F640E-11BA-44F9-95E0-C6882E9CD151} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF}
|
||||||
{F0671F01-ADD7-47A6-8A29-1AAC8565DBE2} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<Project>
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
|
||||||
<IsPackable>true</IsPackable>
|
|
||||||
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
|
||||||
<Version>1.0.8</Version>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<UserSecretsId>85fd766d-5d23-4476-aed1-463b2942e86a</UserSecretsId>
|
|
||||||
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
using isn.abst;
|
||||||
|
|
||||||
using Isn.Abstract;
|
|
||||||
|
|
||||||
namespace isnd.Entities
|
namespace isnd.Entities
|
||||||
{
|
{
|
||||||
|
|
@ -18,5 +16,6 @@ namespace isnd.Entities
|
||||||
public const string CatalogLeaf = "catalog-leaf";
|
public const string CatalogLeaf = "catalog-leaf";
|
||||||
public const string Delete = "delete";
|
public const string Delete = "delete";
|
||||||
public const string Registration = "registration";
|
public const string Registration = "registration";
|
||||||
|
internal const string GetNuspec = Constants.SpecFileEstension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using isnd.Data.Catalog;
|
using isnd.Data.Catalog;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Isn.Abstract
|
namespace isn.Abstract
|
||||||
{
|
{
|
||||||
public class ApiIndexViewModel : HappyIdOwner
|
public class ApiIndexViewModel : HappyIdOwner
|
||||||
{
|
{
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
namespace Isn.Abstract
|
namespace isn.abst
|
||||||
{
|
{
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
public const string PaquetFileEstension = "nupkg";
|
public const string PaquetFileEstension = "nupkg";
|
||||||
public const string SpecFileEstension = "nuspec";
|
public const string SpecFileEstension = "nuspec";
|
||||||
public const string JsonFileEstension = "json";
|
public const string JsonFileEstension = "json";
|
||||||
|
public const string PackageRootServerPrefix = "~/pkgs/";
|
||||||
/**
|
|
||||||
* The prefix for API routes.
|
|
||||||
*/
|
|
||||||
public const string APIPrefix = "api/v3/";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using isnd.Data.Catalog;
|
using isnd.Data.Catalog;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Isn.Abstract
|
namespace isn.Abstract
|
||||||
{
|
{
|
||||||
public class Resource : HappyIdOwner
|
public class Resource : HappyIdOwner
|
||||||
{
|
{
|
||||||
15
src/isn.abst/isn.abst.csproj
Normal file
15
src/isn.abst/isn.abst.csproj
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<PackageVersion>1.0.1</PackageVersion>
|
||||||
|
<Version>1.0.7</Version>
|
||||||
|
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||||
|
<NoWarn>NETSDK1138</NoWarn>
|
||||||
|
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||||
|
<FileVersion>1.0.7.0</FileVersion>
|
||||||
|
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" Version="4.0.0.0"/>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<IsPackable>true</IsPackable>
|
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
|
||||||
<InformationalVersion>1.0.0+Branch.main.Sha.654065d7fef34ba4ed2fb3bca5bc91de9ad16e85</InformationalVersion>
|
|
||||||
<Version>1.0.0</Version>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" Version="4.0.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
internal static class Constants
|
internal static class Constants
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public interface IDataProtector
|
public interface IDataProtector
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public class IsnSourceSettings
|
public class IsnSourceSettings
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public class IsndErrorMessage
|
public class IsndErrorMessage
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@ using System.Linq;
|
||||||
using Mono.Options;
|
using Mono.Options;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public partial class Program
|
public partial class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
public static void LoadConfig()
|
public static void LoadConfig()
|
||||||
{
|
{
|
||||||
FileInfo cfgSettingIf = new FileInfo(ConfigFileName);
|
FileInfo cfgSettingIf = new FileInfo(_configFileName);
|
||||||
if (cfgSettingIf.Exists)
|
if (cfgSettingIf.Exists)
|
||||||
{
|
{
|
||||||
var json = File.ReadAllText(cfgSettingIf.FullName);
|
var json = File.ReadAllText(cfgSettingIf.FullName);
|
||||||
|
|
@ -29,13 +29,12 @@ namespace Isn
|
||||||
{ "h|help", "show this message and exit", h => shouldShowPushHelp = h != null },
|
{ "h|help", "show this message and exit", h => shouldShowPushHelp = h != null },
|
||||||
};
|
};
|
||||||
|
|
||||||
private static string ConfigDirectory =>
|
private static readonly string _configFileName =
|
||||||
Environment.GetEnvironmentVariable("ISN_CONFIG_DIR")
|
Path.Combine(
|
||||||
?? Path.Combine(
|
Path.Combine(Environment.GetFolderPath(
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
Environment.SpecialFolder.UserProfile), ".isn"),
|
||||||
".isn");
|
"config.json")
|
||||||
|
;
|
||||||
private static string ConfigFileName => Path.Combine(ConfigDirectory, "config.json");
|
|
||||||
|
|
||||||
public const string push = "push";
|
public const string push = "push";
|
||||||
static readonly OptionSet options = new OptionSet {
|
static readonly OptionSet options = new OptionSet {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public class SourceSettings
|
public class SourceSettings
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Isn.Abstract;
|
using isn.Abstract;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public static class SourceHelpers
|
public static class SourceHelpers
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public static class UploadFilesToServerUsingHttpClient
|
public static class UploadFilesToServerUsingHttpClient
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
|
|
||||||
public class UploadFilesToServerUsingWebRequest
|
public class UploadFilesToServerUsingWebRequest
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public static class PushCommand
|
public static class PushCommand
|
||||||
{
|
{
|
||||||
|
|
@ -18,8 +18,6 @@ namespace Isn
|
||||||
source = Program.Settings.Sources.First(s=>s.Value.Alias==source).Key;
|
source = Program.Settings.Sources.First(s=>s.Value.Alias==source).Key;
|
||||||
if (source==null) throw new InvalidOperationException("source is invalid");
|
if (source==null) throw new InvalidOperationException("source is invalid");
|
||||||
|
|
||||||
var resolvedApiKey = string.IsNullOrWhiteSpace(apikey) ? ResolveSourceApiKey(source) : apikey;
|
|
||||||
|
|
||||||
var resources = SourceHelpers.GetServerResources(source);
|
var resources = SourceHelpers.GetServerResources(source);
|
||||||
if (resources.Resources == null)
|
if (resources.Resources == null)
|
||||||
throw new InvalidOperationException("source gave no resource");
|
throw new InvalidOperationException("source gave no resource");
|
||||||
|
|
@ -40,7 +38,7 @@ namespace Isn
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine("Connecting to "+ pubRes.Id);
|
Console.WriteLine("Connecting to "+ pubRes.Id);
|
||||||
return client.UploadFilesToServer(new Uri(pubRes.Id), fi, resolvedApiKey);
|
return client.UploadFilesToServer(new Uri(pubRes.Id), fi, apikey);
|
||||||
}
|
}
|
||||||
catch (HttpRequestException hrex)
|
catch (HttpRequestException hrex)
|
||||||
{
|
{
|
||||||
|
|
@ -66,25 +64,5 @@ namespace Isn
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ResolveSourceApiKey(string source)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(source))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Program.Settings.Sources.Values.Any(s => s.Alias == source))
|
|
||||||
{
|
|
||||||
source = Program.Settings.Sources.First(s => s.Value.Alias == source).Key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Program.Settings.Sources.TryGetValue(source, out var sourceSettings))
|
|
||||||
{
|
|
||||||
return sourceSettings.GetClearApiKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
|
|
||||||
partial class Program
|
partial class Program
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using System.IO;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
|
|
||||||
partial class Program
|
partial class Program
|
||||||
|
|
@ -61,7 +61,7 @@ namespace Isn
|
||||||
}
|
}
|
||||||
public static void SaveConfig()
|
public static void SaveConfig()
|
||||||
{
|
{
|
||||||
FileInfo cfgSettingIf = new FileInfo(ConfigFileName);
|
FileInfo cfgSettingIf = new FileInfo(_configFileName);
|
||||||
if (!cfgSettingIf.Directory.Exists) cfgSettingIf.Directory.Create();
|
if (!cfgSettingIf.Directory.Exists) cfgSettingIf.Directory.Create();
|
||||||
File.WriteAllText(
|
File.WriteAllText(
|
||||||
cfgSettingIf.FullName,
|
cfgSettingIf.FullName,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
|
|
||||||
partial class Program
|
partial class Program
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
|
|
||||||
partial class Program
|
partial class Program
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
partial class Program
|
partial class Program
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
|
|
||||||
partial class Program
|
partial class Program
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,25 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||||
<RootNamespace>nuget_cli</RootNamespace>
|
<RootNamespace>nuget_cli</RootNamespace>
|
||||||
|
<UserSecretsId>45b74c62-05bc-4603-95b4-3e80ae2fdf50</UserSecretsId>
|
||||||
|
<Version>1.0.7</Version>
|
||||||
|
<PackageVersion>1.0.1</PackageVersion>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
|
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
||||||
<IsTool>true</IsTool>
|
<IsTool>true</IsTool>
|
||||||
<NoWarn>NETSDK1138</NoWarn>
|
<NoWarn>NETSDK1138</NoWarn>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
<FileVersion>1.0.7.0</FileVersion>
|
||||||
<InformationalVersion>1.0.0+Branch.main.Sha.654065d7fef34ba4ed2fb3bca5bc91de9ad16e85</InformationalVersion>
|
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||||
<Version>1.0.0</Version>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="GitVersion.MsBuild" Version="6.8.1">
|
<PackageReference Include="Mono.Options" Version="5.3.0" />
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PackageReference Include="unleash.client" Version="1.6.1" />
|
||||||
</PackageReference>
|
<Reference Include="System.Net.Http" Version="4.0.0" />
|
||||||
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
|
<PackageReference Include="GitVersion.MsBuild" Version="5.6.10*" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<ProjectReference Include="../isn.abst/isn.abst.csproj" />
|
||||||
<PackageReference Include="unleash.client" Version="6.2.1" />
|
|
||||||
<Reference Include="System.Net.Http" Version="4.0.0.0" />
|
|
||||||
<ProjectReference Include="..\isn.abstract\isn.abstract.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Isn
|
namespace isn
|
||||||
{
|
{
|
||||||
public class PushReport
|
public class PushReport
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,22 +29,14 @@ namespace isnd.Controllers
|
||||||
IAuthenticationSchemeProvider schemeProvider,
|
IAuthenticationSchemeProvider schemeProvider,
|
||||||
SignInManager<ApplicationUser> signInManager,
|
SignInManager<ApplicationUser> signInManager,
|
||||||
UserManager<ApplicationUser> userManager,
|
UserManager<ApplicationUser> userManager,
|
||||||
IOptions<AdminStartupList> startupAdminListConfig,
|
IOptions<AdminStartupList> startupAdminListConfig )
|
||||||
RoleManager<IdentityRole> roleManager
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
_schemeProvider = schemeProvider;
|
_schemeProvider = schemeProvider;
|
||||||
_signInManager = signInManager;
|
_signInManager = signInManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_startupAdminList = startupAdminListConfig.Value;
|
_startupAdminList = startupAdminListConfig.Value;
|
||||||
var roles = roleManager.Roles.ToList();
|
|
||||||
if (!roles.Any(r => r.Name == IsndConstants.AdministratorRoleName))
|
|
||||||
{
|
|
||||||
var role = new IdentityRole(IsndConstants.AdministratorRoleName);
|
|
||||||
roleManager.CreateAsync(role).GetAwaiter().GetResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entry point into the login workflow
|
/// Entry point into the login workflow
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -248,10 +240,10 @@ namespace isnd.Controllers
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<IActionResult> GetAdminrole()
|
public async Task<IActionResult> GetAdminrole()
|
||||||
{
|
{
|
||||||
string userEmail = User.FindFirstValue(ClaimTypes.Email);
|
string username = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
if (_startupAdminList.Users.Contains(userEmail))
|
if (_startupAdminList.Users.Contains(username))
|
||||||
{
|
{
|
||||||
var user = await _userManager.FindByEmailAsync(userEmail);
|
var user = await _userManager.FindByNameAsync(username);
|
||||||
var roles = await _userManager.GetRolesAsync(user);
|
var roles = await _userManager.GetRolesAsync(user);
|
||||||
if (!roles.Contains(IsndConstants.AdministratorRoleName))
|
if (!roles.Contains(IsndConstants.AdministratorRoleName))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ namespace isnd.Controllers
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
ApiKey newKey = new ApiKey { UserId = userid, Name = model.Name,
|
ApiKey newKey = new ApiKey { UserId = userid, Name = model.Name,
|
||||||
CreationDate = DateTime.UtcNow };
|
CreationDate = DateTime.Now };
|
||||||
_ = dbContext.ApiKeys.Add(newKey);
|
_ = dbContext.ApiKeys.Add(newKey);
|
||||||
_ = await dbContext.SaveChangesAsync();
|
_ = await dbContext.SaveChangesAsync();
|
||||||
return View("Details", new DetailModel { Name = newKey.Name,
|
return View("Details", new DetailModel { Name = newKey.Name,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using isnd.ViewModels;
|
using isnd.ViewModels;
|
||||||
|
using Unleash;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Isn.Abstract;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -13,33 +16,31 @@ namespace isnd.Controllers
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _dbContext;
|
private readonly ApplicationDbContext _dbContext;
|
||||||
|
private readonly IUnleash _unleashĈlient;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Home controller ctor
|
/// Home controller ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dbContext"></param>
|
/// <param name="dbContext"></param>
|
||||||
|
/// <param name="unleashĈlient"></param>
|
||||||
|
|
||||||
public HomeController(
|
public HomeController(
|
||||||
ApplicationDbContext dbContext)
|
ApplicationDbContext dbContext,
|
||||||
|
IUnleash unleashĈlient)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
|
_unleashĈlient = unleashĈlient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Index
|
|
||||||
*/
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View(new HomeIndexViewModel
|
return View(new HomeIndexViewModel{
|
||||||
{
|
|
||||||
PkgCount = _dbContext.Packages
|
PkgCount = _dbContext.Packages
|
||||||
.Where(p => p.Versions.Count > 0)
|
.Where(p => p.Versions.Count > 0)
|
||||||
.Count()
|
.Count(),
|
||||||
});
|
UnleashClient = _unleashĈlient
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* About
|
|
||||||
*/
|
|
||||||
public IActionResult About()
|
public IActionResult About()
|
||||||
{
|
{
|
||||||
ViewData["Message"] = "Your application description page.";
|
ViewData["Message"] = "Your application description page.";
|
||||||
|
|
@ -47,24 +48,18 @@ namespace isnd.Controllers
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Contact
|
|
||||||
*/
|
|
||||||
public IActionResult Contact()
|
public IActionResult Contact()
|
||||||
{
|
{
|
||||||
ViewData["Message"] = "Your contact page.";
|
ViewData["Message"] = "Your contact page.";
|
||||||
var ass = typeof(Resource).GetType().Assembly;
|
var ass = typeof(isn.Abstract.Resource).GetType().Assembly;
|
||||||
var attrs = ass.GetCustomAttributes(true);
|
var attrs = ass.GetCustomAttributes(true);
|
||||||
// ass.GetCustomAttributes(true);
|
// ass.GetCustomAttributes(true);
|
||||||
System.Reflection.AssemblyFileVersionAttribute v = (AssemblyFileVersionAttribute)
|
System.Reflection.AssemblyFileVersionAttribute v = (AssemblyFileVersionAttribute)
|
||||||
GetType().Assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute));
|
GetType().Assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute));
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Privacy
|
|
||||||
*/
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
ViewData["Message"] = "Your Privacy page.";
|
ViewData["Message"] = "Your Privacy page.";
|
||||||
|
|
@ -72,9 +67,6 @@ namespace isnd.Controllers
|
||||||
return View(ViewData);
|
return View(ViewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Error
|
|
||||||
*/
|
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using isnd.Services;
|
|
||||||
using isnd.Interfaces;
|
|
||||||
using System.Linq;
|
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
using Isn.Abstract;
|
using isnd.Services;
|
||||||
|
using isn.Abstract;
|
||||||
|
using isn.abst;
|
||||||
|
using isnd.Interfaces;
|
||||||
|
using Unleash;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -19,17 +22,18 @@ namespace isnd.Controllers
|
||||||
/// Api Controller Constructor
|
/// Api Controller Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pm"></param>
|
/// <param name="pm"></param>
|
||||||
public ApiController(IPackageManager pm)
|
/// <param name="unleashĈlient"></param>
|
||||||
|
public ApiController(IPackageManager pm, IUnleash unleashĈlient)
|
||||||
{
|
{
|
||||||
packageManager = pm;
|
packageManager = pm;
|
||||||
resources = packageManager.GetResources().ToArray();
|
resources = packageManager.GetResources(unleashĈlient).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// API index
|
/// API index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.IndexDotJson)]
|
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.IndexDotJson)]
|
||||||
public IActionResult ApiIndex()
|
public IActionResult ApiIndex()
|
||||||
{
|
{
|
||||||
return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl + ApiConfig.IndexDotJson){ Version = PackageManager.BASE_API_LEVEL, Resources = resources });
|
return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl + ApiConfig.IndexDotJson){ Version = PackageManager.BASE_API_LEVEL, Resources = resources });
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using isnd.Services;
|
using isnd.Services;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -9,7 +9,7 @@ namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
// GET /autocomplete?id=isn.protocol&prerelease=true
|
// GET /autocomplete?id=isn.protocol&prerelease=true
|
||||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.AutoComplete)]
|
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.AutoComplete)]
|
||||||
public IActionResult AutoComplete(
|
public IActionResult AutoComplete(
|
||||||
string id,
|
string id,
|
||||||
string semVerLevel,
|
string semVerLevel,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
|
using System.Data.Common;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using isnd.Services;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Isn.Abstract;
|
using System.Collections.Generic;
|
||||||
|
using NuGet.Versioning;
|
||||||
|
using isnd.Data.Packages.Catalog;
|
||||||
|
using isnd.Data.Catalog;
|
||||||
|
using isn.abst;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -9,14 +16,14 @@ namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
// https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning
|
// https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning
|
||||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.Catalog)]
|
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.Catalog)]
|
||||||
public async Task<IActionResult> CatalogIndex()
|
public async Task<IActionResult> CatalogIndex()
|
||||||
{
|
{
|
||||||
return Ok(await packageManager.GetCatalogIndexAsync());
|
return Ok(await packageManager.GetCatalogIndexAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("~/" + Constants.APIPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")]
|
[HttpGet(Constants.PackageRootServerPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")]
|
||||||
public async Task<IActionResult> CatalogRegistration(string apiVersion, string id, string lower)
|
public async Task<IActionResult> CatalogRegistration(string apiVersion, string id, string lower)
|
||||||
{
|
{
|
||||||
if (lower.Equals("index", System.StringComparison.InvariantCultureIgnoreCase))
|
if (lower.Equals("index", System.StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ using isnd.Entities;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using isnd.Attributes;
|
using isnd.Attributes;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
public partial class PackagesController
|
public partial class PackagesController
|
||||||
{
|
{
|
||||||
[HttpDelete("~/" + Constants.APIPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")]
|
[HttpDelete(Constants.PackageRootServerPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")]
|
||||||
public async Task<IActionResult> ApiDelete(
|
public async Task<IActionResult> ApiDelete(
|
||||||
[FromRoute][SafeName][Required] string id,
|
[FromRoute][SafeName][Required] string id,
|
||||||
[FromRoute][SafeName][Required] string lower,
|
[FromRoute][SafeName][Required] string lower,
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,22 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Isn.Abstract;
|
|
||||||
using isnd.Entities;
|
|
||||||
using isnd.Attributes;
|
using isnd.Attributes;
|
||||||
|
using isnd.Entities;
|
||||||
|
using isn.abst;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class PackagesController
|
public partial class PackagesController
|
||||||
{
|
{
|
||||||
// NuGet v3 flat-container versions index.
|
// Web get the paquet
|
||||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetPackage + "/{id}/" + ApiConfig.IndexDotJson)]
|
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{idf}-{lowerf}."
|
||||||
public IActionResult GetPackageVersionsById(
|
|
||||||
[FromRoute][SafeName][Required] string id)
|
|
||||||
{
|
|
||||||
var versions = dbContext.PackageVersions
|
|
||||||
.Where(v => v.PackageId.ToLower() == id.ToLower())
|
|
||||||
.Select(v => v.FullString)
|
|
||||||
.Distinct()
|
|
||||||
.OrderBy(v => v)
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
return Ok(new { versions });
|
|
||||||
}
|
|
||||||
|
|
||||||
// NuGet v3 flat-container package download by filename, e.g. id.version.nupkg.
|
|
||||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{filename}."
|
|
||||||
+ Constants.PaquetFileEstension)]
|
+ Constants.PaquetFileEstension)]
|
||||||
public IActionResult GetPackageByFilename(
|
public IActionResult GetPackage(
|
||||||
[FromRoute][SafeName][Required] string id,
|
[FromRoute][SafeName][Required] string id,
|
||||||
[FromRoute][SafeName][Required] string lower,
|
[FromRoute][SafeName][Required] string lower,
|
||||||
[FromRoute][SafeName][Required] string filename)
|
[FromRoute] string idf, [FromRoute] string lowerf)
|
||||||
{
|
{
|
||||||
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
|
var pkgpath = Path.Combine(isndSettings.PackagesRootDir,
|
||||||
id, lower, $"{id}-{lower}." + Constants.PaquetFileEstension
|
id, lower, $"{id}-{lower}." + Constants.PaquetFileEstension
|
||||||
|
|
@ -48,9 +32,7 @@ namespace isnd.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Web get spec
|
// Web get spec
|
||||||
[HttpGet("~/" + Constants.APIPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}.{lowerf}."
|
[HttpGet(Constants.PackageRootServerPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}-{lowerf}."
|
||||||
+ Constants.SpecFileEstension)]
|
|
||||||
[HttpGet("~/" + Constants.APIPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}-{lowerf}."
|
|
||||||
+ Constants.SpecFileEstension)]
|
+ Constants.SpecFileEstension)]
|
||||||
public IActionResult GetNuspec(
|
public IActionResult GetNuspec(
|
||||||
[FromRoute][SafeName][Required] string id,
|
[FromRoute][SafeName][Required] string id,
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NuGet.Versioning;
|
using NuGet.Versioning;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
public partial class PackagesController
|
public partial class PackagesController
|
||||||
{
|
{
|
||||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.GetVersion + "/{id}/{lower}/" + ApiConfig.IndexDotJson)]
|
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.GetVersion + "/{id}/{lower}/" + ApiConfig.IndexDotJson)]
|
||||||
public IActionResult GetVersions(
|
public IActionResult GetVersions(
|
||||||
string id,
|
string id,
|
||||||
string lower,
|
string lower,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ using isnd.Data;
|
||||||
using isnd.Helpers;
|
using isnd.Helpers;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
using isnd.Data.Packages;
|
using isnd.Data.Packages;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
|
@ -25,18 +25,18 @@ namespace isnd.Controllers
|
||||||
public partial class PackagesController
|
public partial class PackagesController
|
||||||
{
|
{
|
||||||
// TODO [Authorize(Policy = IsndConstants.RequireValidApiKey)]
|
// TODO [Authorize(Policy = IsndConstants.RequireValidApiKey)]
|
||||||
[HttpPut("~/" + Constants.APIPrefix + ApiConfig.Publish)]
|
[HttpPut(Constants.PackageRootServerPrefix + ApiConfig.Publish)]
|
||||||
public async Task<IActionResult> Put()
|
public async Task<IActionResult> Put()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var clientVersionId = Request.Headers["X-NuGet-Client-Version"];
|
var clientVersionId = Request.Headers["X-NuGet-Client-Version"];
|
||||||
string apiKey = Request.Headers["X-NuGet-ApiKey"].FirstOrDefault() ?? string.Empty;
|
string apiKey = Request.Headers["X-NuGet-ApiKey"][0];
|
||||||
ViewData["versionId"] = typeof(PackagesController).Assembly.FullName;
|
ViewData["versionId"] = typeof(PackagesController).Assembly.FullName;
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
ViewData["files"] = files;
|
ViewData["files"] = files;
|
||||||
|
|
||||||
var clearkey = ApiKeyProtector.TryUnprotectKey(protector, apiKey);
|
var clearkey = protector.Unprotect(apiKey);
|
||||||
var apikey = dbContext.ApiKeys.SingleOrDefault(k => k.Id == clearkey);
|
var apikey = dbContext.ApiKeys.SingleOrDefault(k => k.Id == clearkey);
|
||||||
if (apikey == null)
|
if (apikey == null)
|
||||||
{
|
{
|
||||||
|
|
@ -46,7 +46,7 @@ namespace isnd.Controllers
|
||||||
Commit commit = new Commit
|
Commit commit = new Commit
|
||||||
{
|
{
|
||||||
Action = PackageAction.PublishPackage,
|
Action = PackageAction.PublishPackage,
|
||||||
TimeStamp = DateTime.UtcNow
|
TimeStamp = DateTime.Now
|
||||||
};
|
};
|
||||||
dbContext.Commits.Add(commit);
|
dbContext.Commits.Add(commit);
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ namespace isnd.Controllers
|
||||||
dbContext.PackageVersions.Remove(v);
|
dbContext.PackageVersions.Remove(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default package type must be non-null for composite key consistency.
|
// FIXME default type or null
|
||||||
if (types==null || types.Count==0)
|
if (types==null || types.Count==0)
|
||||||
dbContext.PackageVersions.Add
|
dbContext.PackageVersions.Add
|
||||||
(new PackageVersion{
|
(new PackageVersion{
|
||||||
|
|
@ -157,7 +157,7 @@ namespace isnd.Controllers
|
||||||
Revision = version.Revision,
|
Revision = version.Revision,
|
||||||
IsPrerelease = version.IsPrerelease,
|
IsPrerelease = version.IsPrerelease,
|
||||||
FullString = version.ToFullString(),
|
FullString = version.ToFullString(),
|
||||||
Type = string.Empty,
|
Type = null,
|
||||||
LatestCommit = commit
|
LatestCommit = commit
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
|
|
@ -171,14 +171,14 @@ namespace isnd.Controllers
|
||||||
Patch = version.Patch,
|
Patch = version.Patch,
|
||||||
IsPrerelease = version.IsPrerelease,
|
IsPrerelease = version.IsPrerelease,
|
||||||
FullString = version.ToFullString(),
|
FullString = version.ToFullString(),
|
||||||
Type = type.Name ?? string.Empty,
|
Type = type.Name,
|
||||||
LatestCommit = commit
|
LatestCommit = commit
|
||||||
};
|
};
|
||||||
dbContext.PackageVersions.Add(pkgver);
|
dbContext.PackageVersions.Add(pkgver);
|
||||||
}
|
}
|
||||||
|
|
||||||
await dbContext.SaveChangesAsync();
|
await dbContext.SaveChangesAsync();
|
||||||
packageManager.UpdateCatalogForAsync(commit);
|
packageManager.ÛpdateCatalogForAsync(commit);
|
||||||
|
|
||||||
logger.LogInformation($"new paquet : {spec.Name}");
|
logger.LogInformation($"new paquet : {spec.Name}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -11,7 +11,7 @@ namespace isnd.Controllers
|
||||||
public partial class PackagesController
|
public partial class PackagesController
|
||||||
{
|
{
|
||||||
// GET {@id}?q={QUERY}&skip={SKIP}&take={TAKE}&prerelease={PRERELEASE}&semVerLevel={SEMVERLEVEL}&packageType={PACKAGETYPE}
|
// GET {@id}?q={QUERY}&skip={SKIP}&take={TAKE}&prerelease={PRERELEASE}&semVerLevel={SEMVERLEVEL}&packageType={PACKAGETYPE}
|
||||||
[HttpGet("~/" + Constants.APIPrefix + ApiConfig.Search)]
|
[HttpGet(Constants.PackageRootServerPrefix + ApiConfig.Search)]
|
||||||
public IActionResult Search(
|
public IActionResult Search(
|
||||||
string q,
|
string q,
|
||||||
int skip = 0,
|
int skip = 0,
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
pkgtype ??= string.Empty;
|
|
||||||
// var report = await packageManager.DeletePackageAsync(id, lower, type);
|
// var report = await packageManager.DeletePackageAsync(id, lower, type);
|
||||||
|
|
||||||
var packageVersion = await dbContext.PackageVersions.Include(p => p.Package)
|
var packageVersion = await dbContext.PackageVersions.Include(p => p.Package)
|
||||||
|
|
@ -78,7 +77,6 @@ namespace isnd.Controllers
|
||||||
public async Task<IActionResult> DeleteConfirmed(string PackageId, string FullString,
|
public async Task<IActionResult> DeleteConfirmed(string PackageId, string FullString,
|
||||||
string Type)
|
string Type)
|
||||||
{
|
{
|
||||||
Type ??= string.Empty;
|
|
||||||
PackageVersion packageVersion = await dbContext.PackageVersions
|
PackageVersion packageVersion = await dbContext.PackageVersions
|
||||||
.Include(pv => pv.Package)
|
.Include(pv => pv.Package)
|
||||||
.FirstOrDefaultAsync(m => m.PackageId == PackageId
|
.FirstOrDefaultAsync(m => m.PackageId == PackageId
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,21 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using NuGet.Versioning;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
|
using Unleash;
|
||||||
|
using isnd.Services;
|
||||||
|
using isnd.ViewModels;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using isnd.Interfaces;
|
using isnd.Interfaces;
|
||||||
using Isn.Abstract;
|
using isn.Abstract;
|
||||||
|
|
||||||
namespace isnd.Controllers
|
namespace isnd.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -22,15 +30,13 @@ namespace isnd.Controllers
|
||||||
private readonly IsndSettings isndSettings;
|
private readonly IsndSettings isndSettings;
|
||||||
readonly ApplicationDbContext dbContext;
|
readonly ApplicationDbContext dbContext;
|
||||||
private readonly IPackageManager packageManager;
|
private readonly IPackageManager packageManager;
|
||||||
|
private readonly IUnleash unleashĈlient;
|
||||||
/**
|
|
||||||
* PackagesController
|
|
||||||
*/
|
|
||||||
|
|
||||||
public PackagesController(
|
public PackagesController(
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IDataProtectionProvider provider,
|
IDataProtectionProvider provider,
|
||||||
IOptions<IsndSettings> isndOptions,
|
IOptions<IsndSettings> isndOptions,
|
||||||
|
IUnleash unleashĈlient,
|
||||||
ApplicationDbContext dbContext,
|
ApplicationDbContext dbContext,
|
||||||
IPackageManager pm)
|
IPackageManager pm)
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +45,8 @@ namespace isnd.Controllers
|
||||||
protector = provider.CreateProtector(isndSettings.ProtectionTitle);
|
protector = provider.CreateProtector(isndSettings.ProtectionTitle);
|
||||||
this.dbContext = dbContext;
|
this.dbContext = dbContext;
|
||||||
packageManager = pm;
|
packageManager = pm;
|
||||||
resources = packageManager.GetResources().ToArray();
|
this.unleashĈlient = unleashĈlient;
|
||||||
|
resources = packageManager.GetResources(unleashĈlient).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,6 @@ namespace isnd.Data.ApiKeys
|
||||||
|
|
||||||
public DateTime CreationDate { get; set; }
|
public DateTime CreationDate { get; set; }
|
||||||
|
|
||||||
public bool IsValid => CreationDate.AddDays(ValidityPeriodInDays) > DateTime.UtcNow;
|
public bool IsValid => CreationDate.AddDays(ValidityPeriodInDays) > DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -22,19 +22,6 @@ namespace isnd.Data
|
||||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||||
: base(options) { }
|
: base(options) { }
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder builder)
|
|
||||||
{
|
|
||||||
base.OnModelCreating(builder);
|
|
||||||
|
|
||||||
builder.Entity<PackageVersion>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasKey(v => new { v.PackageId, v.FullString, v.Type });
|
|
||||||
entity.Property(v => v.Type)
|
|
||||||
.IsRequired()
|
|
||||||
.HasDefaultValue(string.Empty);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User API keys
|
/// User API keys
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
using isnd.Data.Catalog;
|
using isnd.Data.Catalog;
|
||||||
using isnd.Data.Packages;
|
using isnd.Data.Packages;
|
||||||
using isnd.Data.Packages.Catalog;
|
using isnd.Data.Packages.Catalog;
|
||||||
|
|
@ -38,6 +38,7 @@ namespace isnd.Data
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
[StringLength(256)]
|
[StringLength(256)]
|
||||||
[Required]
|
[Required]
|
||||||
|
[Key]
|
||||||
public string FullString { get; set; }
|
public string FullString { get; set; }
|
||||||
public bool IsPrerelease { get; set; }
|
public bool IsPrerelease { get; set; }
|
||||||
|
|
||||||
|
|
@ -57,9 +58,9 @@ namespace isnd.Data
|
||||||
public string CommitId { get => CommitNId.ToString(); }
|
public string CommitId { get => CommitNId.ToString(); }
|
||||||
|
|
||||||
public virtual Commit LatestCommit { get; set; }
|
public virtual Commit LatestCommit { get; set; }
|
||||||
public string NugetLink => $"{Constants.APIPrefix}{Constants.PaquetFileEstension}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
public string NugetLink => $"{Constants.PaquetFileEstension}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
||||||
+ Constants.PaquetFileEstension;
|
+ Constants.PaquetFileEstension;
|
||||||
public string NuspecLink => $"{Constants.APIPrefix}{Constants.SpecFileEstension}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
public string NuspecLink => $"{Constants.SpecFileEstension}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
||||||
+ Constants.SpecFileEstension;
|
+ Constants.SpecFileEstension;
|
||||||
|
|
||||||
public string SementicVersionString { get => $"{Major}.{Minor}.{Patch}"; }
|
public string SementicVersionString { get => $"{Major}.{Minor}.{Patch}"; }
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,11 @@ namespace isnd.Entities
|
||||||
{
|
{
|
||||||
public class SmtpSettings
|
public class SmtpSettings
|
||||||
{
|
{
|
||||||
/**
|
public string Server {get; set;}
|
||||||
* The SMTP server host.
|
|
||||||
*/
|
|
||||||
public string Host {get; set;}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The SMTP server port.
|
|
||||||
*/
|
|
||||||
public int Port {get; set;}
|
public int Port {get; set;}
|
||||||
/**
|
|
||||||
* The name of the sender.
|
|
||||||
*/
|
|
||||||
public string SenderName {get; set;}
|
public string SenderName {get; set;}
|
||||||
/**
|
public string SenderEMail {get; set;}
|
||||||
* The email address of the sender.
|
|
||||||
*/
|
|
||||||
public string SenderEmail {get; set;}
|
|
||||||
/**
|
|
||||||
* The username for SMTP authentication.
|
|
||||||
*/
|
|
||||||
public string UserName {get; set;}
|
public string UserName {get; set;}
|
||||||
/**
|
|
||||||
* The password for SMTP authentication.
|
|
||||||
*/
|
|
||||||
public string Password {get; set;}
|
public string Password {get; set;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
|
||||||
|
|
||||||
namespace isnd.Helpers
|
|
||||||
{
|
|
||||||
public static class ApiKeyProtector
|
|
||||||
{
|
|
||||||
private const byte LegacyDelta = 145;
|
|
||||||
|
|
||||||
public static string TryUnprotectKey(IDataProtector protector, string protectedValue)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(protectedValue))
|
|
||||||
{
|
|
||||||
return protectedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryUnprotect(protector, protectedValue, out var unprotected))
|
|
||||||
{
|
|
||||||
return unprotected;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryUnprotectLegacy(protectedValue, out unprotected))
|
|
||||||
{
|
|
||||||
return unprotected;
|
|
||||||
}
|
|
||||||
|
|
||||||
return protectedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool TryUnprotect(IDataProtector protector, string protectedValue, out string unprotected)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
unprotected = protector.Unprotect(protectedValue);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (CryptographicException)
|
|
||||||
{
|
|
||||||
unprotected = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
unprotected = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool TryUnprotectLegacy(string protectedValue, out string unprotected)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
unprotected = UnprotectLegacy(protectedValue);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
unprotected = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string UnprotectLegacy(string protectedValue)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(protectedValue))
|
|
||||||
{
|
|
||||||
return protectedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bytes = Convert.FromBase64String(protectedValue);
|
|
||||||
var unprotectedBytes = new byte[bytes.Length];
|
|
||||||
for (var index = 0; index < bytes.Length; index++)
|
|
||||||
{
|
|
||||||
unprotectedBytes[index] = (byte)(bytes[index] ^ LegacyDelta);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Encoding.UTF8.GetString(unprotectedBytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using isnd.Data.Catalog;
|
using isnd.Data.Catalog;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
|
|
|
||||||
32
src/isnd/Helpers/UnleashHelpers.cs
Normal file
32
src/isnd/Helpers/UnleashHelpers.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using isnd.Entities;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Unleash;
|
||||||
|
using Unleash.ClientFactory;
|
||||||
|
|
||||||
|
namespace isnd.Helpers
|
||||||
|
{
|
||||||
|
public static class UnleashHelpers
|
||||||
|
{
|
||||||
|
|
||||||
|
public static IUnleash CreateUnleahClient(this IHostingEnvironment env,
|
||||||
|
UnleashClientSettings unleashClientSettings)
|
||||||
|
{
|
||||||
|
var unleashSettings = new UnleashSettings
|
||||||
|
{
|
||||||
|
UnleashApi = new Uri(unleashClientSettings.ApiUrl),
|
||||||
|
AppName = "isnd",
|
||||||
|
Environment = env.EnvironmentName,
|
||||||
|
CustomHttpHeaders = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{ "Authorization", unleashClientSettings.ClientApiKey }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
UnleashClientFactory unleashClientFactory = new UnleashClientFactory();
|
||||||
|
return unleashClientFactory.CreateClient(unleashSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,76 +1,35 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Isn.Abstract;
|
using isn.Abstract;
|
||||||
|
using isnd.Controllers;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using isnd.Data.Catalog;
|
using isnd.Data.Catalog;
|
||||||
using isnd.Data.Packages;
|
using isnd.Data.Packages;
|
||||||
|
using isnd.Data.Packages.Catalog;
|
||||||
using isnd.Services;
|
using isnd.Services;
|
||||||
using isnd.ViewModels;
|
using isnd.ViewModels;
|
||||||
using NuGet.Versioning;
|
using NuGet.Versioning;
|
||||||
|
using Unleash;
|
||||||
|
|
||||||
namespace isnd.Interfaces
|
namespace isnd.Interfaces
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* IPackageManager
|
|
||||||
*/
|
|
||||||
public interface IPackageManager
|
public interface IPackageManager
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* CatalogBaseUrl
|
|
||||||
*/
|
|
||||||
string CatalogBaseUrl { get; }
|
string CatalogBaseUrl { get; }
|
||||||
/**
|
|
||||||
* AutoComplete generation
|
|
||||||
*/
|
|
||||||
AutoCompleteResult AutoComplete(string pkgid, int skip, int take, bool prerelease = false, string packageType = null);
|
AutoCompleteResult AutoComplete(string pkgid, int skip, int take, bool prerelease = false, string packageType = null);
|
||||||
|
|
||||||
/**
|
|
||||||
* GetVersions
|
|
||||||
*/
|
|
||||||
string[] GetVersions(string pkgid, NuGetVersion parsedVersion, bool prerelease = false, string packageType = null, int skip = 0, int take = 25);
|
string[] GetVersions(string pkgid, NuGetVersion parsedVersion, bool prerelease = false, string packageType = null, int skip = 0, int take = 25);
|
||||||
/**
|
IEnumerable<Resource> GetResources(IUnleash unleashĈlient);
|
||||||
* GetResources
|
Task<RegistrationPageIndex> ÛpdateCatalogForAsync(Commit commit);
|
||||||
*/
|
|
||||||
IEnumerable<Resource> GetResources();
|
|
||||||
/**
|
|
||||||
* UpdateCatalogForAsync
|
|
||||||
*/
|
|
||||||
Task<RegistrationPageIndex> UpdateCatalogForAsync(Commit commit);
|
|
||||||
/**
|
|
||||||
* DeletePackageAsync
|
|
||||||
*/
|
|
||||||
Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type);
|
Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type);
|
||||||
|
|
||||||
/**
|
|
||||||
* UserAskForPackageDeletionAsync
|
|
||||||
*/
|
|
||||||
Task<PackageDeletionReport> UserAskForPackageDeletionAsync(string userid, string pkgId, string lower, string type);
|
Task<PackageDeletionReport> UserAskForPackageDeletionAsync(string userid, string pkgId, string lower, string type);
|
||||||
|
|
||||||
/**
|
|
||||||
* GetPackageAsync
|
|
||||||
*/
|
|
||||||
Task<PackageVersion> GetPackageAsync(string pkgid, string version, string type);
|
Task<PackageVersion> GetPackageAsync(string pkgid, string version, string type);
|
||||||
|
|
||||||
/**
|
|
||||||
* GetCatalogEntryAsync
|
|
||||||
*/
|
|
||||||
Task<CatalogEntry> GetCatalogEntryAsync(string pkgId, string version, string pkgType);
|
Task<CatalogEntry> GetCatalogEntryAsync(string pkgId, string version, string pkgType);
|
||||||
/**
|
|
||||||
* SearchCatalogEntriesById
|
|
||||||
*/
|
|
||||||
IEnumerable<CatalogEntry> SearchCatalogEntriesById(string pkgId, string semver, string pkgType);
|
IEnumerable<CatalogEntry> SearchCatalogEntriesById(string pkgId, string semver, string pkgType);
|
||||||
|
|
||||||
/**
|
|
||||||
* GetCatalogIndexAsync
|
|
||||||
*/
|
|
||||||
Task<RegistrationPageIndex> GetCatalogIndexAsync();
|
Task<RegistrationPageIndex> GetCatalogIndexAsync();
|
||||||
/**
|
|
||||||
* GetPackageRegistrationIndexAsync
|
|
||||||
*/
|
|
||||||
Task<RegistrationPageIndex> GetPackageRegistrationIndexAsync(RegistrationPageIndexQuery query);
|
Task<RegistrationPageIndex> GetPackageRegistrationIndexAsync(RegistrationPageIndexQuery query);
|
||||||
/**
|
|
||||||
* SearchPackageAsync
|
|
||||||
*/
|
|
||||||
Task<RegistrationPageIndex> SearchPackageAsync(RegistrationPageIndexQuery query);
|
Task<RegistrationPageIndex> SearchPackageAsync(RegistrationPageIndexQuery query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
458
src/isnd/Migrations/20260705174847_net10.Designer.cs
generated
458
src/isnd/Migrations/20260705174847_net10.Designer.cs
generated
|
|
@ -1,458 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
using isnd.Data;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace isndhost.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20260705174847_net10")]
|
|
||||||
partial class net10
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "10.0.9")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("RoleNameIndex");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoleClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderKey")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderDisplayName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("LoginProvider", "ProviderKey");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserLogins", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "RoleId");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Value")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "LoginProvider", "Name");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserTokens", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("ValidityPeriodInDays")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("ApiKeys");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApplicationUser", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("FullName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
|
||||||
.HasDatabaseName("EmailIndex");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedUserName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("UserNameIndex");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUsers", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("FullString")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<long>("CommitNId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsPrerelease")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("Major")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Minor")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("PackageId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(1024)
|
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<int>("Patch")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Revision")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.HasKey("FullString");
|
|
||||||
|
|
||||||
b.HasIndex("CommitNId");
|
|
||||||
|
|
||||||
b.HasIndex("PackageId");
|
|
||||||
|
|
||||||
b.ToTable("PackageVersions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Action")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTime>("TimeStamp")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Commits");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasMaxLength(1024)
|
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<long>("CommitNId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CommitTimeStamp")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasMaxLength(1024)
|
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<string>("OwnerId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("Public")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CommitNId");
|
|
||||||
|
|
||||||
b.HasIndex("OwnerId");
|
|
||||||
|
|
||||||
b.ToTable("Packages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.Packages.Commit", "LatestCommit")
|
|
||||||
.WithMany("Versions")
|
|
||||||
.HasForeignKey("CommitNId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.Packages.Package", "Package")
|
|
||||||
.WithMany("Versions")
|
|
||||||
.HasForeignKey("PackageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("LatestCommit");
|
|
||||||
|
|
||||||
b.Navigation("Package");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.Packages.Commit", "LatestVersion")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CommitNId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", "Owner")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("OwnerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("LatestVersion");
|
|
||||||
|
|
||||||
b.Navigation("Owner");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Versions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Versions");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace isndhost.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class net10 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "Id",
|
|
||||||
table: "Commits",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint")
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
|
||||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "Id",
|
|
||||||
table: "AspNetUserClaims",
|
|
||||||
type: "integer",
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "integer")
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
|
||||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "Id",
|
|
||||||
table: "AspNetRoleClaims",
|
|
||||||
type: "integer",
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "integer")
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
|
||||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<long>(
|
|
||||||
name: "Id",
|
|
||||||
table: "Commits",
|
|
||||||
type: "bigint",
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(long),
|
|
||||||
oldType: "bigint")
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
|
|
||||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "Id",
|
|
||||||
table: "AspNetUserClaims",
|
|
||||||
type: "integer",
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "integer")
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
|
|
||||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "Id",
|
|
||||||
table: "AspNetRoleClaims",
|
|
||||||
type: "integer",
|
|
||||||
nullable: false,
|
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "integer")
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
|
|
||||||
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,457 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
using isnd.Data;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace isndhost.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20260705211205_pkgver_composite_identity_fix")]
|
|
||||||
partial class pkgver_composite_identity_fix
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "10.0.9")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("RoleNameIndex");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoleClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderKey")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderDisplayName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("LoginProvider", "ProviderKey");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserLogins", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "RoleId");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Value")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "LoginProvider", "Name");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserTokens", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("ValidityPeriodInDays")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("ApiKeys");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApplicationUser", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("FullName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
|
||||||
.HasDatabaseName("EmailIndex");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedUserName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("UserNameIndex");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUsers", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("PackageId")
|
|
||||||
.HasMaxLength(1024)
|
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<string>("FullString")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)")
|
|
||||||
.HasDefaultValue("");
|
|
||||||
|
|
||||||
b.Property<long>("CommitNId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsPrerelease")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("Major")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Minor")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Patch")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Revision")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("PackageId", "FullString", "Type");
|
|
||||||
|
|
||||||
b.HasIndex("CommitNId");
|
|
||||||
|
|
||||||
b.ToTable("PackageVersions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Action")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTime>("TimeStamp")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Commits");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasMaxLength(1024)
|
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<long>("CommitNId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CommitTimeStamp")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.HasMaxLength(1024)
|
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<string>("OwnerId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("Public")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CommitNId");
|
|
||||||
|
|
||||||
b.HasIndex("OwnerId");
|
|
||||||
|
|
||||||
b.ToTable("Packages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.Packages.Commit", "LatestCommit")
|
|
||||||
.WithMany("Versions")
|
|
||||||
.HasForeignKey("CommitNId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.Packages.Package", "Package")
|
|
||||||
.WithMany("Versions")
|
|
||||||
.HasForeignKey("PackageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("LatestCommit");
|
|
||||||
|
|
||||||
b.Navigation("Package");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.Packages.Commit", "LatestVersion")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CommitNId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", "Owner")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("OwnerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("LatestVersion");
|
|
||||||
|
|
||||||
b.Navigation("Owner");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Versions");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Versions");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace isndhost.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class pkgver_composite_identity_fix : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropPrimaryKey(
|
|
||||||
name: "PK_PackageVersions",
|
|
||||||
table: "PackageVersions");
|
|
||||||
|
|
||||||
migrationBuilder.DropIndex(
|
|
||||||
name: "IX_PackageVersions_PackageId",
|
|
||||||
table: "PackageVersions");
|
|
||||||
|
|
||||||
migrationBuilder.Sql("UPDATE \"PackageVersions\" SET \"Type\" = '' WHERE \"Type\" IS NULL;");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
|
||||||
name: "Type",
|
|
||||||
table: "PackageVersions",
|
|
||||||
type: "character varying(256)",
|
|
||||||
maxLength: 256,
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "",
|
|
||||||
oldClrType: typeof(string),
|
|
||||||
oldType: "character varying(256)",
|
|
||||||
oldMaxLength: 256,
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddPrimaryKey(
|
|
||||||
name: "PK_PackageVersions",
|
|
||||||
table: "PackageVersions",
|
|
||||||
columns: new[] { "PackageId", "FullString", "Type" });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropPrimaryKey(
|
|
||||||
name: "PK_PackageVersions",
|
|
||||||
table: "PackageVersions");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
|
||||||
name: "Type",
|
|
||||||
table: "PackageVersions",
|
|
||||||
type: "character varying(256)",
|
|
||||||
maxLength: 256,
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(string),
|
|
||||||
oldType: "character varying(256)",
|
|
||||||
oldMaxLength: 256,
|
|
||||||
oldDefaultValue: "");
|
|
||||||
|
|
||||||
migrationBuilder.Sql("UPDATE \"PackageVersions\" SET \"Type\" = NULL WHERE \"Type\" = '';");
|
|
||||||
|
|
||||||
migrationBuilder.AddPrimaryKey(
|
|
||||||
name: "PK_PackageVersions",
|
|
||||||
table: "PackageVersions",
|
|
||||||
column: "FullString");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_PackageVersions_PackageId",
|
|
||||||
table: "PackageVersions",
|
|
||||||
column: "PackageId");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,8 +6,6 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace isndhost.Migrations
|
namespace isndhost.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
|
@ -17,161 +15,23 @@ namespace isndhost.Migrations
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "10.0.9")
|
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
|
||||||
|
.HasAnnotation("ProductVersion", "2.1.14-servicing-32113")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Id")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.IsConcurrencyToken()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedName")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("NormalizedName")
|
|
||||||
.IsUnique()
|
|
||||||
.HasDatabaseName("RoleNameIndex");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetRoleClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ClaimType")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ClaimValue")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserClaims", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderKey")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ProviderDisplayName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("LoginProvider", "ProviderKey");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserLogins", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RoleId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "RoleId");
|
|
||||||
|
|
||||||
b.HasIndex("RoleId");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserRoles", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("UserId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("LoginProvider")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Value")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("UserId", "LoginProvider", "Name");
|
|
||||||
|
|
||||||
b.ToTable("AspNetUserTokens", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Id")
|
b.Property<string>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd();
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
b.Property<DateTime>("CreationDate");
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("UserId")
|
b.Property<string>("UserId")
|
||||||
.IsRequired()
|
.IsRequired();
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("ValidityPeriodInDays")
|
b.Property<int>("ValidityPeriodInDays");
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
|
@ -183,124 +43,63 @@ namespace isndhost.Migrations
|
||||||
modelBuilder.Entity("isnd.Data.ApplicationUser", b =>
|
modelBuilder.Entity("isnd.Data.ApplicationUser", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Id")
|
b.Property<string>("Id")
|
||||||
.HasColumnType("text");
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
b.Property<int>("AccessFailedCount");
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
b.Property<string>("ConcurrencyStamp")
|
||||||
.IsConcurrencyToken()
|
.IsConcurrencyToken();
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256);
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
b.Property<bool>("EmailConfirmed");
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("FullName")
|
b.Property<string>("FullName");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
b.Property<bool>("LockoutEnabled");
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
b.Property<DateTimeOffset?>("LockoutEnd");
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
b.Property<string>("NormalizedEmail")
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256);
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
b.Property<string>("NormalizedUserName")
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256);
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
b.Property<string>("PasswordHash");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
b.Property<string>("PhoneNumber");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
b.Property<bool>("PhoneNumberConfirmed");
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
b.Property<string>("SecurityStamp");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
b.Property<bool>("TwoFactorEnabled");
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256);
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
b.HasIndex("NormalizedEmail")
|
||||||
.HasDatabaseName("EmailIndex");
|
.HasName("EmailIndex");
|
||||||
|
|
||||||
b.HasIndex("NormalizedUserName")
|
b.HasIndex("NormalizedUserName")
|
||||||
.IsUnique()
|
.IsUnique()
|
||||||
.HasDatabaseName("UserNameIndex");
|
.HasName("UserNameIndex");
|
||||||
|
|
||||||
b.ToTable("AspNetUsers", (string)null);
|
b.ToTable("AspNetUsers");
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("PackageId")
|
|
||||||
.HasMaxLength(1024)
|
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<string>("FullString")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("character varying(256)")
|
|
||||||
.HasDefaultValue("");
|
|
||||||
|
|
||||||
b.Property<long>("CommitNId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<bool>("IsPrerelease")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("Major")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Minor")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Patch")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Revision")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("PackageId", "FullString", "Type");
|
|
||||||
|
|
||||||
b.HasIndex("CommitNId");
|
|
||||||
|
|
||||||
b.ToTable("PackageVersions");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
|
modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd();
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
b.Property<int>("Action");
|
||||||
|
|
||||||
b.Property<int>("Action")
|
b.Property<DateTime>("TimeStamp");
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTime>("TimeStamp")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
|
@ -310,25 +109,20 @@ namespace isndhost.Migrations
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Id")
|
b.Property<string>("Id")
|
||||||
.HasMaxLength(1024)
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("character varying(1024)");
|
.HasMaxLength(1024);
|
||||||
|
|
||||||
b.Property<long>("CommitNId")
|
b.Property<long>("CommitNId");
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CommitTimeStamp")
|
b.Property<DateTime>("CommitTimeStamp");
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.HasMaxLength(1024)
|
.HasMaxLength(1024);
|
||||||
.HasColumnType("character varying(1024)");
|
|
||||||
|
|
||||||
b.Property<string>("OwnerId")
|
b.Property<string>("OwnerId")
|
||||||
.IsRequired()
|
.IsRequired();
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("Public")
|
b.Property<bool>("Public");
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
|
@ -339,55 +133,145 @@ namespace isndhost.Migrations
|
||||||
b.ToTable("Packages");
|
b.ToTable("Packages");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("FullString")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<long>("CommitNId");
|
||||||
|
|
||||||
|
b.Property<bool>("IsPrerelease");
|
||||||
|
|
||||||
|
b.Property<int>("Major");
|
||||||
|
|
||||||
|
b.Property<int>("Minor");
|
||||||
|
|
||||||
|
b.Property<string>("PackageId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(1024);
|
||||||
|
|
||||||
|
b.Property<int>("Patch");
|
||||||
|
|
||||||
|
b.Property<int>("Revision");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.HasKey("FullString");
|
||||||
|
|
||||||
|
b.HasIndex("CommitNId");
|
||||||
|
|
||||||
|
b.HasIndex("PackageId");
|
||||||
|
|
||||||
|
b.ToTable("PackageVersions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasName("RoleNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoles");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
b.Property<int>("Id")
|
||||||
.WithMany()
|
.ValueGeneratedOnAdd();
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
b.Property<string>("ClaimType");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue");
|
||||||
|
|
||||||
|
b.Property<string>("RoleId")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoleClaims");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
b.Property<int>("Id")
|
||||||
.WithMany()
|
.ValueGeneratedOnAdd();
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
b.Property<string>("ClaimType");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserClaims");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
b.Property<string>("LoginProvider");
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
b.Property<string>("ProviderKey");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
|
b.Property<string>("ProviderDisplayName");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserLogins");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
b.Property<string>("UserId");
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RoleId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
b.Property<string>("RoleId");
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
b.HasKey("UserId", "RoleId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserRoles");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("isnd.Data.ApplicationUser", null)
|
b.Property<string>("UserId");
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
b.Property<string>("LoginProvider");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<string>("Value");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "LoginProvider", "Name");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserTokens");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
||||||
|
|
@ -395,29 +279,7 @@ namespace isndhost.Migrations
|
||||||
b.HasOne("isnd.Data.ApplicationUser", "User")
|
b.HasOne("isnd.Data.ApplicationUser", "User")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("UserId")
|
.HasForeignKey("UserId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("isnd.Data.Packages.Commit", "LatestCommit")
|
|
||||||
.WithMany("Versions")
|
|
||||||
.HasForeignKey("CommitNId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.Packages.Package", "Package")
|
|
||||||
.WithMany("Versions")
|
|
||||||
.HasForeignKey("PackageId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("LatestCommit");
|
|
||||||
|
|
||||||
b.Navigation("Package");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
||||||
|
|
@ -425,28 +287,70 @@ namespace isndhost.Migrations
|
||||||
b.HasOne("isnd.Data.Packages.Commit", "LatestVersion")
|
b.HasOne("isnd.Data.Packages.Commit", "LatestVersion")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CommitNId")
|
.HasForeignKey("CommitNId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("isnd.Data.ApplicationUser", "Owner")
|
b.HasOne("isnd.Data.ApplicationUser", "Owner")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("OwnerId")
|
.HasForeignKey("OwnerId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("LatestVersion");
|
|
||||||
|
|
||||||
b.Navigation("Owner");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
|
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Versions");
|
b.HasOne("isnd.Data.Packages.Commit", "LatestCommit")
|
||||||
|
.WithMany("Versions")
|
||||||
|
.HasForeignKey("CommitNId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("isnd.Data.Packages.Package", "Package")
|
||||||
|
.WithMany("Versions")
|
||||||
|
.HasForeignKey("PackageId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("isnd.Data.Packages.Package", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Versions");
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("isnd.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("isnd.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("isnd.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("isnd.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Identity.UI.Services;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using MailKit.Net.Smtp;
|
using MailKit.Net.Smtp;
|
||||||
using MailKit.Security;
|
|
||||||
using MimeKit;
|
using MimeKit;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -37,26 +36,14 @@ namespace isnd.Services
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var message = new MimeMessage();
|
var message = new MimeMessage();
|
||||||
message.From.Add(new MailboxAddress(Options.SenderName, Options.SenderEmail));
|
message.From.Add(new MailboxAddress(Options.SenderName, Options.SenderEMail));
|
||||||
message.To.Add(new MailboxAddress(name ?? email, email));
|
message.To.Add(new MailboxAddress(name??email, email));
|
||||||
message.Body = new TextPart("html") { Text = body };
|
message.Body = new TextPart("html") { Text = body };
|
||||||
using (var client = new SmtpClient())
|
using (var client = new SmtpClient())
|
||||||
{
|
{
|
||||||
client.ServerCertificateValidationCallback = (s,c,h,e) => true;
|
client.ServerCertificateValidationCallback = (s,c,h,e)=>true;
|
||||||
if (Options.Port > 0)
|
await client.ConnectAsync(Options.Server);
|
||||||
{
|
await client.AuthenticateAsync(Options.UserName, Options.Password);
|
||||||
await client.ConnectAsync(Options.Host, Options.Port, SecureSocketOptions.Auto);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await client.ConnectAsync(Options.Host);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Options.UserName))
|
|
||||||
{
|
|
||||||
await client.AuthenticateAsync(Options.UserName, Options.Password);
|
|
||||||
}
|
|
||||||
|
|
||||||
await client.SendAsync(message);
|
await client.SendAsync(message);
|
||||||
await client.DisconnectAsync(true);
|
await client.DisconnectAsync(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,39 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Isn.Abstract;
|
using isn.Abstract;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using isnd.Data.Catalog;
|
using isnd.Data.Catalog;
|
||||||
using isnd.Data.Packages;
|
using isnd.Data.Packages;
|
||||||
|
using isnd.Data.Packages.Catalog;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
|
using isnd.Helpers;
|
||||||
using isnd.Interfaces;
|
using isnd.Interfaces;
|
||||||
using isnd.ViewModels;
|
using isnd.ViewModels;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using NuGet.Versioning;
|
using NuGet.Versioning;
|
||||||
|
using Unleash;
|
||||||
|
|
||||||
namespace isnd.Services
|
namespace isnd.Services
|
||||||
{
|
{
|
||||||
public class PackageManager : IPackageManager
|
public class PackageManager : IPackageManager
|
||||||
{
|
{
|
||||||
public const string BASE_API_LEVEL = "3.0.0";
|
public const string BASE_API_LEVEL = "3.0.0";
|
||||||
private static string NormalizePackageType(string packageType) => packageType ?? string.Empty;
|
|
||||||
|
|
||||||
ApplicationDbContext dbContext;
|
ApplicationDbContext dbContext;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for the PackageManager class.
|
|
||||||
* @param dbContext The database context.
|
|
||||||
* @param siteConfigOptionsOptions The options for the IsndSettings configuration.
|
|
||||||
*/
|
|
||||||
public PackageManager(ApplicationDbContext dbContext,
|
public PackageManager(ApplicationDbContext dbContext,
|
||||||
IOptions<IsndSettings> siteConfigOptionsOptions)
|
IOptions<IsndSettings> siteConfigOptionsOptions)
|
||||||
{
|
{
|
||||||
this.dbContext = dbContext;
|
this.dbContext = dbContext;
|
||||||
isndSettings = siteConfigOptionsOptions.Value;
|
isndSettings = siteConfigOptionsOptions.Value;
|
||||||
extUrl = isndSettings.ExternalUrl + "/" +Constants.APIPrefix;
|
extUrl = isndSettings.ExternalUrl + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public IEnumerable<Resource> GetResources(IUnleash unleashClient)
|
||||||
* GetResources
|
|
||||||
*/
|
|
||||||
|
|
||||||
public IEnumerable<Resource> GetResources()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
var res = new List<Resource>
|
var res = new List<Resource>
|
||||||
|
|
@ -50,8 +44,7 @@ namespace isnd.Services
|
||||||
},
|
},
|
||||||
// under dev, only leash in release mode
|
// under dev, only leash in release mode
|
||||||
|
|
||||||
// NuGet clients expect a trailing slash on PackageBaseAddress to resolve relative paths.
|
new Resource(extUrl + ApiConfig.GetPackage, "PackageBaseAddress/3.0.0")
|
||||||
new Resource(extUrl + ApiConfig.GetPackage + "/", "PackageBaseAddress/3.0.0")
|
|
||||||
{
|
{
|
||||||
Comment = @"Package Base Address service - Base URL of where NuGet packages are stored, in the format https://<host>/nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
|
Comment = @"Package Base Address service - Base URL of where NuGet packages are stored, in the format https://<host>/nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
|
||||||
},
|
},
|
||||||
|
|
@ -69,15 +62,39 @@ namespace isnd.Services
|
||||||
Comment = "Base URL of storage where isn package registration info is stored. This base URL includes SemVer 2.0.0 packages."
|
Comment = "Base URL of storage where isn package registration info is stored. This base URL includes SemVer 2.0.0 packages."
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/* new Resource(extUrl + ApiConfig.Catalog, "Catalog/" + BASE_API_LEVEL)
|
||||||
|
{
|
||||||
|
Comment = "Package Catalog Index"
|
||||||
|
},*/
|
||||||
|
|
||||||
|
/* res.Add(
|
||||||
|
); res.Add(
|
||||||
|
new Resource(extUrl + "v3.0.0/" + ApiConfig.Registration, "RegistrationsBaseUrl")
|
||||||
|
{
|
||||||
|
|
||||||
|
Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
|
||||||
|
});
|
||||||
|
|
||||||
|
res.Add(
|
||||||
|
new Resource(extUrl + "v3.0.0-beta/" + ApiConfig.Registration, "RegistrationsBaseUrl/3.0.0-beta")
|
||||||
|
{
|
||||||
|
Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
|
||||||
|
});
|
||||||
|
res.Add(
|
||||||
|
new Resource(extUrl + "v3.0.0-rc/" + ApiConfig.Registration,"RegistrationsBaseUrl/3.0.0-rc")
|
||||||
|
{
|
||||||
|
Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
|
||||||
|
});
|
||||||
|
res.Add(new Resource(extUrl + "v3.4.0/" + ApiConfig.Registration,"RegistrationsBaseUrl/3.4.0")
|
||||||
|
{
|
||||||
|
Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
|
||||||
|
});
|
||||||
|
|
||||||
|
res.Add(); */
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* AutoComplete generation
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public AutoCompleteResult AutoComplete(string id,
|
public AutoCompleteResult AutoComplete(string id,
|
||||||
int skip, int take, bool prerelease = false,
|
int skip, int take, bool prerelease = false,
|
||||||
string packageType = null)
|
string packageType = null)
|
||||||
|
|
@ -118,24 +135,18 @@ namespace isnd.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CatalogBaseUrl
|
|
||||||
*/
|
|
||||||
public string CatalogBaseUrl => extUrl;
|
public string CatalogBaseUrl => extUrl;
|
||||||
|
|
||||||
private IsndSettings isndSettings;
|
private IsndSettings isndSettings;
|
||||||
private string extUrl;
|
private string extUrl;
|
||||||
/**
|
|
||||||
* GetCatalogIndexAsync
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public virtual async Task<RegistrationPageIndex> GetCatalogIndexAsync()
|
public virtual async Task<RegistrationPageIndex> GetCatalogIndexAsync()
|
||||||
{
|
{
|
||||||
return await UpdateCatalogForAsync(null);
|
return await ÛpdateCatalogForAsync(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RegistrationPageIndex> UpdateCatalogForAsync(Commit reason = null)
|
public async Task<RegistrationPageIndex> ÛpdateCatalogForAsync(Commit reason = null)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
|
@ -192,12 +203,11 @@ namespace isnd.Services
|
||||||
|
|
||||||
public async Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type)
|
public async Task<PackageDeletionReport> DeletePackageAsync(string pkgid, string version, string type)
|
||||||
{
|
{
|
||||||
type = NormalizePackageType(type);
|
|
||||||
// TODO deletion on disk
|
// TODO deletion on disk
|
||||||
var commit = new Commit
|
var commit = new Commit
|
||||||
{
|
{
|
||||||
Action = PackageAction.DeletePackage,
|
Action = PackageAction.DeletePackage,
|
||||||
TimeStamp = DateTime.UtcNow
|
TimeStamp = DateTime.Now
|
||||||
};
|
};
|
||||||
dbContext.Commits.Add(commit);
|
dbContext.Commits.Add(commit);
|
||||||
var pkg = await dbContext.PackageVersions.SingleOrDefaultAsync(
|
var pkg = await dbContext.PackageVersions.SingleOrDefaultAsync(
|
||||||
|
|
@ -211,13 +221,12 @@ namespace isnd.Services
|
||||||
}
|
}
|
||||||
dbContext.PackageVersions.Remove(pkg);
|
dbContext.PackageVersions.Remove(pkg);
|
||||||
await dbContext.SaveChangesAsync();
|
await dbContext.SaveChangesAsync();
|
||||||
await UpdateCatalogForAsync(commit);
|
await ÛpdateCatalogForAsync(commit);
|
||||||
return new PackageDeletionReport { Deleted = true, DeletedVersion = pkg };
|
return new PackageDeletionReport { Deleted = true, DeletedVersion = pkg };
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PackageVersion> GetPackageAsync(string pkgid, string version, string type)
|
public async Task<PackageVersion> GetPackageAsync(string pkgid, string version, string type)
|
||||||
{
|
{
|
||||||
type = NormalizePackageType(type);
|
|
||||||
return await dbContext.PackageVersions.SingleOrDefaultAsync(
|
return await dbContext.PackageVersions.SingleOrDefaultAsync(
|
||||||
v => v.PackageId == pkgid &&
|
v => v.PackageId == pkgid &&
|
||||||
v.FullString == version &&
|
v.FullString == version &&
|
||||||
|
|
@ -238,7 +247,6 @@ namespace isnd.Services
|
||||||
|
|
||||||
public async Task<PackageDeletionReport> UserAskForPackageDeletionAsync(string uid, string id, string lower, string type)
|
public async Task<PackageDeletionReport> UserAskForPackageDeletionAsync(string uid, string id, string lower, string type)
|
||||||
{
|
{
|
||||||
type = NormalizePackageType(type);
|
|
||||||
PackageVersion packageVersion = await dbContext.PackageVersions
|
PackageVersion packageVersion = await dbContext.PackageVersions
|
||||||
.Include(pv => pv.Package)
|
.Include(pv => pv.Package)
|
||||||
.FirstOrDefaultAsync(m => m.PackageId == id
|
.FirstOrDefaultAsync(m => m.PackageId == id
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
@ -14,46 +15,41 @@ using isnd.Entities;
|
||||||
using isnd.Authorization;
|
using isnd.Authorization;
|
||||||
using isnd.Data.Roles;
|
using isnd.Data.Roles;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Unleash;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using isnd.Helpers;
|
using isnd.Helpers;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using System;
|
using System;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using isnd.Data.Catalog;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.OpenApi;
|
|
||||||
|
|
||||||
namespace isnd
|
namespace isnd
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Startup class for configuring services and the app's request pipeline.
|
|
||||||
*/
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for the Startup class.
|
|
||||||
* @param config The configuration object.
|
|
||||||
*/
|
|
||||||
public Startup(IConfiguration config)
|
public Startup(IConfiguration config)
|
||||||
{
|
{
|
||||||
Configuration = config;
|
Configuration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The configuration object.
|
|
||||||
*/
|
|
||||||
public static IConfiguration Configuration { get; private set; }
|
public static IConfiguration Configuration { get; private set; }
|
||||||
|
|
||||||
/**
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
* This method gets called by the runtime. Use this method to add services to the container.
|
|
||||||
* @param services The service collection.
|
|
||||||
*/
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||||
var isndSettingsconf = Configuration.GetSection("Isn");
|
var isndSettingsconf = Configuration.GetSection("Isn");
|
||||||
var adminStartupListConf = Configuration.GetSection("AdminStartupList");
|
var adminStartupListConf = Configuration.GetSection("AdminList");
|
||||||
|
var unleashConf = Configuration.GetSection("Unleash");
|
||||||
|
|
||||||
services.Configure<ForwardedHeadersOptions>(options =>
|
services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
{
|
{
|
||||||
|
|
@ -61,26 +57,14 @@ namespace isnd
|
||||||
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||||
});
|
});
|
||||||
|
|
||||||
var connectionString = Configuration.GetConnectionString("DefaultConnection");
|
|
||||||
var useInMemoryDatabase = Configuration.GetValue<bool>("UseInMemoryDatabase") ||
|
|
||||||
string.IsNullOrWhiteSpace(connectionString) ||
|
|
||||||
connectionString.Contains("<", StringComparison.Ordinal);
|
|
||||||
|
|
||||||
services.Configure<SmtpSettings>(smtpSettingsconf)
|
services.Configure<SmtpSettings>(smtpSettingsconf)
|
||||||
.Configure<IsndSettings>(isndSettingsconf)
|
.Configure<IsndSettings>(isndSettingsconf)
|
||||||
.Configure<AdminStartupList>(adminStartupListConf)
|
.Configure<AdminStartupList>(adminStartupListConf)
|
||||||
|
.Configure<UnleashClientSettings>(unleashConf)
|
||||||
.Configure<MigrationsEndPointOptions>(o => o.Path = "~/migrate")
|
.Configure<MigrationsEndPointOptions>(o => o.Path = "~/migrate")
|
||||||
.AddDbContext<ApplicationDbContext>(options =>
|
.AddDbContext<ApplicationDbContext>(options =>
|
||||||
{
|
options.UseNpgsql(
|
||||||
if (useInMemoryDatabase)
|
Configuration.GetConnectionString("DefaultConnection")))
|
||||||
{
|
|
||||||
options.UseInMemoryDatabase("isnd-tests");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
options.UseNpgsql(connectionString);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.AddIdentity<ApplicationUser, IdentityRole>()
|
.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
.AddRoles<IdentityRole>()
|
.AddRoles<IdentityRole>()
|
||||||
.AddEntityFrameworkStores<ApplicationDbContext>()
|
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||||||
|
|
@ -105,7 +89,20 @@ namespace isnd
|
||||||
.AddTransient<IEmailSender, EmailSender>()
|
.AddTransient<IEmailSender, EmailSender>()
|
||||||
.AddTransient<IPackageManager, PackageManager>()
|
.AddTransient<IPackageManager, PackageManager>()
|
||||||
.AddSingleton<IAuthorizationHandler, ValidApiKeyRequirementHandler>()
|
.AddSingleton<IAuthorizationHandler, ValidApiKeyRequirementHandler>()
|
||||||
.AddAuthentication("Bearer")
|
.AddSingleton(s =>
|
||||||
|
{
|
||||||
|
var config = s.GetRequiredService<IOptions<UnleashClientSettings>>();
|
||||||
|
if (config.Value == null)
|
||||||
|
throw new System.Exception("No unleash client settings");
|
||||||
|
if (config.Value.ApiUrl == null)
|
||||||
|
throw new System.Exception("No unleash client ApiUrl");
|
||||||
|
if (config.Value.ClientApiKey == null)
|
||||||
|
throw new System.Exception("No unleash client ClientApiKey");
|
||||||
|
return s.GetRequiredService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().CreateUnleahClient(config.Value);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
services.AddAuthentication("Bearer")
|
||||||
.AddJwtBearer("Bearer", options =>
|
.AddJwtBearer("Bearer", options =>
|
||||||
{
|
{
|
||||||
options.Authority = isndSettingsconf.GetValue<string>("ExternalUrl");
|
options.Authority = isndSettingsconf.GetValue<string>("ExternalUrl");
|
||||||
|
|
@ -144,13 +141,7 @@ namespace isnd
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
* This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
||||||
* @param app The application builder.
|
|
||||||
* @param env The web host environment.
|
|
||||||
* @param dbContext The application database context.
|
|
||||||
* @param isnSettingsOption The isnd settings options.
|
|
||||||
*/
|
|
||||||
public void Configure(IApplicationBuilder app,
|
public void Configure(IApplicationBuilder app,
|
||||||
IWebHostEnvironment env,
|
IWebHostEnvironment env,
|
||||||
ApplicationDbContext dbContext,
|
ApplicationDbContext dbContext,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
using Unleash;
|
||||||
|
|
||||||
namespace isnd.ViewModels
|
namespace isnd.ViewModels
|
||||||
{
|
{
|
||||||
public class HomeIndexViewModel
|
public class HomeIndexViewModel
|
||||||
{
|
{
|
||||||
public int PkgCount { get; set; }
|
public int PkgCount { get; set; }
|
||||||
|
public IUnleash UnleashClient;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,8 +3,15 @@
|
||||||
foreach (string leashed in new string[] { "pkg-push", "pkg-get",
|
foreach (string leashed in new string[] { "pkg-push", "pkg-get",
|
||||||
"pkg-autocomplete","pkg-search","pkg-catalog"})
|
"pkg-autocomplete","pkg-search","pkg-catalog"})
|
||||||
{
|
{
|
||||||
|
if (Model.UnleashClient.IsEnabled(leashed))
|
||||||
|
{
|
||||||
|
//do some magic
|
||||||
|
<p>@leashed</p>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//do old boring stuff
|
//do old boring stuff
|
||||||
<p>No @leashed (disabled)</p>
|
<p>No @leashed (disabled)</p>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,11 +16,16 @@
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Smtp": {
|
"Smtp": {
|
||||||
"Host": "<smtp.server.host>",
|
"Server": "<smtp.server.address>",
|
||||||
"Port": 25,
|
"Port": 25,
|
||||||
"SenderName": "<from-name>",
|
"SenderName": "<from-name>",
|
||||||
"SenderEmail": "<from-email>"
|
"SenderEmail": "<from-email>"
|
||||||
},
|
},
|
||||||
|
"Unleash":
|
||||||
|
{
|
||||||
|
"ClientApiKey": "lame-unleash-client-api-key",
|
||||||
|
"ApiUrl": "http://localhost:4242/api/"
|
||||||
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning"
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,48 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<UserSecretsId>85fd766d-5d23-4476-aed1-463b2942e86a</UserSecretsId>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
<NoWarn>NETSDK1138,CS1591,MSB3243</NoWarn>
|
||||||
<InformationalVersion>1.0.0+Branch.main.Sha.654065d7fef34ba4ed2fb3bca5bc91de9ad16e85</InformationalVersion>
|
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||||
<Version>1.0.0</Version>
|
<FileVersion>1.0.7.0</FileVersion>
|
||||||
|
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||||
|
<Version>1.0.7</Version>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="GitVersion.MsBuild" Version="6.8.1">
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.9" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.9">
|
</ItemGroup>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.4" />
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" IncludeAssets="All" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4" />
|
||||||
|
|
||||||
|
<PackageReference Include="NuGet.Packaging.Core" Version="6.5.0" />
|
||||||
|
<PackageReference Include="MailKit" Version="3.6.0" />
|
||||||
|
<PackageReference Include="unleash.client" Version="2.4.3" />
|
||||||
|
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
|
||||||
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.9" />
|
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="7.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Antiforgery" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="10.0.2" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.0.9" />
|
<ProjectReference Include="../isn.abst/isn.abst.csproj" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2" IncludeAssets="All" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.9" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.9" />
|
|
||||||
<PackageReference Include="NuGet.Packaging.Core" Version="6.9.1" />
|
|
||||||
<PackageReference Include="MailKit" Version="4.17.0" />
|
|
||||||
<PackageReference Include="unleash.client" Version="6.2.1" />
|
|
||||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.9" />
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.2.3" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.9" />
|
|
||||||
|
|
||||||
<ProjectReference Include="..\isn.abstract\isn.abstract.csproj" />
|
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\LICENSE" Pack="true" PackagePath="LICENSE" />
|
<None Include="..\..\LICENSE" Pack="true" PackagePath="LICENSE" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
|
||||||
<metadata>
|
|
||||||
<id>dummy.nuget</id>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<authors>isnd.tests</authors>
|
|
||||||
<description>Dummy test package used by integration tests.</description>
|
|
||||||
</metadata>
|
|
||||||
</package>
|
|
||||||
10
test/data/test-isn/ANuGet.Config
Normal file
10
test/data/test-isn/ANuGet.Config
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<apikeys>
|
||||||
|
</apikeys>
|
||||||
|
<packageSources>
|
||||||
|
<add key="dev" value="http://localhost:5000/index.json" protocolVersion="3" />
|
||||||
|
<!-- <add key="isn-prod" value="https://isn.pschneider.fr/index.json" protocolVersion="3" />
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> -->
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<RootNamespace>test_isn</RootNamespace>
|
<RootNamespace>test_isn</RootNamespace>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
<FileVersion>1.0.7.0</FileVersion>
|
||||||
<InformationalVersion>1.0.0+Branch.main.Sha.654065d7fef34ba4ed2fb3bca5bc91de9ad16e85</InformationalVersion>
|
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.7</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
1
test/data/test-isn/testcmd
Normal file
1
test/data/test-isn/testcmd
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
nuget install -NoCache -Verbosity detailed -ConfigFile ANuGet.Config Yavsc.Abstract
|
||||||
|
|
@ -1,190 +1,29 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Data;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Xml;
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using isn.Abstract;
|
||||||
|
using System.Linq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Isn.Abstract;
|
using isn.abst;
|
||||||
|
using isnd.Entities;
|
||||||
|
|
||||||
namespace Isn.tests
|
namespace isn.tests
|
||||||
{
|
{
|
||||||
public sealed class LocalSourceFixture : IDisposable
|
public class Tests
|
||||||
{
|
{
|
||||||
private readonly HttpListener listener;
|
|
||||||
private readonly Task listenerTask;
|
|
||||||
private readonly string configDirectory;
|
|
||||||
private readonly string originalConfigDirectory;
|
|
||||||
|
|
||||||
public string LastApiKeyHeader { get; private set; }
|
|
||||||
|
|
||||||
public LocalSourceFixture()
|
|
||||||
{
|
|
||||||
var port = GetFreePort();
|
|
||||||
var prefix = $"http://127.0.0.1:{port}/"+Constants.APIPrefix;
|
|
||||||
listener = new HttpListener();
|
|
||||||
listener.Prefixes.Add(prefix);
|
|
||||||
listener.Start();
|
|
||||||
|
|
||||||
listenerTask = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
while (listener.IsListening)
|
|
||||||
{
|
|
||||||
HttpListenerContext context;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
context = await listener.GetContextAsync();
|
|
||||||
}
|
|
||||||
catch (HttpListenerException)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.Request.HttpMethod == "PUT")
|
|
||||||
{
|
|
||||||
LastApiKeyHeader = context.Request.Headers["X-NuGet-ApiKey"];
|
|
||||||
}
|
|
||||||
|
|
||||||
var indexJson = JsonConvert.SerializeObject(new ApiIndexViewModel(prefix + "index.json")
|
|
||||||
{
|
|
||||||
Version = "3.0.0",
|
|
||||||
Resources = new[]
|
|
||||||
{
|
|
||||||
new Resource(prefix + "put", "PackagePublish/2.0.0")
|
|
||||||
{
|
|
||||||
Comment = "test publish endpoint"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var payload = Encoding.UTF8.GetBytes(indexJson);
|
|
||||||
context.Response.ContentType = "application/json";
|
|
||||||
context.Response.ContentLength64 = payload.Length;
|
|
||||||
await context.Response.OutputStream.WriteAsync(payload, 0, payload.Length);
|
|
||||||
context.Response.Close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
configDirectory = Path.Combine(Path.GetTempPath(), $"isn-tests-{Guid.NewGuid():N}");
|
|
||||||
Directory.CreateDirectory(configDirectory);
|
|
||||||
originalConfigDirectory = Environment.GetEnvironmentVariable("ISN_CONFIG_DIR");
|
|
||||||
Environment.SetEnvironmentVariable("ISN_CONFIG_DIR", configDirectory);
|
|
||||||
|
|
||||||
SourceUrl = prefix + "index.json";
|
|
||||||
ConfigureIsnSettings(SourceUrl);
|
|
||||||
Program.LoadConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SourceUrl { get; }
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
listener.Close();
|
|
||||||
if (listenerTask != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
listenerTask.GetAwaiter().GetResult();
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable("ISN_CONFIG_DIR", originalConfigDirectory);
|
|
||||||
if (Directory.Exists(configDirectory))
|
|
||||||
{
|
|
||||||
Directory.Delete(configDirectory, recursive: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int GetFreePort()
|
|
||||||
{
|
|
||||||
var listener = new TcpListener(IPAddress.Loopback, 0);
|
|
||||||
listener.Start();
|
|
||||||
var port = ((IPEndPoint)listener.LocalEndpoint).Port;
|
|
||||||
listener.Stop();
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureIsnSettings(string sourceUrl)
|
|
||||||
{
|
|
||||||
var configPath = Path.Combine(configDirectory, "config.json");
|
|
||||||
var settings = new Settings
|
|
||||||
{
|
|
||||||
DataProtectionTitle = "isn",
|
|
||||||
Sources = new Dictionary<string, SourceSettings>
|
|
||||||
{
|
|
||||||
[sourceUrl] = new SourceSettings { Alias = "test" }
|
|
||||||
},
|
|
||||||
DefaultSourceKey = sourceUrl
|
|
||||||
};
|
|
||||||
|
|
||||||
File.WriteAllText(configPath, JsonConvert.SerializeObject(settings, Formatting.Indented));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Tests : IClassFixture<LocalSourceFixture>
|
|
||||||
{
|
|
||||||
private readonly LocalSourceFixture fixture;
|
|
||||||
|
|
||||||
public Tests(LocalSourceFixture fixture)
|
|
||||||
{
|
|
||||||
this.fixture = fixture;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void SupportsIsolatedConfigDirectoryOverride()
|
|
||||||
{
|
|
||||||
var tempDir = Path.Combine(Path.GetTempPath(), $"isn-test-{Guid.NewGuid():N}");
|
|
||||||
Directory.CreateDirectory(tempDir);
|
|
||||||
var originalConfigDir = Environment.GetEnvironmentVariable("ISN_CONFIG_DIR");
|
|
||||||
var configFile = Path.Combine(tempDir, "config.json");
|
|
||||||
var expectedSource = "https://example.test/index.json";
|
|
||||||
var settings = new Settings
|
|
||||||
{
|
|
||||||
DataProtectionTitle = "isn",
|
|
||||||
Sources = new Dictionary<string, SourceSettings>
|
|
||||||
{
|
|
||||||
[expectedSource] = new SourceSettings { Alias = "override" }
|
|
||||||
},
|
|
||||||
DefaultSourceKey = expectedSource
|
|
||||||
};
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("ISN_CONFIG_DIR", tempDir);
|
|
||||||
File.WriteAllText(configFile, JsonConvert.SerializeObject(settings, Formatting.Indented));
|
|
||||||
|
|
||||||
Program.LoadConfig();
|
|
||||||
|
|
||||||
Assert.Equal(expectedSource, Program.Settings.DefaultSourceKey);
|
|
||||||
Assert.True(Program.Settings.Sources.ContainsKey(expectedSource));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Environment.SetEnvironmentVariable("ISN_CONFIG_DIR", originalConfigDir);
|
|
||||||
if (Directory.Exists(tempDir))
|
|
||||||
{
|
|
||||||
Directory.Delete(tempDir, recursive: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void HaveADefaultDataProtector()
|
public void HaveADefaultDataProtector()
|
||||||
{
|
{
|
||||||
var pass = "a lame and big pass";
|
string pass = "a lame and big pass";
|
||||||
IDataProtector protector = new DefaultDataProtector();
|
isn.IDataProtector _protector = new isn.DefaultDataProtector();
|
||||||
var protectedpass = protector.Protect(pass);
|
string protectedpass = _protector.Protect(pass);
|
||||||
var unprotectedpass = protector.UnProtect(protectedpass);
|
string unprotectedpass = _protector.UnProtect(protectedpass);
|
||||||
Console.WriteLine(protectedpass);
|
Console.WriteLine(protectedpass);
|
||||||
Assert.Equal(pass, unprotectedpass);
|
Assert.Equal(pass, unprotectedpass);
|
||||||
Assert.True(protectedpass != null);
|
Assert.True(protectedpass != null);
|
||||||
|
|
@ -194,76 +33,33 @@ namespace Isn.tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task TestHttpClient()
|
public async Task TestHttpClient()
|
||||||
{
|
{
|
||||||
using var client = new HttpClient();
|
string url = "https://isn.pschneider.fr/" + ApiConfig.IndexDotJson;
|
||||||
var response = await client.GetAsync(fixture.SourceUrl);
|
HttpClient client = new HttpClient();
|
||||||
|
// var json = await client.GetStringAsync(new System.Uri(url));
|
||||||
|
var response = await client.GetAsync(url);
|
||||||
var json = await response.Content.ReadAsStringAsync();
|
var json = await response.Content.ReadAsStringAsync();
|
||||||
var vm = JsonConvert.DeserializeObject<ApiIndexViewModel>(json);
|
var vm = JsonConvert.DeserializeObject<ApiIndexViewModel>(json);
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(vm));
|
Console.WriteLine(JsonConvert.SerializeObject(vm));
|
||||||
Assert.NotNull(vm);
|
Assert.NotNull(vm);
|
||||||
Assert.NotNull(vm.Resources);
|
Assert.NotNull(vm.Resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestPush()
|
public void TestPush()
|
||||||
{
|
{
|
||||||
Program.LoadConfig();
|
Program.LoadConfig();
|
||||||
var report = Program.PushPkg(new[] { GetDummyPackagePath() });
|
var report = Program.PushPkg(new string[] { "/home/paul/Nupkgs/Yavsc.Abstract.1.0.8."
|
||||||
Assert.NotNull(report);
|
+ Constants.PaquetFileEstension });
|
||||||
Assert.Single(report);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void PushUsesStoredApiKeyFromConfigWhenNoExplicitApiKeyIsProvided()
|
|
||||||
{
|
|
||||||
Program.LoadConfig();
|
|
||||||
var clearApiKey = "stored-api-key";
|
|
||||||
Program.Settings.Sources[fixture.SourceUrl].SetApiKey(clearApiKey);
|
|
||||||
Program.SaveConfig();
|
|
||||||
Program.LoadConfig();
|
|
||||||
|
|
||||||
var report = Program.PushPkg(new[] { GetDummyPackagePath() });
|
|
||||||
|
|
||||||
Assert.NotNull(report);
|
|
||||||
Assert.Single(report);
|
|
||||||
Assert.Equal(clearApiKey, fixture.LastApiKeyHeader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void GetServerResourcesUsingHttpClientAsyncTest()
|
public void GetServerResourcesUsingHttpClientAsyncTest()
|
||||||
{
|
{
|
||||||
var model = SourceHelpers.GetServerResources(fixture.SourceUrl);
|
var model = SourceHelpers.GetServerResources("Https://isn.pschneider.fr/index.json");
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(model));
|
Console.WriteLine(JsonConvert.SerializeObject(model));
|
||||||
Assert.NotNull(model.Resources);
|
Assert.NotNull(model.Resources);
|
||||||
var pub = model.Resources.FirstOrDefault(r => r.Type.StartsWith("PackagePublish/"));
|
var pub = model.Resources.FirstOrDefault((r) => r.Type.StartsWith("PackagePublish/"));
|
||||||
Assert.True(pub != null);
|
Assert.True(pub != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetDummyPackagePath()
|
|
||||||
{
|
|
||||||
var localOutputDummy = Path.Combine(AppContext.BaseDirectory, "dummy.nupkg");
|
|
||||||
if (File.Exists(localOutputDummy))
|
|
||||||
{
|
|
||||||
return localOutputDummy;
|
|
||||||
}
|
|
||||||
|
|
||||||
var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
|
||||||
while (dir != null)
|
|
||||||
{
|
|
||||||
if (File.Exists(Path.Combine(dir.FullName, "isn.sln")))
|
|
||||||
{
|
|
||||||
var sharedArtifact = Path.Combine(dir.FullName, "test", "data", "nuget-artifacts", "dummy.nuget.1.0.0.nupkg");
|
|
||||||
if (File.Exists(sharedArtifact))
|
|
||||||
{
|
|
||||||
return sharedArtifact;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dir = dir.Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new FileNotFoundException("Unable to locate a dummy NuGet package for push tests.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +1,20 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<NoWarn>NETSDK1138</NoWarn>
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||||
<InformationalVersion>1.0.0+Branch.main.Sha.654065d7fef34ba4ed2fb3bca5bc91de9ad16e85</InformationalVersion>
|
<FileVersion>1.0.7.0</FileVersion>
|
||||||
<Version>1.0.0</Version>
|
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||||
|
<Version>1.0.7</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
||||||
<PackageReference Include="xunit.runner.reporters" Version="2.9.3" />
|
<PackageReference Include="xunit.runner.reporters" Version="2.4.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
|
||||||
<PackageToolReference Include="xunit.runner.console" Version="2.9.3" PrivateAssets="All" />
|
<PackageToolReference Include="xunit.runner.console" Version="2.4.2" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\isn\isn.csproj" />
|
<ProjectReference Include="..\..\src\isn\isn.csproj" />
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,28 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System;
|
||||||
using System.Xml.Linq;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Isn.Abstract;
|
using Microsoft.AspNetCore;
|
||||||
|
using Xunit;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using isnd.Data.ApiKeys;
|
|
||||||
using isnd.Helpers;
|
|
||||||
using isnd.tests;
|
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using NuGet.Common;
|
using System.Diagnostics;
|
||||||
using NuGet.Configuration;
|
using Microsoft.AspNetCore.Hosting.Server;
|
||||||
|
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using isnd.tests;
|
||||||
using NuGet.Protocol;
|
using NuGet.Protocol;
|
||||||
|
using NuGet.Configuration;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using NuGet.Protocol.Core.Types;
|
using NuGet.Protocol.Core.Types;
|
||||||
using NuGet.Versioning;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace isnd.host.tests
|
namespace isnd.host.tests
|
||||||
{
|
{
|
||||||
[Collection("Web server collection")]
|
[Collection("Web server collection")]
|
||||||
public class UnitTestWebHost : IClassFixture<WebServerFixture>
|
public class UnitTestWebHost : IClassFixture<WebServerFixture>
|
||||||
{
|
{
|
||||||
private const string DummyPackageId = "dummy.nuget";
|
WebServerFixture server;
|
||||||
private const string DummyPackageVersion = "1.0.0";
|
|
||||||
private const string DummyArtifactRelativePath = "test/data/nuget-artifacts/dummy.nuget.1.0.0.nupkg";
|
|
||||||
|
|
||||||
private readonly WebServerFixture server;
|
|
||||||
|
|
||||||
public UnitTestWebHost(WebServerFixture server)
|
public UnitTestWebHost(WebServerFixture server)
|
||||||
{
|
{
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
@ -43,324 +31,83 @@ namespace isnd.host.tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestHaveTestDbContextAndMigrate()
|
public void TestHaveTestDbContextAndMigrate()
|
||||||
{
|
{
|
||||||
using var serviceScope = server.Host.Services.CreateScope();
|
using (var serviceScope = server.Host.Services.CreateScope())
|
||||||
var services = serviceScope.ServiceProvider;
|
|
||||||
var myDependency = services.GetRequiredService<ApplicationDbContext>();
|
|
||||||
if (myDependency.Database.ProviderName?.Contains("InMemory", StringComparison.OrdinalIgnoreCase) == true)
|
|
||||||
{
|
|
||||||
myDependency.Database.EnsureCreated();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
var services = serviceScope.ServiceProvider;
|
||||||
|
var myDependency = services.GetRequiredService<ApplicationDbContext>();
|
||||||
myDependency.Database.Migrate();
|
myDependency.Database.Migrate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LegacyApiKeyProtectorCanUnprotectValuesFromOlderClients()
|
void TestDropUser()
|
||||||
{
|
{
|
||||||
const string clearValue = "legacy-api-key";
|
|
||||||
var legacyProtectedValue = new Isn.DefaultDataProtector().Protect(clearValue);
|
using (var serviceScope = server.Host.Services.CreateScope())
|
||||||
|
|
||||||
var unprotected = ApiKeyProtector.TryUnprotectKey(new ThrowingProtector(), legacyProtectedValue);
|
|
||||||
|
|
||||||
Assert.Equal(clearValue, unprotected);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void ApiKeyProtectorReturnsRawValueWhenInputIsNotProtected()
|
|
||||||
{
|
|
||||||
const string rawApiKey = "CfDJ8AstXUEkxpJBrmoENwy__WNPxqcOwAuxyYgiU3Mebns5yxAT3VrC5vTuWTRSGZBFB7IGUyFkUYsp2nhRy64NqeUzLgOwEcU4FPOf-yaAtPeTMeStRd60bRh2ZYyQkQ3hrhW-lwpCLwYtNOnOyX2jayuzByF-4QfHIEhg6lbWenzf";
|
|
||||||
|
|
||||||
var result = ApiKeyProtector.TryUnprotectKey(new ThrowingProtector(), rawApiKey);
|
|
||||||
|
|
||||||
Assert.Equal(rawApiKey, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void TestDropUser()
|
|
||||||
{
|
|
||||||
using var serviceScope = server.Host.Services.CreateScope();
|
|
||||||
var services = serviceScope.ServiceProvider;
|
|
||||||
var dbContext = services.GetRequiredService<ApplicationDbContext>();
|
|
||||||
var paul = dbContext.Users.FirstOrDefaultAsync(u => u.Email == "paul@pschneider.fr").Result;
|
|
||||||
if (paul != null)
|
|
||||||
{
|
{
|
||||||
dbContext.Users.Remove(paul);
|
var services = serviceScope.ServiceProvider;
|
||||||
dbContext.SaveChanges();
|
var dbContext = services.GetRequiredService<ApplicationDbContext>();
|
||||||
|
var paul = dbContext.Users.FirstOrDefaultAsync(u => u.Email == "paul@pschneider.fr").Result;
|
||||||
|
if (paul!=null)
|
||||||
|
{
|
||||||
|
dbContext.Users.Remove(paul);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void NugetInstallsTest()
|
public void NugetInstallsTest()
|
||||||
{
|
{
|
||||||
var pkgSourceUrl = GetServerBaseUrl() + "/" + Constants.APIPrefix + "index.json";
|
|
||||||
using var client = new HttpClient();
|
|
||||||
var response = client.GetAsync(pkgSourceUrl).GetAwaiter().GetResult();
|
|
||||||
var body = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
|
||||||
|
|
||||||
Assert.True(response.IsSuccessStatusCode, $"Expected {pkgSourceUrl} to be reachable but got {(int)response.StatusCode} {response.ReasonPhrase}");
|
|
||||||
Assert.False(string.IsNullOrWhiteSpace(body));
|
|
||||||
Assert.Contains("PackagePublish/2.0.0", body, StringComparison.OrdinalIgnoreCase);
|
|
||||||
Assert.Contains("RegistrationsBaseUrl/Versioned", body, StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void DummyNugetArtifactShouldBeAReadablePackage()
|
|
||||||
{
|
|
||||||
var packagePath = GetDummyArtifactPath();
|
|
||||||
Assert.True(File.Exists(packagePath), $"Missing dummy artifact at {packagePath}");
|
|
||||||
|
|
||||||
var fileInfo = new FileInfo(packagePath);
|
|
||||||
Assert.True(fileInfo.Length > 0, "Dummy artifact is empty.");
|
|
||||||
|
|
||||||
using var stream = File.OpenRead(packagePath);
|
|
||||||
using var archive = new ZipArchive(stream, ZipArchiveMode.Read, leaveOpen: false);
|
|
||||||
var nuspecEntry = archive.GetEntry("dummy.nuget.nuspec");
|
|
||||||
Assert.NotNull(nuspecEntry);
|
|
||||||
|
|
||||||
using var nuspecStream = nuspecEntry.Open();
|
|
||||||
var nuspec = XDocument.Load(nuspecStream);
|
|
||||||
XNamespace ns = "http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd";
|
|
||||||
var id = nuspec.Root?.Element(ns + "metadata")?.Element(ns + "id")?.Value;
|
|
||||||
var version = nuspec.Root?.Element(ns + "metadata")?.Element(ns + "version")?.Value;
|
|
||||||
|
|
||||||
Assert.Equal(DummyPackageId, id);
|
|
||||||
Assert.Equal(DummyPackageVersion, version);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task PushDummyPackageAndDiscoverItThroughNuGetEndpoints()
|
|
||||||
{
|
|
||||||
var apiKeyValue = $"dummy-key-{Guid.NewGuid():N}";
|
|
||||||
var packagePath = GetDummyArtifactPath();
|
|
||||||
Assert.True(File.Exists(packagePath), $"Missing dummy artifact at {packagePath}");
|
|
||||||
|
|
||||||
using (var serviceScope = server.Host.Services.CreateScope())
|
using (var serviceScope = server.Host.Services.CreateScope())
|
||||||
{
|
{ var isnSettings = serviceScope.ServiceProvider.GetService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
||||||
var dbContext = serviceScope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
string pkgSourceUrl = isnSettings.ExternalUrl + "/index.json";
|
||||||
var userId = $"dummy-user-{Guid.NewGuid():N}";
|
ProcessStartInfo psi = new ProcessStartInfo("nuget");
|
||||||
|
psi.ArgumentList.Add("install");
|
||||||
await ResetDummyPackageStateAsync(serviceScope.ServiceProvider, dbContext);
|
psi.ArgumentList.Add("gitversion");
|
||||||
|
psi.ArgumentList.Add("-PreRelease");
|
||||||
dbContext.Users.Add(new ApplicationUser
|
psi.ArgumentList.Add("-Source");
|
||||||
{
|
psi.ArgumentList.Add(pkgSourceUrl);
|
||||||
Id = userId,
|
Process p = Process.Start(psi);
|
||||||
UserName = userId,
|
p.WaitForExit();
|
||||||
NormalizedUserName = userId.ToUpperInvariant(),
|
Assert.True(p.ExitCode == 0, "nuget install failed!");
|
||||||
Email = $"{userId}@tests.local",
|
|
||||||
NormalizedEmail = $"{userId}@tests.local".ToUpperInvariant(),
|
|
||||||
EmailConfirmed = true
|
|
||||||
});
|
|
||||||
|
|
||||||
dbContext.ApiKeys.Add(new ApiKey
|
|
||||||
{
|
|
||||||
Id = apiKeyValue,
|
|
||||||
UserId = userId,
|
|
||||||
Name = "dummy-key",
|
|
||||||
CreationDate = DateTime.UtcNow,
|
|
||||||
ValidityPeriodInDays = 30
|
|
||||||
});
|
|
||||||
|
|
||||||
await dbContext.SaveChangesAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await PushPackageAsync(packagePath, apiKeyValue);
|
|
||||||
await AssertRegistrationContainsPushedVersionAsync(DummyPackageId, DummyPackageVersion);
|
|
||||||
await AssertAutocompleteContainsPushedVersionAsync(DummyPackageId, DummyPackageVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task NuGetV3ProtocolCanDownloadDummyPackage()
|
|
||||||
{
|
|
||||||
var apiKeyValue = $"dummy-key-{Guid.NewGuid():N}";
|
|
||||||
var packagePath = GetDummyArtifactPath();
|
|
||||||
Assert.True(File.Exists(packagePath), $"Missing dummy artifact at {packagePath}");
|
|
||||||
|
|
||||||
using (var serviceScope = server.Host.Services.CreateScope())
|
|
||||||
{
|
|
||||||
var dbContext = serviceScope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
|
||||||
var userId = $"dummy-user-{Guid.NewGuid():N}";
|
|
||||||
|
|
||||||
await ResetDummyPackageStateAsync(serviceScope.ServiceProvider, dbContext);
|
|
||||||
|
|
||||||
dbContext.Users.Add(new ApplicationUser
|
|
||||||
{
|
|
||||||
Id = userId,
|
|
||||||
UserName = userId,
|
|
||||||
NormalizedUserName = userId.ToUpperInvariant(),
|
|
||||||
Email = $"{userId}@tests.local",
|
|
||||||
NormalizedEmail = $"{userId}@tests.local".ToUpperInvariant(),
|
|
||||||
EmailConfirmed = true
|
|
||||||
});
|
|
||||||
|
|
||||||
dbContext.ApiKeys.Add(new ApiKey
|
|
||||||
{
|
|
||||||
Id = apiKeyValue,
|
|
||||||
UserId = userId,
|
|
||||||
Name = "dummy-key",
|
|
||||||
CreationDate = DateTime.UtcNow,
|
|
||||||
ValidityPeriodInDays = 30
|
|
||||||
});
|
|
||||||
|
|
||||||
await dbContext.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
await PushPackageAsync(packagePath, apiKeyValue);
|
|
||||||
|
|
||||||
var indexUrl = GetServerBaseUrl() + "/" + Constants.APIPrefix + "index.json";
|
|
||||||
var repository = Repository.Factory.GetCoreV3(indexUrl);
|
|
||||||
var findPackageById = await repository.GetResourceAsync<FindPackageByIdResource>();
|
|
||||||
Assert.NotNull(findPackageById);
|
|
||||||
|
|
||||||
await using var nupkgStream = new MemoryStream();
|
|
||||||
using var cache = new SourceCacheContext();
|
|
||||||
var copied = await findPackageById.CopyNupkgToStreamAsync(
|
|
||||||
DummyPackageId,
|
|
||||||
NuGetVersion.Parse(DummyPackageVersion),
|
|
||||||
nupkgStream,
|
|
||||||
cache,
|
|
||||||
NullLogger.Instance,
|
|
||||||
CancellationToken.None);
|
|
||||||
|
|
||||||
Assert.True(copied, "NuGet v3 client could not download the package from the feed.");
|
|
||||||
Assert.True(nupkgStream.Length > 0, "Downloaded package stream is empty.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestRegistrationV3Resource()
|
public void TestRegistrationV3Resource()
|
||||||
{
|
{
|
||||||
using var serviceScope = server.Host.Services.CreateScope();
|
using (var serviceScope = server.Host.Services.CreateScope())
|
||||||
var isnSettings = serviceScope.ServiceProvider.GetService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
{ var isnSettings = serviceScope.ServiceProvider.GetService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
||||||
string pkgSourceUrl = isnSettings.ExternalUrl + "/pkgs/index.json";
|
string pkgSourceUrl = isnSettings.ExternalUrl + "/index.json";
|
||||||
var throttle = new NullThrottle();
|
NullThrottle throttle = new NullThrottle();
|
||||||
|
|
||||||
var packageSource = new PackageSource(pkgSourceUrl);
|
PackageSource packageSource = new PackageSource(pkgSourceUrl);
|
||||||
var client = new HttpSource(packageSource, PkgSourceMessageHandler, throttle);
|
HttpSource client = new HttpSource(packageSource, PkgSourceMessageHandler, throttle);
|
||||||
_ = new RegistrationResourceV3(client, new Uri(isnSettings.ExternalUrl + "/v3.4.0//registration"));
|
NuGet.Protocol.RegistrationResourceV3 res = new NuGet.Protocol.RegistrationResourceV3(client ,
|
||||||
|
new Uri(isnSettings.ExternalUrl + "/v3.4.0//registration"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TrueTestRegistrationV3Resource()
|
public void TrueTestRegistrationV3Resource()
|
||||||
{
|
{
|
||||||
using var serviceScope = server.Host.Services.CreateScope();
|
using (var serviceScope = server.Host.Services.CreateScope())
|
||||||
var isnSettings = serviceScope.ServiceProvider.GetService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
{
|
||||||
string pkgSourceUrl = isnSettings.ExternalUrl + "/pkgs/index.json";
|
var isnSettings = serviceScope.ServiceProvider.GetService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
||||||
|
string pkgSourceUrl = isnSettings.ExternalUrl + "/index.json";
|
||||||
var prov = new RegistrationResourceV3Provider();
|
var prov = new RegistrationResourceV3Provider();
|
||||||
var source = new PackageSource(pkgSourceUrl);
|
var source = new PackageSource(pkgSourceUrl);
|
||||||
var repo = new SourceRepository(source, new INuGetResourceProvider[] { prov });
|
var repo = new SourceRepository(source, new INuGetResourceProvider[]{ prov });
|
||||||
prov.TryCreate(repo, CancellationToken.None);
|
prov.TryCreate(repo, CancellationToken.None);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<HttpHandlerResource> PkgSourceMessageHandler()
|
private Task<HttpHandlerResource> PkgSourceMessageHandler()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetServerBaseUrl()
|
|
||||||
{
|
|
||||||
var address = server.Addresses.FirstOrDefault();
|
|
||||||
Assert.False(string.IsNullOrWhiteSpace(address), "No listening address was captured from WebServerFixture.");
|
|
||||||
return address.TrimEnd('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetDummyArtifactPath()
|
|
||||||
{
|
|
||||||
var root = FindRepoRoot();
|
|
||||||
return Path.Combine(root, DummyArtifactRelativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string FindRepoRoot()
|
|
||||||
{
|
|
||||||
var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
|
||||||
while (dir != null)
|
|
||||||
{
|
|
||||||
if (File.Exists(Path.Combine(dir.FullName, "isn.sln")))
|
|
||||||
{
|
|
||||||
return dir.FullName;
|
|
||||||
}
|
|
||||||
|
|
||||||
dir = dir.Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new DirectoryNotFoundException("Could not locate repository root from AppContext.BaseDirectory.");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task ResetDummyPackageStateAsync(IServiceProvider serviceProvider, ApplicationDbContext dbContext)
|
|
||||||
{
|
|
||||||
var settings = serviceProvider.GetRequiredService<IOptions<isnd.Entities.IsndSettings>>().Value;
|
|
||||||
var versions = dbContext.PackageVersions.Where(v => v.PackageId == DummyPackageId);
|
|
||||||
var packages = dbContext.Packages.Where(p => p.Id == DummyPackageId);
|
|
||||||
|
|
||||||
dbContext.PackageVersions.RemoveRange(versions);
|
|
||||||
dbContext.Packages.RemoveRange(packages);
|
|
||||||
await dbContext.SaveChangesAsync();
|
|
||||||
|
|
||||||
var packageRootDir = settings.PackagesRootDir;
|
|
||||||
if (!Path.IsPathRooted(packageRootDir))
|
|
||||||
{
|
|
||||||
packageRootDir = Path.Combine(FindRepoRoot(), packageRootDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
var packageOnDiskPath = Path.Combine(packageRootDir, DummyPackageId);
|
|
||||||
if (Directory.Exists(packageOnDiskPath))
|
|
||||||
{
|
|
||||||
Directory.Delete(packageOnDiskPath, recursive: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task PushPackageAsync(string packagePath, string apiKey)
|
|
||||||
{
|
|
||||||
using var client = new HttpClient { BaseAddress = new Uri(GetServerBaseUrl()) };
|
|
||||||
using var request = new HttpRequestMessage(HttpMethod.Put, $"/{Constants.APIPrefix}{isnd.Entities.ApiConfig.Publish}");
|
|
||||||
using var multipart = new MultipartFormDataContent();
|
|
||||||
await using var packageStream = File.OpenRead(packagePath);
|
|
||||||
using var packageContent = new StreamContent(packageStream);
|
|
||||||
|
|
||||||
packageContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
|
||||||
multipart.Add(packageContent, "package", Path.GetFileName(packagePath));
|
|
||||||
request.Content = multipart;
|
|
||||||
request.Headers.Add("X-NuGet-ApiKey", apiKey);
|
|
||||||
request.Headers.Add("X-NuGet-Client-Version", "6.11.1");
|
|
||||||
|
|
||||||
var response = await client.SendAsync(request);
|
|
||||||
var responseBody = await response.Content.ReadAsStringAsync();
|
|
||||||
Assert.True(response.IsSuccessStatusCode,
|
|
||||||
$"Expected push to succeed but got {(int)response.StatusCode} {response.ReasonPhrase}. Body: {responseBody}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task AssertRegistrationContainsPushedVersionAsync(string packageId, string packageVersion)
|
|
||||||
{
|
|
||||||
using var client = new HttpClient { BaseAddress = new Uri(GetServerBaseUrl()) };
|
|
||||||
var lowerId = packageId.ToLowerInvariant();
|
|
||||||
var route = $"/{Constants.APIPrefix}v3.4.0/{isnd.Entities.ApiConfig.Registration}/{lowerId}/index.json";
|
|
||||||
var response = await client.GetAsync(route);
|
|
||||||
var body = await response.Content.ReadAsStringAsync();
|
|
||||||
|
|
||||||
Assert.True(response.IsSuccessStatusCode,
|
|
||||||
$"Expected registration endpoint to succeed but got {(int)response.StatusCode} {response.ReasonPhrase}. Body: {body}");
|
|
||||||
Assert.Contains(packageVersion, body, StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task AssertAutocompleteContainsPushedVersionAsync(string packageId, string packageVersion)
|
|
||||||
{
|
|
||||||
using var client = new HttpClient { BaseAddress = new Uri(GetServerBaseUrl()) };
|
|
||||||
var route = $"/{Constants.APIPrefix}{isnd.Entities.ApiConfig.AutoComplete}?id={packageId}&semVerLevel=3.0.0&prerelease=true";
|
|
||||||
var response = await client.GetAsync(route);
|
|
||||||
var body = await response.Content.ReadAsStringAsync();
|
|
||||||
|
|
||||||
Assert.True(response.IsSuccessStatusCode,
|
|
||||||
$"Expected autocomplete endpoint to succeed but got {(int)response.StatusCode} {response.ReasonPhrase}. Body: {body}");
|
|
||||||
Assert.Contains(packageVersion, body, StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
private sealed class ThrowingProtector : IDataProtector
|
|
||||||
{
|
|
||||||
public byte[] Protect(byte[] plaintext) => throw new CryptographicException("unexpected protect call");
|
|
||||||
|
|
||||||
public byte[] Unprotect(byte[] protectedData) => throw new CryptographicException("unexpected unprotect call");
|
|
||||||
|
|
||||||
public IDataProtector CreateProtector(string purpose) => this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ namespace isnd.tests
|
||||||
.UseStartup(typeof(Startup))
|
.UseStartup(typeof(Startup))
|
||||||
.ConfigureAppConfiguration((builderContext, config) =>
|
.ConfigureAppConfiguration((builderContext, config) =>
|
||||||
{
|
{
|
||||||
config.AddJsonFile("appsettings.json", optional: false);
|
config.AddJsonFile("appsettings.json", false);
|
||||||
config.AddJsonFile("appsettings.Development.json", optional: true);
|
config.AddJsonFile("appsettings.Development.json", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Host = webhostBuilder.Build();
|
Host = webhostBuilder.Build();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<UserSecretsId>d7144e46-4e63-4391-ba86-64b61f6e7be4</UserSecretsId>
|
<UserSecretsId>d7144e46-4e63-4391-ba86-64b61f6e7be4</UserSecretsId>
|
||||||
<NoWarn>NETSDK1138</NoWarn>
|
<NoWarn>NETSDK1138</NoWarn>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.0.0</FileVersion>
|
<FileVersion>1.0.7.0</FileVersion>
|
||||||
<InformationalVersion>1.0.0+Branch.main.Sha.654065d7fef34ba4ed2fb3bca5bc91de9ad16e85</InformationalVersion>
|
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.7</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="XunitXml.TestLogger" Version="3.0.70" />
|
<PackageReference Include="XunitXml.TestLogger" Version="3.0.70" />
|
||||||
|
|
|
||||||
0
test/isnd.tests/wwwroot/favicon.ico
Normal file
0
test/isnd.tests/wwwroot/favicon.ico
Normal file
Loading…
Add table
Add a link
Reference in a new issue