push js
This commit is contained in:
14
fly.toml
14
fly.toml
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user