Skip to content

Commit

Permalink
Revert "Merge pull request praeclarum#165 from MaceWindu/issue/72"
Browse files Browse the repository at this point in the history
This reverts commit ea8468a, reversing
changes made to 9c613d3.
  • Loading branch information
praeclarum committed Mar 22, 2022
1 parent ea8468a commit 1fc7615
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Data/PackageData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public class PackageData

static readonly PackageDataCache cache = new PackageDataCache ();

public string SafeIconUrl => string.IsNullOrEmpty (IconUrl) ? "~/images/no-icon.png" : IconUrl;
public string SafeIconUrl => string.IsNullOrEmpty (IconUrl) ? "/images/no-icon.png" : IconUrl;

public static Task<PackageData> GetAsync (object inputId, object inputVersion, HttpClient client) =>
GetAsync (inputId, inputVersion, client, CancellationToken.None);
Expand Down
2 changes: 1 addition & 1 deletion Data/PackageSearchResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void Add (PackageTargetFramework framework, PackageAssembly a, TypeDefini
return;
var dir = a.IsBuildAssembly ? "build" : "lib";
var code = isPublic ? "" : (framework.Package.AllowedToDecompile ? "?code=true" : "");
var link = $"~/packages/{Uri.EscapeDataString(package.Id)}/{Uri.EscapeDataString(package.Version.ShortVersionString)}/{framework.Moniker}/{dir}/{Uri.EscapeDataString(a.FileName)}/{Uri.EscapeDataString(m.Namespace)}/{Uri.EscapeDataString(m.Name)}{code}#{Uri.EscapeDataString(id)}";
var link = $"/packages/{Uri.EscapeDataString(package.Id)}/{Uri.EscapeDataString(package.Version.ShortVersionString)}/{framework.Moniker}/{dir}/{Uri.EscapeDataString(a.FileName)}/{Uri.EscapeDataString(m.Namespace)}/{Uri.EscapeDataString(m.Name)}{code}#{Uri.EscapeDataString(id)}";
results.TryAdd (link, new PackageSearchResult {
Name = name,
Parent = parent,
Expand Down
2 changes: 1 addition & 1 deletion Data/PackageTargetFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ from a in Assemblies.Concat (BuildAssemblies)
return null;
}
var dir = at.a.IsBuildAssembly ? "build" : "lib";
return $"~/packages/{Uri.EscapeDataString(Package.Id)}/{Uri.EscapeDataString(Package.Version.ShortVersionString)}/{dir}/{Uri.EscapeDataString(Moniker)}/{Uri.EscapeDataString(at.a.FileName)}/{Uri.EscapeDataString(at.t.Namespace)}/{Uri.EscapeDataString(at.t.Name)}";
return $"/packages/{Uri.EscapeDataString(Package.Id)}/{Uri.EscapeDataString(Package.Version.ShortVersionString)}/{dir}/{Uri.EscapeDataString(Moniker)}/{Uri.EscapeDataString(at.a.FileName)}/{Uri.EscapeDataString(at.t.Namespace)}/{Uri.EscapeDataString(at.t.Name)}";
}

async Task<string> DeepFindTypeUrlAsync (
Expand Down
2 changes: 1 addition & 1 deletion Data/PackagesSearchResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ public class PackagesSearchResult

public override string ToString() => PackageId;

public string SafeIconUrl => string.IsNullOrEmpty (IconUrl) ? "~/images/no-icon.png" : IconUrl;
public string SafeIconUrl => string.IsNullOrEmpty (IconUrl) ? "/images/no-icon.png" : IconUrl;
}
}
8 changes: 4 additions & 4 deletions Pages/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button> -->
<a href="~/" class="navbar-brand" style="padding-right:2em">fuget.org</a>
<form id="searchForm" class="input-group" action="~/packages" method="GET" style="margin-top:0.6em;width:20em">
<a href="/" class="navbar-brand" style="padding-right:2em">fuget.org</a>
<form id="searchForm" class="input-group" action="/packages" method="GET" style="margin-top:0.6em;width:20em">
<input name="q" id="packageSearch" value="@ViewData["q"]" type="text" class="form-control" placeholder="Search Packages"
style="background-color:#444;border-color:#444;color:#fff;border-radius:0.5em;outline:none;box-shadow:none;"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
Expand Down Expand Up @@ -63,9 +63,9 @@
<li class="private-api"><span class="fugeticon fugeticon-class" aria-hidden="true"></span>&nbsp;Grayed out is non-public</li>
</ul>
</div>
<p><a href="~/">fuget.org</a> is &copy; @DateTime.UtcNow.Year Frank A. Krueger</p>
<p><a href="/">fuget.org</a> is &copy; @DateTime.UtcNow.Year Frank A. Krueger</p>
<p>help me <a href="https://github.com/praeclarum/FuGetGallery">build this on github</a></p>
<p><a href="~/privacy">privacy policy</a></p>
<p><a href="/privacy">privacy policy</a></p>

