Compare commits

..

2 Commits

15 changed files with 39 additions and 40 deletions

@ -1,9 +0,0 @@
namespace isn
{
public class IsnSourceSettings
{
internal string Source { get; set; }
internal string[] Keys { get; set; }
}
}

@ -17,32 +17,28 @@ namespace isn
/// <value></value>
public string ProtectedApiKey { get; set; }
public string ApiKey { get; set; }
/// <summary>
/// Key alias
/// </summary>
/// <value></value>
public string Alias { get; set; }
public string Url { get; set; }
public SourceSettings()
{
rsa = RSA.Create();
}
public string GetClearApiKey()
{
if (!string.IsNullOrEmpty(ApiKey)) return ApiKey;
return
Encoding.UTF8.GetString(
rsa.Decrypt(Encoding.UTF8.GetBytes(ProtectedApiKey),
RSAEncryptionPadding.Pkcs1));
var base64EncodedBytes = System.Convert.FromBase64String(ProtectedApiKey);
var decrypted = rsa.Decrypt(base64EncodedBytes, RSAEncryptionPadding.Pkcs1);
return Encoding.UTF8.GetString(decrypted);
}
public void SetApiKey(string key)
{
ApiKey = Encoding.UTF8.GetString(
rsa.Encrypt(Encoding.UTF8.GetBytes(key),
RSAEncryptionPadding.Pkcs1));
var crypted =rsa.Encrypt(Encoding.UTF8.GetBytes(key), RSAEncryptionPadding.Pkcs1);
ProtectedApiKey = System.Convert.ToBase64String(crypted);
}
}
@ -51,8 +47,6 @@ namespace isn
public string DataProtectionTitle { get; set; }
public Dictionary<string, SourceSettings> Sources { get; set; }
public bool AutoUpdateApiKey { get; set; } = false;
private string defSourceKey;
/// <summary>
@ -68,7 +62,7 @@ namespace isn
{
Sources[value]=new SourceSettings
{
Alias = defSourceKey
Url = defSourceKey
};
}
defSourceKey = value;

@ -16,7 +16,7 @@ namespace isn
{
SourceSettings setting = Settings.Sources[arg];
throw new InvalidOperationException
(setting.Alias);
(setting.Url);
}
throw new NotImplementedException();
}

@ -11,7 +11,7 @@ namespace isn
SourceSettings settings =
Settings.Sources.ContainsKey(arg) ?
Settings.Sources[arg] :
Settings.Sources.Values.FirstOrDefault((s)=> s.Alias == arg) ;
Settings.Sources.Values.FirstOrDefault((s)=> s.Url == arg) ;
if (settings==null) throw new InvalidOperationException(arg);
Settings.DefaultSourceKey = arg;
SaveConfig();

@ -4,6 +4,7 @@ using System.Threading.Tasks;
using isn.abst;
using isnd.Data;
using isnd.Data.Catalog;
using isnd.Entities;
using isnd.Helpers;
using isnd.ViewModels;
using Microsoft.AspNetCore.Authorization;
@ -22,6 +23,7 @@ namespace isnd.Controllers
return View(new RegistrationPageIndexQueryAndResult
{
Source = packageManager.CatalogBaseUrl+ApiConfig.Index,
Query = model,
Result = pkgs.GetResults().Select(p => new PackageRegistration(apiBase, p)).ToArray()
});

@ -270,7 +270,6 @@ namespace isnd.Services
.Include(p => p.Versions)
.Include(p => p.Owner)
.Include(p => p.LatestCommit)
.Include(p => p.Versions[0].LatestCommit)
.SingleOrDefaultAsync(p => p.Id.ToLower() == query.Query);
if (scope==null) return null;
if (scope.Versions.Count==0) return null;

@ -5,6 +5,7 @@ namespace isnd
{
public class RegistrationPageIndexQueryAndResult
{
public string Source { get; set; }
public PackageRegistrationQuery Query { get; set; }
public PackageRegistration[] Result { get; set; }
}

@ -3,9 +3,6 @@
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Bienvenue</h1>
<h1>Bienvenue dans isn</h1>
<p>
<strong>@Model.PkgCount identifiant(s) de paquet dans le SI</strong>
</p>
<h1 class="display-4">Wasa!</h1>
<p>hum.</p>
</div>

@ -35,3 +35,6 @@ foreach (var i in regpage.Items) {
}
</tbody>
</table>
<p><pre><code>@Model.Source</code></pre></p>

@ -4,9 +4,8 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - isn</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="~/css/site.css" />
<link rel="shortcut icon" href="favicon.ico#1" >
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
<link rel="shortcut icon" href="favicon.ico" asp-append-version="true" >
</head>
<body>
<header>

@ -153,7 +153,7 @@ samp {
pre {
margin-top: 0;
margin-bottom: 1rem;
padding-bottom: 1rem;
overflow: auto; }
figure {
@ -7843,7 +7843,7 @@ a.text-dark:hover, a.text-dark:focus {
border: 1px solid #333;
box-shadow: 8px 8px 5px #444;
padding: 8px 12px;
background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc);
background-image: linear-gradient(192deg, #081018, #21218d 40%, #500c0c);
margin: 1em; }
.fa-copy {
@ -7851,3 +7851,9 @@ a.text-dark:hover, a.text-dark:focus {
.border-top.footer.text-muted {
padding: 1em; }
pre code {
color: #ccc;
background-color: #000; }
/*# sourceMappingURL=site.css.map */

File diff suppressed because one or more lines are too long

@ -104,7 +104,7 @@ background-color: black;
border: 1px solid #333;
box-shadow: 8px 8px 5px #444;
padding: 8px 12px;
background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc);
background-image: linear-gradient(192deg, #081018, #21218d 40%, #500c0c);
margin: 1em;
}
@ -116,3 +116,9 @@ background-color: black;
padding: 1em;
}
pre code {
color:#ccc;
background-color: #000;
}

@ -1573,7 +1573,8 @@ pre {
pre code {
padding: 0;
font-size: inherit;
color: inherit;
color: gainsboro;
background-color: #000;
white-space: pre-wrap;
background-color: transparent;
border-radius: 0;

@ -226,7 +226,7 @@ pre {
// Remove browser default top margin
margin-top: 0;
// Reset browser default of `1em` to use `rem`s
margin-bottom: 1rem;
padding-bottom: 1rem;
// Don't allow content to break outside
overflow: auto;
}

Loading…