fix: vendor htmx.min.js locally instead of loading from CDN
Download htmx.org v1.9.10 into static/htmx.min.js and update all references (layout.html, handlers.go fallback page, sw.js precache list) to use the local copy. This enables the PWA to work fully offline since the service worker can now cache htmx from the same origin. Bump service worker cache version to v2 so existing installations pick up the new asset list. Closes leeworks-agents/gitea-mobile#17 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,7 +104,7 @@ var basePage = template.Must(template.New("base").Parse(`<!DOCTYPE html>
|
|||||||
<link rel="apple-touch-icon" href="/static/icon-192.png">
|
<link rel="apple-touch-icon" href="/static/icon-192.png">
|
||||||
<title>{{.Title}} — Gitea Mobile</title>
|
<title>{{.Title}} — Gitea Mobile</title>
|
||||||
<link rel="stylesheet" href="/static/style.css">
|
<link rel="stylesheet" href="/static/style.css">
|
||||||
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
<script src="/static/htmx.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="content" id="main-content">
|
<div class="content" id="main-content">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<link rel="apple-touch-icon" href="/static/icon-192.png">
|
<link rel="apple-touch-icon" href="/static/icon-192.png">
|
||||||
<title>{{.Title}} — Gitea Mobile</title>
|
<title>{{.Title}} — Gitea Mobile</title>
|
||||||
<link rel="stylesheet" href="/static/style.css">
|
<link rel="stylesheet" href="/static/style.css">
|
||||||
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
<script src="/static/htmx.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="content" id="main-content">
|
<div class="content" id="main-content">
|
||||||
|
|||||||
Vendored
+1
File diff suppressed because one or more lines are too long
+2
-2
@@ -1,14 +1,14 @@
|
|||||||
// Service Worker for Gitea Mobile PWA
|
// Service Worker for Gitea Mobile PWA
|
||||||
// Caches the app shell for offline/fast loading.
|
// Caches the app shell for offline/fast loading.
|
||||||
|
|
||||||
const CACHE_NAME = 'gitea-mobile-v1';
|
const CACHE_NAME = 'gitea-mobile-v2';
|
||||||
const APP_SHELL = [
|
const APP_SHELL = [
|
||||||
'/',
|
'/',
|
||||||
'/static/style.css',
|
'/static/style.css',
|
||||||
'/static/manifest.json',
|
'/static/manifest.json',
|
||||||
'/static/icon-192.png',
|
'/static/icon-192.png',
|
||||||
'/static/icon-512.png',
|
'/static/icon-512.png',
|
||||||
'https://unpkg.com/htmx.org@1.9.10'
|
'/static/htmx.min.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Install: cache app shell resources.
|
// Install: cache app shell resources.
|
||||||
|
|||||||
Reference in New Issue
Block a user