diff --git a/src/base_page.c b/src/base_page.c
index 09d892f..43a942c 100644
--- a/src/base_page.c
+++ b/src/base_page.c
@@ -30,7 +30,7 @@
#include "global_cache.h"
// Files
-#include "../static/index.chtml"
+#include "../static/index.ctmpl"
#include "../static/quick_login.chtml"
#define BODY_STYLE "style=\"background:url('%s');\""
@@ -45,7 +45,8 @@ void render_base_page(struct base_page* page, struct session* ssn, mastodont_t*
// Sidebar
char* sidebar_str,
* main_sidebar_str = NULL,
- * account_sidebar_str = NULL;
+ * account_sidebar_str = NULL,
+ * instance_str = NULL;
// Mastodont, used for notifications sidebar
struct mstdnt_storage storage = { 0 };
struct mstdnt_notification* notifs = NULL;
@@ -106,50 +107,47 @@ void render_base_page(struct base_page* page, struct session* ssn, mastodont_t*
account_sidebar_str ? account_sidebar_str : "",
main_sidebar_str ? main_sidebar_str : "");
- char* data;
- int len = easprintf(&data, data_index_html,
- L10N[locale][L10N_APP_NAME],
- ssn->config.theme,
- ssn->config.themeclr ? "-dark" : "",
- background_url_css ? background_url_css : "",
- config_url_prefix,
- L10N[locale][L10N_APP_NAME],
- login_string,
- config_url_prefix,
- L10N[locale][L10N_SEARCH_PLACEHOLDER],
- L10N[locale][L10N_SEARCH_BUTTON],
- CAT_TEXT(page->category, BASE_CAT_HOME),
- config_url_prefix,
- L10N[locale][L10N_HOME],
- CAT_TEXT(page->category, BASE_CAT_LOCAL),
- config_url_prefix,
- L10N[locale][L10N_LOCAL],
- CAT_TEXT(page->category, BASE_CAT_FEDERATED),
- config_url_prefix,
- L10N[locale][L10N_FEDERATED],
- CAT_TEXT(page->category, BASE_CAT_NOTIFICATIONS),
- config_url_prefix,
- L10N[locale][L10N_NOTIFICATIONS],
- CAT_TEXT(page->category, BASE_CAT_LISTS),
- config_url_prefix,
- L10N[locale][L10N_LISTS],
- CAT_TEXT(page->category, BASE_CAT_FAVOURITES),
- config_url_prefix,
- L10N[locale][L10N_FAVOURITES],
- CAT_TEXT(page->category, BASE_CAT_BOOKMARKS),
- config_url_prefix,
- L10N[locale][L10N_BOOKMARKS],
- CAT_TEXT(page->category, BASE_CAT_DIRECT),
- config_url_prefix,
- L10N[locale][L10N_DIRECT],
- CAT_TEXT(page->category, BASE_CAT_CONFIG),
- config_url_prefix,
- L10N[locale][L10N_CONFIG],
- page->sidebar_left ? page->sidebar_left : "",
- (ssn->config.instance_panel && g_cache.panel_html.response ?
- g_cache.panel_html.response : ""),
- page->content,
- sidebar_str ? sidebar_str : "");
+ // Create instance panel
+ easprintf(&instance_str, "
%s
",
+ (g_cache.panel_html.response ?
+ g_cache.panel_html.response : ""));
+
+ struct index_template index = {
+ .title = L10N[locale][L10N_APP_NAME],
+ .theme = ssn->config.theme,
+ .theme_clr = ssn->config.themeclr ? "-dark" : "",
+ .prefix = config_url_prefix,
+ .background_url = background_url_css,
+ .name = L10N[locale][L10N_APP_NAME],
+ .sidebar_cnt = login_string,
+ .placeholder = L10N[locale][L10N_SEARCH_PLACEHOLDER],
+ .search_btn = L10N[locale][L10N_SEARCH_BUTTON],
+ .active_home = CAT_TEXT(page->category, BASE_CAT_HOME),
+ .home = L10N[locale][L10N_HOME],
+ .active_local = CAT_TEXT(page->category, BASE_CAT_LOCAL),
+ .local = L10N[locale][L10N_LOCAL],
+ .active_federated = CAT_TEXT(page->category, BASE_CAT_FEDERATED),
+ .federated = L10N[locale][L10N_FEDERATED],
+ .active_notifications = CAT_TEXT(page->category, BASE_CAT_NOTIFICATIONS),
+ .notifications = L10N[locale][L10N_NOTIFICATIONS],
+ .active_lists = CAT_TEXT(page->category, BASE_CAT_LISTS),
+ .lists = L10N[locale][L10N_LISTS],
+ .active_favourites = CAT_TEXT(page->category, BASE_CAT_FAVOURITES),
+ .favourites = L10N[locale][L10N_FAVOURITES],
+ .active_bookmarks = CAT_TEXT(page->category, BASE_CAT_BOOKMARKS),
+ .bookmarks = L10N[locale][L10N_BOOKMARKS],
+ .active_direct = CAT_TEXT(page->category, BASE_CAT_DIRECT),
+ .direct = L10N[locale][L10N_DIRECT],
+ .active_config = CAT_TEXT(page->category, BASE_CAT_CONFIG),
+ .config = L10N[locale][L10N_CONFIG],
+ .sidebar_leftbar = page->sidebar_left,
+ .instance_panel = ssn->config.instance_panel ? instance_str : "",
+ .main = page->content,
+ .sidebar_rightbar = sidebar_str
+ };
+
+ unsigned len;
+ char* data = tmpl_gen_index(&index, &len);
if (!data)
{
@@ -167,6 +165,7 @@ cleanup:
if (main_sidebar_str != sidebar_embed) free(main_sidebar_str);
free(account_sidebar_str);
free(background_url_css);
+ free(instance_str);
}
void render_html(char* data, size_t data_len)
diff --git a/src/status.c b/src/status.c
index 9a02892..26e399b 100644
--- a/src/status.c
+++ b/src/status.c
@@ -245,7 +245,7 @@ char* construct_interaction_buttons(struct session* ssn,
config_url_prefix,
status->id,
status->id,
- reltime_to_str(status->created_at));
+ time_str);
if (size) *size = s;
// Cleanup
@@ -561,7 +561,7 @@ char* construct_status(struct session* ssn,
}
// Delete status menu item, logged in only
- if (strcmp(status->account.acct, ssn->acct.acct) == 0)
+ if (ssn->logged_in && strcmp(status->account.acct, ssn->acct.acct) == 0)
easprintf(&delete_status, data_menu_item_html,
config_url_prefix, status->id, "delete", "Delete status");
diff --git a/src/template/main.c b/src/template/main.c
index f5575c9..a3ecaaa 100644
--- a/src/template/main.c
+++ b/src/template/main.c
@@ -56,7 +56,7 @@ long filesize(FILE* file)
void chexput(const char* buf, size_t size)
{
- for (size_t i = 0; i < size; ++i)
+ for (size_t i = 0; i < size && buf; ++i)
{
printf("0X%hhX,", buf[i]);
}
@@ -81,6 +81,7 @@ char* tkn_typetostr(enum tmpl_type tkn)
case TMPL_INT:
return "int";
case TMPL_STR:
+ return "const char*";
case TMPL_STRLEN:
return "char*";
case TMPL_UINT:
@@ -190,8 +191,8 @@ void print_template(char* var, char* buf)
// Print remainder if any
chexput(buf_prev, strlen(buf_prev));
- printf("};\n"
- "struct %s {", var);
+ printf("0};\n"
+ "struct %s_template {", var);
int should_print = 0;
// Print tokens
@@ -217,12 +218,16 @@ void print_template(char* var, char* buf)
// Generate function
printf("};\n"
- "char* tmpl_gen_%s(struct %s* data, unsigned* size){\n"
+ "char* tmpl_gen_%s(struct %s_template* data, unsigned* size){\n"
"char* ret;\n"
"unsigned s = easprintf(&ret, data_%s, ", var, var, var);
for (size_t i = 0; i < tokens_len; ++i)
{
- printf("data->%s%s", tokens[i].token, i < tokens_len-1 ? ", " : "");
+ printf("data->%s", tokens[i].token);
+ // No (null) strings, make them empty
+ if (tokens[i].type == TMPL_STR || tokens[i].type == TMPL_STRLEN)
+ printf("?data->%s:\"\"", tokens[i].token);
+ fputs(i < tokens_len-1 ? ", " : "", stdout);
}
fputs(");\n"
"if (size) *size = s;\n"
@@ -255,6 +260,7 @@ int main(int argc, char** argv)
}
fclose(file);
+ buf[size-1] = '\0';
print_template(argv[ARG_VARIABLE], buf);
diff --git a/static/index.ctmpl b/static/index.ctmpl
new file mode 100644
index 0000000..5adebe5
--- /dev/null
+++ b/static/index.ctmpl
@@ -0,0 +1,42 @@
+#ifndef __index
+#define __index
+static const char data_index[] = {0X3C,0X21,0X44,0X4F,0X43,0X54,0X59,0X50,0X45,0X20,0X68,0X74,0X6D,0X6C,0X3E,0XA,0X3C,0X68,0X74,0X6D,0X6C,0X3E,0XA,0X20,0X20,0X3C,0X68,0X65,0X61,0X64,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X6D,0X65,0X74,0X61,0X20,0X63,0X68,0X61,0X72,0X73,0X65,0X74,0X3D,0X22,0X75,0X74,0X66,0X2D,0X38,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X74,0X69,0X74,0X6C,0X65,0X3E,0X25,0X73,0X3C,0X2F,0X74,0X69,0X74,0X6C,0X65,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X6E,0X6B,0X20,0X72,0X65,0X6C,0X3D,0X22,0X69,0X63,0X6F,0X6E,0X22,0X20,0X74,0X79,0X70,0X65,0X3D,0X22,0X69,0X6D,0X61,0X67,0X65,0X2F,0X70,0X6E,0X67,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X2F,0X66,0X61,0X76,0X69,0X63,0X6F,0X6E,0X2E,0X70,0X6E,0X67,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X6E,0X6B,0X20,0X72,0X65,0X6C,0X3D,0X22,0X73,0X74,0X79,0X6C,0X65,0X73,0X68,0X65,0X65,0X74,0X22,0X20,0X74,0X79,0X70,0X65,0X3D,0X22,0X74,0X65,0X78,0X74,0X2F,0X63,0X73,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X2F,0X25,0X73,0X25,0X73,0X2E,0X63,0X73,0X73,0X22,0X3E,0XA,0X20,0X20,0X3C,0X2F,0X68,0X65,0X61,0X64,0X3E,0XA,0X20,0X20,0X3C,0X62,0X6F,0X64,0X79,0X20,0X25,0X73,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X64,0X69,0X76,0X3E,0X3C,0X2F,0X64,0X69,0X76,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X64,0X69,0X76,0X20,0X69,0X64,0X3D,0X22,0X6D,0X61,0X69,0X6E,0X2D,0X70,0X61,0X67,0X65,0X2D,0X63,0X6F,0X6E,0X74,0X61,0X69,0X6E,0X65,0X72,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X64,0X69,0X76,0X20,0X69,0X64,0X3D,0X22,0X6D,0X61,0X69,0X6E,0X2D,0X70,0X61,0X67,0X65,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X68,0X65,0X61,0X64,0X65,0X72,0X20,0X69,0X64,0X3D,0X22,0X6E,0X61,0X76,0X62,0X61,0X72,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X61,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X22,0X3E,0X3C,0X69,0X6D,0X67,0X20,0X73,0X72,0X63,0X3D,0X22,0X2F,0X74,0X72,0X65,0X65,0X62,0X69,0X72,0X64,0X5F,0X6C,0X6F,0X67,0X6F,0X2E,0X70,0X6E,0X67,0X22,0X20,0X68,0X65,0X69,0X67,0X68,0X74,0X3D,0X22,0X34,0X32,0X22,0X3E,0X3C,0X2F,0X61,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X73,0X70,0X61,0X6E,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X69,0X6E,0X66,0X6F,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X73,0X70,0X61,0X6E,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X64,0X69,0X76,0X20,0X69,0X64,0X3D,0X22,0X6E,0X61,0X76,0X62,0X61,0X72,0X2D,0X72,0X69,0X67,0X68,0X74,0X2D,0X63,0X6F,0X6E,0X74,0X61,0X69,0X6E,0X65,0X72,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X64,0X69,0X76,0X20,0X69,0X64,0X3D,0X22,0X6E,0X61,0X76,0X62,0X61,0X72,0X2D,0X72,0X69,0X67,0X68,0X74,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X21,0X2D,0X2D,0X20,0X53,0X65,0X61,0X72,0X63,0X68,0X62,0X6F,0X78,0X20,0X2D,0X2D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X66,0X6F,0X72,0X6D,0X20,0X61,0X63,0X74,0X69,0X6F,0X6E,0X3D,0X22,0X25,0X73,0X2F,0X73,0X65,0X61,0X72,0X63,0X68,0X22,0X20,0X6D,0X65,0X74,0X68,0X6F,0X64,0X3D,0X22,0X67,0X65,0X74,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X69,0X6E,0X70,0X75,0X74,0X20,0X74,0X79,0X70,0X65,0X3D,0X22,0X74,0X65,0X78,0X74,0X62,0X6F,0X78,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X67,0X72,0X6F,0X75,0X70,0X20,0X67,0X72,0X6F,0X75,0X70,0X2D,0X6C,0X65,0X66,0X74,0X20,0X67,0X72,0X6F,0X75,0X70,0X2D,0X69,0X6E,0X70,0X75,0X74,0X62,0X6F,0X78,0X22,0X20,0X70,0X6C,0X61,0X63,0X65,0X68,0X6F,0X6C,0X64,0X65,0X72,0X3D,0X22,0X25,0X73,0X22,0X20,0X69,0X64,0X3D,0X22,0X73,0X65,0X61,0X72,0X63,0X68,0X62,0X6F,0X78,0X22,0X20,0X6E,0X61,0X6D,0X65,0X3D,0X22,0X71,0X22,0X3E,0X3C,0X21,0X2D,0X2D,0X20,0X69,0X20,0X68,0X61,0X74,0X65,0X20,0X48,0X54,0X4D,0X4C,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X2D,0X2D,0X3E,0X3C,0X69,0X6E,0X70,0X75,0X74,0X20,0X74,0X79,0X70,0X65,0X3D,0X22,0X73,0X75,0X62,0X6D,0X69,0X74,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X62,0X74,0X6E,0X20,0X67,0X72,0X6F,0X75,0X70,0X20,0X67,0X72,0X6F,0X75,0X70,0X2D,0X72,0X69,0X67,0X68,0X74,0X22,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X22,0X25,0X73,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X66,0X6F,0X72,0X6D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X64,0X69,0X76,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X64,0X69,0X76,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X68,0X65,0X61,0X64,0X65,0X72,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X74,0X61,0X62,0X6C,0X65,0X20,0X69,0X64,0X3D,0X22,0X63,0X6F,0X6E,0X74,0X65,0X6E,0X74,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X75,0X69,0X2D,0X74,0X61,0X62,0X6C,0X65,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X21,0X2D,0X2D,0X20,0X4E,0X61,0X76,0X69,0X67,0X61,0X74,0X69,0X6F,0X6E,0X20,0X2D,0X2D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X74,0X72,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X74,0X64,0X20,0X69,0X64,0X3D,0X22,0X6C,0X65,0X66,0X74,0X62,0X61,0X72,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X75,0X6C,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X6C,0X6F,0X63,0X61,0X6C,0X2F,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X66,0X65,0X64,0X65,0X72,0X61,0X74,0X65,0X64,0X2F,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X6E,0X6F,0X74,0X69,0X66,0X69,0X63,0X61,0X74,0X69,0X6F,0X6E,0X73,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X6C,0X69,0X73,0X74,0X73,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X66,0X61,0X76,0X6F,0X75,0X72,0X69,0X74,0X65,0X73,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X62,0X6F,0X6F,0X6B,0X6D,0X61,0X72,0X6B,0X73,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X64,0X69,0X72,0X65,0X63,0X74,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X6C,0X69,0X3E,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X62,0X74,0X6E,0X20,0X25,0X73,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X63,0X6F,0X6E,0X66,0X69,0X67,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X75,0X6C,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X74,0X64,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X21,0X2D,0X2D,0X20,0X44,0X69,0X73,0X70,0X6C,0X61,0X79,0X20,0X66,0X6F,0X72,0X20,0X70,0X6F,0X73,0X74,0X73,0X20,0X2D,0X2D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X74,0X64,0X20,0X69,0X64,0X3D,0X22,0X6D,0X61,0X69,0X6E,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X74,0X64,0X3E,0XA,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X21,0X2D,0X2D,0X20,0X4E,0X6F,0X74,0X69,0X66,0X69,0X63,0X61,0X74,0X69,0X6F,0X6E,0X73,0X20,0X61,0X6E,0X64,0X20,0X73,0X75,0X63,0X68,0X20,0X2D,0X2D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X74,0X64,0X20,0X69,0X64,0X3D,0X22,0X72,0X69,0X67,0X68,0X74,0X62,0X61,0X72,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X69,0X64,0X65,0X62,0X61,0X72,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X74,0X64,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X74,0X72,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X74,0X61,0X62,0X6C,0X65,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X64,0X69,0X76,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X2F,0X64,0X69,0X76,0X3E,0XA,0XA,0X20,0X20,0X20,0X20,0X3C,0X21,0X2D,0X2D,0X20,0X53,0X6F,0X75,0X72,0X63,0X65,0X20,0X2D,0X2D,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X73,0X63,0X72,0X69,0X70,0X74,0X20,0X73,0X72,0X63,0X3D,0X22,0X2F,0X6A,0X73,0X2F,0X6D,0X61,0X69,0X6E,0X2E,0X6A,0X73,0X22,0X3E,0X3C,0X2F,0X73,0X63,0X72,0X69,0X70,0X74,0X3E,0XA,0X20,0X20,0X3C,0X2F,0X62,0X6F,0X64,0X79,0X3E,0XA,0X3C,0X2F,0X68,0X74,0X6D,0X6C,0X3E,0};
+struct index_template {const char* title;
+const char* theme;
+const char* theme_clr;
+const char* background_url;
+const char* prefix;
+const char* name;
+const char* sidebar_cnt;
+const char* placeholder;
+const char* search_btn;
+const char* active_home;
+const char* home;
+const char* active_local;
+const char* local;
+const char* active_federated;
+const char* federated;
+const char* active_notifications;
+const char* notifications;
+const char* active_lists;
+const char* lists;
+const char* active_favourites;
+const char* favourites;
+const char* active_bookmarks;
+const char* bookmarks;
+const char* active_direct;
+const char* direct;
+const char* active_config;
+const char* config;
+const char* sidebar_leftbar;
+const char* instance_panel;
+const char* main;
+const char* sidebar_rightbar;
+};
+char* tmpl_gen_index(struct index_template* data, unsigned* size){
+char* ret;
+unsigned s = easprintf(&ret, data_index, data->title?data->title:"", data->theme?data->theme:"", data->theme_clr?data->theme_clr:"", data->background_url?data->background_url:"", data->prefix?data->prefix:"", data->name?data->name:"", data->sidebar_cnt?data->sidebar_cnt:"", data->prefix?data->prefix:"", data->placeholder?data->placeholder:"", data->search_btn?data->search_btn:"", data->active_home?data->active_home:"", data->prefix?data->prefix:"", data->home?data->home:"", data->active_local?data->active_local:"", data->prefix?data->prefix:"", data->local?data->local:"", data->active_federated?data->active_federated:"", data->prefix?data->prefix:"", data->federated?data->federated:"", data->active_notifications?data->active_notifications:"", data->prefix?data->prefix:"", data->notifications?data->notifications:"", data->active_lists?data->active_lists:"", data->prefix?data->prefix:"", data->lists?data->lists:"", data->active_favourites?data->active_favourites:"", data->prefix?data->prefix:"", data->favourites?data->favourites:"", data->active_bookmarks?data->active_bookmarks:"", data->prefix?data->prefix:"", data->bookmarks?data->bookmarks:"", data->active_direct?data->active_direct:"", data->prefix?data->prefix:"", data->direct?data->direct:"", data->active_config?data->active_config:"", data->prefix?data->prefix:"", data->config?data->config:"", data->sidebar_leftbar?data->sidebar_leftbar:"", data->instance_panel?data->instance_panel:"", data->main?data->main:"", data->sidebar_rightbar?data->sidebar_rightbar:"");
+if (size) *size = s;
+return ret;
+}
+#endif
diff --git a/static/index.tmpl b/static/index.tmpl
index 1a0a4c9..cf730da 100644
--- a/static/index.tmpl
+++ b/static/index.tmpl
@@ -6,7 +6,7 @@
-
+
@@ -40,9 +40,7 @@
{{ %s : sidebar_leftbar }}
-
- {{ %s : instance_panel }}
-
+ {{ %s : instance_panel }}