feat: add cache busting and hls query param
This commit is contained in:
@@ -19,14 +19,14 @@
|
||||
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap"></noscript>
|
||||
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,600&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,600&display=swap"></noscript>
|
||||
<link rel="stylesheet" href="/dist/tailwind.css">
|
||||
<link rel="stylesheet" href="{{assetURL "/dist/tailwind.css"}}">
|
||||
<style>
|
||||
[data-htmx-loading="true"] {
|
||||
opacity: 0.65;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
<script type="module" src="/dist/static/app.js" defer></script>
|
||||
<script type="module" src="{{assetURL "/dist/static/app.js"}}" defer></script>
|
||||
<template id="toast-template">
|
||||
<div class="toast pointer-events-auto w-88 max-w-[calc(100vw-2rem)] bg-background shadow-(--shadow-card) ring-1 ring-black/5 flex items-start gap-3 px-4 py-3 transform transition-all duration-300 translate-y-2 opacity-0">
|
||||
<div class="min-w-0 flex-1">
|
||||
@@ -39,7 +39,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<script src="/dist/static/htmx-lib.js"></script>
|
||||
<script src="{{assetURL "/dist/static/htmx-lib.js"}}"></script>
|
||||
{{block "scripts" .}}{{end}}
|
||||
</head>
|
||||
<body class="bg-background text-foreground">
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/url"
|
||||
"os"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -284,3 +285,14 @@ func episodeRangeStart(epNum, step int) int {
|
||||
}
|
||||
return ((epNum-1)/step)*step + 1
|
||||
}
|
||||
|
||||
func assetURL(assetPath string) string {
|
||||
info, err := os.Stat(strings.TrimPrefix(assetPath, "/"))
|
||||
if err != nil {
|
||||
return assetPath
|
||||
}
|
||||
|
||||
values := url.Values{}
|
||||
values.Set("v", fmt.Sprintf("%d-%d", info.ModTime().Unix(), info.Size()))
|
||||
return assetPath + "?" + values.Encode()
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ func rendererFuncs() template.FuncMap {
|
||||
"urlquery": url.QueryEscape,
|
||||
"posterURL": posterURL,
|
||||
"episodeRangeStart": episodeRangeStart,
|
||||
"assetURL": assetURL,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{define "title"}}Watch {{.Anime.Title}}{{end}}
|
||||
{{define "scripts"}}<script type="module" src="/dist/static/player/main.js" defer></script>{{end}}
|
||||
{{define "scripts"}}<script type="module" src="{{assetURL "/dist/static/player/main.js"}}" defer></script>{{end}}
|
||||
{{define "page_container"}}
|
||||
<div class="-m-4 h-[calc(100dvh-4rem)] overflow-hidden p-4 md:-m-8 md:p-6">
|
||||
{{template "content" .}}
|
||||
|
||||
Reference in New Issue
Block a user