play-probe: include JS version (detect stale-cache phones)
This commit is contained in:
1 parent
c7f5ad4c7a
commit
66a6ed5d93
2 files changed
+6
-4
No files matched your search
+4
-2
@@ -1,4 +1,6 @@
|
||||
// app.js — ani-web frontend: search -> detail -> play, vanilla JS + hls.js
|
||||
const JSV = 10; // bump with every app.js change; play-probe reports it so a
|
||||
// stale-cache phone is detectable server-side
|
||||
// BASE = this page's directory, so the app works at / or behind a
|
||||
// prefixing reverse proxy (e.g. https://host/ani/)
|
||||
const BASE = (() => {
|
||||
@@ -73,7 +75,7 @@ function showStreamError(msg, retry) {
|
||||
// + report the client's capabilities so a failing browser is diagnosable
|
||||
// from server.log instead of by guesswork
|
||||
try {
|
||||
postEvent({type: "client-fail", msg,
|
||||
postEvent({type: "client-fail", jsv: JSV, msg,
|
||||
ua: navigator.userAgent,
|
||||
hls_lib: typeof window.Hls,
|
||||
mse: (window.Hls && Hls.isSupported) ? Hls.isSupported() : null,
|
||||
@@ -877,7 +879,7 @@ async function play(ep_id, ep_no) {
|
||||
try {
|
||||
const nativeOK = (() => { try { return document.createElement("video").canPlayType("application/vnd.apple.mpegurl") || "none"; } catch { return "err"; } })();
|
||||
const mse = (() => { try { return (window.Hls && Hls.isSupported) ? Hls.isSupported() : null; } catch { return "err"; } })();
|
||||
postEvent({type: "play-probe",
|
||||
postEvent({type: "play-probe", jsv: JSV,
|
||||
branch: (!window.Hls || !Hls.isSupported()) ? (nativeOK !== "none" && nativeOK !== "" ? "native" : "none-throw") : "hlsjs",
|
||||
hls_lib: typeof window.Hls,
|
||||
mse, native_hls: nativeOK, ua: navigator.userAgent});
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
<title>ani-web</title>
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%23f97316'/%3E%3Ctext x='32' y='45' font-family='sans-serif' font-size='42' font-weight='700' text-anchor='middle' fill='%230e0f13'%3Ea%3C/text%3E%3C/svg%3E">
|
||||
|
||||
<link rel="stylesheet" href="style.css?v=9">
|
||||
<link rel="stylesheet" href="style.css?v=10">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
@@ -30,6 +30,6 @@
|
||||
max-age=300 in browser AND possibly in your HTTPS proxy, and a stale
|
||||
copy is exactly how users keep seeing an old UI after a deploy -->
|
||||
<script src="hls.min.js"></script>
|
||||
<script src="app.js?v=9"></script>
|
||||
<script src="app.js?v=10"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user