mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Smaller aircraft photos, one-row-per-item detail cards, push diagnostics
- Aircraft photos get 192px and 960x432 copies made on upload; the header, share page and Fleet cards use them (and the offline copies), instead of the full original. - Flight, engine data, component and major record details show one label and value per row on phones (wide items no longer add grid columns). - Profile re-records this device's push subscription on every visit, and says why if it can't; Send test delivers now and lists each device's result; Google's other push hosts are accepted; turning notifications on shows the browser's actual error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f314a13bb
commit
d4b71d17a1
21 files changed
+234
-96
No files matched your search
@@ -64,7 +64,7 @@ self.addEventListener("fetch", (event) => {
|
||||
.catch(() => caches.match(url.pathname)))
|
||||
} else if (url.pathname.startsWith("/assets/")) {
|
||||
event.respondWith(cachedAsset(request))
|
||||
} else if (url.pathname.startsWith("/rails/active_storage/blobs/redirect/")) {
|
||||
} else if (/^\/rails\/active_storage\/(blobs|representations)\/redirect\//.test(url.pathname)) {
|
||||
// Uploaded files come from the network; an aircraft photo saved for
|
||||
// offline use stands in when there's none.
|
||||
event.respondWith(fetch(request)
|
||||
@@ -80,11 +80,12 @@ const savedImage = async (request, response) => {
|
||||
}
|
||||
|
||||
// Photo links carry an expiry, so they change with every page; the saved copy
|
||||
// is filed under the upload's id instead (same rule in offline_prep_controller.js).
|
||||
// is filed under the upload's id (and size) instead (same rule in offline_prep_controller.js).
|
||||
function imageKey(url) {
|
||||
try {
|
||||
const signed = new URL(url, self.location.origin).pathname.match(/\/blobs\/redirect\/([^/]+?)--/)[1]
|
||||
return `${self.location.origin}/offline-image/${JSON.parse(atob(decodeURIComponent(signed)))._rails.data}`
|
||||
const [ , signed, size ] = new URL(url, self.location.origin).pathname.match(/\/(?:blobs|representations)\/redirect\/([^/]+?)--[^/]+\/(?:([^/]+)\/)?/)
|
||||
const id = JSON.parse(atob(decodeURIComponent(signed)))._rails.data
|
||||
return `${self.location.origin}/offline-image/${id}${size ? `/${size}` : ""}`
|
||||
} catch (_) { return null }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user