Browse Source

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 <giovanni@giacobbi.net>
Giovanni Giacobbi 2 months ago
parent
commit
147b362334

+ 1 - 10
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
+# call BuildPackage - OpenWrt buildroot signature

+ 1 - 1
luasrc/view/themes/argon/footer.htm

@@ -43,4 +43,4 @@
 </script>
 <script src="<%=media%>/js/script.js"></script>
 </body>
-</html>
+</html>

+ 46 - 0
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 <jerrykuku@qq.com>
+
+	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 <lutty@wcan.in>
+	
+	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" %>
+</div>
+<footer class="mobile-hide">
+	<div>
+		<a class="luci-link" href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> /
+						<a href="https://github.com/jerrykuku/luci-theme-argon">ArgonTheme <%# vPKG_VERSION %></a> /
+						<%= ver.distversion %>
+		<ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul>
+	</div>
+</footer>
+</div>
+</div>
+<script>
+	// thanks for Jo-Philipp Wich <jow@openwrt.org>
+	var luciLocation = <%= luci.http.write_json(luci.dispatcher.context.path) %>;
+	var winHeight = $(window).height();
+	$(window).resize(function () {
+		var winWidth = $(window).width()
+		if(winWidth < 600){
+			var newHeight = $(this).height();
+			var keyboradHeight = newHeight - winHeight;
+			$(".ftc").css("bottom", keyboradHeight + 30);
+		}
+	})
+</script>
+<script src="<%=media%>/js/script.js"></script>
+</body>
+</html>

+ 27 - 0
luasrc/view/themes/argon/out_footer_login.htm

@@ -0,0 +1,27 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2019 Jo-Philipp Wich <jo@mein.io>
+ 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
+%>
+	<script type="text/javascript">
+		document.addEventListener("luci-loaded", function() {
+			<% if trigger_apply then -%>
+				L.ui.changes.apply(true);
+			<%- elseif trigger_revert then -%>
+				L.ui.changes.revert();
+			<%- else -%>
+				L.ui.changes.confirm(true, Date.now() + <%=rollback_time_remaining%> * 1000, <%=luci.http.write_json(rollback_token)%>);
+			<%- end %>
+		});
+	</script>
+<%
+	end
+
+	include("themes/" .. theme .. "/footer_login")
+%>

+ 3 - 3
luasrc/view/themes/argon/out_header_login.htm

@@ -13,8 +13,8 @@
 	local applyconf = luci.config and luci.config.apply
 %>
 
-<script type="text/javascript" src="<%=resource%>/promis.min.js?v=git-20.186.82389-282dbf8"></script>
-<script type="text/javascript" src="<%=resource%>/luci.js?v=git-20.186.82389-282dbf8"></script>
+<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(<%= luci.http.write_json({
 		token          = token,
@@ -29,7 +29,7 @@
 		ubuspath       = luci.config.main.ubuspath or '/ubus/',
 		sessionid      = luci.dispatcher.context.authsession,
 		nodespec       = luci.dispatcher.context.dispatched,
-		apply_rollback = math.max(applyconf and applyconf.rollback or 30, 30),
+		apply_rollback = math.max(applyconf and applyconf.rollback or 90, 90),
 		apply_holdoff  = math.max(applyconf and applyconf.holdoff or 4, 1),
 		apply_timeout  = math.max(applyconf and applyconf.timeout or 5, 1),
 		apply_display  = math.max(applyconf and applyconf.display or 1.5, 1),

+ 2 - 2
luasrc/view/themes/argon/sysauth.htm

@@ -21,7 +21,7 @@
 	Licensed to the public under the Apache License 2.0
 -%>
 
-<%+header_login%>
+<%+themes/argon/out_header_login%>
 <%
 	local util = require "luci.util"
 	local boardinfo = util.ubus("system", "board")
@@ -156,4 +156,4 @@
 				}
 			//]]></script>
 			<% end %>
-<%+footer%>
+<%+themes/argon/out_footer_login%>

+ 12 - 0
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

+ 0 - 11
root/etc/uci-defaults/39_luci-theme-argon

@@ -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