diff options
Diffstat (limited to 'modules/luci-base/ucode/template')
-rw-r--r-- | modules/luci-base/ucode/template/csrftoken.ut | 24 | ||||
-rw-r--r-- | modules/luci-base/ucode/template/error404.ut | 14 | ||||
-rw-r--r-- | modules/luci-base/ucode/template/error500.ut | 67 | ||||
-rw-r--r-- | modules/luci-base/ucode/template/footer.ut | 42 | ||||
-rw-r--r-- | modules/luci-base/ucode/template/header.ut | 32 | ||||
-rw-r--r-- | modules/luci-base/ucode/template/sysauth.ut | 74 | ||||
-rw-r--r-- | modules/luci-base/ucode/template/view.ut | 12 |
7 files changed, 265 insertions, 0 deletions
diff --git a/modules/luci-base/ucode/template/csrftoken.ut b/modules/luci-base/ucode/template/csrftoken.ut new file mode 100644 index 0000000000..4e96eebe90 --- /dev/null +++ b/modules/luci-base/ucode/template/csrftoken.ut @@ -0,0 +1,24 @@ +{# + Copyright 2015-2022 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +{% include('header') %} + +<h2 name="content">{{ _('Form token mismatch') }}</h2> +<br /> + +<p class="alert-message">{{ _('The submitted security token is invalid or already expired!') }}</p> + +<p>{{ _(` + In order to prevent unauthorized access to the system, your request has + been blocked. Click "Continue »" below to return to the previous page. +`) }}</p> + +<hr /> + +<p class="right"> + <strong><a href="#" onclick="window.history.back();">Continue »</a></strong> +</p> + +{% include('footer') %} diff --git a/modules/luci-base/ucode/template/error404.ut b/modules/luci-base/ucode/template/error404.ut new file mode 100644 index 0000000000..90c3d3784b --- /dev/null +++ b/modules/luci-base/ucode/template/error404.ut @@ -0,0 +1,14 @@ +{# + Copyright 2008 Steven Barth <steven@midlink.org> + Copyright 2008-2022 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +{% include('header') %} + +<h2 name="content">404 {{ _('Not Found') }}</h2> +<p>{{ _('Sorry, the object you requested was not found.') }}</p> +<p>{{ message }}</p> +<tt>{{ _('Unable to dispatch') }}: {{ dispatcher.build_url(...ctx.request_path) }}</tt> + +{% include('footer') %} diff --git a/modules/luci-base/ucode/template/error500.ut b/modules/luci-base/ucode/template/error500.ut new file mode 100644 index 0000000000..39a0eec678 --- /dev/null +++ b/modules/luci-base/ucode/template/error500.ut @@ -0,0 +1,67 @@ +{# + Copyright 2022 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +<!--]]>--><!--'>--><!--">--> +<style type="text/css"> + body { + line-height: 1.5; + font-size: 14px; + font-family: sans-serif; + } + + .error500 * { + margin: 0; + padding: 0; + color: inherit; + } + + .error500 { + box-sizing: border-box; + position: fixed; + z-index: 999999; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + overflow: auto; + background: #ffe; + color: #f00 !important; + padding: 1em; + } + + .error500 h1 { + margin-bottom: .5em; + } + + .error500 .exception { + font-weight: normal; + white-space: normal; + margin: .25em; + padding: .5em; + border: 1px solid #f00; + background: rgba(204, 204, 204, .2); + } + + .error500 .message { + font-weight: bold; + white-space: pre-line; + } + + .error500 .context { + margin-top: 2em; + } +</style> + +<div class="error500"> + <h1>{{ title }}</h1> + <div class="message">{{ message }}</div> + + {% if (exception): %} + <div class="exception"> + <div class="message">{{ exception.message }}</div> + <pre class="context">{{ exception.stacktrace[0].context }}</pre> + </div> + {% endif %} +</div> diff --git a/modules/luci-base/ucode/template/footer.ut b/modules/luci-base/ucode/template/footer.ut new file mode 100644 index 0000000000..d0978594f8 --- /dev/null +++ b/modules/luci-base/ucode/template/footer.ut @@ -0,0 +1,42 @@ +{# + Copyright 2022 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +{% const rollback = dispatcher.rollback_pending() %} +{% if (rollback || trigger_apply || trigger_revert): %} + <script type="text/javascript"> + document.addEventListener("luci-loaded", function() { + {% if (trigger_apply): %} + L.ui.changes.apply(true); + {% elif (trigger_revert): %} + L.ui.changes.revert(); + {% else %} + L.ui.changes.confirm(true, Date.now() + {{rollback.remaining * 1000}}, {{sprintf('%J', rollback.token)}}); + {% endif %} + }); + </script> +{% endif %} + +{% if (media_error): %} + <script type="text/javascript"> + L.require('ui').then(function(ui) { + ui.showIndicator('media_error', _('Theme fallback'), function(ev) { + ui.showModal(_('Error loading theme'), [ + E('p', [ + _('A fallback is used since the configured theme failed to load with the error below.') + ]), + E('hr'), + E('div', { 'style': 'white-space:pre-line' }, {{ sprintf('%J', trim(media_error)) }}), + E('div', { 'class': 'right' }, [ + E('button', { 'class': 'btn cbi-button', 'click': ui.hideModal }, _('Dismiss')) + ]) + ]); + }); + }); + </script> +{% endif %} + +{% include(`themes/${theme}/footer`) %} + +<!-- Lua compatibility mode active: {{ lua_active ? 'yes' : 'no' }} --> diff --git a/modules/luci-base/ucode/template/header.ut b/modules/luci-base/ucode/template/header.ut new file mode 100644 index 0000000000..fb61da5146 --- /dev/null +++ b/modules/luci-base/ucode/template/header.ut @@ -0,0 +1,32 @@ +{# + Copyright 2022 Jo-Philipp Wich <jo@mein.io> + Licensed to the public under the Apache License 2.0. +-#} + +{% + include(`themes/${theme}/header`); +-%} + +<script type="text/javascript" src="{{ resource }}/promis.min.js"></script> +<script type="text/javascript" src="{{ resource }}/luci.js"></script> +<script type="text/javascript"> + L = new LuCI({{ { + media : media, + resource : resource, + scriptname : http.getenv("SCRIPT_NAME"), + pathinfo : http.getenv("PATH_INFO"), + documentroot : http.getenv("DOCUMENT_ROOT"), + requestpath : ctx.request_path, + dispatchpath : ctx.path, + pollinterval : +config.main.pollinterval || 5, + ubuspath : config.main.ubuspath || '/ubus/', + sessionid : ctx.authsession, + token : ctx.authtoken, + nodespec : node, + apply_rollback : max(+config.apply.rollback || 90, 90), + apply_holdoff : max(+config.apply.holdoff || 4, 1), + apply_timeout : max(+config.apply.timeout || 5, 1), + apply_display : max(+config.apply.display || 1.5, 1), + rollback_token : rollback_token + } }}); +</script> diff --git a/modules/luci-base/ucode/template/sysauth.ut b/modules/luci-base/ucode/template/sysauth.ut new file mode 100644 index 0000000000..0fe873d440 --- /dev/null +++ b/modules/luci-base/ucode/template/sysauth.ut @@ -0,0 +1,74 @@ +{# + Copyright 2008 Steven Barth <steven@midlink.org> + Copyright 2008-2012 Jo-Philipp Wich <jow@openwrt.org> + Licensed to the public under the Apache License 2.0. +-#} + +{% include('header') %} + +<form method="post"> + {% if (fuser): %} + <div class="alert-message warning"> + <p>{{ _('Invalid username and/or password! Please try again.') }}</p> + </div> + {% endif %} + + <div class="cbi-map"> + <h2 name="content">{{ _('Authorization Required') }}</h2> + <div class="cbi-map-descr"> + {{ _('Please enter your username and password.') }} + </div> + <div class="cbi-section"><div class="cbi-section-node"> + <div class="cbi-value"> + <label class="cbi-value-title">{{ _('Username') }}</label> + <div class="cbi-value-field"> + <input class="cbi-input-text" type="text" name="luci_username" value="{{ entityencode(duser, true) }}" /> + </div> + </div> + <div class="cbi-value cbi-value-last"> + <label class="cbi-value-title">{{ _('Password') }}</label> + <div class="cbi-value-field"> + <input class="cbi-input-text" type="password" name="luci_password" /> + </div> + </div> + </div></div> + </div> + + <div class="cbi-page-actions"> + <input type="submit" value="{{ _('Login') }}" class="btn cbi-button cbi-button-apply" /> + <input type="reset" value="{{ _('Reset') }}" class="btn cbi-button cbi-button-reset" /> + </div> +</form> + +{% + let https_ports = uci.get('uhttpd', 'main', 'listen_https') ?? []; + + https_ports = uniq(filter( + map( + (type(https_ports) == 'string') ? split(https_port, /\s+/) : https_ports, + e => +match(e, /\d+$/)?.[0] + ), + p => (p >= 0 && p <= 65535) + )); +%} + +<script type="text/javascript">//<![CDATA[ + var input = document.getElementsByName('luci_password')[0]; + + if (input) + input.focus(); + + if (document.location.protocol != 'https:') { + {{ https_ports }}.forEach(function(port) { + var url = 'https://' + window.location.hostname + ':' + port + window.location.pathname; + var img = new Image(); + + img.onload = function() { window.location = url }; + img.src = 'https://' + window.location.hostname + ':' + port + '{{ resource }}/icons/loading.gif?' + Math.random(); + + setTimeout(function() { img.src = '' }, 5000); + }); + } +//]]></script> + +{% include('footer') %} diff --git a/modules/luci-base/ucode/template/view.ut b/modules/luci-base/ucode/template/view.ut new file mode 100644 index 0000000000..11ac824290 --- /dev/null +++ b/modules/luci-base/ucode/template/view.ut @@ -0,0 +1,12 @@ +{% include('header') %} + +<div id="view"> + <div class="spinning">{{ _('Loading view…') }}</div> + <script type="text/javascript"> + L.require('ui').then(function(ui) { + ui.instantiateView('{{ view }}'); + }); + </script> +</div> + +{% include('footer') %} |