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>
|
/// <value></value>
|
||||||
public string ProtectedApiKey { get; set; }
|
public string ProtectedApiKey { get; set; }
|
||||||
|
|
||||||
public string ApiKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Key alias
|
/// Key alias
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public string Alias { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
public SourceSettings()
|
public SourceSettings()
|
||||||
{
|
{
|
||||||
rsa = RSA.Create();
|
rsa = RSA.Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetClearApiKey()
|
public string GetClearApiKey()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(ApiKey)) return ApiKey;
|
var base64EncodedBytes = System.Convert.FromBase64String(ProtectedApiKey);
|
||||||
return
|
var decrypted = rsa.Decrypt(base64EncodedBytes, RSAEncryptionPadding.Pkcs1);
|
||||||
Encoding.UTF8.GetString(
|
return Encoding.UTF8.GetString(decrypted);
|
||||||
rsa.Decrypt(Encoding.UTF8.GetBytes(ProtectedApiKey),
|
|
||||||
RSAEncryptionPadding.Pkcs1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetApiKey(string key)
|
public void SetApiKey(string key)
|
||||||
{
|
{
|
||||||
ApiKey = Encoding.UTF8.GetString(
|
var crypted =rsa.Encrypt(Encoding.UTF8.GetBytes(key), RSAEncryptionPadding.Pkcs1);
|
||||||
rsa.Encrypt(Encoding.UTF8.GetBytes(key),
|
ProtectedApiKey = System.Convert.ToBase64String(crypted);
|
||||||
RSAEncryptionPadding.Pkcs1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +47,6 @@ namespace isn
|
|||||||
public string DataProtectionTitle { get; set; }
|
public string DataProtectionTitle { get; set; }
|
||||||
public Dictionary<string, SourceSettings> Sources { get; set; }
|
public Dictionary<string, SourceSettings> Sources { get; set; }
|
||||||
|
|
||||||
public bool AutoUpdateApiKey { get; set; } = false;
|
|
||||||
|
|
||||||
private string defSourceKey;
|
private string defSourceKey;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -68,7 +62,7 @@ namespace isn
|
|||||||
{
|
{
|
||||||
Sources[value]=new SourceSettings
|
Sources[value]=new SourceSettings
|
||||||
{
|
{
|
||||||
Alias = defSourceKey
|
Url = defSourceKey
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
defSourceKey = value;
|
defSourceKey = value;
|
||||||
|
@ -16,7 +16,7 @@ namespace isn
|
|||||||
{
|
{
|
||||||
SourceSettings setting = Settings.Sources[arg];
|
SourceSettings setting = Settings.Sources[arg];
|
||||||
throw new InvalidOperationException
|
throw new InvalidOperationException
|
||||||
(setting.Alias);
|
(setting.Url);
|
||||||
}
|
}
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace isn
|
|||||||
SourceSettings settings =
|
SourceSettings settings =
|
||||||
Settings.Sources.ContainsKey(arg) ?
|
Settings.Sources.ContainsKey(arg) ?
|
||||||
Settings.Sources[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);
|
if (settings==null) throw new InvalidOperationException(arg);
|
||||||
Settings.DefaultSourceKey = arg;
|
Settings.DefaultSourceKey = arg;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
|||||||
using isn.abst;
|
using isn.abst;
|
||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using isnd.Data.Catalog;
|
using isnd.Data.Catalog;
|
||||||
|
using isnd.Entities;
|
||||||
using isnd.Helpers;
|
using isnd.Helpers;
|
||||||
using isnd.ViewModels;
|
using isnd.ViewModels;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -22,6 +23,7 @@ namespace isnd.Controllers
|
|||||||
|
|
||||||
return View(new RegistrationPageIndexQueryAndResult
|
return View(new RegistrationPageIndexQueryAndResult
|
||||||
{
|
{
|
||||||
|
Source = packageManager.CatalogBaseUrl+ApiConfig.Index,
|
||||||
Query = model,
|
Query = model,
|
||||||
Result = pkgs.GetResults().Select(p => new PackageRegistration(apiBase, p)).ToArray()
|
Result = pkgs.GetResults().Select(p => new PackageRegistration(apiBase, p)).ToArray()
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,7 @@ namespace isnd
|
|||||||
{
|
{
|
||||||
public class RegistrationPageIndexQueryAndResult
|
public class RegistrationPageIndexQueryAndResult
|
||||||
{
|
{
|
||||||
|
public string Source { get; set; }
|
||||||
public PackageRegistrationQuery Query { get; set; }
|
public PackageRegistrationQuery Query { get; set; }
|
||||||
public PackageRegistration[] Result { get; set; }
|
public PackageRegistration[] Result { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -35,3 +35,6 @@ foreach (var i in regpage.Items) {
|
|||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<p><pre><code>@Model.Source</code></pre></p>
|
||||||
|
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - isn</title>
|
<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" asp-append-version="true"/>
|
||||||
<link rel="stylesheet" href="~/css/site.css" />
|
<link rel="shortcut icon" href="favicon.ico" asp-append-version="true" >
|
||||||
<link rel="shortcut icon" href="favicon.ico#1" >
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
@ -7851,3 +7851,9 @@ a.text-dark:hover, a.text-dark:focus {
|
|||||||
|
|
||||||
.border-top.footer.text-muted {
|
.border-top.footer.text-muted {
|
||||||
padding: 1em; }
|
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;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre code {
|
||||||
|
|
||||||
|
color:#ccc;
|
||||||
|
background-color: #000;
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1573,7 +1573,8 @@ pre {
|
|||||||
pre code {
|
pre code {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
color: inherit;
|
color: gainsboro;
|
||||||
|
background-color: #000;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
Reference in New Issue
Block a user