import frappe

no_cache = 1


def get_context(context):
	context.boot = get_boot()
	frappe.db.commit()


@frappe.whitelist(allow_guest=True)
def get_context_for_dev():
	if not frappe.conf.developer_mode:
		frappe.throw("This method is only available in developer mode")
	return get_boot()


def get_boot():
	return {
		"csrf_token": frappe.sessions.get_csrf_token(),
		"user": frappe.session.user,
	}
