feat: configuration to disable pwa

This commit is contained in:
Jannat Patel
2025-12-10 18:05:50 +05:30
parent 0877e32e1b
commit 80a217e646
11 changed files with 46 additions and 68 deletions

View File

@@ -1304,25 +1304,21 @@ def get_notifications(filters):
@frappe.whitelist(allow_guest=True)
def get_lms_setting(field=None):
if not field:
frappe.throw(_("Field name is required"))
frappe.log_error("Field name is missing when accessing LMS Settings {0} {1} {2}").format(
frappe.local.request_ip, frappe.get_request_header("Referer"), frappe.get_request_header("Origin")
)
def get_lms_settings():
allowed_fields = [
"allow_guest_access",
"prevent_skipping_videos",
"contact_us_email",
"contact_us_url",
"livecode_url",
"disable_pwa",
]
if field not in allowed_fields:
frappe.throw(_("You are not allowed to access this field"))
settings = frappe._dict()
for field in allowed_fields:
settings[field] = frappe.get_cached_value("LMS Settings", None, field)
return frappe.get_cached_value("LMS Settings", None, field)
return settings
@frappe.whitelist()

View File

@@ -12,6 +12,7 @@
"column_break_zdel",
"allow_guest_access",
"prevent_skipping_videos",
"disable_pwa",
"column_break_bjis",
"unsplash_access_key",
"livecode_url",
@@ -438,13 +439,19 @@
"fieldname": "certifications",
"fieldtype": "Check",
"label": "Certifications"
},
{
"default": "0",
"fieldname": "disable_pwa",
"fieldtype": "Check",
"label": "Disable PWA"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2025-12-02 12:21:15.832799",
"modified": "2025-12-10 17:36:15.689695",
"modified_by": "sayali@frappe.io",
"module": "LMS",
"name": "LMS Settings",