Merge pull request #1736 from pateljannat/pwa-customizations

feat: PWA Customizations
This commit is contained in:
Jannat Patel
2025-09-24 12:26:54 +05:30
committed by GitHub
4 changed files with 26 additions and 28 deletions

View File

@@ -86,11 +86,8 @@ declare module 'vue' {
Notes: typeof import('./src/components/Notes/Notes.vue')['default']
NotPermitted: typeof import('./src/components/NotPermitted.vue')['default']
PageModal: typeof import('./src/components/Modals/PageModal.vue')['default']
PaymentGateway: typeof import('./src/components/Settings/PaymentGateway.vue')['default']
PaymentGatewayDetails: typeof import('./src/components/Settings/PaymentGatewayDetails.vue')['default']
PaymentGateways: typeof import('./src/components/Settings/PaymentGateways.vue')['default']
PaymentSettings: typeof import('./src/components/Settings/PaymentSettings.vue')['default']
PaymentTransactions: typeof import('./src/components/Settings/PaymentTransactions.vue')['default']
Play: typeof import('./src/components/Icons/Play.vue')['default']
ProgressBar: typeof import('./src/components/ProgressBar.vue')['default']
Question: typeof import('./src/components/Modals/Question.vue')['default']

View File

@@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" href="{{ favicon }}" />
<link rel="manifest" href="/api/method/lms.lms.api.get_pwa_manifest" />
<link rel="apple-touch-icon" href="public/manifest/apple-icon-180.png" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="theme-color" content="#FFFFFF" media="(prefers-color-scheme: light)" />

View File

@@ -33,30 +33,7 @@ export default defineConfig({
cleanupOutdatedCaches: true,
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
},
manifest: {
display: 'standalone',
name: 'Learning',
short_name: 'Learning',
start_url: '/lms',
description:
'Easy to use, 100% open source Learning Management System',
theme_color: '#0f7159',
background_color: '#ffffff',
icons: [
{
src: '/assets/lms/frontend/manifest/manifest-icon-192.maskable.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable any',
},
{
src: '/assets/lms/frontend/manifest/manifest-icon-512.maskable.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable any',
},
],
},
manifest: false,
}),
],
server: {

View File

@@ -6,7 +6,6 @@ import re
import shutil
import xml.etree.ElementTree as ET
import zipfile
from dataclasses import fields
from xml.dom.minidom import parseString
import frappe
@@ -26,6 +25,7 @@ from frappe.utils import (
get_datetime,
now,
)
from frappe.utils.response import Response
from lms.lms.doctype.course_lesson.course_lesson import save_progress
from lms.lms.utils import get_average_rating, get_lesson_count
@@ -1647,3 +1647,26 @@ def get_progress_distribution(progressList):
]
return distribution
@frappe.whitelist(allow_guest=True)
def get_pwa_manifest():
title = frappe.db.get_single_value("Website Settings", "app_name") or "Frappe Learning"
banner_image = frappe.db.get_single_value("Website Settings", "banner_image")
manifest = {
"name": title,
"short_name": title,
"description": "Easy to use, 100% open source Learning Management System",
"start_url": "/lms",
"icons": [
{
"src": banner_image or "/assets/lms/frontend/manifest/manifest-icon-192.maskable.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any",
}
],
}
return Response(json.dumps(manifest), status=200, content_type="application/manifest+json")