feat(lander): show filenames on index pages
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/build Pipeline was successful
Details
parent
f789847fc5
commit
a68e32c949
|
@ -190,14 +190,19 @@ lnm_http_step_err lander_get_index(lnm_http_conn *conn) {
|
||||||
lsm_str_len(entry_key) - prefix_len);
|
lsm_str_len(entry_key) - prefix_len);
|
||||||
break;
|
break;
|
||||||
case lander_entry_type_file:
|
case lander_entry_type_file:
|
||||||
ltm_instance_block_add_nested(&nested, c_ctx->instance, "file");
|
case lander_entry_type_paste:
|
||||||
|
ltm_instance_block_add_nested(&nested, c_ctx->instance,
|
||||||
|
t == lander_entry_type_file ? "file"
|
||||||
|
: "paste");
|
||||||
|
|
||||||
ltm_instance_block_add_var(
|
ltm_instance_block_add_var(
|
||||||
nested, "full_key", ltm_instance_block_type_buf,
|
nested, "full_key", ltm_instance_block_type_buf,
|
||||||
(void *)lsm_str_ptr(entry_key), lsm_str_len(entry_key));
|
(void *)lsm_str_ptr(entry_key), lsm_str_len(entry_key));
|
||||||
|
|
||||||
|
// Add the filename as the link name if known, or just the key otherwise
|
||||||
lsm_str *filename;
|
lsm_str *filename;
|
||||||
if (lsm_entry_attr_get(&filename, handle, lander_attr_type_file_name)) {
|
if (lsm_entry_attr_get(&filename, handle, lander_attr_type_file_name) ==
|
||||||
|
lsm_error_ok) {
|
||||||
ltm_instance_block_add_var(
|
ltm_instance_block_add_var(
|
||||||
nested, "filename", ltm_instance_block_type_buf,
|
nested, "filename", ltm_instance_block_type_buf,
|
||||||
(void *)lsm_str_ptr(filename), lsm_str_len(filename));
|
(void *)lsm_str_ptr(filename), lsm_str_len(filename));
|
||||||
|
|
|
@ -25,7 +25,7 @@ const char *index_template =
|
||||||
"<!doctype html>\n"
|
"<!doctype html>\n"
|
||||||
"<body>\n"
|
"<body>\n"
|
||||||
"<h1>Index /{{ title_key }}</h1>\n"
|
"<h1>Index /{{ title_key }}</h1>\n"
|
||||||
"<h2>Redirects</h2>"
|
"<h2>Redirects</h2>\n"
|
||||||
"<ul>\n"
|
"<ul>\n"
|
||||||
"{{ redirect start }}\n"
|
"{{ redirect start }}\n"
|
||||||
"<li><a href=\"/{{ full_key }}\">{{ short_key }}</a></li>\n"
|
"<li><a href=\"/{{ full_key }}\">{{ short_key }}</a></li>\n"
|
||||||
|
@ -37,6 +37,12 @@ const char *index_template =
|
||||||
"<li><a href=\"/{{ full_key }}\">{{ filename }}</a></li>\n"
|
"<li><a href=\"/{{ full_key }}\">{{ filename }}</a></li>\n"
|
||||||
"{{ file end }}\n"
|
"{{ file end }}\n"
|
||||||
"</ul>\n"
|
"</ul>\n"
|
||||||
|
"<h2>Pastes</h2>\n"
|
||||||
|
"<ul>\n"
|
||||||
|
"{{ paste start }}\n"
|
||||||
|
"<li><a href=\"/{{ full_key }}\">{{ filename }}</a></li>\n"
|
||||||
|
"{{ paste end }}\n"
|
||||||
|
"</ul>\n"
|
||||||
"</body>\n";
|
"</body>\n";
|
||||||
|
|
||||||
lnm_http_loop *loop_init(lander_gctx *gctx, const char *api_key) {
|
lnm_http_loop *loop_init(lander_gctx *gctx, const char *api_key) {
|
||||||
|
|
Loading…
Reference in New Issue