some details
This commit is contained in:
@ -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()
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ namespace isnd
|
||||
{
|
||||
public class RegistrationPageIndexQueryAndResult
|
||||
{
|
||||
public string Source { get; set; }
|
||||
public PackageRegistrationQuery Query { get; set; }
|
||||
public PackageRegistration[] Result { get; set; }
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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
@ -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;
|
||||
|
Reference in New Issue
Block a user