Changeset

5995:28b386fc7a05

mod_http_index: Add metadata to enable installation with plugin installer
author Kim Alvefur <zash@zash.se>
date Tue, 08 Oct 2024 22:17:01 +0200
parents 5994:1bb8b559f441
children 5996:a1aa56ebe73f
files mod_http_index/README.markdown mod_http_index/html/http_index.html mod_http_index/http_index.html mod_http_index/mod_http_index.lua
diffstat 4 files changed, 66 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_index/README.markdown	Thu Oct 03 22:29:03 2024 +0200
+++ b/mod_http_index/README.markdown	Tue Oct 08 22:17:01 2024 +0200
@@ -1,3 +1,13 @@
+---
+summary: Generate an index of local HTTP services
+labels:
+- Stage-Beta
+rockspec:
+  build:
+    copy_directories:
+    - html
+---
+
 Introduction
 ============
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_http_index/html/http_index.html	Tue Oct 08 22:17:01 2024 +0200
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="generator" value="prosody/{prosody_version} mod_{mod_name}">
+<link rel="canonical" href="{canonical}">
+<title>{title}</title>
+<style>
+:link,:visited{color:#3465a4;text-decoration:none;}
+:link:hover,:visited:hover{color:#6197df;}
+body{background-color:#eeeeec;margin:1ex 0;padding-bottom:3em;font-family:Arial,Helvetica,sans-serif;}
+ul,ol{padding:0;}
+li{list-style:none;}
+hr{visibility:hidden;clear:both;}
+br{clear:both;}
+header,footer{margin:1ex 1em;}
+footer{font-size:smaller;color:#babdb6;}
+nav{font-size:large;margin:1ex 1ex;clear:both;line-height:1.5em;}
+footer nav .up{display:none;}
+@media screen and (min-width: 460px) {
+nav {font-size:x-large;margin:1ex 1em;}
+}
+nav a{padding:1ex}
+nav li,nav dt{margin:1ex}
+.content{background-color:white;padding:1em;list-style-position:inside;}
+@media (prefers-color-scheme: dark) {
+html{color:#eee}
+body{background-color:#161616}
+.content{background-color:#1c1c1c}
+footer{color:#444}
+}
+</style>
+</head>
+<body>
+<header>
+<h1>Prosody IM</h1>
+<h2>HTTP Services</h2>
+</header>
+<hr>
+<div class="content">
+<nav>
+<ul>{items#
+<li><a href="{item.url}" title="{item.module}">{item.title?{item.name}}</a></li>}
+</ul>
+</nav>
+</div>
+<hr>
+<footer>
+<br>
+<div class="powered-by">Prosody {prosody_version?}</div>
+</footer>
+</body>
+</html>
--- a/mod_http_index/http_index.html	Thu Oct 03 22:29:03 2024 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width, initial-scale=1">
-<meta name="generator" value="prosody/{prosody_version} mod_{mod_name}">
-<link rel="canonical" href="{canonical}">
-<title>{title}</title>
-<style>
-:link,:visited{color:#3465a4;text-decoration:none;}
-:link:hover,:visited:hover{color:#6197df;}
-body{background-color:#eeeeec;margin:1ex 0;padding-bottom:3em;font-family:Arial,Helvetica,sans-serif;}
-ul,ol{padding:0;}
-li{list-style:none;}
-hr{visibility:hidden;clear:both;}
-br{clear:both;}
-header,footer{margin:1ex 1em;}
-footer{font-size:smaller;color:#babdb6;}
-nav{font-size:large;margin:1ex 1ex;clear:both;line-height:1.5em;}
-footer nav .up{display:none;}
-@media screen and (min-width: 460px) {
-nav {font-size:x-large;margin:1ex 1em;}
-}
-nav a{padding:1ex}
-nav li,nav dt{margin:1ex}
-.content{background-color:white;padding:1em;list-style-position:inside;}
-@media (prefers-color-scheme: dark) {
-html{color:#eee}
-body{background-color:#161616}
-.content{background-color:#1c1c1c}
-footer{color:#444}
-}
-</style>
-</head>
-<body>
-<header>
-<h1>Prosody IM</h1>
-<h2>HTTP Services</h2>
-</header>
-<hr>
-<div class="content">
-<nav>
-<ul>{items#
-<li><a href="{item.url}" title="{item.module}">{item.title?{item.name}}</a></li>}
-</ul>
-</nav>
-</div>
-<hr>
-<footer>
-<br>
-<div class="powered-by">Prosody {prosody_version?}</div>
-</footer>
-</body>
-</html>
--- a/mod_http_index/mod_http_index.lua	Thu Oct 03 22:29:03 2024 +0200
+++ b/mod_http_index/mod_http_index.lua	Tue Oct 08 22:17:01 2024 +0200
@@ -7,8 +7,8 @@
 
 local base_template;
 do
-	local template_file = module:get_option_string(module.name .. "_template", module.name .. ".html");
-	template_file = assert(module:load_resource(template_file));
+	local template_file = module:get_option_path(module.name .. "_template", module.name .. ".html", "html");
+	template_file = assert(io.open(template_file));
 	base_template = template_file:read("*a");
 	template_file:close();
 end