</footer>
</div>
Expand Down
4 changes: 2 additions & 2 deletions Pages/packages/badges.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
};
}

<h1 style="margin-bottom:0.5em"><a href="~/packages/@Uri.EscapeDataString(package.Id)">@package.Id</a> Badges</h1>
<h1 style="margin-bottom:0.5em"><a href="/packages/@Uri.EscapeDataString(package.Id)">@package.Id</a> Badges</h1>

<div style="margin-bottom:2em">
<a href="@urlroot/packages/@Uri.EscapeDataString(package.Id)/badge.svg">
<img src="~/packages/@Uri.EscapeDataString(package.Id)/badge.svg" />
<img src="/packages/@Uri.EscapeDataString(package.Id)/badge.svg" />
</a>
</div>

Expand Down
4 changes: 2 additions & 2 deletions Pages/packages/dependents.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
};
}

<h1 style="margin-bottom:0.5em"><a href="~/packages/@Uri.EscapeDataString(package.Id)">@package.Id</a> Dependents</h1>
<h1 style="margin-bottom:0.5em"><a href="/packages/@Uri.EscapeDataString(package.Id)">@package.Id</a> Dependents</h1>

<p>The following @dependents.Count packages directly use @(package.Id):</p>

<ol>
@foreach (var r in dependents) {
<li>
<a href="~/packages/@Uri.EscapeDataString(@r)">@r</a>
<a href="/packages/@Uri.EscapeDataString(@r)">@r</a>
</li>
}
</ol>
31 changes: 15 additions & 16 deletions Pages/packages/details.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
onamespace = (onamespace ?? ns?.Key) ?? RouteData.Values["namespace"];
otypeName = otypeName ?? RouteData.Values["typeName"];
ocode = ocode ?? Request.Query["code"].FirstOrDefault();
var r = "~/packages";
var r = "/packages";
if (oid != null)
{
r += "/" + Uri.EscapeDataString(oid.ToString());
Expand Down Expand Up @@ -172,9 +172,8 @@
if ("true".Equals(ocode) && package.AllowedToDecompile)
{
r += "?code=true";
}

return Url.Content(r);
}
return r;
}

string ShortDate(DateTime? date)
Expand All @@ -197,12 +196,12 @@

