Compare commits
62 Commits
Author | SHA1 | Date | |
---|---|---|---|
cbe5614794 | |||
f03c56fead | |||
26e253a3ab | |||
6d0ec6d8a8 | |||
b97f3d3575 | |||
9f357b4b0e | |||
dc54df19a6 | |||
1224d27caa | |||
f91557ba05 | |||
a483804ac2 | |||
ee5a3cd775 | |||
5f7a346d8a | |||
94c850c293 | |||
301a276a7b | |||
bc1464db7f | |||
913f2ae5dd | |||
27ad3841a0 | |||
a6f9d974d3 | |||
a3d3e51259 | |||
753f54dad0 | |||
72ecf30458 | |||
5f1dca3d61 | |||
c615886a4c | |||
2b45e421dd | |||
7ca465d4a9 | |||
8532b81638 | |||
01405abdf2 | |||
62a8bf27cb | |||
9c9ee6cc4c | |||
3af05fc034 | |||
04a467dd83 | |||
96f91c3ba0 | |||
aeecc524a4 | |||
e229439174 | |||
c6c52a48c4 | |||
8656bce151 | |||
d6180aa154 | |||
89e1b5a235 | |||
e69462999e | |||
e1a012e15b | |||
16258d1c33 | |||
019d858ac2 | |||
72839e8251 | |||
7987fa04a0 | |||
9e79edc624 | |||
06b0115405 | |||
cea05fe8ff | |||
fa6272ac28 | |||
77a16c5551 | |||
e2775dedaf | |||
e5932a11c2 | |||
4de566ee41 | |||
d3b96088ab | |||
56e4b6c526 | |||
b20e822427 | |||
9fc3f7ea4a | |||
9363cd756b | |||
9e2cebde2e | |||
a2e22c357a | |||
ee636a29ac | |||
d3f49a3c01 | |||
58d1f26701 |
24
.build
Normal file
24
.build
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Isn" default="clean" basedir=".">
|
||||
<description>The Hello World of build files.</description>
|
||||
<property name="debug" value="true" overwrite="false" />
|
||||
|
||||
<target name="clean" description="remove all generated files">
|
||||
<delete dir="src/isn.abst/bin/" failonerror="false" />
|
||||
<delete dir="src/isn.abst/obj/" failonerror="false" />
|
||||
<delete dir="src/isn/bin/" failonerror="false" />
|
||||
<delete dir="src/isn/obj/" failonerror="false" />
|
||||
<delete dir="src/isnd/bin/" failonerror="false" />
|
||||
<delete dir="src/isnd/obj/" failonerror="false" />
|
||||
<delete dir="test/isn.tests/bin/" failonerror="false" />
|
||||
<delete dir="test/isn.tests/obj/" failonerror="false" />
|
||||
<delete dir="test/isnd.tests/bin/" failonerror="false" />
|
||||
<delete dir="test/isnd.tests/obj/" failonerror="false" />
|
||||
</target>
|
||||
<target name="build" description="build all">
|
||||
<exec program="dotnet" commandline="build" />
|
||||
</target>
|
||||
<target name="test" description="test all">
|
||||
<exec program="dotnet" commandline="test" />
|
||||
</target>
|
||||
</project>
|
24
.gitignore
vendored
24
.gitignore
vendored
@ -1,3 +1,21 @@
|
||||
/packages/
|
||||
/bin/
|
||||
/obj/
|
||||
.sass-cache/
|
||||
/src/isnd/bin/
|
||||
/src/isnd/obj/
|
||||
/src/isn/obj
|
||||
/src/isn/bin
|
||||
/src/isn/.vscode/
|
||||
/test/isnd.tests/obj/
|
||||
/test/isnd.tests/bin/
|
||||
/test/isn.tests/bin
|
||||
/test/isn.tests/obj/
|
||||
/src/isn.abst/bin
|
||||
/src/isn.abst/obj
|
||||
/src/isnd/packages/
|
||||
/test/data/test-isn/bin/
|
||||
/test/data/test-isn/obj
|
||||
.fake
|
||||
/artifacts/
|
||||
/.vs/
|
||||
/.vscode/
|
||||
appsettings.Development.json
|
||||
|
||||
|
66
.gitlab-ci.yml
Normal file
66
.gitlab-ci.yml
Normal file
@ -0,0 +1,66 @@
|
||||
# You can override the included template(s) by including variable overrides
|
||||
# See https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
|
||||
# Note that environment variables can be set in several places
|
||||
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
|
||||
image: busybox:latest
|
||||
before_script:
|
||||
- dotnet restore
|
||||
- dotnet nuget remove source gitlab || true
|
||||
nonreg:
|
||||
tags:
|
||||
- dotnet
|
||||
stage: test
|
||||
environment: Development
|
||||
script:
|
||||
- |
|
||||
echo "setting : $ISND_TESTING_SETTINGS"
|
||||
dotnet build
|
||||
cat $ISND_TESTING_SETTINGS > test/isnd.tests/appsettings.json
|
||||
dotnet test
|
||||
publish:
|
||||
tags:
|
||||
- dotnet
|
||||
stage: deploy
|
||||
dependencies:
|
||||
- nonreg
|
||||
artifacts:
|
||||
paths:
|
||||
- src/isnd/bin/Release/netcoreapp2.1/publish/
|
||||
when: always
|
||||
script:
|
||||
- dotnet publish --configuration Release
|
||||
deploy-to-gitlab:
|
||||
tags:
|
||||
- dotnet
|
||||
stage: deploy
|
||||
dependencies:
|
||||
- nonreg
|
||||
artifacts:
|
||||
paths:
|
||||
- src/*/bin/Release/*.nupkg
|
||||
when: always
|
||||
script:
|
||||
- dotnet pack -c Release
|
||||
- dotnet nuget add source --name gitlab --username gitlab+deploy-token-2 --password
|
||||
$CI_JOB_TOKEN --store-password-in-clear-text "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json"
|
||||
- dotnet nuget push src/*/bin/Release/*.nupkg -s gitlab
|
||||
deploy-to-isn:
|
||||
stage: deploy
|
||||
tags:
|
||||
- dotnet
|
||||
artifacts:
|
||||
paths:
|
||||
- src/*/bin/Release/*.nupkg
|
||||
when: always
|
||||
script:
|
||||
- dotnet pack --configuration Release --no-restore
|
||||
- cd src/isn
|
||||
- find -name "*.nupkg" -exec dotnet run push -s $ISNSOURCE -k $ISNAPIKEY {} \;
|
||||
environment:
|
||||
name: production
|
||||
url: $ISNSOURCE
|
||||
dependencies:
|
||||
- nonreg
|
||||
stages:
|
||||
- test
|
||||
- deploy
|
29
.vscode/launch.json
vendored
29
.vscode/launch.json
vendored
@ -1,29 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/nuget-host.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"OS-COMMENT5": "Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser",
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\\\bNow listening on:\\\\s+(https?://\\\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
63
.vscode/tasks.json
vendored
63
.vscode/tasks.json
vendored
@ -7,11 +7,31 @@
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/nuget-host.csproj",
|
||||
"/p:Configuration=Debug",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
"problemMatcher": "$msCompile",
|
||||
"group": "build"
|
||||
},
|
||||
{
|
||||
"label": "db-upgrade",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"ef",
|
||||
"database",
|
||||
"update"
|
||||
],
|
||||
"problemMatcher": "$msCompile",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/src/isnd",
|
||||
"env": {
|
||||
"ASPNETCORE_ENV": "Development"
|
||||
}
|
||||
},
|
||||
"dependsOn":["build"],
|
||||
"group": "test"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
@ -19,35 +39,52 @@
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/nuget-host.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
"/p:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary",
|
||||
"/p:TargetFramework=netcoreapp2.1",
|
||||
"/p:RuntimeIdentifier=linux-x64",
|
||||
"/p:PublishDir=${workspaceFolder}/artifacts"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
"problemMatcher": "$msCompile",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": "none"
|
||||
},
|
||||
{
|
||||
"label": "launch-dotnet",
|
||||
"label": "test",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"options": {
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"args": [
|
||||
"${workspaceFolder}/bin/Debug/netcoreapp2.0/nuget-host.dll"
|
||||
"test",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"--logger:xunit"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
"problemMatcher": "$msCompile",
|
||||
"dependsOn": [ "build"],
|
||||
"group": "test"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"bin/Debug/netcoreapp2.0/nuget-host.dll",
|
||||
"/property:GenerateFullPaths=true"
|
||||
"bin/Debug/netcoreapp2.1/isnd.dll",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/restore"
|
||||
],
|
||||
"options": {
|
||||
"env": {
|
||||
"ASPNETCORE_ENV": "Development"
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"problemMatcher": "$msCompile"
|
||||
"problemMatcher": "$msCompile",
|
||||
"group": "none"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using nuget_host.Models;
|
||||
|
||||
namespace nuget_host.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult About()
|
||||
{
|
||||
ViewData["Message"] = "Your application description page.";
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Contact()
|
||||
{
|
||||
ViewData["Message"] = "Your contact page.";
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Test()
|
||||
{
|
||||
ViewData["Message"] = "Your contact page.";
|
||||
|
||||
return Ok(ViewData);
|
||||
}
|
||||
|
||||
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NuGet.Packaging;
|
||||
|
||||
namespace nuget_host.Controllers
|
||||
{
|
||||
public class PackagesController : Controller
|
||||
{
|
||||
private ILogger<PackagesController> logger;
|
||||
|
||||
public PackagesController(ILoggerFactory loggerFactory)
|
||||
{
|
||||
logger = loggerFactory.CreateLogger<PackagesController>();
|
||||
|
||||
}
|
||||
|
||||
[HttpPut("packages/{*spec}")]
|
||||
public IActionResult Put(string spec)
|
||||
{
|
||||
string path = null;
|
||||
if (string.IsNullOrEmpty(spec))
|
||||
{
|
||||
var clientVersionId = Request.Headers["X-NuGet-Client-Version"];
|
||||
ViewData["nuget client "] = "nuget {clientVersionId}";
|
||||
foreach (var file in Request.Form.Files)
|
||||
{
|
||||
string initpath = "package.nupkg";
|
||||
using (FileStream fw = new FileStream(initpath, FileMode.Create))
|
||||
{
|
||||
file.CopyTo(fw);
|
||||
}
|
||||
|
||||
using (FileStream fw = new FileStream(initpath, FileMode.Open))
|
||||
{
|
||||
var archive = new System.IO.Compression.ZipArchive(fw);
|
||||
foreach (var filename in archive.GetFiles())
|
||||
{
|
||||
if (filename.EndsWith(".nuspec"))
|
||||
{
|
||||
// var entry = archive.GetEntry(filename);
|
||||
var specstr = archive.OpenFile(filename);
|
||||
NuspecReader reader = new NuspecReader(specstr);
|
||||
|
||||
string pkgdesc = reader.GetDescription();
|
||||
string pkgid = reader.GetId();
|
||||
var version = reader.GetVersion();
|
||||
|
||||
|
||||
path = Path.Combine(Startup.SourceDir,
|
||||
Path.Combine(pkgid,
|
||||
Path.Combine(version.ToFullString(),
|
||||
$"{pkgid}-{version}.nupkg")));
|
||||
var source = new FileInfo(initpath);
|
||||
var dest = new FileInfo(path);
|
||||
var destdir = new DirectoryInfo(dest.DirectoryName);
|
||||
if (dest.Exists)
|
||||
return BadRequest(new {error = "existant"});
|
||||
|
||||
if (!destdir.Exists) destdir.Create();
|
||||
source.MoveTo(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewData["spec"] = spec;
|
||||
// TODO Assert valid sem ver spec
|
||||
var filelst = new DirectoryInfo(Startup.SourceDir);
|
||||
var fi = new FileInfo(spec);
|
||||
var lst = filelst.GetFiles(fi.Name + "*.nupkg");
|
||||
ViewData["lst"] = lst.Select(entry => entry.Name);
|
||||
}
|
||||
return Ok(ViewData);
|
||||
}
|
||||
|
||||
[HttpGet("Packages/{spec}")]
|
||||
public IActionResult Index(string spec)
|
||||
{
|
||||
if (string.IsNullOrEmpty(spec))
|
||||
{
|
||||
ViewData["warn"] = "no spec";
|
||||
/*
|
||||
usr/lib/mono/msbuild/Current/bin/NuGet.targets(128,5): error : Failed to retrieve information about 'Microsoft.VisualStudio.Web.CodeGeneration.Tools' from remote source 'http://localhost:5000/Packages/FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration.Tools'&semVerLevel=2.0.0'. [/home/paul/workspace/nuget-host/nuget-host.csproj]
|
||||
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewData["spec"] = spec;
|
||||
// TODO Assert valid sem ver spec
|
||||
var filelst = new DirectoryInfo(Startup.SourceDir);
|
||||
var fi = new FileInfo(spec);
|
||||
var lst = filelst.GetDirectories(spec);
|
||||
ViewData["lst"] = lst.Select(entry => entry.Name);
|
||||
}
|
||||
return Ok(ViewData);
|
||||
}
|
||||
}
|
||||
}
|
10
Directory.Build.props
Normal file
10
Directory.Build.props
Normal file
@ -0,0 +1,10 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>1.0.8</Version>
|
||||
<Authors>paul</Authors>
|
||||
<Copyright>WFPL</Copyright>
|
||||
<ProjectUrl></ProjectUrl>
|
||||
<RepositoryUrl></RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
</PropertyGroup>
|
||||
</Project>
|
14
LICENSE
Normal file
14
LICENSE
Normal file
@ -0,0 +1,14 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
49
Makefile
Normal file
49
Makefile
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
CONFIGURATION=Debug
|
||||
TARGETFV=net8.0
|
||||
|
||||
all: build-isn build-isnd
|
||||
|
||||
build-%: src/%
|
||||
dotnet build -p:Configuration=$(CONFIGURATION) $^
|
||||
|
||||
pack-%: src/%
|
||||
dotnet pack $^
|
||||
|
||||
watch:
|
||||
dotnet watch --project=src/isnd
|
||||
|
||||
test-push:
|
||||
isn push src/isn/bin/Debug/isn.*.nupkg
|
||||
|
||||
clean-src-%: src/%
|
||||
rm -rf $^/bin $^/obj
|
||||
|
||||
clean-test-%: test/%
|
||||
rm -rf $^/bin $^/obj
|
||||
|
||||
packs: pack-isn pack-isnd pack-isn.abst
|
||||
|
||||
clean: clean-src-isnd clean-src-isn clean-src-isn.abst clean-test-isnd.tests clean-test-isn.tests
|
||||
|
||||
TARGETFRAMEWORK=net9.0
|
||||
|
||||
server-update:
|
||||
dotnet build -c Release src/isnd
|
||||
dotnet publish -c Release -f $(TARGETFRAMEWORK) src/isnd
|
||||
sudo systemctl stop isnd
|
||||
sudo cp -a src/isnd/bin/Release/$(TARGETFRAMEWORK)/publish/* /srv/www/isnd
|
||||
sudo systemctl start isnd
|
||||
|
||||
client-update:
|
||||
dotnet build -c Release src/isn
|
||||
# MAJ du client
|
||||
sudo cp -a src/isn/bin/Release/$(TARGETFRAMEWORK)/* /usr/local/lib/isn
|
||||
sudo chown -R root:root /usr/local/lib/isn
|
||||
|
||||
src/isn.abst/bin/Release/isn.abst.1.0.24.nupkg:
|
||||
dotnet pack src/isn.abst -c Release
|
||||
|
||||
push-test: src/isn.abst/bin/Release/isn.abst.1.0.24.nupkg
|
||||
isn push -s "http://localhost:3002/v3/index.json" src/isn.abst/bin/Release/isn.abst.1.0.24.nupkg
|
||||
|
@ -1,11 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace nuget_host.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
99
README.md
99
README.md
@ -1,9 +1,100 @@
|
||||
# Usage
|
||||
# ISN
|
||||
|
||||
Hébergement de paquets logiciels Nuget, fournissant une implémentation minimale de l'API Nuget V3
|
||||
|
||||
## Usage
|
||||
|
||||
````sh
|
||||
|
||||
nuget sources remove -Name dev
|
||||
nuget sources add -Name dev -Source Http://localhost:5000/packages
|
||||
nuget push your-versionned.nupkg -ApiKey 15d0dda1-4028-4896-9f1a-188817da23f4 -Source http://localhost:5000/packages
|
||||
dotnet user-secrets set ConnectionStrings:DefaultConnection "Server=<lame-pgserver>;Port=<lame-pgport>;Database=<lame-dbname>;Username=<lame-dbusername>;Password=<lame-dbpass>;"
|
||||
|
||||
isnd&
|
||||
|
||||
# get an api-key from <http://localhost:5000/ApkKeys>
|
||||
|
||||
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
|
||||
````
|
||||
|
||||
## Installation
|
||||
|
||||
### Compilation
|
||||
|
||||
Dans le dossier de la solution, compiler la solution :
|
||||
|
||||
````bash
|
||||
dotnet build /restore -c Release
|
||||
dotnet publish -c Release src/isnd
|
||||
````
|
||||
|
||||
### Déploiement du serveur
|
||||
|
||||
La livraison initiale, aujourd'hui :
|
||||
|
||||
````bash
|
||||
sudo mkdir -p /srv/www/isnd
|
||||
sudo cp -a src/isnd/bin/Release/net9.0/publish/* /srv/www/isnd
|
||||
sudo cp contrib/isnd.service /etc/systemd/system
|
||||
chown -R isn:isn /srv/www/isnd/
|
||||
sudo systemctl daemon-reload
|
||||
````
|
||||
|
||||
Une base de donées Postgresql est requise, avec, pour faire simple,
|
||||
son utilisateur, et le droit de créer des tables (ce dernier droit pourrait expirer, mais gare aux mises à jour).
|
||||
|
||||
Il faudra éditer la configuration pour indiquer :
|
||||
|
||||
* dans /etc/systemd/system/isnd.service , la connextion à une base de donnée Postresgql, sous la forme :
|
||||
`"Server=<pgserver>;Port=<pgport>;Database=<dbname>;Username=<dbusername>;Password=<dbpass>;"`
|
||||
* dans /srv/www/isnd/appsettings.Production.json, la connection au serveur de messagerie,
|
||||
* l'URL externe du ou des sites à propulser, et à utiliser dans la description de service,
|
||||
* et les autres détails.
|
||||
|
||||
Pour faire ceci, vous pourrez éditer une copie du fichier `appsettings.json` vers `appsettings.Production.json`,
|
||||
pour renseigner toutes les valeurs spécifiées.
|
||||
|
||||
* Démarrer le serveur :
|
||||
|
||||
````bash
|
||||
sudo systemctl start isnd
|
||||
````
|
||||
|
||||
* Activation du serveur :
|
||||
|
||||
````bash
|
||||
sudo systemctl enable isnd
|
||||
````
|
||||
|
||||
### Installation du client
|
||||
|
||||
````bash
|
||||
sudo mkdir /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 ln -s /usr/local/lib/isn/isn /usr/local/bin/isn
|
||||
````
|
||||
|
||||
### Mises à jour
|
||||
|
||||
Dans le détail, la séquence serait du style :
|
||||
|
||||
````bash
|
||||
# compiler tout
|
||||
dotnet build -c Release
|
||||
dotnet publish -c Release -f net9.0 src/isnd
|
||||
# MAJ du serveur
|
||||
sudo systemctl stop isnd
|
||||
sudo cp -a src/isnd/bin/Release/net9.0/publish/* /srv/www/isnd
|
||||
sudo systemctl start isnd
|
||||
# MAJ du client
|
||||
sudo cp -a src/isn/bin/Release/net9.0/* /usr/local/lib/isn
|
||||
sudo chown -R root:root /usr/local/lib/isn
|
||||
````
|
||||
|
||||
On pourra cibler "client-update" ou "server-update", à la construction :
|
||||
|
||||
|
||||
````bash
|
||||
make server-update
|
||||
make client-update
|
||||
````
|
||||
|
54
Startup.cs
54
Startup.cs
@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace nuget_host
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IHostingEnvironment env, IConfiguration config)
|
||||
{
|
||||
Configuration = config;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
public static string ExternalUrl { get; private set; }
|
||||
public static string SourceDir { get; private set; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
}
|
||||
|
||||
ExternalUrl = Configuration["NuGet:ExternalUrl"];
|
||||
SourceDir = Configuration["NuGet:SourceDir"];
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
|
||||
<ol class="carousel-indicators">
|
||||
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||
<li data-target="#myCarousel" data-slide-to="2"></li>
|
||||
<li data-target="#myCarousel" data-slide-to="3"></li>
|
||||
</ol>
|
||||
<div class="carousel-inner" role="listbox">
|
||||
<div class="item active">
|
||||
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
|
||||
<div class="carousel-caption" role="option">
|
||||
<p>
|
||||
Learn how to build ASP.NET apps that can run anywhere.
|
||||
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
|
||||
Learn More
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
|
||||
<div class="carousel-caption" role="option">
|
||||
<p>
|
||||
There are powerful new features in Visual Studio for building modern web apps.
|
||||
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
|
||||
Learn More
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img src="~/images/banner3.svg" alt="Package Management" class="img-responsive" />
|
||||
<div class="carousel-caption" role="option">
|
||||
<p>
|
||||
Bring in libraries from NuGet and npm, and automate tasks using Grunt or Gulp.
|
||||
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
|
||||
Learn More
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img src="~/images/banner4.svg" alt="Microsoft Azure" class="img-responsive" />
|
||||
<div class="carousel-caption" role="option">
|
||||
<p>
|
||||
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
|
||||
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
|
||||
Learn More
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
||||
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
||||
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<h2>Application uses</h2>
|
||||
<ul>
|
||||
<li>Sample pages using ASP.NET Core MVC</li>
|
||||
<li>Theming using <a href="https://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h2>How to</h2>
|
||||
<ul>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h2>Overview</h2>
|
||||
<ul>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h2>Run & Deploy</h2>
|
||||
<ul>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
@ -1,22 +0,0 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
|
||||
</p>
|
@ -1,71 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - nuget_host</title>
|
||||
|
||||
<environment include="Development">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||
</environment>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">nuget_host</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 2018 - nuget_host</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<environment include="Development">
|
||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
|
||||
</script>
|
||||
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
@ -1,3 +0,0 @@
|
||||
@using nuget_host
|
||||
@using nuget_host.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"NuGet": {
|
||||
"ExternalUrl" : "<http://localhost:5000/Packages",
|
||||
"SourceDir" : "packages"
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"NuGet": {
|
||||
"ExternalUrl" : "<http://your-external.url",
|
||||
"SourceDir" : "<your-Source-dir>"
|
||||
},
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
8
debian/README.Debian
vendored
Normal file
8
debian/README.Debian
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
yavsc for Debian
|
||||
|
||||
Please edit this to provide information specific to
|
||||
this yavsc Debian package.
|
||||
|
||||
(Automatically generated by debmake Version 4.5.1)
|
||||
|
||||
-- Paul Schneider <paul@localhost> Sun, 08 Jun 2025 01:41:54 +0100
|
14
debian/README.source
vendored
Normal file
14
debian/README.source
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
yavsc for Debian
|
||||
|
||||
See Debian policy manual section 4.14.
|
||||
https://www.debian.org/doc/debian-policy/ch-source.html#source-package-handling-debian-readme-source
|
||||
|
||||
If running dpkg-source -x on a source package doesn’t produce the source of the
|
||||
package, ready for editing, and allow one to make changes and run
|
||||
dpkg-buildpackage to produce a modified package without taking any additional
|
||||
steps, creating this file explain how to do all of these is recommended.
|
||||
Otherwise, remove this file.
|
||||
|
||||
(Automatically generated by debmake Version 4.5.1)
|
||||
|
||||
-- Paul Schneider <paul@localhost> Sun, 08 Jun 2025 01:41:54 +0100
|
6
debian/changelog
vendored
Normal file
6
debian/changelog
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
yavsc (1.1.0-1) UNRELEASED; urgency=low
|
||||
|
||||
* Initial release. Closes: #nnnn
|
||||
<nnnn is the bug number of your ITP>
|
||||
|
||||
-- Paul Schneider <paul@localhost> Sun, 08 Jun 2025 01:41:54 +0100
|
1
debian/clean
vendored
Normal file
1
debian/clean
vendored
Normal file
@ -0,0 +1 @@
|
||||
# You must remove unused comment lines for the released package.
|
21
debian/control
vendored
Normal file
21
debian/control
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Source: yavsc
|
||||
Section: unknown
|
||||
Priority: optional
|
||||
Maintainer: Paul Schneider <paul@localhost>
|
||||
Build-Depends:
|
||||
debhelper-compat (= 13),
|
||||
Standards-Version: 4.7.0
|
||||
Homepage: <insert the upstream URL, if relevant>
|
||||
Rules-Requires-Root: no
|
||||
#Vcs-Git: https://salsa.debian.org/debian/yavsc.git
|
||||
#Vcs-Browser: https://salsa.debian.org/debian/yavsc
|
||||
|
||||
Package: yavsc
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Description: auto-generated package by debmake
|
||||
This Debian binary package was auto-generated by the
|
||||
debmake(1) command provided by the debmake package.
|
2092
debian/copyright
vendored
Normal file
2092
debian/copyright
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
debian/dirs
vendored
Normal file
2
debian/dirs
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
# You must remove unused comment lines for the released package.
|
2
debian/gbp.conf
vendored
Normal file
2
debian/gbp.conf
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
[DEFAULT]
|
||||
upstream-tag=v%(version)s
|
2
debian/install
vendored
Normal file
2
debian/install
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
# You must remove unused comment lines for the released package.
|
2
debian/links
vendored
Normal file
2
debian/links
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
# You must remove unused comment lines for the released package.
|
7
debian/maintscript.ex
vendored
Normal file
7
debian/maintscript.ex
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# see: dh_installdeb(1), dpkg-maintscript-helper(1)
|
||||
# For renaming a conffile, you are advised to uncomment and edit the following
|
||||
#dpkg-maintscript-helper mv_conffile old-conffile new-conffile prior-version package
|
||||
# For switching a symlink to directory, you are advised to uncomment and edit the following
|
||||
#dpkg-maintscript-helper symlink_to_dir pathname old-target prior-version package
|
||||
# For switching a directory to symlink, you are advised to uncomment and edit the following
|
||||
#dpkg-maintscript-helper dir_to_symlink pathname new-target prior-version package
|
73
debian/manpage.1.ex
vendored
Normal file
73
debian/manpage.1.ex
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" (C) Copyright 2025 Paul Schneider <paul@localhost>,
|
||||
.\"
|
||||
.\" See man(1), man(7) and man-pages(7), https://www.tldp.org/HOWTO/Man-Page/
|
||||
.\" for the documentation about man-pages and man-page-formatting:
|
||||
.\"
|
||||
.\" 1. Use this as the template for the manpage for <commandname> after
|
||||
.\" renaming this file to <commandname>.1 (if it is for section 1).
|
||||
.\"
|
||||
.\" 2. List the path to this file in debian/<packagename>.manpages to
|
||||
.\" install this manpage to the target binary package.
|
||||
.\"
|
||||
.\" First parameter, YAVSC, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.\"
|
||||
.\" Easier way to make an initial manpage for commands is the use of help2man
|
||||
.\" command provided by help2man package while using this file as an tutorial
|
||||
.\" to understand what was created or to make touch-up edits.
|
||||
.\"
|
||||
.\" Other template files (manpage.*) created by debmake command are secondary
|
||||
.\" helper files to create an initial manpage.
|
||||
.\"
|
||||
.TH YAVSC SECTION "08 Jun 2025"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
.\" .nh disable hyphenation
|
||||
.\" .hy enable hyphenation
|
||||
.\" .ad l left justify
|
||||
.\" .ad b justify to both left and right margins
|
||||
.\" .nf disable filling
|
||||
.\" .fi enable filling
|
||||
.\" .br insert line break
|
||||
.\" .sp <n> insert n+1 empty lines
|
||||
.\" for manpage-specific macros, see man(7)
|
||||
.SH NAME
|
||||
yavsc \- program to do something
|
||||
.SH SYNOPSIS
|
||||
.B yavsc
|
||||
.RI [ options ] " files" ...
|
||||
.br
|
||||
.B bar
|
||||
.RI [ options ] " files" ...
|
||||
.SH DESCRIPTION
|
||||
This manual page documents briefly the
|
||||
.B yavsc
|
||||
and
|
||||
.B bar
|
||||
commands.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
|
||||
.\" respectively.
|
||||
\fByavsc\fP is a program that...
|
||||
.SH OPTIONS
|
||||
These programs follow the usual GNU command line syntax, with long
|
||||
options starting with two dashes (`-').
|
||||
A summary of options is included below.
|
||||
For a complete description, see the Info files.
|
||||
.TP
|
||||
.B \-h, \-\-help
|
||||
Show summary of options.
|
||||
.TP
|
||||
.B \-v, \-\-version
|
||||
Show version of program.
|
||||
.SH SEE ALSO
|
||||
.BR bar (1),
|
||||
.BR baz (1).
|
||||
.br
|
||||
The programs are documented fully by
|
||||
.IR "The Rise and Fall of a Fooish Bar" ,
|
||||
available via the Info system.
|
44
debian/manpage.asciidoc.ex
vendored
Normal file
44
debian/manpage.asciidoc.ex
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
= @UPACKAGE@(1)
|
||||
:man source: YAVSC
|
||||
:man version: 1.1.0-1
|
||||
:man manual: YAVSC Manual
|
||||
|
||||
// Secondary template file to make manpage.1
|
||||
//
|
||||
// See "AsciiDoc Syntax Quick Reference"
|
||||
// https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/
|
||||
// https://docs.asciidoctor.org/asciidoctor/latest/manpage-backend/
|
||||
|
||||
// convert by:
|
||||
// $ asciidoctor --doctype manpage -b manpage -a 'newline=\n' yavsc.asciidoc
|
||||
|
||||
== NAME
|
||||
|
||||
yavsc - program to do something
|
||||
|
||||
== SYNOPSIS
|
||||
|
||||
*yavsc* [*-h*] ...
|
||||
|
||||
|
||||
== DESCRIPTION
|
||||
|
||||
*yavsc* do something.
|
||||
|
||||
=== optional arguments:
|
||||
|
||||
*-h*, *--help*::
|
||||
show this help message and exit.
|
||||
|
||||
|
||||
== AUTHOR
|
||||
|
||||
Copyright © 2025 Paul Schneider <paul@localhost>
|
||||
|
||||
== LICENSE
|
||||
|
||||
MIT License
|
||||
|
||||
== SEE ALSO
|
||||
|
||||
See also ...
|
129
debian/manpage.md.ex
vendored
Normal file
129
debian/manpage.md.ex
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
% YAVSC(SECTION) | User Commands
|
||||
%
|
||||
% "08 Jun 2025"
|
||||
|
||||
[comment]: # Secondary template file to make manpage.1
|
||||
[comment]: #
|
||||
[comment]: # The lines above form a Pandoc metadata block. They must be
|
||||
[comment]: # the first ones in the file.
|
||||
[comment]: # See https://pandoc.org/MANUAL.html#metadata-blocks for details.
|
||||
|
||||
[comment]: # pandoc -s -f markdown -t man package.md -o package.1
|
||||
[comment]: #
|
||||
[comment]: # A manual page package.1 will be generated. You may view the
|
||||
[comment]: # manual page with: nroff -man package.1 | less. A typical entry
|
||||
[comment]: # in a Makefile or Makefile.am is:
|
||||
[comment]: #
|
||||
[comment]: # package.1: package.md
|
||||
[comment]: # pandoc --standalone --from=markdown --to=man $< --output=$@
|
||||
[comment]: #
|
||||
[comment]: # The pandoc binary is found in the pandoc package. Please remember
|
||||
[comment]: # that if you create the nroff version in one of the debian/rules
|
||||
[comment]: # file targets, such as build, you will need to include pandoc in
|
||||
[comment]: # your Build-Depends control field.
|
||||
|
||||
[comment]: # lowdown is a low dependency, lightweight alternative to
|
||||
[comment]: # pandoc as a markdown to manpage translator. Use with:
|
||||
[comment]: #
|
||||
[comment]: # package.1: package.md
|
||||
[comment]: # lowdown -s -Tman -o $@ $<
|
||||
[comment]: #
|
||||
[comment]: # And add lowdown to the Build-Depends control field.
|
||||
|
||||
[comment]: # Remove the lines starting with '[comment]:' in this file in order
|
||||
[comment]: # to avoid warning messages.
|
||||
|
||||
# NAME
|
||||
|
||||
yavsc - short summary
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
**yavsc** **-e** _this_ [**\-\-example=that**] [{**-e** | **\-\-example**} _this_]
|
||||
[{**-e** | **\-\-example**} {_this_ | _that_}]
|
||||
|
||||
**yavsc** [{**-h** | *\-\-help**} | {**-v** | **\-\-version**}]
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
**yavsc** is a program that...
|
||||
|
||||
# OPTIONS
|
||||
|
||||
The program follows the usual GNU command line syntax, with long options
|
||||
starting with two dashes ('-'). A summary of options is included below.
|
||||
|
||||
**-e** _this_, **\-\-example=**_that_
|
||||
: Does this and that.
|
||||
|
||||
**-h**, **\-\-help**
|
||||
: Show summary of options.
|
||||
|
||||
**-v**, **\-\-version**
|
||||
: Show version of program.
|
||||
|
||||
# FILES
|
||||
|
||||
/etc/foo.conf
|
||||
: The system-wide configuration file to control the behaviour of
|
||||
yavsc. See **foo.conf**(5) for further details.
|
||||
|
||||
${HOME}/.foo.conf
|
||||
: The per-user configuration file to control the behaviour of
|
||||
yavsc. See **foo.conf**(5) for further details.
|
||||
|
||||
# ENVIRONMENT
|
||||
|
||||
**FOO_CONF**
|
||||
: If used, the defined file is used as configuration file (see also
|
||||
the section called “FILES”).
|
||||
|
||||
# DIAGNOSTICS
|
||||
|
||||
The following diagnostics may be issued on stderr:
|
||||
|
||||
Bad configuration file. Exiting.
|
||||
: The configuration file seems to contain a broken configuration
|
||||
line. Use the **\-\-verbose** option, to get more info.
|
||||
|
||||
**yavsc** provides some return codes, that can be used in scripts:
|
||||
|
||||
Code Diagnostic
|
||||
0 Program exited successfully.
|
||||
1 The configuration file seems to be broken.
|
||||
|
||||
# BUGS
|
||||
|
||||
The program is currently limited to only work with the foobar library.
|
||||
|
||||
The upstream BTS can be found at https://bugzilla.foo.tld.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
**bar**(1), **baz**(1), **foo.conf**(5)
|
||||
|
||||
The programs are documented fully by The Rise and Fall of a Fooish Bar
|
||||
available via the **info**(1) system.
|
||||
|
||||
# AUTHOR
|
||||
|
||||
Paul Schneider <paul@localhost>
|
||||
: Wrote this manpage for the Debian system.
|
||||
|
||||
# COPYRIGHT
|
||||
|
||||
Copyright © 2025 Paul Schneider
|
||||
|
||||
This manual page was written for the Debian system (and may be used by
|
||||
others).
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document under
|
||||
the terms of the GNU General Public License, Version 2 or (at your option)
|
||||
any later version published by the Free Software Foundation.
|
||||
|
||||
On Debian systems, the complete text of the GNU General Public License
|
||||
can be found in /usr/share/common-licenses/GPL.
|
||||
|
||||
[comment]: # Local Variables:
|
||||
[comment]: # mode: markdown
|
||||
[comment]: # End:
|
144
debian/manpage.sgml.ex
vendored
Normal file
144
debian/manpage.sgml.ex
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
|
||||
|
||||
<!--
|
||||
Install docbook-to-man package and see docbook-to-man(1)
|
||||
|
||||
Secondary template file to make manpage.1
|
||||
-->
|
||||
|
||||
<!-- Fill in your name for FIRSTNAME and SURNAME. -->
|
||||
<!ENTITY dhfirstname "<firstname>FIRSTNAME</firstname>">
|
||||
<!ENTITY dhsurname "<surname>SURNAME</surname>">
|
||||
<!-- Please adjust the date whenever revising the manpage. -->
|
||||
<!ENTITY dhdate "<date>08 Jun 2025</date>">
|
||||
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
|
||||
allowed: see man(7), man(1). -->
|
||||
<!ENTITY dhsection "<manvolnum>SECTION</manvolnum>">
|
||||
<!ENTITY dhemail "<email>paul@localhost</email>">
|
||||
<!ENTITY dhusername "Paul Schneider">
|
||||
<!ENTITY dhucpackage "<refentrytitle>YAVSC</refentrytitle>">
|
||||
<!ENTITY dhpackage "yavsc">
|
||||
|
||||
<!ENTITY debian "<productname>Debian</productname>">
|
||||
<!ENTITY gnu "<acronym>GNU</acronym>">
|
||||
<!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
|
||||
]>
|
||||
|
||||
<refentry>
|
||||
<refentryinfo>
|
||||
<address>
|
||||
&dhemail;
|
||||
</address>
|
||||
<author>
|
||||
&dhfirstname;
|
||||
&dhsurname;
|
||||
</author>
|
||||
<copyright>
|
||||
<year>2003</year>
|
||||
<holder>&dhusername;</holder>
|
||||
</copyright>
|
||||
&dhdate;
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
&dhucpackage;
|
||||
|
||||
&dhsection;
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>&dhpackage;</refname>
|
||||
|
||||
<refpurpose>program to do something</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>&dhpackage;</command>
|
||||
|
||||
<arg><option>-e <replaceable>this</replaceable></option></arg>
|
||||
|
||||
<arg><option>--example <replaceable>that</replaceable></option></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
<refsect1>
|
||||
<title>DESCRIPTION</title>
|
||||
|
||||
<para>This manual page documents briefly the
|
||||
<command>&dhpackage;</command> and <command>bar</command>
|
||||
commands.</para>
|
||||
|
||||
<para>This manual page was written for the &debian; distribution
|
||||
because the original program does not have a manual page.
|
||||
Instead, it has documentation in the &gnu;
|
||||
<application>Info</application> format; see below.</para>
|
||||
|
||||
<para><command>&dhpackage;</command> is a program that...</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>OPTIONS</title>
|
||||
|
||||
<para>These programs follow the usual &gnu; command line syntax,
|
||||
with long options starting with two dashes (`-'). A summary of
|
||||
options is included below. For a complete description, see the
|
||||
<application>Info</application> files.</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>
|
||||
<option>--help</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Show summary of options.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-v</option>
|
||||
<option>--version</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Show version of program.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>SEE ALSO</title>
|
||||
|
||||
<para>bar (1), baz (1).</para>
|
||||
|
||||
<para>The programs are documented fully by <citetitle>The Rise and
|
||||
Fall of a Fooish Bar</citetitle> available via the
|
||||
<application>Info</application> system.</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>AUTHOR</title>
|
||||
|
||||
<para>This manual page was written by &dhusername; &dhemail; for
|
||||
the &debian; system (and may be used by others). Permission is
|
||||
granted to copy, distribute and/or modify this document under
|
||||
the terms of the &gnu; General Public License, Version 2 any
|
||||
later version published by the Free Software Foundation.
|
||||
</para>
|
||||
<para>
|
||||
On Debian systems, the complete text of the GNU General Public
|
||||
License can be found in /usr/share/common-licenses/GPL.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:2
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:nil
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
267
debian/manpage.xml.ex
vendored
Normal file
267
debian/manpage.xml.ex
vendored
Normal file
@ -0,0 +1,267 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
|
||||
<!--
|
||||
|
||||
Secondary template file to make manpage.1
|
||||
|
||||
Install docbook-xsl and docbook-xsl-doc-html and see
|
||||
/usr/share/doc/docbook-xsl/examples/foo.1.example_manpage.xml
|
||||
/usr/share/doc/docbook-xsl-doc-html/doc/manpages/index.html
|
||||
|
||||
The xsltproc binary is found in the xsltproc package. The XSL files are in
|
||||
docbook-xsl. A description of the parameters you can use can be found in the
|
||||
docbook-xsl-doc-* packages.
|
||||
|
||||
Validation can be done using: `xmllint -''-noout -''-valid manpage.xml`
|
||||
|
||||
General documentation about man-pages and man-page-formatting:
|
||||
man(1), man(7), man-pages(7), https://www.tldp.org/HOWTO/Man-Page/
|
||||
|
||||
-->
|
||||
|
||||
<!-- Fill in your name for FIRSTNAME and SURNAME. -->
|
||||
<!ENTITY dhfirstname "FIRSTNAME">
|
||||
<!ENTITY dhsurname "SURNAME">
|
||||
<!-- dhusername could also be set to "&dhfirstname; &dhsurname;". -->
|
||||
<!ENTITY dhusername "Paul Schneider">
|
||||
<!ENTITY dhemail "paul@localhost">
|
||||
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
|
||||
allowed: see man(7), man(1) and
|
||||
https://www.tldp.org/HOWTO/Man-Page/q2.html. -->
|
||||
<!ENTITY dhsection "SECTION">
|
||||
<!-- TITLE should be something like "User commands" or similar (see
|
||||
https://www.tldp.org/HOWTO/Man-Page/q2.html). -->
|
||||
<!ENTITY dhtitle "yavsc User Manual">
|
||||
<!ENTITY dhucpackage "YAVSC">
|
||||
<!ENTITY dhpackage "yavsc">
|
||||
]>
|
||||
|
||||
<refentry>
|
||||
<refentryinfo>
|
||||
<title>&dhtitle;</title>
|
||||
<productname>&dhpackage;</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>&dhfirstname;</firstname>
|
||||
<surname>&dhsurname;</surname>
|
||||
<contrib>Wrote this manpage for the Debian system.</contrib>
|
||||
<address>
|
||||
<email>&dhemail;</email>
|
||||
</address>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
<year>2007</year>
|
||||
<holder>&dhusername;</holder>
|
||||
</copyright>
|
||||
<legalnotice>
|
||||
<para>This manual page was written for the Debian system
|
||||
(and may be used by others).</para>
|
||||
<para>Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU General Public License,
|
||||
Version 2 or (at your option) any later version published by
|
||||
the Free Software Foundation.</para>
|
||||
<para>On Debian systems, the complete text of the GNU General Public
|
||||
License can be found in
|
||||
<filename>/usr/share/common-licenses/GPL</filename>.</para>
|
||||
</legalnotice>
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
<refentrytitle>&dhucpackage;</refentrytitle>
|
||||
<manvolnum>&dhsection;</manvolnum>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>&dhpackage;</refname>
|
||||
<refpurpose>program to do something</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>&dhpackage;</command>
|
||||
<!-- These are several examples, how syntaxes could look -->
|
||||
<arg choice="plain"><option>-e <replaceable>this</replaceable></option></arg>
|
||||
<arg choice="opt"><option>--example=<parameter>that</parameter></option></arg>
|
||||
<arg choice="opt">
|
||||
<group choice="req">
|
||||
<arg choice="plain"><option>-e</option></arg>
|
||||
<arg choice="plain"><option>--example</option></arg>
|
||||
</group>
|
||||
<replaceable class="option">this</replaceable>
|
||||
</arg>
|
||||
<arg choice="opt">
|
||||
<group choice="req">
|
||||
<arg choice="plain"><option>-e</option></arg>
|
||||
<arg choice="plain"><option>--example</option></arg>
|
||||
</group>
|
||||
<group choice="req">
|
||||
<arg choice="plain"><replaceable>this</replaceable></arg>
|
||||
<arg choice="plain"><replaceable>that</replaceable></arg>
|
||||
</group>
|
||||
</arg>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>&dhpackage;</command>
|
||||
<!-- Normally the help and version options make the programs stop
|
||||
right after outputting the requested information. -->
|
||||
<group choice="opt">
|
||||
<arg choice="plain">
|
||||
<group choice="req">
|
||||
<arg choice="plain"><option>-h</option></arg>
|
||||
<arg choice="plain"><option>--help</option></arg>
|
||||
</group>
|
||||
</arg>
|
||||
<arg choice="plain">
|
||||
<group choice="req">
|
||||
<arg choice="plain"><option>-v</option></arg>
|
||||
<arg choice="plain"><option>--version</option></arg>
|
||||
</group>
|
||||
</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
<refsect1 id="description">
|
||||
<title>DESCRIPTION</title>
|
||||
<para>This manual page documents briefly the
|
||||
<command>&dhpackage;</command> and <command>bar</command>
|
||||
commands.</para>
|
||||
<para>This manual page was written for the Debian distribution
|
||||
because the original program does not have a manual page.
|
||||
Instead, it has documentation in the GNU <citerefentry>
|
||||
<refentrytitle>info</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry> format; see below.</para>
|
||||
<para><command>&dhpackage;</command> is a program that...</para>
|
||||
</refsect1>
|
||||
<refsect1 id="options">
|
||||
<title>OPTIONS</title>
|
||||
<para>The program follows the usual GNU command line syntax,
|
||||
with long options starting with two dashes (`-'). A summary of
|
||||
options is included below. For a complete description, see the
|
||||
<citerefentry>
|
||||
<refentrytitle>info</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry> files.</para>
|
||||
<variablelist>
|
||||
<!-- Use the variablelist.term.separator and the
|
||||
variablelist.term.break.after parameters to
|
||||
control the term elements. -->
|
||||
<varlistentry>
|
||||
<term><option>-e <replaceable>this</replaceable></option></term>
|
||||
<term><option>--example=<replaceable>that</replaceable></option></term>
|
||||
<listitem>
|
||||
<para>Does this and that.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-h</option></term>
|
||||
<term><option>--help</option></term>
|
||||
<listitem>
|
||||
<para>Show summary of options.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<term><option>--version</option></term>
|
||||
<listitem>
|
||||
<para>Show version of program.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1 id="files">
|
||||
<title>FILES</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><filename>/etc/foo.conf</filename></term>
|
||||
<listitem>
|
||||
<para>The system-wide configuration file to control the
|
||||
behaviour of <application>&dhpackage;</application>. See
|
||||
<citerefentry>
|
||||
<refentrytitle>foo.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry> for further details.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><filename>${HOME}/.foo.conf</filename></term>
|
||||
<listitem>
|
||||
<para>The per-user configuration file to control the
|
||||
behaviour of <application>&dhpackage;</application>. See
|
||||
<citerefentry>
|
||||
<refentrytitle>foo.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry> for further details.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1 id="environment">
|
||||
<title>ENVIRONMENT</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><envar>FOO_CONF</envar></term>
|
||||
<listitem>
|
||||
<para>If used, the defined file is used as configuration
|
||||
file (see also <xref linkend="files"/>).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1 id="diagnostics">
|
||||
<title>DIAGNOSTICS</title>
|
||||
<para>The following diagnostics may be issued
|
||||
on <filename class="devicefile">stderr</filename>:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><errortext>Bad configuration file. Exiting.</errortext></term>
|
||||
<listitem>
|
||||
<para>The configuration file seems to contain a broken configuration
|
||||
line. Use the <option>--verbose</option> option, to get more info.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para><command>&dhpackage;</command> provides some return codes, that can
|
||||
be used in scripts:</para>
|
||||
<segmentedlist>
|
||||
<segtitle>Code</segtitle>
|
||||
<segtitle>Diagnostic</segtitle>
|
||||
<seglistitem>
|
||||
<seg><errorcode>0</errorcode></seg>
|
||||
<seg>Program exited successfully.</seg>
|
||||
</seglistitem>
|
||||
<seglistitem>
|
||||
<seg><errorcode>1</errorcode></seg>
|
||||
<seg>The configuration file seems to be broken.</seg>
|
||||
</seglistitem>
|
||||
</segmentedlist>
|
||||
</refsect1>
|
||||
<refsect1 id="bugs">
|
||||
<!-- Or use this section to tell about upstream BTS. -->
|
||||
<title>BUGS</title>
|
||||
<para>The program is currently limited to only work
|
||||
with the <package>foobar</package> library.</para>
|
||||
<para>The upstreams <acronym>BTS</acronym> can be found
|
||||
at <ulink url="https://bugzilla.foo.tld"/>.</para>
|
||||
</refsect1>
|
||||
<refsect1 id="see_also">
|
||||
<title>SEE ALSO</title>
|
||||
<!-- In alphabetical order. -->
|
||||
<para><citerefentry>
|
||||
<refentrytitle>bar</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>, <citerefentry>
|
||||
<refentrytitle>baz</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>, <citerefentry>
|
||||
<refentrytitle>foo.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry></para>
|
||||
<para>The programs are documented fully by <citetitle>The Rise and
|
||||
Fall of a Fooish Bar</citetitle> available via the <citerefentry>
|
||||
<refentrytitle>info</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry> system.</para>
|
||||
</refsect1>
|
||||
</refentry>
|
1
debian/patches/series
vendored
Normal file
1
debian/patches/series
vendored
Normal file
@ -0,0 +1 @@
|
||||
# You must remove unused comment lines for the released package.
|
7
debian/postinst.ex
vendored
Normal file
7
debian/postinst.ex
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# If no user provided script is activated in this file, you should remove this file.
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
7
debian/postrm.ex
vendored
Normal file
7
debian/postrm.ex
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# If no user provided script is activated in this file, you should remove this file.
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
7
debian/preinst.ex
vendored
Normal file
7
debian/preinst.ex
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# If no user provided script is activated in this file, you should remove this file.
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
7
debian/prerm.ex
vendored
Normal file
7
debian/prerm.ex
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# If no user provided script is activated in this file, you should remove this file.
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
15
debian/rules
vendored
Executable file
15
debian/rules
vendored
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/make -f
|
||||
# You must remove unused comment lines for the released package.
|
||||
#export DH_VERBOSE = 1
|
||||
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
|
||||
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
#override_dh_auto_install:
|
||||
# dh_auto_install -- prefix=/usr
|
||||
|
||||
#override_dh_install:
|
||||
# dh_install --list-missing -X.pyc -X.pyo
|
25
debian/salsa-ci.yml
vendored
Normal file
25
debian/salsa-ci.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# For more information on what jobs are run see:
|
||||
# https://salsa.debian.org/salsa-ci-team/pipeline
|
||||
#
|
||||
# To enable the jobs, go to your repository (at salsa.debian.org)
|
||||
# and click over Settings > CI/CD > Expand (in General pipelines).
|
||||
# In "CI/CD configuration file" write debian/salsa-ci.yml and click
|
||||
# in "Save Changes". The CI tests will run after the next commit.
|
||||
---
|
||||
include:
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml
|
||||
|
||||
# # This commented-out sample disables all default tests, only disable those
|
||||
# # CI tests that is required to get the CI process to succeed.
|
||||
#
|
||||
# variables:
|
||||
# SALSA_CI_DISABLE_APTLY: 1
|
||||
# SALSA_CI_DISABLE_AUTOPKGTEST: 1
|
||||
# SALSA_CI_DISABLE_BLHC: 1
|
||||
# SALSA_CI_DISABLE_LINTIAN: 1
|
||||
# SALSA_CI_DISABLE_PIUPARTS: 1
|
||||
# SALSA_CI_DISABLE_REPROTEST: 1
|
||||
# SALSA_CI_DISABLE_BUILD_PACKAGE_ALL: 1
|
||||
# SALSA_CI_DISABLE_BUILD_PACKAGE_ANY: 1
|
||||
# SALSA_CI_DISABLE_BUILD_PACKAGE_I386: 1
|
||||
# SALSA_CI_DISABLE_CROSSBUILD_ARM64: 1
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
2
debian/source/lintian-overrides.ex
vendored
Normal file
2
debian/source/lintian-overrides.ex
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# See dh_lintian(1)
|
||||
# cut and paste the lintian(1) outputs without leading "E: ", "W: ", ...
|
47
debian/source/local-options.ex
vendored
Normal file
47
debian/source/local-options.ex
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
# Uncomment to active options. See dpkg-source(1)
|
||||
#
|
||||
# This file contains a list of long options that should be automatically
|
||||
# prepended to the set of command line options of a dpkg-source --build call.
|
||||
|
||||
# This is normally for the non-native Debian packaging.
|
||||
|
||||
# Whenever possible, use this instead of debian/local-options to make
|
||||
# dpkg-source long options applied for the team builds based on the VCS
|
||||
# repository while NMU builds based on the Debian source package are not
|
||||
# affected.
|
||||
|
||||
# == Patch unapplied strategy (dquilt, gbp, ...) ==
|
||||
#
|
||||
# The source outside of debian/ directory is unmodified from the upstream one:
|
||||
# * Workflow using diff -u
|
||||
# https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html#diff-u
|
||||
# * Workflow using dquilt
|
||||
# https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html#dquilt
|
||||
# * Workflow using dpkg-source commit (commit only patch to VCS after dpkg-source commit)
|
||||
# https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html#dpkg-source-commit
|
||||
# * Workflow to use gbp-buildpackage(1) with pristine-tar
|
||||
# * Workflow described in dgit-maint-gbp(7)
|
||||
#
|
||||
# Uncomment following if you use this strategy
|
||||
#abort-on-upstream-changes
|
||||
#unapply-patches
|
||||
|
||||
# == Patch applied strategy (merge) ==
|
||||
#
|
||||
# The source outside of debian/ directory is modified by maintainer and
|
||||
# different from the upstream one:
|
||||
# * Workflow using dpkg-source commit (commit all to VCS after dpkg-source commit)
|
||||
# https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html#dpkg-source-commit
|
||||
# * Workflow described in dgit-maint-merge(7)
|
||||
#
|
||||
# uncomment following if you use this strategy
|
||||
#single-debian-patch
|
||||
#auto-commit
|
||||
|
||||
# == Patch applied strategy (debrebase) ==
|
||||
#
|
||||
# The source outside of debian/ directory is modified by maintainer and
|
||||
# different from the upstream one:
|
||||
# * Workflow described in dgit-maint-debrebase(7)
|
||||
#
|
||||
# Remove this file if you use this strategy
|
26
debian/source/local-patch-header.ex
vendored
Normal file
26
debian/source/local-patch-header.ex
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
The automatically generated patch by dpkg-source(1) puts this free form text on
|
||||
top of it.
|
||||
|
||||
This is normally for the non-native Debian packaging.
|
||||
|
||||
Whenever possible, use this instead of debian/patch-header to make dpkg-source
|
||||
long options applied for the team builds based on the VCS repository while NMU
|
||||
builds based on the Debian source package are not affected.
|
||||
|
||||
== Patch applied strategy (merge) ==
|
||||
|
||||
The source outside of debian/ directory is modified by maintainer and
|
||||
different from the upstream one:
|
||||
* Workflow using dpkg-source commit (commit all to VCS after dpkg-source commit)
|
||||
https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html#dpkg-source-commit
|
||||
* Workflow described in dgit-maint-merge(7)
|
||||
|
||||
Keep this file after updating its content if you use this strategy
|
||||
|
||||
== Other strategies ==
|
||||
|
||||
Remove this file if you use this strategy
|
||||
|
||||
===
|
||||
|
||||
A single combined diff, containing all the changes, follows.
|
10
debian/source/options.ex
vendored
Normal file
10
debian/source/options.ex
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Uncomment to active options. See dpkg-source(1)
|
||||
#
|
||||
# This file contains a list of long options that should be automatically
|
||||
# prepended to the set of command line options of a dpkg-source --build call.
|
||||
|
||||
# This is normally for the non-native Debian packaging.
|
||||
|
||||
# Whenever possible, use debian/local-options instead to make dpkg-source long
|
||||
# options applied for the team builds based on the VCS repository while NMU
|
||||
# builds based on the Debian source package are not affected.
|
12
debian/source/patch-header.ex
vendored
Normal file
12
debian/source/patch-header.ex
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
The automatically generated patch by dpkg-source(1) puts this free form text on
|
||||
top of it.
|
||||
|
||||
This is normally for the non-native Debian packaging.
|
||||
|
||||
Whenever possible, use debian/local-patch-header instead to make dpkg-source long
|
||||
options applied for the team builds based on the VCS repository while NMU
|
||||
builds based on the Debian source package are not affected.
|
||||
|
||||
A single combined diff, containing all the changes, follows.
|
||||
|
||||
===
|
9
debian/tests/control
vendored
Normal file
9
debian/tests/control
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# DEP-8: autopkgtest - automatic as-installed package testing
|
||||
# Please check * https://dep-team.pages.debian.net/deps/dep8/
|
||||
# * /usr/share/doc/autopkgtest
|
||||
#
|
||||
# !!! Please make sure to edit this to a valid test, otherwise build will fails
|
||||
#
|
||||
#Tests: testcode.sh
|
||||
#Restrictions: allow-stderr, breaks-testbed, needs-internet, needs-root
|
16
debian/upstream/metadata
vendored
Normal file
16
debian/upstream/metadata
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# DEP-12: Per-package machine-readable metadata about Upstream
|
||||
# Please check * https://dep-team.pages.debian.net/deps/dep12/
|
||||
# * https://wiki.debian.org/UpstreamMetadata
|
||||
Reference:
|
||||
Author: <please use full names and separate multiple author by the keyword "and">
|
||||
Title:
|
||||
Journal:
|
||||
Year:
|
||||
Volume:
|
||||
Number:
|
||||
Pages:
|
||||
DOI:
|
||||
PMID:
|
||||
URL:
|
||||
eprint:
|
3
debian/watch
vendored
Normal file
3
debian/watch
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# You must remove unused comment lines for the released package.
|
||||
# Compulsory line, this is a version 4 file
|
||||
version=4
|
3
debian/yavsc.bug-control.ex
vendored
Normal file
3
debian/yavsc.bug-control.ex
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Installed as usr/share/bug/yavsc/control in yavsc
|
||||
# See dh_bugfiles(1) and /usr/share/doc/reportbug/README.developers.gz
|
||||
# It is the bug control file containing some directions for the bug reporting tool.
|
3
debian/yavsc.bug-presubj.ex
vendored
Normal file
3
debian/yavsc.bug-presubj.ex
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Installed as usr/share/bug/yavsc/presubj in yavsc
|
||||
# See dh_bugfiles(1) and /usr/share/doc/reportbug/README.developers.gz
|
||||
# The contents of this file are displayed to the user by the bug reporting tool.
|
3
debian/yavsc.bug-script.ex
vendored
Normal file
3
debian/yavsc.bug-script.ex
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Installed as usr/share/bug/yavsc or usr/share/bug/yavsc/script in yavsc
|
||||
# See dh_bugfiles(1) and /usr/share/doc/reportbug/README.developers.gz
|
||||
# This is the script to be run by the bug reporting program for generating a bug report template.
|
10
debian/yavsc.conffiles.ex
vendored
Normal file
10
debian/yavsc.conffiles.ex
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# See dh_installdeb(1).
|
||||
# This file will be installed into the DEBIAN directory. The provided file will
|
||||
# be enriched by debhelper to include all the conffiles auto-detected by
|
||||
# debhelper (the maintainer should not list there as debhelper assumes it
|
||||
# should handle that part).
|
||||
#
|
||||
# This file is primarily useful for using "special" entries such as the
|
||||
# remove-on-upgrade feature from dpkg.
|
||||
#
|
||||
# For most packages, this file doesn’t need to exist.
|
5
debian/yavsc.cron.d.ex
vendored
Normal file
5
debian/yavsc.cron.d.ex
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
#
|
||||
# Regular cron jobs for the yavsc package
|
||||
# See dh_installcron(1) and crontab(5).
|
||||
#
|
||||
#0 4 * * * root [ -x /usr/bin/yavsc_maintenance ] && /usr/bin/yavsc_maintenance
|
3
debian/yavsc.cron.daily.ex
vendored
Normal file
3
debian/yavsc.cron.daily.ex
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Daily cron jobs shell script for the yavsc package
|
||||
#true
|
3
debian/yavsc.cron.hourly.ex
vendored
Normal file
3
debian/yavsc.cron.hourly.ex
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Hourly cron jobs shell script for the yavsc package
|
||||
#true
|
3
debian/yavsc.cron.monthly.ex
vendored
Normal file
3
debian/yavsc.cron.monthly.ex
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Monthly cron jobs shell script for the yavsc package
|
||||
#true
|
3
debian/yavsc.cron.weekly.ex
vendored
Normal file
3
debian/yavsc.cron.weekly.ex
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Weekly cron jobs shell script for the yavsc package
|
||||
#true
|
7
debian/yavsc.default.ex
vendored
Normal file
7
debian/yavsc.default.ex
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# Defaults for yavsc initscript
|
||||
|
||||
#
|
||||
# This is a POSIX shell fragment
|
||||
#
|
||||
|
||||
#DAEMON_OPTS=""
|
47
debian/yavsc.emacsen-install.ex
vendored
Normal file
47
debian/yavsc.emacsen-install.ex
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
#! /bin/sh -e
|
||||
# /usr/lib/emacsen-common/packages/install/yavsc
|
||||
|
||||
# Written by Jim Van Zandt <jrv@debian.org>, borrowing heavily
|
||||
# from the install scripts for gettext by Santiago Vila
|
||||
# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>.
|
||||
|
||||
FLAVOR=$1
|
||||
PACKAGE=yavsc
|
||||
|
||||
if [ ${FLAVOR} = emacs ]; then exit 0; fi
|
||||
|
||||
echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
|
||||
|
||||
#FLAVORTEST=`echo $FLAVOR | cut -c-6`
|
||||
#if [ ${FLAVORTEST} = xemacs ] ; then
|
||||
# SITEFLAG="-no-site-file"
|
||||
#else
|
||||
# SITEFLAG="--no-site-file"
|
||||
#fi
|
||||
FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
|
||||
|
||||
ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
|
||||
ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
|
||||
ELRELDIR=../../../emacs/site-lisp/${PACKAGE}
|
||||
|
||||
# Install-info-altdir does not actually exist.
|
||||
# Maybe somebody will write it.
|
||||
if test -x /usr/sbin/install-info-altdir; then
|
||||
echo install/${PACKAGE}: install Info links for ${FLAVOR}
|
||||
install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz
|
||||
fi
|
||||
|
||||
install -m 755 -d ${ELCDIR}
|
||||
cd ${ELDIR}
|
||||
FILES=`echo *.el`
|
||||
cd ${ELCDIR}
|
||||
ln -sf ${ELRELDIR}/*.el .
|
||||
|
||||
cat << EOF > path.el
|
||||
(debian-pkg-add-load-path-item ".")
|
||||
(setq byte-compile-warnings nil)
|
||||
EOF
|
||||
${FLAVOR} ${FLAGS} ${FILES}
|
||||
rm -f path.el
|
||||
|
||||
exit 0
|
15
debian/yavsc.emacsen-remove.ex
vendored
Normal file
15
debian/yavsc.emacsen-remove.ex
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh -e
|
||||
# /usr/lib/emacsen-common/packages/remove/yavsc
|
||||
|
||||
FLAVOR=$1
|
||||
PACKAGE=yavsc
|
||||
|
||||
if [ ${FLAVOR} != emacs ]; then
|
||||
if test -x /usr/sbin/install-info-altdir; then
|
||||
echo remove/${PACKAGE}: removing Info links for ${FLAVOR}
|
||||
install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/yavsc.info.gz
|
||||
fi
|
||||
|
||||
echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}
|
||||
rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
|
||||
fi
|
26
debian/yavsc.emacsen-startup.ex
vendored
Normal file
26
debian/yavsc.emacsen-startup.ex
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
;; -*-emacs-lisp-*-
|
||||
;;
|
||||
;; Emacs startup file, e.g. /etc/emacs/site-start.d/50yavsc.el
|
||||
;; for the Debian yavsc package
|
||||
;;
|
||||
;; Originally contributed by Nils Naumann <naumann@unileoben.ac.at>
|
||||
;; Modified by Dirk Eddelbuettel <edd@debian.org>
|
||||
;; Adapted for dh-make by Jim Van Zandt <jrv@debian.org>
|
||||
|
||||
;; The yavsc package follows the Debian/GNU Linux 'emacsen' policy and
|
||||
;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
|
||||
;; xemacs19, emacs20, xemacs20...). The compiled code is then
|
||||
;; installed in a subdirectory of the respective site-lisp directory.
|
||||
;; We have to add this to the load-path:
|
||||
(let ((package-dir (concat "/usr/share/"
|
||||
(symbol-name debian-emacs-flavor)
|
||||
"/site-lisp/yavsc")))
|
||||
;; If package-dir does not exist, the yavsc package must have
|
||||
;; removed but not purged, and we should skip the setup.
|
||||
(when (file-directory-p package-dir)
|
||||
(if (fboundp 'debian-pkg-add-load-path-item)
|
||||
(debian-pkg-add-load-path-item package-dir)
|
||||
(setq load-path (cons package-dir load-path)))
|
||||
(autoload 'yavsc-mode "yavsc-mode"
|
||||
"Major mode for editing yavsc files." t)
|
||||
(add-to-list 'auto-mode-alist '("\\.yavsc$" . yavsc-mode))))
|
2
debian/yavsc.lintian-overrides.ex
vendored
Normal file
2
debian/yavsc.lintian-overrides.ex
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# See dh_lintian(1) and Lintian User Manual (/usr/share/doc/lintian/lintian.html)
|
||||
# cut and paste the lintian(1) outputs without leading "E: ", "W: ", ...
|
2
debian/yavsc.service.ex
vendored
Normal file
2
debian/yavsc.service.ex
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# If this exists, it is installed into lib/systemd/system/yavsc.service in yavsc
|
||||
# See dh_systemd_enable(1).
|
2
debian/yavsc.tmpfile.ex
vendored
Normal file
2
debian/yavsc.tmpfile.ex
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# If this exists, it is installed into usr/lib/tmpfiles.d/yavsc.conf in yavsc
|
||||
# See dh_installtmpfiles(1).
|
27
dotnet-tools.json
Normal file
27
dotnet-tools.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"codecov.tool": {
|
||||
"version": "1.13.0",
|
||||
"commands": [
|
||||
"codecov"
|
||||
],
|
||||
"rollForward": false
|
||||
},
|
||||
"gitreleasemanager.tool": {
|
||||
"version": "0.20.0",
|
||||
"commands": [
|
||||
"dotnet-gitreleasemanager"
|
||||
],
|
||||
"rollForward": false
|
||||
},
|
||||
"Wyam2.Tool": {
|
||||
"version": "3.0.0-rc3",
|
||||
"commands": [
|
||||
"wyam2"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
27
gitversion.json
Normal file
27
gitversion.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"AssemblySemFileVer": "1.1.1.0",
|
||||
"AssemblySemVer": "1.1.1.0",
|
||||
"BranchName": "main",
|
||||
"BuildMetaData": null,
|
||||
"CommitDate": "2024-10-09",
|
||||
"CommitsSinceVersionSource": 19,
|
||||
"EscapedBranchName": "main",
|
||||
"FullBuildMetaData": "Branch.main.Sha.2b45e421dda285b73bf7eb3387915030cd751b88",
|
||||
"FullSemVer": "1.1.1-19",
|
||||
"InformationalVersion": "1.1.1-19+Branch.main.Sha.2b45e421dda285b73bf7eb3387915030cd751b88",
|
||||
"Major": 1,
|
||||
"MajorMinorPatch": "1.1.1",
|
||||
"Minor": 1,
|
||||
"Patch": 1,
|
||||
"PreReleaseLabel": "",
|
||||
"PreReleaseLabelWithDash": "",
|
||||
"PreReleaseNumber": 19,
|
||||
"PreReleaseTag": "19",
|
||||
"PreReleaseTagWithDash": "-19",
|
||||
"SemVer": "1.1.1-19",
|
||||
"Sha": "2b45e421dda285b73bf7eb3387915030cd751b88",
|
||||
"ShortSha": "2b45e42",
|
||||
"UncommittedChanges": 20,
|
||||
"VersionSourceSha": "72839e8251297935a4ab138a99152733f07a23f2",
|
||||
"WeightedPreReleaseNumber": 55019
|
||||
}
|
101
isn.sln
Normal file
101
isn.sln
Normal file
@ -0,0 +1,101 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.6.30114.105
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3C312E42-9A47-4BED-8265-A405FCA6AFFF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isnd.tests", "test\isnd.tests\isnd.tests.csproj", "{9D758F00-17FF-433D-B088-F9C2D97C9BD1}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8A2DF68-847A-4D88-B002-64FB666F696C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isnd", "src\isnd\isnd.csproj", "{468DB0E4-6221-4E01-BEFF-F452865E59C1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn", "src\isn\isn.csproj", "{910E800A-59AE-46C4-B7C7-879986179246}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.tests", "test\isn.tests\isn.tests.csproj", "{305F640E-11BA-44F9-95E0-C6882E9CD151}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.abst", "src\isn.abst\isn.abst.csproj", "{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x64.Build.0 = Release|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{910E800A-59AE-46C4-B7C7-879986179246}.Release|x86.Build.0 = Release|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x64.Build.0 = Release|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{9D758F00-17FF-433D-B088-F9C2D97C9BD1} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF}
|
||||
{468DB0E4-6221-4E01-BEFF-F452865E59C1} = {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}
|
||||
{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7} = {E8A2DF68-847A-4D88-B002-64FB666F696C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,20 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<UserSecretsId>85fd766d-5d23-4476-aed1-463b2942e86a</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="1.0.0-alpha2-final" />
|
||||
|
||||
<PackageReference Include="NuGet.Packaging.Core" Version="5.9.0" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
35
src/.vscode/launch.json
vendored
Normal file
35
src/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/isnd/bin/Debug/net9.0/isnd.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/isnd",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
41
src/.vscode/tasks.json
vendored
Normal file
41
src/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/isnd/isnd.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/isnd/isnd.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/isnd/isnd.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
11
src/isn.abst/APIKO.cs
Normal file
11
src/isn.abst/APIKO.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
public class APIKO
|
||||
{
|
||||
public string Context { get; set; }
|
||||
public Dictionary<string, string[]> Errors { get; set; }
|
||||
|
||||
}
|
||||
}
|
24
src/isn.abst/ApiConfig.cs
Normal file
24
src/isn.abst/ApiConfig.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using isn.abst;
|
||||
|
||||
namespace isnd.Entities
|
||||
{
|
||||
public static class ApiConfig
|
||||
{
|
||||
public const string Index = "/index.json";
|
||||
public const string Catalog = "/catalog";
|
||||
public const string Package = "/package";
|
||||
public const string Search = "/search";
|
||||
public const string AutoComplete = "/autocomplete";
|
||||
public const string Registration = "/registration";
|
||||
|
||||
public const string ContentBase = "/content";
|
||||
public const string Nuget = "/nuget";
|
||||
|
||||
public const string PackageDetailUriTemplate = Package+"/{id}/{version}";
|
||||
|
||||
[Obsolete("use the V3 search")]
|
||||
|
||||
public const string V2Find = "/v2/FindPackagesById()"; // /FindPackagesById()??$filter=IsLatestVersion&$orderby=Version desc&$top=1&id='isn.abst'
|
||||
}
|
||||
}
|
18
src/isn.abst/ApiIndexViewModel.cs
Normal file
18
src/isn.abst/ApiIndexViewModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using isnd.Data.Catalog;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn.Abstract
|
||||
{
|
||||
public class ApiIndexViewModel : Permalink
|
||||
{
|
||||
public ApiIndexViewModel(string id) : base(id, "ApiIndex")
|
||||
{
|
||||
}
|
||||
|
||||
[JsonProperty("version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("resources")]
|
||||
public Resource[] Resources { get; set; }
|
||||
}
|
||||
}
|
9
src/isn.abst/Constants.cs
Normal file
9
src/isn.abst/Constants.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace isn.abst
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
public const string PacketFileExtension = "nupkg";
|
||||
public const string SpecFileExtension = "nuspec";
|
||||
public const string ApiVersionPrefix = "/v3";
|
||||
}
|
||||
}
|
48
src/isn.abst/Permalink.cs
Normal file
48
src/isn.abst/Permalink.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public abstract class Permalink
|
||||
{
|
||||
public Permalink(string id)
|
||||
{
|
||||
Type = GetType().Name;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Permalink(string id, string type)
|
||||
{
|
||||
Type = type;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
[JsonProperty("@type")]
|
||||
public virtual string Type { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get => id; }
|
||||
protected string id;
|
||||
|
||||
public string GetId() { return id; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj!=null)
|
||||
{
|
||||
if (GetType().IsAssignableFrom(obj.GetType()))
|
||||
{
|
||||
var rpobj = (Permalink) obj;
|
||||
return this.id == rpobj.id;
|
||||
}
|
||||
}
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return id.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
18
src/isn.abst/Resource.cs
Normal file
18
src/isn.abst/Resource.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using isnd.Data.Catalog;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn.Abstract
|
||||
{
|
||||
public class Resource : Permalink
|
||||
{
|
||||
public Resource(string id, string typename) : base(id)
|
||||
{
|
||||
Type = typename;
|
||||
}
|
||||
|
||||
|
||||
[JsonProperty("comment")]
|
||||
public string Comment {get; set; }
|
||||
|
||||
}
|
||||
}
|
20
src/isn.abst/SafeNameAttribute.cs
Normal file
20
src/isn.abst/SafeNameAttribute.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
||||
namespace isnd.Attributes
|
||||
{
|
||||
public class SafeNameAttribute : ValidationAttribute
|
||||
{
|
||||
public override bool IsValid(object value)
|
||||
{
|
||||
if (!(value is string))
|
||||
return false;
|
||||
string str = value as string;
|
||||
if (str.Length>126) return false;
|
||||
if (str.Any(c => !char.IsLetterOrDigit(c)
|
||||
&& !"-_.".Contains(c))) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
8
src/isn.abst/isn.abst.csproj
Normal file
8
src/isn.abst/isn.abst.csproj
Normal file
@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
7
src/isn/Constants.cs
Normal file
7
src/isn/Constants.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace isn
|
||||
{
|
||||
internal static class Constants
|
||||
{
|
||||
internal const string ClientVersion = "isn v1.0";
|
||||
}
|
||||
}
|
8
src/isn/IsndErrorMessage.cs
Normal file
8
src/isn/IsndErrorMessage.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace isn
|
||||
{
|
||||
public class IsndErrorMessage
|
||||
{
|
||||
public int ecode { get; set; }
|
||||
public string msg { get; set; }
|
||||
}
|
||||
}
|
212
src/isn/Program.cs
Normal file
212
src/isn/Program.cs
Normal file
@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Mono.Options;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
public partial class Program
|
||||
{
|
||||
|
||||
public static void LoadConfig()
|
||||
{
|
||||
FileInfo cfgSettingIf = new FileInfo(_configFileName);
|
||||
if (cfgSettingIf.Exists)
|
||||
{
|
||||
var json = File.ReadAllText(cfgSettingIf.FullName);
|
||||
Settings = JsonConvert.DeserializeObject<Settings>(json);
|
||||
CurrentSource = Settings.DefaultSourceKey;
|
||||
}
|
||||
|
||||
if (Settings==null)
|
||||
{
|
||||
Settings= Settings.Create();
|
||||
}
|
||||
}
|
||||
static readonly OptionSet storeoptions = new OptionSet {
|
||||
{ "s|source=", "use source", val => Settings.CurrentSourceKey ??= val },
|
||||
{ "h|help", "show this message and exit", h => shouldShowPushHelp = h != null },
|
||||
};
|
||||
|
||||
private static readonly string _configFileName =
|
||||
Path.Combine(
|
||||
Path.Combine(Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.UserProfile), ".isn"),
|
||||
"config.json")
|
||||
;
|
||||
|
||||
public const string push = "push";
|
||||
static readonly OptionSet options = new OptionSet {
|
||||
{ "h|help", "show this message and exit", h => shouldShowHelp = h != null },
|
||||
{ "v|version", "show soft version info and exit", h => shouldShowVersion = h != null }
|
||||
};
|
||||
|
||||
static readonly OptionSet pushoptions = new OptionSet {
|
||||
{ "k|api-key=", "use api key", val => Settings.CurrentSource.SetApiKey(val)},
|
||||
{ "s|source=", "use source", val => Settings.CurrentSourceKey = val },
|
||||
{ "h|help", "show this message and exit", h => shouldShowPushHelp = h != null },
|
||||
};
|
||||
static readonly OptionSet sourceoptions = new OptionSet {
|
||||
{ "h|help", "show this message and exit", h => shouldShowSourceHelp = h != null },
|
||||
};
|
||||
|
||||
static readonly OptionSet showOptions = new OptionSet {
|
||||
{ "h|help", "show this message and exit", h => shouldShowSourceHelp = h != null },
|
||||
};
|
||||
|
||||
private static bool shouldShowHelp;
|
||||
private static bool shouldShowVersion;
|
||||
private static bool shouldShowSourceHelp;
|
||||
private static bool shouldShowPushHelp;
|
||||
|
||||
public static Settings Settings
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
public static string CurrentSource { get => Settings.CurrentSourceKey; set => Settings.CurrentSourceKey = value; }
|
||||
|
||||
static int Main(string[] args)
|
||||
{
|
||||
|
||||
LoadConfig();
|
||||
|
||||
var commandSet = new CommandSet("isn");
|
||||
var srclst = new Command("list")
|
||||
{
|
||||
Run = sargs => SourceList(sargs)
|
||||
};
|
||||
|
||||
var showconfig = new Command("config")
|
||||
{
|
||||
Run = sargs => ShowConfig()
|
||||
};
|
||||
|
||||
var srcadd = new Command("add")
|
||||
{
|
||||
Run = sargs => SourceAdd(sargs)
|
||||
};
|
||||
|
||||
var srcsetdef = new Command("set-default")
|
||||
{
|
||||
Run = sargs => SetDefaultSource(sargs?.FirstOrDefault())
|
||||
};
|
||||
|
||||
var showCommand = new Command("show")
|
||||
{
|
||||
Run = sargs =>
|
||||
{
|
||||
var showCommandSet = new CommandSet("show")
|
||||
{
|
||||
showconfig
|
||||
};
|
||||
var pargs = showOptions.Parse(sargs);
|
||||
if (shouldShowSourceHelp)
|
||||
{
|
||||
// output the options
|
||||
Console.WriteLine("Sources Options:");
|
||||
showOptions.WriteOptionDescriptions(Console.Out);
|
||||
return;
|
||||
}
|
||||
showCommandSet.Run(pargs);
|
||||
}
|
||||
};
|
||||
|
||||
var srcCmd = new Command("sources")
|
||||
{
|
||||
Run = sargs =>
|
||||
{
|
||||
|
||||
var sourcesCmdSet = new CommandSet("sources")
|
||||
{
|
||||
srclst,
|
||||
srcadd,
|
||||
srcsetdef
|
||||
};
|
||||
|
||||
|
||||
var pargs = sourceoptions.Parse(sargs);
|
||||
if (shouldShowSourceHelp)
|
||||
{
|
||||
// output the options
|
||||
Console.WriteLine("Sources Options:");
|
||||
sourceoptions.WriteOptionDescriptions(Console.Out);
|
||||
return;
|
||||
}
|
||||
sourcesCmdSet.Run(pargs);
|
||||
}
|
||||
};
|
||||
|
||||
var add = new Command("add")
|
||||
{
|
||||
Run = sargs => Add(sargs)
|
||||
};
|
||||
|
||||
commandSet.Add(add);
|
||||
|
||||
var pushCmd = new Command(push)
|
||||
{
|
||||
Run = sargs =>
|
||||
{
|
||||
var pargs = pushoptions.Parse(sargs);
|
||||
if (args.Count()==0) shouldShowPushHelp=true;
|
||||
if (shouldShowPushHelp)
|
||||
{
|
||||
// output the options
|
||||
Console.Error.WriteLine("Push Options:");
|
||||
pushoptions.WriteOptionDescriptions(Console.Out);
|
||||
return;
|
||||
}
|
||||
List<PushReport> reports = PushPkg(pargs);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var setapikey = new Command("store-api-key", "Store this API key")
|
||||
{
|
||||
Run = sargs => StoreApiKey(sargs)
|
||||
};
|
||||
setapikey.Options = pushoptions;
|
||||
|
||||
commandSet.Add(setapikey);
|
||||
commandSet.Add(pushCmd);
|
||||
commandSet.Add(srcCmd);
|
||||
commandSet.Add(showCommand);
|
||||
|
||||
List<string> extra;
|
||||
try
|
||||
{
|
||||
// parse the command line
|
||||
extra = options.Parse(args);
|
||||
}
|
||||
catch (OptionException e)
|
||||
{
|
||||
Console.Error.Write("isn: ");
|
||||
Console.Error.WriteLine(e.Message);
|
||||
Console.Error.WriteLine("Try `isn --help' for more information.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
if (shouldShowHelp)
|
||||
{
|
||||
// output the options
|
||||
Console.WriteLine("Options:");
|
||||
options.WriteOptionDescriptions(Console.Out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shouldShowVersion)
|
||||
{
|
||||
Console.WriteLine("isn version " + GitVersionInformation.AssemblySemFileVer);
|
||||
}
|
||||
return commandSet.Run(args);
|
||||
}
|
||||
}
|
||||
}
|
90
src/isn/Settings.cs
Normal file
90
src/isn/Settings.cs
Normal file
@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
public class SourceSettings
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Protected API Key
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Key alias
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string Url { get; set; }
|
||||
|
||||
public SourceSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public string GetClearApiKey()
|
||||
{
|
||||
return ApiKey;
|
||||
}
|
||||
|
||||
public void SetApiKey(string key)
|
||||
{
|
||||
ApiKey = key;
|
||||
}
|
||||
}
|
||||
|
||||
public class Settings
|
||||
{
|
||||
private Settings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static Settings Create()
|
||||
{
|
||||
return new Settings {
|
||||
Sources = new Dictionary<string, SourceSettings>()
|
||||
};
|
||||
}
|
||||
|
||||
public Dictionary<string, SourceSettings> Sources { get; set; }
|
||||
|
||||
private string defSourceKey;
|
||||
|
||||
/// <summary>
|
||||
/// Default source by its alias
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string DefaultSourceKey
|
||||
{
|
||||
get => defSourceKey;
|
||||
set
|
||||
{
|
||||
defSourceKey = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[JsonIgnore, NotMapped]
|
||||
public string CurrentSourceKey {get; set;}
|
||||
|
||||
|
||||
[JsonIgnore, NotMapped]
|
||||
public SourceSettings CurrentSource
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CurrentSourceKey==null) return null;
|
||||
if (!Sources.ContainsKey(CurrentSourceKey))
|
||||
{
|
||||
Sources.Add(CurrentSourceKey, new SourceSettings());
|
||||
}
|
||||
return Sources[CurrentSourceKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
40
src/isn/SourceHelpers.cs
Normal file
40
src/isn/SourceHelpers.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using isn.Abstract;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
public static class SourceHelpers
|
||||
{
|
||||
public static ApiIndexViewModel GetServerResources(string url)
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
ApiIndexViewModel result = null;
|
||||
// var json = await client.GetStringAsync(new System.Uri(url));
|
||||
|
||||
Task.Run(async ()=> {
|
||||
try {
|
||||
var response = await client.GetStringAsync(url);
|
||||
result = JsonConvert.DeserializeObject<ApiIndexViewModel>(response);
|
||||
|
||||
} catch (HttpRequestException ex)
|
||||
{
|
||||
if (ex.StatusCode==HttpStatusCode.NotFound)
|
||||
{
|
||||
Console.Error.WriteLine("Not found ... server's down ?");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine($"{ex.StatusCode} : {ex.Message}");
|
||||
}
|
||||
}
|
||||
}).Wait();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
44
src/isn/UploadFilesToServerUsingHttpClient.cs
Normal file
44
src/isn/UploadFilesToServerUsingHttpClient.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
public static class UploadFilesToServerUsingHttpClient
|
||||
{
|
||||
public static PushReport UploadFilesToServer(this HttpClient client, Uri uri, FileInfo fi,
|
||||
string apikey)
|
||||
{
|
||||
return UploadFilesToServerAsync(client, uri, fi, apikey).Result;
|
||||
}
|
||||
|
||||
public static async Task<PushReport> UploadFilesToServerAsync(this HttpClient client, Uri uri, FileInfo fi,
|
||||
string apikey)
|
||||
{
|
||||
|
||||
client.DefaultRequestHeaders.Add("X-NuGet-Client-Version", Constants.ClientVersion);
|
||||
client.DefaultRequestHeaders.Add("X-NuGet-ApiKey", apikey);
|
||||
|
||||
using (var multipartFormDataContent = new MultipartFormDataContent())
|
||||
{
|
||||
multipartFormDataContent.Add(new ByteArrayContent(File.ReadAllBytes(fi.FullName)),
|
||||
'"' + "File" + '"',
|
||||
'"' + fi.Name + '"');
|
||||
|
||||
var result = await client.PutAsync(uri, multipartFormDataContent);
|
||||
if (result.IsSuccessStatusCode) return
|
||||
new PushReport() {
|
||||
KO = JsonConvert.DeserializeObject<APIKO>(await result.Content.ReadAsStringAsync())
|
||||
};
|
||||
else
|
||||
return new PushReport() {
|
||||
OK = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
75
src/isn/commands/PushCommand.cs
Normal file
75
src/isn/commands/PushCommand.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
public class PushCommand
|
||||
{
|
||||
Settings settings;
|
||||
|
||||
public PushCommand(Settings settings)
|
||||
{
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public PushReport Run(string pkg, string source, string apiKey)
|
||||
{
|
||||
|
||||
var resources = SourceHelpers.GetServerResources(source);
|
||||
if (resources == null) return null;
|
||||
if (resources.Resources == null)
|
||||
throw new InvalidOperationException("source gave no resource");
|
||||
if (!resources.Resources.Any(res => res.Type == "PackagePublish/2.0.0"))
|
||||
throw new InvalidOperationException("Source won't serve the expected push command");
|
||||
var pubRes = resources.Resources.First(res => res.Type == "PackagePublish/2.0.0");
|
||||
FileInfo fi = new FileInfo(pkg);
|
||||
if (!fi.Exists)
|
||||
{
|
||||
var report = new PushReport
|
||||
{
|
||||
PkgName = fi.Name,
|
||||
Message = "The package does not exist : " + fi.FullName
|
||||
};
|
||||
return report;
|
||||
}
|
||||
using (var client = new HttpClient(
|
||||
new HttpClientHandler
|
||||
{
|
||||
AllowAutoRedirect = false
|
||||
}
|
||||
))
|
||||
try
|
||||
{
|
||||
return client.UploadFilesToServer(new Uri(pubRes.Id), fi, settings.Sources[source].ApiKey);
|
||||
}
|
||||
catch (HttpRequestException httpEx)
|
||||
{
|
||||
var report = new PushReport
|
||||
{
|
||||
PkgName = fi.Name,
|
||||
Message = "HttpRequest: " + httpEx.Message,
|
||||
StackTrace = httpEx.StackTrace,
|
||||
StatusCode = httpEx.HResult.ToString()
|
||||
};
|
||||
Console.Error.WriteLine(httpEx.Message);
|
||||
return report;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var report = new PushReport
|
||||
{
|
||||
PkgName = fi.Name,
|
||||
Message = ex.Message,
|
||||
StackTrace = ex.StackTrace
|
||||
};
|
||||
Console.Error.WriteLine(ex.Message);
|
||||
return report;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
src/isn/commands/push.cs
Normal file
33
src/isn/commands/push.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace isn
|
||||
{
|
||||
|
||||
partial class Program
|
||||
{
|
||||
public static List<PushReport> PushPkg(IEnumerable<string> pkgs)
|
||||
{
|
||||
List<PushReport> pushReports = new List<PushReport>();
|
||||
var cmd = new PushCommand(Settings);
|
||||
|
||||
if (Settings.CurrentSource == null) throw new InvalidOperationException("source is null");
|
||||
var source = Settings.CurrentSource;
|
||||
foreach (string pkg in pkgs)
|
||||
{
|
||||
var report = cmd.Run(pkg, source.Url, source.ApiKey);
|
||||
pushReports.Add(report);
|
||||
}
|
||||
return pushReports;
|
||||
}
|
||||
|
||||
private static object Add(IEnumerable<string> str)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
19
src/isn/commands/show.config.cs
Normal file
19
src/isn/commands/show.config.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace isn
|
||||
{
|
||||
|
||||
partial class Program
|
||||
{
|
||||
|
||||
private static void ShowConfig()
|
||||
{
|
||||
Console.WriteLine(JsonConvert.SerializeObject(Settings, Formatting.Indented));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
25
src/isn/commands/sources.add.cs
Normal file
25
src/isn/commands/sources.add.cs
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
|
||||
partial class Program
|
||||
{
|
||||
private static void SourceAdd(IEnumerable<string> str)
|
||||
{
|
||||
foreach (string arg in str)
|
||||
{
|
||||
if (Settings.Sources.ContainsKey(arg))
|
||||
{
|
||||
SourceSettings setting = Settings.Sources[arg];
|
||||
throw new InvalidOperationException
|
||||
(setting.Url);
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
src/isn/commands/sources.list.cs
Normal file
20
src/isn/commands/sources.list.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
partial class Program
|
||||
{
|
||||
private static void SourceList(IEnumerable<string> sargs)
|
||||
{
|
||||
IEnumerable<string> spec = sargs.Count()>0 ? sargs : Settings.Sources.Keys;
|
||||
foreach (string arg in spec)
|
||||
{
|
||||
SourceSettings setting = Settings.Sources[arg];
|
||||
Console.WriteLine(JsonConvert.SerializeObject(setting));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
src/isn/commands/sources.set-default.cs
Normal file
21
src/isn/commands/sources.set-default.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
|
||||
partial class Program
|
||||
{
|
||||
private static void SetDefaultSource(string arg)
|
||||
{
|
||||
SourceSettings settings =
|
||||
Settings.Sources.ContainsKey(arg) ?
|
||||
Settings.Sources[arg] :
|
||||
Settings.Sources.Values.FirstOrDefault((s)=> s.Url == arg) ;
|
||||
if (settings==null) throw new InvalidOperationException(arg);
|
||||
Settings.DefaultSourceKey = arg;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
46
src/isn/commands/store-api-key.cs
Normal file
46
src/isn/commands/store-api-key.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace isn
|
||||
{
|
||||
|
||||
partial class Program
|
||||
{
|
||||
private static void StoreApiKey(IEnumerable<string> storeArgs)
|
||||
{
|
||||
var args = storeoptions.Parse(storeArgs);
|
||||
if (args.Count != 1)
|
||||
{
|
||||
Console.Error.WriteLine("StoreApiKey command takes only one argument, the key.");
|
||||
shouldShowPushHelp=true;
|
||||
}
|
||||
if (shouldShowPushHelp)
|
||||
{
|
||||
// output the options
|
||||
Console.Error.WriteLine("StoreApiKey Options:");
|
||||
storeoptions.WriteOptionDescriptions(Console.Out);
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.CurrentSource.SetApiKey(args[0]);
|
||||
SaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveConfig()
|
||||
{
|
||||
FileInfo cfgSettingIf = new FileInfo(_configFileName);
|
||||
if (!cfgSettingIf.Directory.Exists) cfgSettingIf.Directory.Create();
|
||||
File.WriteAllText(
|
||||
cfgSettingIf.FullName,
|
||||
JsonConvert.SerializeObject(
|
||||
Settings,
|
||||
Formatting.Indented
|
||||
));
|
||||
Console.WriteLine("config saved .");
|
||||
}
|
||||
}
|
||||
}
|
22
src/isn/isn.csproj
Normal file
22
src/isn/isn.csproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net9.0</TargetFrameworks>
|
||||
<RootNamespace>nuget_cli</RootNamespace>
|
||||
<UserSecretsId>45b74c62-05bc-4603-95b4-3e80ae2fdf50</UserSecretsId>
|
||||
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
||||
<IsTool>true</IsTool>
|
||||
<NoWarn>NETSDK1138</NoWarn>
|
||||
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.6" />
|
||||
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="unleash.client" Version="5.2.1" />
|
||||
<PackageReference Include="GitVersion.MsBuild" Version="6.3.0" />
|
||||
<ProjectReference Include="../isn.abst/isn.abst.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
42
src/isn/model/PushReport.cs
Normal file
42
src/isn/model/PushReport.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.Threading.Tasks.Dataflow;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
public class PushReport
|
||||
{
|
||||
public PushReport()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string PkgName { get; set; }
|
||||
public bool Executed { get; set; }
|
||||
public bool OK { get; set; }
|
||||
public bool AlreadyPresent { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string StatusCode { get; set; }
|
||||
public string StackTrace { get; set; }
|
||||
public APIKO KO { get; set; }
|
||||
|
||||
public string ToDoc()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder($"= push {PkgName}\n\n");
|
||||
if (Executed) sb.AppendLine("* Executed");
|
||||
if (OK) sb.AppendLine("* OK");
|
||||
if (!string.IsNullOrWhiteSpace(Message))
|
||||
sb.AppendLine("* Message :" + Message);
|
||||
if (!string.IsNullOrWhiteSpace(StatusCode))
|
||||
sb.AppendLine($"* Status Code : ");
|
||||
if (!string.IsNullOrWhiteSpace(StackTrace))
|
||||
sb.AppendLine($"* StackTrace : " + StackTrace);
|
||||
if (KO!=null)
|
||||
sb.AppendLine($"* KO : " + KO.Context);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
8
src/isnd/Authorisation/ValidApiKeyRequirement.cs
Normal file
8
src/isnd/Authorisation/ValidApiKeyRequirement.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace isnd.Authorization
|
||||
{
|
||||
internal class ValidApiKeyRequirement : IAuthorizationRequirement
|
||||
{
|
||||
}
|
||||
}
|
13
src/isnd/Authorisation/ValidApiKeyRequirementHandler.cs
Normal file
13
src/isnd/Authorisation/ValidApiKeyRequirementHandler.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace isnd.Authorization
|
||||
{
|
||||
internal class ValidApiKeyRequirementHandler : AuthorizationHandler<ValidApiKeyRequirement>
|
||||
{
|
||||
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ValidApiKeyRequirement requirement)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
9
src/isnd/Constants.cs
Normal file
9
src/isnd/Constants.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace isnd
|
||||
{
|
||||
public static class IsndConstants
|
||||
{
|
||||
public const string AdministratorRoleName = "Admin";
|
||||
public const string RequireAdminPolicyName = "RequireAdministratorRole";
|
||||
public const string RequireValidApiKey = "RequireValideApiKey";
|
||||
}
|
||||
}
|
257
src/isnd/Controllers/AccountController.cs
Normal file
257
src/isnd/Controllers/AccountController.cs
Normal file
@ -0,0 +1,257 @@
|
||||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using isnd.Data;
|
||||
using isnd.Data.Roles;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace isnd.Controllers
|
||||
{
|
||||
public class AccountController : Controller
|
||||
{
|
||||
private readonly IAuthenticationSchemeProvider _schemeProvider;
|
||||
|
||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
private readonly AdminStartupList _startupAdminList;
|
||||
|
||||
public AccountController(
|
||||
IAuthenticationSchemeProvider schemeProvider,
|
||||
SignInManager<ApplicationUser> signInManager,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IOptions<AdminStartupList> startupAdminListConfig )
|
||||
{
|
||||
_schemeProvider = schemeProvider;
|
||||
_signInManager = signInManager;
|
||||
_userManager = userManager;
|
||||
_startupAdminList = startupAdminListConfig.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry point into the login workflow
|
||||
/// </summary>
|
||||
[HttpGet,AllowAnonymous]
|
||||
public async Task<IActionResult> Login(string returnUrl)
|
||||
{
|
||||
// build a model so we know what to show on the login page
|
||||
var vm = await BuildLoginViewModelAsync(returnUrl);
|
||||
|
||||
if (vm.IsExternalLoginOnly)
|
||||
{
|
||||
// we only have one option for logging in and it's an external provider
|
||||
return RedirectToAction("Challenge", "External", new { scheme = vm.ExternalLoginScheme, returnUrl });
|
||||
}
|
||||
|
||||
return View(vm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle postback from username/password login
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken, AllowAnonymous]
|
||||
public async Task<IActionResult> Login(LoginInputModel model, string button)
|
||||
{
|
||||
|
||||
// the user clicked the "cancel" button
|
||||
if (button != "login")
|
||||
{
|
||||
|
||||
// since we don't have a valid context, then we just go back to the home page
|
||||
return Redirect("~/");
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// validate username/password
|
||||
var user = await _userManager.FindByNameAsync(model.Username);
|
||||
var signResult = await _signInManager.CheckPasswordSignInAsync(user, model.Password, true);
|
||||
|
||||
if (signResult.Succeeded)
|
||||
{
|
||||
|
||||
// only set explicit expiration here if user chooses "remember me".
|
||||
// otherwise we rely upon expiration configured in cookie middleware.
|
||||
AuthenticationProperties props = null;
|
||||
if (AccountOptions.AllowRememberLogin && model.RememberLogin)
|
||||
{
|
||||
props = new AuthenticationProperties
|
||||
{
|
||||
IsPersistent = true,
|
||||
ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
|
||||
};
|
||||
};
|
||||
|
||||
await _signInManager.SignInAsync(user, model.RememberLogin && AccountOptions.AllowRememberLogin);
|
||||
if (Url.IsLocalUrl(model.ReturnUrl))
|
||||
{
|
||||
return Redirect(model.ReturnUrl);
|
||||
}
|
||||
else if (string.IsNullOrEmpty(model.ReturnUrl))
|
||||
{
|
||||
return Redirect("~/");
|
||||
}
|
||||
else
|
||||
{
|
||||
// user might have clicked on a malicious link - should be logged
|
||||
throw new Exception("invalid return URL");
|
||||
}
|
||||
}
|
||||
|
||||
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
|
||||
}
|
||||
|
||||
// something went wrong, show form with error
|
||||
var vm = await BuildLoginViewModelAsync(model);
|
||||
return View(vm);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Show logout page
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Logout(string logoutId)
|
||||
{
|
||||
// build a model so the logout page knows what to display
|
||||
var vm = BuildLogoutViewModel(logoutId);
|
||||
|
||||
if (vm.ShowLogoutPrompt == false)
|
||||
{
|
||||
// if the request for logout was properly authenticated from IdentityServer, then
|
||||
// we don't need to show the prompt and can just log the user out directly.
|
||||
return await Logout(vm);
|
||||
}
|
||||
|
||||
return View(vm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle logout page postback
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Logout(LogoutInputModel model)
|
||||
{
|
||||
// build a model so the logged out page knows what to display
|
||||
var vm = BuildLoggedOutViewModel(model.LogoutId);
|
||||
|
||||
if (User?.Identity.IsAuthenticated == true)
|
||||
{
|
||||
// delete local authentication cookie
|
||||
await HttpContext.SignOutAsync();
|
||||
}
|
||||
|
||||
// check if we need to trigger sign-out at an upstream identity provider
|
||||
if (vm.TriggerExternalSignout)
|
||||
{
|
||||
// build a return URL so the upstream provider will redirect back
|
||||
// to us after the user has logged out. this allows us to then
|
||||
// complete our single sign-out processing.
|
||||
string url = Url.Action("Logout", new { logoutId = vm.LogoutId });
|
||||
|
||||
// this triggers a redirect to the external provider for sign-out
|
||||
return SignOut(new AuthenticationProperties { RedirectUri = url }, vm.ExternalAuthenticationScheme);
|
||||
}
|
||||
|
||||
return View("LoggedOut", vm);
|
||||
}
|
||||
|
||||
[HttpGet,AllowAnonymous]
|
||||
public IActionResult AccessDenied()
|
||||
{
|
||||
return new BadRequestObjectResult(403);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* helper APIs for the AccountController */
|
||||
/*****************************************/
|
||||
private async Task<LoginViewModel> BuildLoginViewModelAsync(string returnUrl)
|
||||
{
|
||||
|
||||
|
||||
var schemes = await _schemeProvider.GetAllSchemesAsync();
|
||||
|
||||
var providers = schemes
|
||||
.Where(x => x.DisplayName != null)
|
||||
.Select(x => new ExternalProvider
|
||||
{
|
||||
DisplayName = x.DisplayName ?? x.Name,
|
||||
AuthenticationScheme = x.Name
|
||||
}).ToList();
|
||||
|
||||
var allowLocal = true;
|
||||
|
||||
|
||||
return new LoginViewModel
|
||||
{
|
||||
AllowRememberLogin = AccountOptions.AllowRememberLogin,
|
||||
EnableLocalLogin = allowLocal && AccountOptions.AllowLocalLogin,
|
||||
ReturnUrl = returnUrl,
|
||||
ExternalProviders = providers.ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
private async Task<LoginViewModel> BuildLoginViewModelAsync(LoginInputModel model)
|
||||
{
|
||||
var vm = await BuildLoginViewModelAsync(model.ReturnUrl);
|
||||
vm.Username = model.Username;
|
||||
vm.RememberLogin = model.RememberLogin;
|
||||
return vm;
|
||||
}
|
||||
|
||||
private LogoutViewModel BuildLogoutViewModel(string logoutId)
|
||||
{
|
||||
var vm = new LogoutViewModel { LogoutId = logoutId, ShowLogoutPrompt = AccountOptions.ShowLogoutPrompt };
|
||||
|
||||
if (User?.Identity.IsAuthenticated != true)
|
||||
{
|
||||
// if the user is not authenticated, then just show logged out page
|
||||
vm.ShowLogoutPrompt = false;
|
||||
return vm;
|
||||
}
|
||||
|
||||
// show the logout prompt. this prevents attacks where the user
|
||||
// is automatically signed out by another malicious web page.
|
||||
return vm;
|
||||
}
|
||||
|
||||
private LoggedOutViewModel BuildLoggedOutViewModel(string logoutId)
|
||||
{
|
||||
var vm = new LoggedOutViewModel
|
||||
{
|
||||
AutomaticRedirectAfterSignOut = AccountOptions.AutomaticRedirectAfterSignOut,
|
||||
LogoutId = logoutId
|
||||
};
|
||||
return vm;
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
public async Task<IActionResult> GetAdminrole()
|
||||
{
|
||||
string username = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (_startupAdminList.Users.Contains(username))
|
||||
{
|
||||
var user = await _userManager.FindByNameAsync(username);
|
||||
var roles = await _userManager.GetRolesAsync(user);
|
||||
if (!roles.Contains(IsndConstants.AdministratorRoleName))
|
||||
{
|
||||
await _userManager.AddToRoleAsync(user, IsndConstants.AdministratorRoleName);
|
||||
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user