Some tiny code style updates
This commit is contained in:
@@ -8,12 +8,16 @@ namespace Umbraco.Web.Editors
|
||||
{
|
||||
public class HelpController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private static readonly HttpClient HttpClient = new HttpClient();
|
||||
private static HttpClient _httpClient;
|
||||
public async Task<List<HelpPage>> GetContextHelpForPage(string section, string tree, string baseUrl = "https://our.umbraco.com")
|
||||
{
|
||||
var url = string.Format(baseUrl + "/Umbraco/Documentation/Lessons/GetContextHelpDocs?sectionAlias={0}&treeAlias={1}", section, tree);
|
||||
|
||||
if (_httpClient == null)
|
||||
_httpClient = new HttpClient();
|
||||
|
||||
//fetch dashboard json and parse to JObject
|
||||
var json = await HttpClient.GetStringAsync(url);
|
||||
var json = await _httpClient.GetStringAsync(url);
|
||||
var result = JsonConvert.DeserializeObject<List<HelpPage>>(json);
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
@@ -193,9 +193,8 @@ namespace Umbraco.Web.Install
|
||||
internal IEnumerable<Package> GetStarterKits()
|
||||
{
|
||||
if (_httpClient == null)
|
||||
{
|
||||
_httpClient = new HttpClient();
|
||||
}
|
||||
|
||||
var packages = new List<Package>();
|
||||
try
|
||||
{
|
||||
|
||||
@@ -83,9 +83,8 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
try
|
||||
{
|
||||
if (_webClient == null)
|
||||
{
|
||||
_webClient = new WebClient();
|
||||
}
|
||||
|
||||
var values = new NameValueCollection { { "name", admin.Name }, { "email", admin.Email} };
|
||||
_webClient.UploadValues("https://shop.umbraco.com/base/Ecom/SubmitEmail/installer.aspx", values);
|
||||
}
|
||||
|
||||
@@ -63,13 +63,11 @@ namespace Umbraco.Web.Scheduling
|
||||
private async Task<bool> GetTaskByHttpAync(string url, CancellationToken token)
|
||||
{
|
||||
if (_httpClient == null)
|
||||
{
|
||||
_httpClient = new HttpClient();
|
||||
}
|
||||
|
||||
if (Uri.TryCreate(_appContext.UmbracoApplicationUrl, UriKind.Absolute, out var baseUri))
|
||||
{
|
||||
_httpClient.BaseAddress = baseUri;
|
||||
}
|
||||
|
||||
var request = new HttpRequestMessage(HttpMethod.Get, url);
|
||||
|
||||
//TODO: pass custom the authorization header, currently these aren't really secured!
|
||||
|
||||
@@ -688,9 +688,7 @@ namespace umbraco.cms.businesslogic.packager
|
||||
Directory.CreateDirectory(IOHelper.MapPath(SystemDirectories.Packages));
|
||||
|
||||
if (_webClient == null)
|
||||
{
|
||||
_webClient = new WebClient();
|
||||
}
|
||||
|
||||
_webClient.DownloadFile(
|
||||
"http://" + PackageServer + "/fetch?package=" + Package.ToString(),
|
||||
|
||||
Reference in New Issue
Block a user