Explorar el Código

[minor] remove script tags from boot

version-14
Rushabh Mehta hace 10 años
padre
commit
f85afbeba0
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. +6
    -3
      frappe/templates/pages/desk.py

+ 6
- 3
frappe/templates/pages/desk.py Ver fichero

@@ -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")
}

Cargando…
Cancelar
Guardar