<header>
<h1>
<a href="~/packages/@Uri.EscapeDataString(package.Id)">
<img src="@package.SafeIconUrl" class="package-icon" width="64" height="64" onError="this.onerror=null;this.src='@Url.Content("~/images/no-icon.png")';" />
<a href="/packages/@Uri.EscapeDataString(package.Id)">
<img src="@package.SafeIconUrl" class="package-icon" width="64" height="64" onError="this.onerror=null;this.src='/images/no-icon.png';" />
</a>
<a href="~/packages/@Uri.EscapeDataString(package.Id)">@package.Id</a>
<a href="/packages/@Uri.EscapeDataString(package.Id)">@package.Id</a>
<small>by @authors</small>
<a href="~/packages/@Uri.EscapeDataString(package.Id)/badges"><img src="~/packages/@Uri.EscapeDataString(package.Id)/[email protected](versionSpec.ShortVersionString)" /></a>
<a href="/packages/@Uri.EscapeDataString(package.Id)/badges"><img src="/packages/@Uri.EscapeDataString(package.Id)/[email protected](versionSpec.ShortVersionString)" /></a>
</h1>
<nav>
<div class="btn-group" style="display: inline-block">
Expand Down Expand Up @@ -306,7 +305,7 @@
@foreach (var d in framework.Dependencies.OrderBy(x => x.PackageId))
{
<a class="btn btn-default btn-sm" style="color:#777"
href="~/packages/@Uri.EscapeDataString(d.PackageId)/@Uri.EscapeDataString(d.VersionSpec)">
href="/packages/@Uri.EscapeDataString(d.PackageId)/@Uri.EscapeDataString(d.VersionSpec)">
<span class="fugeticon fugeticon-@GetIcon(d)" aria-hidden="true"></span>&nbsp;@d.PackageId&nbsp;@d.VersionSpec
</a>
}
Expand All @@ -320,14 +319,14 @@
@foreach (var d in (from d in dependents let r = rand.Next() orderby r select d).Take(maxDisplayDependents).OrderBy(x => x))
{
<a class="btn btn-default btn-sm" style="color:#777"
href="~/packages/@Uri.EscapeDataString(d)">
href="/packages/@Uri.EscapeDataString(d)">
<span class="fugeticon fugeticon-@packageIcon" aria-hidden="true"></span>&nbsp;@d
</a>
}
@if (dependents.Count > maxDisplayDependents)
{
<a class="btn btn-default btn-sm" style="color:#777"
href="~/packages/@Uri.EscapeDataString(package.Id)/dependents">@(dependents.Count - maxDisplayDependents) more...</a>
href="/packages/@Uri.EscapeDataString(package.Id)/dependents">@(dependents.Count - maxDisplayDependents) more...</a>
}
</nav>
}
Expand Down Expand Up @@ -405,7 +404,7 @@ else
var cls = (active ? "active " : "") + "public-api";
<li>
<a class="@cls"
href="~/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/lib/@Uri.EscapeDataString(framework.Moniker)/@Uri.EscapeDataString(a.FileName)">
href="/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/lib/@Uri.EscapeDataString(framework.Moniker)/@Uri.EscapeDataString(a.FileName)">
<span class="fugeticon fugeticon-@GetIcon(a)" aria-hidden="true"></span>&nbsp;@a.FileName
</a>
</li>
Expand All @@ -422,7 +421,7 @@ else
var cls = (active ? "active " : "") + "public-api";
<li>
<a class="@cls"
href="~/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/build/@Uri.EscapeDataString(framework.Moniker)/@Uri.EscapeDataString(a.FileName)">
href="/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/build/@Uri.EscapeDataString(framework.Moniker)/@Uri.EscapeDataString(a.FileName)">
<span class="fugeticon fugeticon-@GetIcon(a)" aria-hidden="true"></span>&nbsp;@a.FileName
</a>
</li>
Expand All @@ -442,7 +441,7 @@ else
{
<li>
<a class="@cls"
href="~/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/@Uri.EscapeDataString(dir)/@Uri.EscapeDataString(framework.Moniker)/@Uri.EscapeDataString(asm.FileName)/@Uri.EscapeDataString(n.Key)">
href="/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/@Uri.EscapeDataString(dir)/@Uri.EscapeDataString(framework.Moniker)/@Uri.EscapeDataString(asm.FileName)/@Uri.EscapeDataString(n.Key)">
<span class="fugeticon fugeticon-@GetIcon(n)" aria-hidden="true"></span>&nbsp;@n.Key
</a>
</li>
Expand Down Expand Up @@ -480,7 +479,7 @@ else
var color = bold == "bold" ? "#000" : "#777";
<li>
<a style="font-weight:@bold;color:@color;"
href="~/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/content/@a.ArchiveEntry.FullName.Substring(8)">
href="/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/content/@a.ArchiveEntry.FullName.Substring(8)">
<span class="fugeticon fugeticon-@GetIcon(a)" aria-hidden="true"></span>&nbsp;@a.ArchiveEntry.FullName.Substring(8)
</a>
</li>
Expand All @@ -497,7 +496,7 @@ else
var color = bold == "bold" ? "#000" : "#777";
<li>
<a style="font-weight:@bold;color:@color;"
href="~/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/tools/@a.ArchiveEntry.FullName.Substring(6)">
href="/packages/@Uri.EscapeDataString(package.Id)/@Uri.EscapeDataString(package.Version.ShortVersionString)/tools/@a.ArchiveEntry.FullName.Substring(6)">
<span class="fugeticon fugeticon-@GetIcon(a)" aria-hidden="true"></span>&nbsp;@a.ArchiveEntry.FullName.Substring(6)
</a>
</li>
Expand Down
6 changes: 3 additions & 3 deletions Pages/packages/index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
@foreach (var r in results.Results) {
<li class="media">
<div class="media-left">
<a href="~/packages/@Uri.EscapeDataString(@r.PackageId)">
<img src="@r.SafeIconUrl" class="package-icon-in-list" width="64" height="64" onError="this.onerror=null;this.src='@Url.Content("~/images/no-icon.png")';" />
<a href="/packages/@Uri.EscapeDataString(@r.PackageId)">
<img src="@r.SafeIconUrl" class="package-icon-in-list" width="64" height="64" onError="this.onerror=null;this.src='/images/no-icon.png';" />
</a>
</div>
<div class="media-body">
<h4><a href="~/packages/@Uri.EscapeDataString(@r.PackageId)">@r.PackageId</a><small> by @r.Authors</small></h4>
<h4><a href="/packages/@Uri.EscapeDataString(@r.PackageId)">@r.PackageId</a><small> by @r.Authors</small></h4>
<p style="max-height:5em;overflow:auto">@r.Description</p>
</div>
</li>
Expand Down

0 comments on commit 1fc7615

Please sign in to comment.