diff options
Diffstat (limited to 'modules/luci-base/ucode')
-rw-r--r-- | modules/luci-base/ucode/dispatcher.uc | 23 | ||||
-rw-r--r-- | modules/luci-base/ucode/http.uc | 2 | ||||
-rw-r--r-- | modules/luci-base/ucode/runtime.uc | 2 | ||||
-rw-r--r-- | modules/luci-base/ucode/template/sysauth.ut | 2 |
4 files changed, 17 insertions, 12 deletions
diff --git a/modules/luci-base/ucode/dispatcher.uc b/modules/luci-base/ucode/dispatcher.uc index 39af8375ea..8717385be2 100644 --- a/modules/luci-base/ucode/dispatcher.uc +++ b/modules/luci-base/ucode/dispatcher.uc @@ -52,7 +52,7 @@ function error500(msg, ex) { } catch { http.write('<!--]]>--><!--\'>--><!--">-->\n'); - http.write(`<p>${trim(ex)}</p>\n`); + http.write(`<p>${trim(msg)}</p>\n`); if (ex) { http.write(`<p>${trim(ex.message)}</p>\n`); @@ -395,7 +395,7 @@ function build_pagetree() { } node.children ??= {}; - node.children[s[0]] ??= {}; + node.children[s[0]] ??= { satisfied: true }; node = node.children[s[0]]; } @@ -772,7 +772,7 @@ function render_action(fn) { } function run_action(request_path, lang, tree, resolved, action) { - switch (action?.type) { + switch ((type(action) == 'object') ? action.type : 'none') { case 'template': if (runtime.is_ucode_template(action.path)) runtime.render(action.path, {}); @@ -840,14 +840,19 @@ function run_action(request_path, lang, tree, resolved, action) { break; case 'firstchild': - if (!length(tree.children)) + if (!length(tree.children)) { error404("No root node was registered, this usually happens if no module was installed.\n" + "Install luci-mod-admin-full and retry. " + "If the module is already installed, try removing the /tmp/luci-indexcache file."); - else - error404(`No page is registered at '/${entityencode(join("/", resolved.ctx.request_path))}'.\n` + - "If this url belongs to an extension, make sure it is properly installed.\n" + - "If the extension was recently installed, try removing the /tmp/luci-indexcache file."); + break; + } + + /* fall through */ + + case 'none': + error404(`No page is registered at '/${entityencode(join("/", resolved.ctx.request_path))}'.\n` + + "If this url belongs to an extension, make sure it is properly installed.\n" + + "If the extension was recently installed, try removing the /tmp/luci-indexcache file."); break; default: @@ -886,7 +891,7 @@ dispatch = function(_http, path) { striptags, entityencode, _: (...args) => translate(...args) ?? args[0], - N_: (...args) => ntranslate(...args) ?? (n[0] == 1 ? n[1] : n[2]), + N_: (...args) => ntranslate(...args) ?? (args[0] == 1 ? args[1] : args[2]), }); try { diff --git a/modules/luci-base/ucode/http.uc b/modules/luci-base/ucode/http.uc index 579dda3ced..e7f64ae6e9 100644 --- a/modules/luci-base/ucode/http.uc +++ b/modules/luci-base/ucode/http.uc @@ -430,7 +430,7 @@ const Class = { for (let name, value in this.message.params) { while (value?.fd) { let data = value.fd.read(1024); - let eof = (data == null || data == ''); + let eof = (length(data) == 0); this.filehandler(value, data, eof); diff --git a/modules/luci-base/ucode/runtime.uc b/modules/luci-base/ucode/runtime.uc index e460127e2c..f14bf74480 100644 --- a/modules/luci-base/ucode/runtime.uc +++ b/modules/luci-base/ucode/runtime.uc @@ -173,7 +173,7 @@ export default function(env) { } if (!media) - error500(`Unable to render any theme header template, last error was:\n${status}`); + env.dispatcher.error500(`Unable to render any theme header template, last error was:\n${status}`); } self.env.media = media; diff --git a/modules/luci-base/ucode/template/sysauth.ut b/modules/luci-base/ucode/template/sysauth.ut index 0fe873d440..3c580949bb 100644 --- a/modules/luci-base/ucode/template/sysauth.ut +++ b/modules/luci-base/ucode/template/sysauth.ut @@ -35,7 +35,7 @@ </div> <div class="cbi-page-actions"> - <input type="submit" value="{{ _('Login') }}" class="btn cbi-button cbi-button-apply" /> + <input type="submit" value="{{ _('Log in') }}" class="btn cbi-button cbi-button-apply" /> <input type="reset" value="{{ _('Reset') }}" class="btn cbi-button cbi-button-reset" /> </div> </form> |