diff options
Diffstat (limited to 'themes')
19 files changed, 366 insertions, 361 deletions
diff --git a/themes/luci-theme-bootstrap/Makefile b/themes/luci-theme-bootstrap/Makefile index 1bb205ee05..1e7f49a12e 100644 --- a/themes/luci-theme-bootstrap/Makefile +++ b/themes/luci-theme-bootstrap/Makefile @@ -11,6 +11,16 @@ LUCI_DEPENDS:= PKG_LICENSE:=Apache-2.0 +define Package/luci-theme-bootstrap/postrm +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || { + uci -q delete luci.themes.Bootstrap + uci -q delete luci.themes.BootstrapDark + uci -q delete luci.themes.BootstrapLight + uci commit luci +} +endef + include ../../luci.mk # call BuildPackage - OpenWrt buildroot signature diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/footer.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/footer.htm deleted file mode 100644 index 48d9b98b92..0000000000 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/footer.htm +++ /dev/null @@ -1,21 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Copyright 2012 David Menting <david@nut-bolt.nl> - Licensed to the public under the Apache License 2.0. --%> - - <% if not blank_page then %> - <% local ver = require "luci.version" %> - </div> - <footer> - <span> - <a href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> / <%= ver.distversion %> - </span> - <ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul> - </footer> - <script type="text/javascript">L.require('menu-bootstrap')</script> - <% end %> - </body> -</html> - diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm deleted file mode 100644 index 37d18a2f07..0000000000 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm +++ /dev/null @@ -1,95 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008-2016 Jo-Philipp Wich <jow@openwrt.org> - Copyright 2012 David Menting <david@nut-bolt.nl> - Licensed to the public under the Apache License 2.0. --%> - -<% - local sys = require "luci.sys" - local util = require "luci.util" - local http = require "luci.http" - local disp = require "luci.dispatcher" - - local boardinfo = util.ubus("system", "board") - - local node = disp.context.dispatched - - local darkpref - - if theme == "bootstrap-dark" then - darkpref = "true" - elseif theme == "bootstrap-light" then - darkpref = "false" - end - - -- send as HTML5 - http.prepare_content("text/html") --%> -<!DOCTYPE html> -<html lang="<%=luci.i18n.context.lang%>"<%= ifattr(darkpref ~= nil, "data-darkmode", darkpref) %>> - <head> - <meta charset="utf-8"> - <title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title> - <% if darkpref == nil then %> - <script type="text/javascript"> - var mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'), - rootElement = document.querySelector(':root'), - setDarkMode = function(match) { rootElement.setAttribute('data-darkmode', match.matches) }; - - mediaQuery.addEventListener('change', setDarkMode); - setDarkMode(mediaQuery); - </script> - <% end %> - <meta name="viewport" content="initial-scale=1.0"> - <link rel="stylesheet" href="<%=media%>/cascade.css"> - <link rel="stylesheet" media="only screen and (max-device-width: 854px)" href="<%=media%>/mobile.css" type="text/css" /> - <link rel="shortcut icon" href="<%=media%>/favicon.png"> - <% if node and node.css then %> - <link rel="stylesheet" href="<%=resource%>/<%=node.css%>"> - <% end -%> - <% if css then %> - <style title="text/css"><%= css %></style> - <% end -%> - <script src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script> - <script src="<%=resource%>/cbi.js"></script> - </head> - - <body class="lang_<%=luci.i18n.context.lang%> <% if node then %><%= striptags( node.title ) %><%- end %>" data-page="<%= pcdata(table.concat(disp.context.requestpath, "-")) %>"> - <% if not blank_page then %> - <header> - <a class="brand" href="/"><%=striptags(boardinfo.hostname or "?")%></a> - <ul class="nav" id="topmenu" style="display:none"></ul> - <div id="indicators" class="pull-right"></div> - </header> - - <div id="maincontent" class="container"> - <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%> - <div class="alert-message warning"> - <h4><%:No password set!%></h4> - <p><%:There is no password set on this router. Please configure a root password to protect the web interface.%></p> - <% if disp.lookup("admin/system/admin") then %> - <div class="right"><a class="btn" href="<%=url("admin/system/admin")%>"><%:Go to password configuration...%></a></div> - <% end %> - </div> - <%- end -%> - - <%- if boardinfo.rootfs_type == "initramfs" then -%> - <div class="alert-message warning"> - <h4><%:System running in recovery (initramfs) mode.%></h4> - <p><%:No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade%></p> - <% if disp.lookup("admin/system/flash") then %> - <div class="right"><a class="btn" href="<%=url("admin/system/flash")%>"><%:Go to firmware upgrade...%></a></div> - <% end %> - </div> - <%- end -%> - - <noscript> - <div class="alert-message warning"> - <h4><%:JavaScript required!%></h4> - <p><%:You must enable JavaScript in your browser or LuCI will not work properly.%></p> - </div> - </noscript> - - <div id="tabmenu" style="display:none"></div> - <% end %> diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/sysauth.htm b/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/sysauth.htm deleted file mode 100644 index 8a97bbd104..0000000000 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/sysauth.htm +++ /dev/null @@ -1,53 +0,0 @@ -<%# - Copyright 2021 Jo-Philipp Wich <jo@mein.io> - Licensed to the public under the Apache License 2.0. --%> - -<% - -- tell bootstrap's templates to not render header and footer - blank_page = true -%> - -<%+header%> - -<section hidden> - <form method="post" class="cbi-map"> - <div class="cbi-section"> - <div class="cbi-section-node"> - <div class="cbi-value"> - <label class="cbi-value-title" for="luci_username"><%:Username%></label> - <div class="cbi-value-field"> - <input name="luci_username" type="text"<%=attr("value", duser)%>> - </div> - </div> - <div class="cbi-value"> - <label class="cbi-value-title" for="luci_password"><%:Password%></label> - <div class="cbi-value-field"> - <input name="luci_password" type="password"> - </div> - </div> - </div> - </div> - </form> - - <hr> - - <% if fuser then %> - <div class="alert-message error"> - <%:Invalid username and/or password! Please try again.%> - </div> - <% end %> - - <button class="btn cbi-button-positive important"><%:Login%></button> -</section> - -<div id="view"> - <div class="spinning"><%:Loading view…%></div> - <script type="text/javascript"> - L.require('ui').then(function(ui) { - ui.instantiateView('bootstrap.sysauth'); - }); - </script> -</div> - -<%+footer%> diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-dark b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-dark index ac7bcbbf37..ac7bcbbf37 120000 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-dark +++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-dark diff --git a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-light b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-light index ac7bcbbf37..ac7bcbbf37 120000 --- a/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap-light +++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap-light diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/footer.ut b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/footer.ut new file mode 100644 index 0000000000..6031724053 --- /dev/null +++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/footer.ut @@ -0,0 +1,20 @@ + {% if (!blank_page): %} + </div> + <footer> + <span> + Powered by + <a href="https://github.com/openwrt/luci"> + {{ version.luciname }} ({{ version.luciversion }})</a> + / + <a href="{{ entityencode(version.disturl ?? '#', true) }}"> + {{ version.distname }} {{ version.distversion }} ({{ version.distrevision }})</a> + {% if (lua_active): %} + / {{ _('Lua compatibility mode active') }} + {% endif %} + </span> + <ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul> + </footer> + <script type="text/javascript">L.require('menu-bootstrap')</script> + {% endif %} + </body> +</html> diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut new file mode 100644 index 0000000000..b7bc770b4b --- /dev/null +++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/header.ut @@ -0,0 +1,83 @@ +{# + Copyright 2008 Steven Barth <steven@midlink.org> + Copyright 2012 David Menting <david@nut-bolt.nl> + Copyright 2008-2022 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +{% + import { getuid, getspnam } from 'luci.core'; + + const boardinfo = ubus.call('system', 'board'); + const darkpref = (theme == 'bootstrap-dark' ? 'true' : (theme == 'bootstrap-light' ? 'false' : null)); + + http.prepare_content('text/html; charset=UTF-8'); +-%} + +<!DOCTYPE html> +<html lang="{{ dispatcher.lang }}" {{ darkpref ? `data-darkmode="${darkpref}"` : '' }}> + <head> + <meta charset="utf-8"> + <title>{{ striptags(`${boardinfo.hostname ?? '?'}${node ? ` - ${node.title}` : ''}`) }} - LuCI</title> + {% if (!darkpref): %} + <script type="text/javascript"> + var mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'), + rootElement = document.querySelector(':root'), + setDarkMode = function(match) { rootElement.setAttribute('data-darkmode', match.matches) }; + + mediaQuery.addEventListener('change', setDarkMode); + setDarkMode(mediaQuery); + </script> + {% endif %} + <meta name="viewport" content="initial-scale=1.0"> + <link rel="stylesheet" href="{{ media }}/cascade.css"> + <link rel="stylesheet" media="only screen and (max-device-width: 854px)" href="{{ media }}/mobile.css" type="text/css" /> + <link rel="shortcut icon" href="{{ media }}/favicon.png"> + {% if (node?.css): %} + <link rel="stylesheet" href="{{ resource }}/{{ node.css }}"> + {% endif %} + {% if (css): %} + <style title="text/css">{{ css }}</style> + {% endif %} + <script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script> + <script src="{{ resource }}/cbi.js"></script> + </head> + + <body class="lang_{{ dispatcher.lang }} {{ entityencode(striptags(node?.title ?? ''), true) }}" data-page="{{ entityencode(join('-', ctx.request_path), true) }}"> + {% if (!blank_page): %} + <header> + <a class="brand" href="/">{{ striptags(boardinfo.hostname ?? '?') }}</a> + <ul class="nav" id="topmenu" style="display:none"></ul> + <div id="indicators" class="pull-right"></div> + </header> + + <div id="maincontent" class="container"> + {% if (getuid() == 0 && getspnam('root')?.pwdp === ''): %} + <div class="alert-message warning"> + <h4>{{ _('No password set!') }}</h4> + <p>{{ _('There is no password set on this router. Please configure a root password to protect the web interface.') }}</p> + {% if (dispatcher.lookup("admin/system/admin")): %} + <div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/admin") }}">{{ _('Go to password configuration...') }}</a></div> + {% endif %} + </div> + {% endif %} + + {% if (boardinfo.rootfs_type == "initramfs"): %} + <div class="alert-message warning"> + <h4>{{ _('System running in recovery (initramfs) mode.') }}</h4> + <p>{{ _('No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade') }}</p> + {% if (dispatcher.lookup("admin/system/flash")): %} + <div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/flash") }}">{{ _('Go to firmware upgrade...') }}</a></div> + {% endif %} + </div> + {% endif %} + + <noscript> + <div class="alert-message warning"> + <h4>{{ _('JavaScript required!') }}</h4> + <p>{{ _('You must enable JavaScript in your browser or LuCI will not work properly.') }}</p> + </div> + </noscript> + + <div id="tabmenu" style="display:none"></div> + {% endif %} diff --git a/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/sysauth.ut b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/sysauth.ut new file mode 100644 index 0000000000..a172d95d76 --- /dev/null +++ b/themes/luci-theme-bootstrap/ucode/template/themes/bootstrap/sysauth.ut @@ -0,0 +1,48 @@ +{# + Copyright 2022 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +{% include('header', { blank_page: true }) %} + +<section hidden> + <form method="post" class="cbi-map"> + <div class="cbi-section"> + <div class="cbi-section-node"> + <div class="cbi-value"> + <label class="cbi-value-title" for="luci_username">{{ _('Username') }}</label> + <div class="cbi-value-field"> + <input name="luci_username" id="luci_username" type="text" autocomplete="username" value="{{ entityencode(duser, true) }}"> + </div> + </div> + <div class="cbi-value"> + <label class="cbi-value-title" for="luci_password">{{ _('Password') }}</label> + <div class="cbi-value-field"> + <input name="luci_password" id="luci_password" type="password" autocomplete="current-password"> + </div> + </div> + </div> + </div> + </form> + + <hr> + + {% if (fuser): %} + <div class="alert-message error"> + {{ _('Invalid username and/or password! Please try again.') }} + </div> + {% endif %} + + <button class="btn cbi-button-positive important">{{ _('Login') }}</button> +</section> + +<div id="view"> + <div class="spinning">{{ _('Loading view…') }}</div> + <script type="text/javascript"> + L.require('ui').then(function(ui) { + ui.instantiateView('bootstrap.sysauth'); + }); + </script> +</div> + +{% include('footer', { blank_page: true }) %} diff --git a/themes/luci-theme-material/Makefile b/themes/luci-theme-material/Makefile index 5bc16eb7db..0fdd55edd4 100644 --- a/themes/luci-theme-material/Makefile +++ b/themes/luci-theme-material/Makefile @@ -9,6 +9,14 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=Material Theme LUCI_DEPENDS:= +define Package/luci-theme-material/postrm +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || { + uci -q delete luci.themes.Material + uci commit luci +} +endef + include ../../luci.mk # call BuildPackage - OpenWrt buildroot signature diff --git a/themes/luci-theme-material/luasrc/view/themes/material/header.htm b/themes/luci-theme-material/luasrc/view/themes/material/header.htm deleted file mode 100644 index 48059fe17a..0000000000 --- a/themes/luci-theme-material/luasrc/view/themes/material/header.htm +++ /dev/null @@ -1,101 +0,0 @@ -<%# - Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI - - luci-theme-material - Copyright 2015-2017 Lutty Yang <lutty@wcan.in> - - Have a bug? Please create an issue here on GitHub! - https://github.com/LuttyYang/luci-theme-material/issues - - luci-theme-bootstrap: - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008-2016 Jo-Philipp Wich <jow@openwrt.org> - Copyright 2012 David Menting <david@nut-bolt.nl> - - MUI: - https://github.com/muicss/mui - - Licensed to the public under the Apache License 2.0 --%> - -<% - local sys = require "luci.sys" - local util = require "luci.util" - local http = require "luci.http" - local disp = require "luci.dispatcher" - local ver = require "luci.version" - - local boardinfo = util.ubus("system", "board") or { } - - local node = disp.context.dispatched - local path = table.concat(disp.context.path, "-") - - http.prepare_content("text/html; charset=UTF-8") --%> -<!DOCTYPE html> -<html lang="<%=luci.i18n.context.lang%>"> -<head> -<meta charset="utf-8"> -<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/> -<meta name="apple-mobile-web-app-capable" content="yes"> -<meta name="mobile-web-app-capable" content="yes"> -<meta name="theme-color" content="#09c"> -<meta name="msapplication-tap-highlight" content="no"> -<meta name="msapplication-TileColor" content="#09c"> -<meta name="application-name" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI"> -<meta name="apple-mobile-web-app-title" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI"> -<link rel="stylesheet" href="<%=media%>/cascade.css"> -<link rel="shortcut icon" href="<%=media%>/favicon.ico"> -<% if node and node.css then %> -<link rel="stylesheet" href="<%=resource%>/<%=node.css%>"> -<% end -%> -<script src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script> -<script src="<%=resource%>/cbi.js"></script> -<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title> -<% if css then %><style title="text/css"> -<%= css %> -</style> -<% end -%> -</head> -<body class="lang_<%=luci.i18n.context.lang%> <% if luci.dispatcher.context.authsession then %>logged-in<% end %> <% if not (path == "") then %>node-<%= path %><% else %>node-main-login<% end %>" data-page="<%= pcdata(path) %>"> -<header> - <div class="fill"> - <div class="container"> - <span class="showSide"></span> - <a id="logo" href="<% if luci.dispatcher.context.authsession then %><%=url('admin/status/overview')%><% else %>#<% end %>"><img src="<%=media%>/brand.png" alt="OpenWrt"></a> - <a class="brand" href="#"><%=striptags(boardinfo.hostname or "?")%></a> - <span class="status" id="indicators"></span> - </div> - </div> -</header> -<div class="main"> - <div style="" class="loading"><span><div class="loading-img"></div><%:Collecting data...%></span></div> - <div class="main-left" id="mainmenu" style="display:none"></div> - <div class="main-right"> - <div class="modemenu-buttons" style="display:none"> - <ul id="modemenu"></ul> - </div> - <div class="darkMask"></div> - <div id="maincontent"> - <div class="container"> - <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") and path ~= "admin-system-admin-password" then -%> - <%- end -%> - - <%- if boardinfo.rootfs_type == "initramfs" then -%> - <div class="alert-message warning"> - <h4><%:System running in recovery (initramfs) mode.%></h4> - <p><%:No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade%></p> - <% if disp.lookup("admin/system/flash") then %> - <div class="right"><a class="btn" href="<%=url("admin/system/flash")%>"><%:Go to firmware upgrade...%></a></div> - <% end %> - </div> - <%- end -%> - - <noscript> - <div class="alert-message warning"> - <h4><%:JavaScript required!%></h4> - <p><%:You must enable JavaScript in your browser or LuCI will not work properly.%></p> - </div> - </noscript> - - <div id="tabmenu" style="display:none"></div> diff --git a/themes/luci-theme-material/luasrc/view/themes/material/footer.htm b/themes/luci-theme-material/ucode/template/themes/material/footer.ut index f572504f4b..9249427a43 100644 --- a/themes/luci-theme-material/luasrc/view/themes/material/footer.htm +++ b/themes/luci-theme-material/ucode/template/themes/material/footer.ut @@ -1,4 +1,4 @@ -<%# +{# Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI luci-theme-material @@ -16,17 +16,17 @@ https://github.com/muicss/mui Licensed to the public under the Apache License 2.0 --%> - -<% local ver = require "luci.version" %> - </div> - <footer class="mobile-hide"> - <a href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> / <%= ver.distversion %> - </footer> +-#} + + </div> + <footer class="mobile-hide"> + <a href="https://github.com/openwrt/luci">Powered by {{ version.luciname }} ({{ version.luciversion }})</a> / + {{ version.distname }} {{ version.distversion }} ({{ version.distrevision }}) + </footer> + </div> </div> -</div> -<script type="text/javascript">L.require('menu-material')</script> + <script type="text/javascript">L.require('menu-material')</script> </body> </html> diff --git a/themes/luci-theme-material/ucode/template/themes/material/header.ut b/themes/luci-theme-material/ucode/template/themes/material/header.ut new file mode 100644 index 0000000000..24b2c73517 --- /dev/null +++ b/themes/luci-theme-material/ucode/template/themes/material/header.ut @@ -0,0 +1,96 @@ +{# + Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI + + luci-theme-material + Copyright 2015-2017 Lutty Yang <lutty@wcan.in> + + Have a bug? Please create an issue here on GitHub! + https://github.com/LuttyYang/luci-theme-material/issues + + luci-theme-bootstrap: + Copyright 2008 Steven Barth <steven@midlink.org> + Copyright 2008-2016 Jo-Philipp Wich <jow@openwrt.org> + Copyright 2012 David Menting <david@nut-bolt.nl> + + MUI: + https://github.com/muicss/mui + + Licensed to the public under the Apache License 2.0 +-#} + +{% + import { getuid, getspnam } from 'luci.core'; + + const boardinfo = ubus.call('system', 'board'); + const hostname = striptags(boardinfo?.hostname ?? '?'); + + http.prepare_content('text/html; charset=UTF-8'); +-%} + +<!DOCTYPE html> +<html lang="{{ dispatcher.lang }}"> +<head> +<meta charset="utf-8"> +<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/> +<meta name="apple-mobile-web-app-capable" content="yes"> +<meta name="mobile-web-app-capable" content="yes"> +<meta name="theme-color" content="#09c"> +<meta name="msapplication-tap-highlight" content="no"> +<meta name="msapplication-TileColor" content="#09c"> +<meta name="application-name" content="{{ hostname }} - LuCI"> +<meta name="apple-mobile-web-app-title" content="{{ hostname }} - LuCI"> +<link rel="stylesheet" href="{{ media }}/cascade.css"> +<link rel="shortcut icon" href="{{ media }}/favicon.ico"> +{% if (node?.css): %} +<link rel="stylesheet" href="{{ resource }}/{{ node.css }}"> +{% endif %} +<script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script> +<script src="{{ resource }}/cbi.js"></script> +<title>{{ hostname }}{{ node?.title ? ` - ${striptags(node.title)}` : '' }} - LuCI</title> +{% if (css): %} +<style title="text/css">{{ css }}</style> +{% endif %} +</head> +<body class="lang_{{ dispatcher.lang }} {{ ctx.authsession ? 'logged-in' : '' }} {{ length(ctx.path) ? `node-${join('-', ctx.path)}` : 'node-main-login' }}" data-page="{{ entityencode(join('-', ctx.path), true) }}"> +<header> + <div class="fill"> + <div class="container"> + <span class="showSide"></span> + <a id="logo" href="{{ ctx.authsession ? dispatcher.build_url('admin/status/overview') : '#' }}"><img src="{{ media }}/brand.png" alt="OpenWrt"></a> + <a class="brand" href="#">{{ hostname }}</a> + <span class="status" id="indicators"></span> + </div> + </div> +</header> +<div class="main"> + <div style="" class="loading"><span><div class="loading-img"></div>{{ _('Collecting data...') }}</span></div> + <div class="main-left" id="mainmenu" style="display:none"></div> + <div class="main-right"> + <div class="modemenu-buttons" style="display:none"> + <ul id="modemenu"></ul> + </div> + <div class="darkMask"></div> + <div id="maincontent"> + <div class="container"> + {% if (getuid() == 0 && getspnam('root')?.pwdp === ''): %} + <!-- no password set --> + {% endif %} + + {% if (boardinfo?.rootfs_type == "initramfs"): %} + <div class="alert-message warning"> + <h4>{{ _('System running in recovery (initramfs) mode.') }}</h4> + <p>{{ _('No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade') }}</p> + {% if (dispatcher.lookup("admin/system/flash")): %} + <div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/flash") }}">{{ _('Go to firmware upgrade...') }}</a></div> + {% endif %} + </div> + {% endif %} + + <noscript> + <div class="alert-message warning"> + <h4>{{ _('JavaScript required!') }}</h4> + <p>{{ _('You must enable JavaScript in your browser or LuCI will not work properly.') }}</p> + </div> + </noscript> + + <div id="tabmenu" style="display:none"></div> diff --git a/themes/luci-theme-openwrt-2020/Makefile b/themes/luci-theme-openwrt-2020/Makefile index dcbe110125..8b0c1a93a5 100644 --- a/themes/luci-theme-openwrt-2020/Makefile +++ b/themes/luci-theme-openwrt-2020/Makefile @@ -9,6 +9,14 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI modern OpenWrt theme LUCI_DEPENDS:= +define Package/luci-theme-openwrt-2020/postrm +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || { + uci -q delete luci.themes.OpenWrt2020 + uci commit luci +} +endef + include ../../luci.mk # call BuildPackage - OpenWrt buildroot signature diff --git a/themes/luci-theme-openwrt-2020/htdocs/luci-static/openwrt2020/logo.png b/themes/luci-theme-openwrt-2020/htdocs/luci-static/openwrt2020/logo.png Binary files differnew file mode 100644 index 0000000000..182d7e35c5 --- /dev/null +++ b/themes/luci-theme-openwrt-2020/htdocs/luci-static/openwrt2020/logo.png diff --git a/themes/luci-theme-openwrt-2020/luasrc/view/themes/openwrt2020/header.htm b/themes/luci-theme-openwrt-2020/luasrc/view/themes/openwrt2020/header.htm deleted file mode 100644 index 34c52f4b12..0000000000 --- a/themes/luci-theme-openwrt-2020/luasrc/view/themes/openwrt2020/header.htm +++ /dev/null @@ -1,77 +0,0 @@ -<%# - Copyright 2020 Jo-Philipp Wich <jo@mein.io> - Licensed to the public under the Apache License 2.0. --%> - -<% - local sys = require "luci.sys" - local util = require "luci.util" - local http = require "luci.http" - local disp = require "luci.dispatcher" - local ver = require "luci.version" - - local boardinfo = util.ubus("system", "board") or { } - - local node = disp.context.dispatched - local path = table.concat(disp.context.path, "-") - - http.prepare_content("text/html; charset=UTF-8") --%> -<!DOCTYPE html> -<html lang="<%=luci.i18n.context.lang%>"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta http-equiv="Content-Script-Type" content="text/javascript" /> -<meta name="viewport" content="width=device-width, initial-scale=1" /> -<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" /> -<link rel="icon" href="<%=media%>/logo.svg" type="image/svg+xml" /> -<script type="text/javascript" src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script> -<script type="text/javascript" src="<%=resource%>/cbi.js"></script> -<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title> -<% if css then %><style title="text/css"> -<%= css %> -</style> -<% end -%> -</head> -<body class="lang_<%=luci.i18n.context.lang%>" data-page="<%= pcdata(path) %>"> - -<p class="skiplink"> -<span id="skiplink1"><a href="#navigation"><%:Skip to navigation%></a></span> -<span id="skiplink2"><a href="#content"><%:Skip to content%></a></span> -</p> - -<div id="menubar"> - <h2 class="navigation"><a id="navigation" name="navigation"><%:Navigation%></a></h2> - - <span class="hostname"><a href="/"><%=striptags(boardinfo.hostname or "?")%></a></span> - <span class="distversion"><%=ver.distversion%></span> - <span id="indicators"></span> -</div> - -<div id="modemenu" style="display:none"></div> - -<div id="maincontainer"> - <div id="mainmenu"></div> - - <div id="maincontent"> - <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") and path ~= "admin-system-admin-password" then -%> - <div class="alert-message warning"> - <h4><%:No password set!%></h4> - <p><%:There is no password set on this router. Please configure a root password to protect the web interface.%></p> - <% if disp.lookup("admin/system/admin") then %> - <div class="right"><a class="btn" href="<%=url("admin/system/admin")%>"><%:Go to password configuration...%></a></div> - <% end %> - </div> - <%- end -%> - - <%- if boardinfo.rootfs_type == "initramfs" then -%> - <div class="alert-message warning"> - <h4><%:System running in recovery (initramfs) mode.%></h4> - <p><%:No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade%></p> - <% if disp.lookup("admin/system/flash") then %> - <div class="right"><a class="btn" href="<%=url("admin/system/flash")%>"><%:Go to firmware upgrade...%></a></div> - <% end %> - </div> - <%- end -%> - - <div id="tabmenu" style="display:none"></div> diff --git a/themes/luci-theme-openwrt-2020/luasrc/view/themes/openwrt2020/footer.htm b/themes/luci-theme-openwrt-2020/ucode/template/themes/openwrt2020/footer.ut index e9122f0b5c..5899f2a9dd 100644 --- a/themes/luci-theme-openwrt-2020/luasrc/view/themes/openwrt2020/footer.htm +++ b/themes/luci-theme-openwrt-2020/ucode/template/themes/openwrt2020/footer.ut @@ -1,14 +1,13 @@ -<%# +{# Copyright 2020 Jo-Philipp Wich <jo@mein.io> Licensed to the public under the Apache License 2.0. --%> +-#} </div> </div> <p class="luci"> - <% local ver = require "luci.version" -%> - Powered by <%= ver.luciname %> (<%= ver.luciversion %>) + Powered by {{ version.luciname }} ({{ version.luciversion }}) </p> <script type="text/javascript">L.require('menu-openwrt2020')</script> diff --git a/themes/luci-theme-openwrt-2020/ucode/template/themes/openwrt2020/header.ut b/themes/luci-theme-openwrt-2020/ucode/template/themes/openwrt2020/header.ut new file mode 100644 index 0000000000..2b7c581387 --- /dev/null +++ b/themes/luci-theme-openwrt-2020/ucode/template/themes/openwrt2020/header.ut @@ -0,0 +1,72 @@ +{# + Copyright 2020 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +{% + import { getuid, getspnam } from 'luci.core'; + + const boardinfo = ubus.call('system', 'board'); + + http.prepare_content('text/html; charset=UTF-8'); +-%} + +<!DOCTYPE html> +<html lang="{{ dispatcher.lang }}"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta http-equiv="Content-Script-Type" content="text/javascript" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> +<meta name="apple-mobile-web-app-capable" content="yes" /> +<link rel="stylesheet" type="text/css" media="screen" href="{{ media }}/cascade.css" /> +<link rel="icon" href="{{ media }}/logo.svg" type="image/svg+xml" /> +<link rel="apple-touch-icon" href="{{ media }}/logo.png" /> +<script type="text/javascript" src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script> +<script type="text/javascript" src="{{ resource }}/cbi.js"></script> +<title>{{ striptags(`${boardinfo.hostname ?? '?'}${node ? ` - ${node.title}` : ''}`) }} - LuCI</title> +{% if (css): %} +<style title="text/css">{{ css }}</style> +{% endif %} +</head> +<body class="lang_{{ dispatcher.lang }}" data-page="{{ entityencode(join('-', ctx.request_path), true) }}"> + +<p class="skiplink"> +<span id="skiplink1"><a href="#navigation">{{ _('Skip to navigation') }}</a></span> +<span id="skiplink2"><a href="#content">{{ _('Skip to content') }}</a></span> +</p> + +<div id="menubar"> + <h2 class="navigation"><a id="navigation" name="navigation">{{ _('Navigation') }}</a></h2> + + <span class="hostname"><a href="/">{{ striptags(boardinfo.hostname ?? '?') }}</a></span> + <span class="distversion">{{ version.distversion }} {{ version.distrevision }}</span> + <span id="indicators"></span> +</div> + +<div id="modemenu" style="display:none"></div> + +<div id="maincontainer"> + <div id="mainmenu"></div> + + <div id="maincontent"> + {% if (getuid() == 0 && getspnam('root')?.pwdp === '' && join('-', ctx.request_path) != 'admin-system-admin'): %} + <div class="alert-message warning"> + <h4>{{ _('No password set!') }}</h4> + <p>{{ _('There is no password set on this router. Please configure a root password to protect the web interface.') }}</p> + {% if (dispatcher.lookup("admin/system/admin")): %} + <div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/admin") }}">{{ _('Go to password configuration...') }}</a></div> + {% endif %} + </div> + {% endif %} + + {% if (boardinfo.rootfs_type == "initramfs"): %} + <div class="alert-message warning"> + <h4>{{ _('System running in recovery (initramfs) mode.') }}</h4> + <p>{{ _('No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade') }}</p> + {% if (dispatcher.lookup("admin/system/flash")): %} + <div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/flash") }}">{{ _('Go to firmware upgrade...') }}</a></div> + {% endif %} + </div> + {% endif %} + + <div id="tabmenu" style="display:none"></div> diff --git a/themes/luci-theme-openwrt/Makefile b/themes/luci-theme-openwrt/Makefile index b873d80727..41f479157c 100644 --- a/themes/luci-theme-openwrt/Makefile +++ b/themes/luci-theme-openwrt/Makefile @@ -9,6 +9,14 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI OpenWrt.org theme LUCI_DEPENDS:= +define Package/luci-theme-openwrt/postrm +#!/bin/sh +[ -n "$${IPKG_INSTROOT}" ] || { + uci -q delete luci.themes.OpenWrt + uci commit luci +} +endef + include ../../luci.mk # call BuildPackage - OpenWrt buildroot signature |