[minor] remove script tags from boot
This commit is contained in:
parent
08bcb1e283
commit
f85afbeba0
1 changed files with 6 additions and 3 deletions
|
|
@ -7,11 +7,10 @@ no_sitemap = 1
|
|||
no_cache = 1
|
||||
base_template_path = "templates/pages/desk.html"
|
||||
|
||||
import os, json
|
||||
import os, json, re
|
||||
import frappe
|
||||
from frappe import _
|
||||
import frappe.sessions
|
||||
from frappe.utils.response import json_handler
|
||||
|
||||
def get_context(context):
|
||||
if (frappe.session.user == "Guest" or
|
||||
|
|
@ -21,13 +20,17 @@ def get_context(context):
|
|||
|
||||
hooks = frappe.get_hooks()
|
||||
boot = frappe.sessions.get()
|
||||
boot_json = json.dumps(boot)
|
||||
|
||||
# remove script tags from boot
|
||||
boot_json = re.sub("\<script\>[^<]*\</script\>", "", boot_json)
|
||||
|
||||
return {
|
||||
"build_version": str(os.path.getmtime(os.path.join(frappe.local.sites_path, "assets", "js",
|
||||
"desk.min.js"))),
|
||||
"include_js": hooks["app_include_js"],
|
||||
"include_css": hooks["app_include_css"],
|
||||
"boot": frappe.as_json(boot),
|
||||
"boot": boot_json,
|
||||
"background_image": boot.user.background_image or boot.default_background_image,
|
||||
"google_analytics_id": frappe.conf.get("google_analytics_id")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue