Modify the style sheet URL to let the browser cache (#297)

while still supporting switching the style
This commit is contained in:
Tim Wilkinson 2022-03-16 19:43:18 -07:00 committed by GitHub
parent 8947e6f23c
commit 7a4ae6d057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -48,13 +48,15 @@ function html.header(title, close)
html.print("<meta name='robots' content='noindex'>")
-- set up the style sheet
if not nixio.fs.stat("/tmp/web") then
nixio.fs.mkdir("/tmp/web")
local link = nixio.fs.readlink("/tmp/web/style.css")
if not link then
if not nixio.fs.stat("/tmp/web") then
nixio.fs.mkdir("/tmp/web")
end
link = "/www/aredn.css"
nixio.fs.symlink(link, "/tmp/web/style.css")
end
if not nixio.fs.readlink("/tmp/web/style.css") then
nixio.fs.symlink("/www/aredn.css", "/tmp/web/style.css")
end
html.print("<link id='stylesheet_css' rel=StyleSheet href='/style.css?" .. os.time() .. "' type='text/css'>")
html.print("<link id='stylesheet_css' rel=StyleSheet href='/style.css?_=" .. link .. "' type='text/css'>")
if close then
html.print("</head>")
end