fix: scope mobile share install to dashboard path (#223)
This commit is contained in:
parent
4499a7f947
commit
a25b547d20
|
|
@ -3067,7 +3067,7 @@ textarea { resize: vertical; min-height: 120px; }
|
||||||
if (workSession.active()) workSession.reconcile();
|
if (workSession.active()) workSession.reconcile();
|
||||||
});
|
});
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.register('/service-worker.js').catch(error =>
|
navigator.serviceWorker.register('service-worker.js').catch(error =>
|
||||||
console.warn('Stackchain install support unavailable', error)
|
console.warn('Stackchain install support unavailable', error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
"name": "Stackchain Dashboard",
|
"name": "Stackchain Dashboard",
|
||||||
"short_name": "Stackchain",
|
"short_name": "Stackchain",
|
||||||
"description": "Capture, plan, and complete Gitea work from mobile.",
|
"description": "Capture, plan, and complete Gitea work from mobile.",
|
||||||
"id": "/",
|
"id": "./",
|
||||||
"start_url": "/",
|
"start_url": "./",
|
||||||
"scope": "/",
|
"scope": "./",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#07111f",
|
"background_color": "#07111f",
|
||||||
"theme_color": "#0b1220",
|
"theme_color": "#0b1220",
|
||||||
"icons": [
|
"icons": [
|
||||||
{"src": "/static/icons/stackchain-192.png", "sizes": "192x192", "type": "image/png"},
|
{"src": "static/icons/stackchain-192.png", "sizes": "192x192", "type": "image/png"},
|
||||||
{"src": "/static/icons/stackchain-512.png", "sizes": "512x512", "type": "image/png"}
|
{"src": "static/icons/stackchain-512.png", "sizes": "512x512", "type": "image/png"}
|
||||||
],
|
],
|
||||||
"share_target": {
|
"share_target": {
|
||||||
"action": "/",
|
"action": "./",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"enctype": "application/x-www-form-urlencoded",
|
"enctype": "application/x-www-form-urlencoded",
|
||||||
"params": {"title": "title", "text": "text", "url": "url"}
|
"params": {"title": "title", "text": "text", "url": "url"}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
const CACHE = 'stackchain-shell-v1';
|
const CACHE = 'stackchain-shell-v1';
|
||||||
const SHELL = ['/manifest.webmanifest', '/static/icons/stackchain-192.png', '/static/icons/stackchain-512.png'];
|
const BASE = new URL('./', self.location.href).pathname;
|
||||||
|
const SHELL = [
|
||||||
|
BASE + 'manifest.webmanifest',
|
||||||
|
BASE + 'static/icons/stackchain-192.png',
|
||||||
|
BASE + 'static/icons/stackchain-512.png',
|
||||||
|
];
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
event.waitUntil(caches.open(CACHE).then(cache => cache.addAll(SHELL)).then(() => self.skipWaiting()));
|
event.waitUntil(caches.open(CACHE).then(cache => cache.addAll(SHELL)).then(() => self.skipWaiting()));
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,7 @@ async def test_dashboard_launches_share_capture_with_draft_conflict_choices():
|
||||||
assert 'id="shared-content-conflict"' in html
|
assert 'id="shared-content-conflict"' in html
|
||||||
assert '.shared-content-actions button { min-height:44px;' in html
|
assert '.shared-content-actions button { min-height:44px;' in html
|
||||||
assert "history.replaceState({}, '', cleanUrl)" in html
|
assert "history.replaceState({}, '', cleanUrl)" in html
|
||||||
assert "navigator.serviceWorker.register('/service-worker.js')" in html
|
assert "navigator.serviceWorker.register('service-worker.js')" in html
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,11 @@ async def test_pwa_assets_expose_root_scoped_share_target_without_caching_api_da
|
||||||
|
|
||||||
assert manifest.status_code == 200
|
assert manifest.status_code == 200
|
||||||
assert manifest.headers["content-type"].startswith("application/manifest+json")
|
assert manifest.headers["content-type"].startswith("application/manifest+json")
|
||||||
|
assert manifest.json()["id"] == "./"
|
||||||
|
assert manifest.json()["start_url"] == "./"
|
||||||
|
assert manifest.json()["scope"] == "./"
|
||||||
assert manifest.json()["share_target"] == {
|
assert manifest.json()["share_target"] == {
|
||||||
"action": "/", "method": "GET", "enctype": "application/x-www-form-urlencoded",
|
"action": "./", "method": "GET", "enctype": "application/x-www-form-urlencoded",
|
||||||
"params": {"title": "title", "text": "text", "url": "url"},
|
"params": {"title": "title", "text": "text", "url": "url"},
|
||||||
}
|
}
|
||||||
assert worker.status_code == 200
|
assert worker.status_code == 200
|
||||||
|
|
@ -82,3 +85,4 @@ async def test_pwa_assets_expose_root_scoped_share_target_without_caching_api_da
|
||||||
assert worker.headers["service-worker-allowed"] == "/"
|
assert worker.headers["service-worker-allowed"] == "/"
|
||||||
assert "request.url.includes('/api/')" in worker.text
|
assert "request.url.includes('/api/')" in worker.text
|
||||||
assert "request.method !== 'GET'" in worker.text
|
assert "request.method !== 'GET'" in worker.text
|
||||||
|
assert "new URL('./', self.location.href).pathname" in worker.text
|
||||||
Loading…
Reference in New Issue
Block a user