Skip to content

Commit 9cf2ed8

Browse files
committed
refactor(home): remove dynamic PWA manifest generation and update manifest link in dashboard
1 parent d39adf3 commit 9cf2ed8

File tree

4 files changed

+25
-100
lines changed

4 files changed

+25
-100
lines changed

app/routers/home.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,6 @@
1414
async def base():
1515
return render_template(HOME_PAGE_TEMPLATE)
1616

17-
18-
@router.get("/manifest.json")
19-
async def get_manifest(request: Request, start_url: Optional[str] = None):
20-
"""
21-
Dynamic PWA manifest generator
22-
"""
23-
# Get the base URL
24-
# base_url = str(request.base_url).rstrip("/")
25-
26-
# Determine start URL - prioritize query param, then dashboard path, then root
27-
if start_url:
28-
# Validate that start_url is within the dashboard path for security
29-
if start_url.startswith(DASHBOARD_ROUTE):
30-
resolved_start_url = start_url
31-
else:
32-
resolved_start_url = DASHBOARD_ROUTE
33-
else:
34-
resolved_start_url = DASHBOARD_ROUTE or "/"
35-
36-
manifest = {
37-
"name": "PasarGuard",
38-
"short_name": "PasarGuard",
39-
"description": "PasarGuard: Modern dashboard for managing proxies and users.",
40-
"theme_color": "#1b1b1d",
41-
"background_color": "#1b1b1d",
42-
"display": "standalone",
43-
"start_url": resolved_start_url,
44-
"scope": DASHBOARD_ROUTE or "/",
45-
"icons": [
46-
{"src": "/statics/favicon/logo-pwa.png", "sizes": "192x192", "type": "image/png"},
47-
{"src": "/statics/favicon/logo-pwa.png", "sizes": "512x512", "type": "image/png"},
48-
{"src": "/statics/favicon/logo-pwa.png", "sizes": "180x180", "type": "image/png"},
49-
],
50-
}
51-
52-
return JSONResponse(content=manifest)
53-
54-
5517
@router.get("/health", response_model=dict, status_code=status.HTTP_200_OK)
5618
async def health():
5719
return {"status": "ok"}

dashboard/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<meta name="apple-mobile-web-app-capable" content="yes" />
1414
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
1515
<link rel="apple-touch-icon" href="/statics/favicon/logo-pwa.png" />
16-
<link rel="manifest" href="/manifest.json" />
16+
<link rel="manifest" href="/statics/favicon/site.webmanifest" />
1717
<title>PasarGuard</title>
1818
</head>
1919
<body>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "",
3+
"short_name": "",
4+
"icons": [
5+
{
6+
"src": "/statics/favicon/logo-pwa.png",
7+
"sizes": "192x192",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "/statics/favicon/logo-pwa.png",
12+
"sizes": "512x512",
13+
"type": "image/png"
14+
},
15+
{
16+
"src": "/statics/favicon/logo-pwa.png",
17+
"sizes": "180x180",
18+
"type": "image/png"
19+
}
20+
],
21+
"theme_color": "#1b1b1d",
22+
"background_color": "#1b1b1d",
23+
"display": "standalone"
24+
}

dashboard/src/service/api/index.ts

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,67 +2723,6 @@ export function useBase<TData = Awaited<ReturnType<typeof base>>, TError = Error
27232723
return query
27242724
}
27252725

2726-
/**
2727-
* Dynamic PWA manifest generator
2728-
* @summary Get Manifest
2729-
*/
2730-
export const getManifest = (params?: GetManifestParams, signal?: AbortSignal) => {
2731-
return orvalFetcher<unknown>({ url: `/manifest.json`, method: 'GET', params, signal })
2732-
}
2733-
2734-
export const getGetManifestQueryKey = (params?: GetManifestParams) => {
2735-
return [`/manifest.json`, ...(params ? [params] : [])] as const
2736-
}
2737-
2738-
export const getGetManifestQueryOptions = <TData = Awaited<ReturnType<typeof getManifest>>, TError = ErrorType<HTTPValidationError>>(
2739-
params?: GetManifestParams,
2740-
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData>> },
2741-
) => {
2742-
const { query: queryOptions } = options ?? {}
2743-
2744-
const queryKey = queryOptions?.queryKey ?? getGetManifestQueryKey(params)
2745-
2746-
const queryFn: QueryFunction<Awaited<ReturnType<typeof getManifest>>> = ({ signal }) => getManifest(params, signal)
2747-
2748-
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
2749-
}
2750-
2751-
export type GetManifestQueryResult = NonNullable<Awaited<ReturnType<typeof getManifest>>>
2752-
export type GetManifestQueryError = ErrorType<HTTPValidationError>
2753-
2754-
export function useGetManifest<TData = Awaited<ReturnType<typeof getManifest>>, TError = ErrorType<HTTPValidationError>>(
2755-
params: undefined | GetManifestParams,
2756-
options: {
2757-
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData>, 'initialData'>
2758-
},
2759-
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
2760-
export function useGetManifest<TData = Awaited<ReturnType<typeof getManifest>>, TError = ErrorType<HTTPValidationError>>(
2761-
params?: GetManifestParams,
2762-
options?: {
2763-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData>, 'initialData'>
2764-
},
2765-
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
2766-
export function useGetManifest<TData = Awaited<ReturnType<typeof getManifest>>, TError = ErrorType<HTTPValidationError>>(
2767-
params?: GetManifestParams,
2768-
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData>> },
2769-
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
2770-
/**
2771-
* @summary Get Manifest
2772-
*/
2773-
2774-
export function useGetManifest<TData = Awaited<ReturnType<typeof getManifest>>, TError = ErrorType<HTTPValidationError>>(
2775-
params?: GetManifestParams,
2776-
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getManifest>>, TError, TData>> },
2777-
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
2778-
const queryOptions = getGetManifestQueryOptions(params, options)
2779-
2780-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
2781-
2782-
query.queryKey = queryOptions.queryKey
2783-
2784-
return query
2785-
}
2786-
27872726
/**
27882727
* @summary Health
27892728
*/

0 commit comments

Comments
 (0)