This commit is contained in:
Tommy Parnell
2022-11-14 16:13:23 -05:00
parent 5a253f6ada
commit afcae26bc1
3 changed files with 13 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
# fly.toml file generated for tp-blog-2 on 2022-08-26T12:21:08-04:00
# fly.toml file generated for dry-meadow-9911 on 2022-11-09T12:09:05-05:00
app = "tp-blog-2"
app = "dry-meadow-9911"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
@@ -27,12 +27,12 @@ processes = []
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
# [[services.ports]]
# handlers = ["tls", "http"]
# port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
grace_period = "2s"
interval = "3s"
restart_limit = 0
timeout = "2s"

View File

@@ -16,6 +16,7 @@ namespace TerribleDev.Blog.Web.Taghelpers
public record PushUrl(string Url, string asProperty);
[HtmlTargetElement("link", Attributes = "[rel=stylesheet],href,push")]
[HtmlTargetElement("img", Attributes = "src,push")]
[HtmlTargetElement("script", Attributes = "src,push")]
public class HttpPush : LinkTagHelper
{
[HtmlAttributeNotBound]
@@ -28,9 +29,11 @@ namespace TerribleDev.Blog.Web.Taghelpers
}
private (string Url, string AsProperty) GetTagInfo(string tag) =>
tag switch {
tag switch
{
"link" => ("href", "link"),
"img" => ("src", "image"),
"script" => ("src", "script"),
_ => (null, null)
};
@@ -41,7 +44,6 @@ namespace TerribleDev.Blog.Web.Taghelpers
return;
}
var (urlAttribute, asProperty) = GetTagInfo(output.TagName);
// var urlAttribute = context.TagName == "link" ? "href" : "src";
var url = base.TryResolveUrl(output.Attributes[urlAttribute].Value.ToString(), out string resolvedUrl) ? resolvedUrl : output.Attributes[urlAttribute].Value.ToString();
var linkList = ViewContext.HttpContext.Items.TryGetValue(Key, out var links) ? links as List<PushUrl> : null;

View File

@@ -54,10 +54,10 @@
</div>
@RenderSection("Scripts", required: false)
<environment names="Development">
<script asp-append-version="true" src="~/js/swi.js" async></script>
<script push asp-append-version="true" src="~/js/swi.js" async></script>
</environment>
<environment names="Production">
<script asp-append-version="true" src="~/js/site.min.js" async></script>
<script push asp-append-version="true" src="~/js/site.min.js" async></script>
</environment>
</body>
</html>