From 147b36233451d0a0770e530ab43932e7b811c588 Mon Sep 17 00:00:00 2001 From: Giovanni Giacobbi Date: Thu, 21 Jan 2021 09:10:49 +0100 Subject: [PATCH] Removed install scripts hacks as they are no longer needed - The default 'postinst' from 'luci.mk' is sufficient for what we need, also updated the 'uci-default' to a standard version - Hack about 'header_login' is replaced with adding 'out_header_login' directly from the sysauth template - Also added specialized 'out_footer_login' and 'footer_login' for symmetric reasons - Synced 'out_header_login.htm' with current LuCI 'header.htm' Signed-off-by: Giovanni Giacobbi --- Makefile | 11 +---- luasrc/view/themes/argon/footer.htm | 2 +- luasrc/view/themes/argon/footer_login.htm | 46 +++++++++++++++++++ luasrc/view/themes/argon/out_footer_login.htm | 27 +++++++++++ luasrc/view/themes/argon/out_header_login.htm | 6 +-- luasrc/view/themes/argon/sysauth.htm | 4 +- root/etc/uci-defaults/30_luci-theme-argon | 12 +++++ root/etc/uci-defaults/39_luci-theme-argon | 11 ----- 8 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 luasrc/view/themes/argon/footer_login.htm create mode 100644 luasrc/view/themes/argon/out_footer_login.htm create mode 100644 root/etc/uci-defaults/30_luci-theme-argon delete mode 100644 root/etc/uci-defaults/39_luci-theme-argon diff --git a/Makefile b/Makefile index f16143a..56747a8 100644 --- a/Makefile +++ b/Makefile @@ -13,13 +13,4 @@ PKG_RELEASE:=20200914 include $(TOPDIR)/feeds/luci/luci.mk -define Package/luci-theme-argon/postinst -#!/bin/sh -sed -i ":a;$!N;s/tmpl.render.*sysauth_template.*return/local scope = { duser = default_user, fuser = user }\nlocal ok, res = luci.util.copcall\(luci.template.render_string, [[<% include\(\"themes\/\" .. theme .. \"\/sysauth\"\) %>]], scope\)\nif ok then\nreturn res\nend\nreturn luci.template.render\(\"sysauth\", scope\)/;ba" /usr/lib/lua/luci/dispatcher.lua -[ -f /usr/lib/lua/luci/view/themes/argon/out_header_login.htm ] && mv -f /usr/lib/lua/luci/view/themes/argon/out_header_login.htm /usr/lib/lua/luci/view/header_login.htm -rm -Rf /var/luci-modulecache -rm -Rf /var/luci-indexcache -exit 0 -endef - -# call BuildPackage - OpenWrt buildroot signature \ No newline at end of file +# call BuildPackage - OpenWrt buildroot signature diff --git a/luasrc/view/themes/argon/footer.htm b/luasrc/view/themes/argon/footer.htm index cdb46bb..7dde6bb 100644 --- a/luasrc/view/themes/argon/footer.htm +++ b/luasrc/view/themes/argon/footer.htm @@ -43,4 +43,4 @@ - \ No newline at end of file + diff --git a/luasrc/view/themes/argon/footer_login.htm b/luasrc/view/themes/argon/footer_login.htm new file mode 100644 index 0000000..7dde6bb --- /dev/null +++ b/luasrc/view/themes/argon/footer_login.htm @@ -0,0 +1,46 @@ +<%# + Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material Argon Template + + luci-theme-argon + Copyright 2020 Jerrykuku + + Have a bug? Please create an issue here on GitHub! + https://github.com/jerrykuku/luci-theme-argon/issues + + luci-theme-material: + Copyright 2015 Lutty Yang + + Agron Theme + https://demos.creative-tim.com/argon-dashboard/index.html + + Licensed to the public under the Apache License 2.0 +-%> + +<% local ver = require "luci.version" %> + + + + + + + + diff --git a/luasrc/view/themes/argon/out_footer_login.htm b/luasrc/view/themes/argon/out_footer_login.htm new file mode 100644 index 0000000..3983147 --- /dev/null +++ b/luasrc/view/themes/argon/out_footer_login.htm @@ -0,0 +1,27 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008-2019 Jo-Philipp Wich + Licensed to the public under the Apache License 2.0. +-%> + +<% + local is_rollback_pending, rollback_time_remaining, rollback_session, rollback_token = luci.model.uci:rollback_pending() + + if is_rollback_pending or trigger_apply or trigger_revert then +%> + +<% + end + + include("themes/" .. theme .. "/footer_login") +%> diff --git a/luasrc/view/themes/argon/out_header_login.htm b/luasrc/view/themes/argon/out_header_login.htm index c550b21..075c1e8 100644 --- a/luasrc/view/themes/argon/out_header_login.htm +++ b/luasrc/view/themes/argon/out_header_login.htm @@ -13,8 +13,8 @@ local applyconf = luci.config and luci.config.apply %> - - + + <% end %> -<%+footer%> +<%+themes/argon/out_footer_login%> diff --git a/root/etc/uci-defaults/30_luci-theme-argon b/root/etc/uci-defaults/30_luci-theme-argon new file mode 100644 index 0000000..6820d25 --- /dev/null +++ b/root/etc/uci-defaults/30_luci-theme-argon @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ "$PKG_UPGRADE" != 1 ]; then + uci get luci.themes.Argon >/dev/null 2>&1 || \ + uci batch <<-EOF + set luci.themes.Argon=/luci-static/argon + set luci.main.mediaurlbase=/luci-static/argon + commit luci + EOF +fi + +exit 0 diff --git a/root/etc/uci-defaults/39_luci-theme-argon b/root/etc/uci-defaults/39_luci-theme-argon deleted file mode 100644 index e898052..0000000 --- a/root/etc/uci-defaults/39_luci-theme-argon +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -uci batch <<-EOF - set luci.themes.Argon=/luci-static/argon - set luci.main.mediaurlbase=/luci-static/argon - commit luci -EOF -sed -i ":a;$!N;s/tmpl.render.*sysauth_template.*return/local scope = { duser = default_user, fuser = user }\nlocal ok, res = luci.util.copcall\(luci.template.render_string, [[<% include\(\"themes\/\" .. theme .. \"\/sysauth\"\) %>]], scope\)\nif ok then\nreturn res\nend\nreturn luci.template.render\(\"sysauth\", scope\)/;ba" /usr/lib/lua/luci/dispatcher.lua -[ -f /usr/lib/lua/luci/view/themes/argon/out_header_login.htm ] && mv -f /usr/lib/lua/luci/view/themes/argon/out_header_login.htm /usr/lib/lua/luci/view/header_login.htm -rm -Rf /var/luci-modulecache -rm -Rf /var/luci-indexcache -exit 0