header.htm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <%#
  2. Copyright 2008 Steven Barth <steven@midlink.org>
  3. Copyright 2008-2019 Jo-Philipp Wich <jo@mein.io>
  4. Licensed to the public under the Apache License 2.0.
  5. -%>
  6. <%
  7. if not luci.dispatcher.context.template_header_sent then
  8. include("themes/" .. theme .. "/header")
  9. luci.dispatcher.context.template_header_sent = true
  10. end
  11. local applyconf = luci.config and luci.config.apply
  12. %>
  13. <script type="text/javascript" src="<%=resource%>/promis.min.js"></script>
  14. <script type="text/javascript" src="<%=resource%>/luci.js"></script>
  15. <script type="text/javascript">
  16. L = new LuCI(<%= luci.http.write_json({
  17. token = token,
  18. media = media,
  19. resource = resource,
  20. scriptname = luci.http.getenv("SCRIPT_NAME"),
  21. pathinfo = luci.http.getenv("PATH_INFO"),
  22. documentroot = luci.http.getenv("DOCUMENT_ROOT"),
  23. requestpath = luci.dispatcher.context.requestpath,
  24. dispatchpath = luci.dispatcher.context.path,
  25. pollinterval = luci.config.main.pollinterval or 5,
  26. ubuspath = luci.config.main.ubuspath or '/ubus/',
  27. sessionid = luci.dispatcher.context.authsession,
  28. nodespec = luci.dispatcher.context.dispatched,
  29. apply_rollback = math.max(applyconf and applyconf.rollback or 90, 90),
  30. apply_holdoff = math.max(applyconf and applyconf.holdoff or 4, 1),
  31. apply_timeout = math.max(applyconf and applyconf.timeout or 5, 1),
  32. apply_display = math.max(applyconf and applyconf.display or 1.5, 1),
  33. rollback_token = rollback_token
  34. }) %>);
  35. </script>