Skip to content

Commit

Permalink
#7403 Removed the problematic pathBase code until we find a solution …
Browse files Browse the repository at this point in the history
…with local links
  • Loading branch information
skoshelev committed Nov 11, 2024
1 parent b320af0 commit 8adea3b
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 69 deletions.
7 changes: 1 addition & 6 deletions src/Libraries/Nop.Core/Configuration/HostingConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,5 @@ public partial class HostingConfig : IConfig
/// <summary>
/// Gets or sets addresses of known networks to accept forwarded headers from
/// </summary>
public string KnownNetworks { get; protected set; } = string.Empty;

/// <summary>
/// Ability to set a custom path base, for example domain.com/path/
/// </summary>
public string PathBase { get; protected set; } = "/";
public string KnownNetworks { get; protected set; } = string.Empty;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
/// <param name="application">Builder for configuring an application's request pipeline</param>
public void Configure(IApplicationBuilder application)
{
var hostingConfig = Singleton<AppSettings>.Instance.Get<HostingConfig>();

//use path base
if (!string.IsNullOrEmpty(hostingConfig.PathBase))
application.UsePathBase(hostingConfig.PathBase);

//add the RoutingMiddleware
application.UseRouting();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,6 @@ public override void Up()
//#7299
["Admin.Catalog.Products.Multimedia.Videos.Description"] = "How to embed a video: Find your video in your library (on any video hosting) and select it to open the video settings page. Select the privacy icon from your \"Share\" button. Click on \"Embed\" from the window that opens up. You can copy the <strong>src</strong> from the embed option and use it.",

//path base
["Admin.Configuration.AppSettings.Hosting.PathBase"] = "Path base",
["Admin.Configuration.AppSettings.Hosting.PathBase.Hint"] = "Ability to set a custom path base, for example domain.com/path/",
//4306
["Admin.Configuration.Settings.Catalog.ShowSearchBoxCategories"] = "Show product categories for the search box",
["Admin.Configuration.Settings.Catalog.ShowSearchBoxCategories.Hint"] = "Check to display the drop-down list with product categories next to the search box.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4667,13 +4667,7 @@
</LocaleResource>
<LocaleResource Name="Admin.Configuration.AppSettings.Hosting.KnownNetworks.Hint">
<Value>Specify a list of IP CIDR notations (comma separated) to accept forwarded headers. e.g. 172.64.0.0/13,162.158.0.0/15</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.AppSettings.Hosting.PathBase">
<Value>Path base</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.AppSettings.Hosting.PathBase.Hint">
<Value>Ability to set a custom path base, for example domain.com/path/</Value>
</LocaleResource>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.AppSettings.Hosting.UseProxy">
<Value>Use proxy servers</Value>
</LocaleResource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ public partial record HostingConfigModel : BaseNopModel, IConfigModel
[NopResourceDisplayName("Admin.Configuration.AppSettings.Hosting.KnownNetworks")]
public string KnownNetworks { get; set; }

[NopResourceDisplayName("Admin.Configuration.AppSettings.Hosting.PathBase")]
public string PathBase { get; set; } = "/";

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,4 @@
</div>
</div>
</nop-nested-setting>
<div class="form-group row">
<div class="col-md-3">
<nop-label asp-for="HostingConfigModel.PathBase" />
</div>
<div class="col-md-9">
<nop-editor asp-for="HostingConfigModel.PathBase" />
<span asp-validation-for="HostingConfigModel.PathBase"></span>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
@inject LocalizationSettings localizationSettings
@inject StoreInformationSettings storeInformationSettings
@inject Nop.Services.Localization.ILanguageService languageService
@inject AppSettings appSettings

@using Nop.Core.Domain
@using Nop.Core.Domain.Localization
@using Nop.Core.Configuration
@using Nop.Services.Customers
@using Nop.Services.Helpers
@using Nop.Services.Security
Expand All @@ -28,10 +26,7 @@

//avatar
var currentCustomer = await workContext.GetCurrentCustomerAsync();

// Custom path base
var usePathBase = appSettings.Get<HostingConfig>().PathBase;


//event
await eventPublisher.PublishAsync(new PageRenderingEvent(NopHtml));

Expand All @@ -43,8 +38,6 @@
<title>@adminPageTitle</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

<base href="@usePathBase" />

@NopHtml.GenerateHeadCustom()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
@inject IEventPublisher eventPublisher
@inject LocalizationSettings localizationSettings
@inject AppSettings appSettings

@using Nop.Core.Domain.Localization
@using Nop.Core.Configuration

@{
//page title
string adminPageTitle = !string.IsNullOrWhiteSpace(ViewBag.PageTitle) ? ViewBag.PageTitle + " / " : "";
adminPageTitle += T("Admin.PageTitle").Text;

var usePathBase = appSettings.Get<HostingConfig>().PathBase;

//event
await eventPublisher.PublishAsync(new PageRenderingEvent(NopHtml));
}
Expand All @@ -21,8 +18,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

<base href="@usePathBase" />

@NopHtml.GenerateHeadCustom()

@* CSS & Script resources *@
Expand Down
8 changes: 1 addition & 7 deletions src/Presentation/Nop.Web/Views/Install/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
@model InstallModel

@inject AppSettings appSettings

@using Nop.Core.Configuration
@{
Layout = null;
var usePathBase = appSettings.Get<HostingConfig>().PathBase;
}

<!DOCTYPE html>
<html>
<head>
<title>@ILS.GetResource("Title")</title>

<base href="@usePathBase" />


<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic" />
<link rel="shortcut icon" href="/icons/icons_0/favicon.ico" />
Expand Down
6 changes: 0 additions & 6 deletions src/Presentation/Nop.Web/Views/Shared/_Print.cshtml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
@inject Nop.Core.Domain.Common.CommonSettings commonSettings
@inject IThemeContext themeContext
@inject AppSettings appSettings

@using Nop.Core.Configuration

@{
var themeName = await themeContext.GetWorkingThemeNameAsync();
var title = await NopHtml.GenerateTitleAsync();
var usePathBase = appSettings.Get<HostingConfig>().PathBase;
}
<!DOCTYPE html>
<html lang="@CultureInfo.CurrentUICulture.TwoLetterISOLanguageName" dir="@Html.GetUIDirection(!await Html.ShouldUseRtlThemeAsync())" class="@NopHtml.GeneratePageCssClasses()">
<head>
<title>@title</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

<base href="@usePathBase" />

<link href="~/Themes/@themeName/Content/css/print.css" rel="stylesheet" type="text/css" />

@NopHtml.GenerateCssFiles()
Expand Down
10 changes: 2 additions & 8 deletions src/Presentation/Nop.Web/Views/Shared/_Root.Head.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using Nop.Core.Configuration
@using Nop.Core.Domain.Catalog
@using Nop.Core.Domain.Catalog
@using Nop.Core.Domain.Common
@using Nop.Core.Domain.Seo
@using Nop.Services.Security
Expand All @@ -10,7 +9,6 @@
@inject IEventPublisher eventPublisher
@inject IPermissionService permissionService
@inject SeoSettings seoSettings
@inject AppSettings appSettings

@{
if (catalogSettings.DisplayAllPicturesOnCatalogPages)
Expand Down Expand Up @@ -39,9 +37,7 @@
{
NopHtml.AppendHeadCustomParts(seoSettings.CustomHeadTags);
}

var usePathBase = appSettings.Get<HostingConfig>().PathBase;


//event
await eventPublisher.PublishAsync(new PageRenderingEvent(NopHtml));

Expand All @@ -54,8 +50,6 @@
<head>
<title>@title</title>

<base href="@usePathBase" />

<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta name="description" content="@description" />
<meta name="keywords" content="@keywords" />
Expand Down

0 comments on commit 8adea3b

Please sign in to comment.