From 8d5f9eb2691d0933da62fee84c94c6c5fc2b2397 Mon Sep 17 00:00:00 2001 From: nekobit Date: Mon, 30 May 2022 07:46:19 +0000 Subject: [PATCH] Template makefile and status template FossilOrigin-Name: 9a4b3c391855b099fa68f157ce655fd95532c602d954a3e6d8974fe46f29f988 --- Makefile | 126 ++------------------------------------------ src/lists.c | 1 - src/page_config.c | 1 - src/status.c | 59 ++++++++++----------- static/status.ctmpl | 32 +++++++++++ static/status.html | 50 ------------------ static/status.tmpl | 50 ++++++++++++++++++ 7 files changed, 114 insertions(+), 205 deletions(-) create mode 100644 static/status.ctmpl delete mode 100644 static/status.html create mode 100644 static/status.tmpl diff --git a/Makefile b/Makefile index 60dcb6f..97cd6fa 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ SRC = $(wildcard src/*.c) OBJ = $(patsubst %.c,%.o,$(SRC)) HEADERS = $(wildcard src/*.h) PAGES_DIR = static -PAGES = $(wildcard $(PAGES_DIR)/*.html) -PAGES_CMP = $(patsubst %.html,%.chtml,$(PAGES)) +PAGES = $(wildcard $(PAGES_DIR)/*.tmpl) +PAGES_CMP = $(patsubst %.tmpl,%.ctmpl,$(PAGES)) DIST = dist/ PREFIX ?= /usr/local TARGET = treebird @@ -23,7 +23,7 @@ $(TARGET): filec template $(PAGES_CMP) $(OBJ) $(HEADERS) $(CC) -o $(TARGET) $(OBJ) $(LDFLAGS) template: src/template/main.o - $(CC) $(LDFLATS) -o template $< + $(CC) $(LDFLAGS) -o template $< filec: src/file-to-c/main.o $(CC) -o filec $< @@ -32,124 +32,8 @@ emojitoc: scripts/emoji-to.o $(CC) -o emojitoc $< $(LDFLAGS) ./emojitoc meta/emoji.json > src/emoji_codes.h -# PAGES -$(PAGES_DIR)/index.chtml: $(PAGES_DIR)/index.html - ./filec $< data_index_html > $@ -$(PAGES_DIR)/status.chtml: $(PAGES_DIR)/status.html - ./filec $< data_status_html > $@ -$(PAGES_DIR)/account.chtml: $(PAGES_DIR)/account.html - ./filec $< data_account_html > $@ -$(PAGES_DIR)/login.chtml: $(PAGES_DIR)/login.html - ./filec $< data_login_html > $@ -$(PAGES_DIR)/post.chtml: $(PAGES_DIR)/post.html - ./filec $< data_post_html > $@ -$(PAGES_DIR)/list.chtml: $(PAGES_DIR)/list.html - ./filec $< data_list_html > $@ -$(PAGES_DIR)/lists.chtml: $(PAGES_DIR)/lists.html - ./filec $< data_lists_html > $@ -$(PAGES_DIR)/error.chtml: $(PAGES_DIR)/error.html - ./filec $< data_error_html > $@ -$(PAGES_DIR)/attachments.chtml: $(PAGES_DIR)/attachments.html - ./filec $< data_attachments_html > $@ -$(PAGES_DIR)/attachment_image.chtml: $(PAGES_DIR)/attachment_image.html - ./filec $< data_attachment_image_html > $@ -$(PAGES_DIR)/attachment_video.chtml: $(PAGES_DIR)/attachment_video.html - ./filec $< data_attachment_video_html > $@ -$(PAGES_DIR)/attachment_link.chtml: $(PAGES_DIR)/attachment_link.html - ./filec $< data_attachment_link_html > $@ -$(PAGES_DIR)/attachment_audio.chtml: $(PAGES_DIR)/attachment_audio.html - ./filec $< data_attachment_audio_html > $@ -$(PAGES_DIR)/attachment_gifv.chtml: $(PAGES_DIR)/attachment_gifv.html - ./filec $< data_attachment_gifv_html > $@ -$(PAGES_DIR)/emoji_reactions.chtml: $(PAGES_DIR)/emoji_reactions.html - ./filec $< data_emoji_reactions_html > $@ -$(PAGES_DIR)/emoji_reaction.chtml: $(PAGES_DIR)/emoji_reaction.html - ./filec $< data_emoji_reaction_html > $@ -$(PAGES_DIR)/menu_item.chtml: $(PAGES_DIR)/menu_item.html - ./filec $< data_menu_item_html > $@ -$(PAGES_DIR)/test.chtml: $(PAGES_DIR)/test.html - ./filec $< data_test_html > $@ -$(PAGES_DIR)/notifications_page.chtml: $(PAGES_DIR)/notifications_page.html - ./filec $< data_notifications_page_html > $@ -$(PAGES_DIR)/notifications_embed.chtml: $(PAGES_DIR)/notifications_embed.html - ./filec $< data_notifications_embed_html > $@ -$(PAGES_DIR)/notifications.chtml: $(PAGES_DIR)/notifications.html - ./filec $< data_notifications_html > $@ -$(PAGES_DIR)/notification.chtml: $(PAGES_DIR)/notification.html - ./filec $< data_notification_html > $@ -$(PAGES_DIR)/notification_compact.chtml: $(PAGES_DIR)/notification_compact.html - ./filec $< data_notification_compact_html > $@ -$(PAGES_DIR)/error_404.chtml: $(PAGES_DIR)/error_404.html - ./filec $< data_error_404_html > $@ -$(PAGES_DIR)/navigation.chtml: $(PAGES_DIR)/navigation.html - ./filec $< data_navigation_html > $@ -$(PAGES_DIR)/config_sidebar.chtml: $(PAGES_DIR)/config_sidebar.html - ./filec $< data_config_sidebar_html > $@ -$(PAGES_DIR)/like_svg.chtml: $(PAGES_DIR)/like_svg.html - ./filec $< data_like_svg_html > $@ -$(PAGES_DIR)/repeat_svg.chtml: $(PAGES_DIR)/repeat_svg.html - ./filec $< data_repeat_svg_html > $@ -$(PAGES_DIR)/follow_svg.chtml: $(PAGES_DIR)/follow_svg.html - ./filec $< data_follow_svg_html > $@ -$(PAGES_DIR)/notification_action.chtml: $(PAGES_DIR)/notification_action.html - ./filec $< data_notification_action_html > $@ -$(PAGES_DIR)/config_general.chtml: $(PAGES_DIR)/config_general.html - ./filec $< data_config_general_html > $@ -$(PAGES_DIR)/config_appearance.chtml: $(PAGES_DIR)/config_appearance.html - ./filec $< data_config_appearance_html > $@ -$(PAGES_DIR)/in_reply_to.chtml: $(PAGES_DIR)/in_reply_to.html - ./filec $< data_in_reply_to_html > $@ -$(PAGES_DIR)/account_info.chtml: $(PAGES_DIR)/account_info.html - ./filec $< data_account_info_html > $@ -$(PAGES_DIR)/search.chtml: $(PAGES_DIR)/search.html - ./filec $< data_search_html > $@ -$(PAGES_DIR)/scrobble.chtml: $(PAGES_DIR)/scrobble.html - ./filec $< data_scrobble_html > $@ -$(PAGES_DIR)/directs_page.chtml: $(PAGES_DIR)/directs_page.html - ./filec $< data_directs_page_html > $@ -$(PAGES_DIR)/status_interactions.chtml: $(PAGES_DIR)/status_interactions.html - ./filec $< data_status_interactions_html > $@ -$(PAGES_DIR)/status_interactions_label.chtml: $(PAGES_DIR)/status_interactions_label.html - ./filec $< data_status_interactions_label_html > $@ -$(PAGES_DIR)/status_interaction_profile.chtml: $(PAGES_DIR)/status_interaction_profile.html - ./filec $< data_status_interaction_profile_html > $@ -$(PAGES_DIR)/account_follow_btn.chtml: $(PAGES_DIR)/account_follow_btn.html - ./filec $< data_account_follow_btn_html > $@ -$(PAGES_DIR)/bookmarks_page.chtml: $(PAGES_DIR)/bookmarks_page.html - ./filec $< data_bookmarks_page_html > $@ -$(PAGES_DIR)/favourites_page.chtml: $(PAGES_DIR)/favourites_page.html - ./filec $< data_favourites_page_html > $@ -$(PAGES_DIR)/account_stub.chtml: $(PAGES_DIR)/account_stub.html - ./filec $< data_account_stub_html > $@ -$(PAGES_DIR)/hashtag.chtml: $(PAGES_DIR)/hashtag.html - ./filec $< data_hashtag_html > $@ -$(PAGES_DIR)/hashtag_page.chtml: $(PAGES_DIR)/hashtag_page.html - ./filec $< data_hashtag_page_html > $@ -$(PAGES_DIR)/bar_graph.chtml: $(PAGES_DIR)/bar_graph.html - ./filec $< data_bar_graph_html > $@ -$(PAGES_DIR)/bar.chtml: $(PAGES_DIR)/bar.html - ./filec $< data_bar_html > $@ -$(PAGES_DIR)/emoji_picker.chtml: $(PAGES_DIR)/emoji_picker.html - ./filec $< data_emoji_picker_html > $@ -$(PAGES_DIR)/emoji.chtml: $(PAGES_DIR)/emoji.html - ./filec $< data_emoji_html > $@ -$(PAGES_DIR)/likeboost.chtml: $(PAGES_DIR)/likeboost.html - ./filec $< data_likeboost_html > $@ -$(PAGES_DIR)/reactions_btn.chtml: $(PAGES_DIR)/reactions_btn.html - ./filec $< data_reactions_btn_html > $@ -$(PAGES_DIR)/interaction_buttons.chtml: $(PAGES_DIR)/interaction_buttons.html - ./filec $< data_interaction_buttons_html > $@ -$(PAGES_DIR)/license.chtml: $(PAGES_DIR)/license.html - ./filec $< data_license_html > $@ -# Login panel -$(PAGES_DIR)/quick_login.chtml: $(PAGES_DIR)/quick_login.html - ./filec $< data_quick_login_html > $@ -$(PAGES_DIR)/account_sidebar.chtml: $(PAGES_DIR)/account_sidebar.html - ./filec $< data_account_sidebar_html > $@ -$(PAGES_DIR)/about.chtml: $(PAGES_DIR)/about.html - ./filec $< data_about_html > $@ -$(PAGES_DIR)/instance.chtml: $(PAGES_DIR)/instance.html - ./filec $< data_instance_html > $@ +$(PAGES_DIR)/%.ctmpl: $(PAGES_DIR)/%.tmpl + ./template $< $(notdir $*) > $@ $(MASTODONT_DIR): cd ..; fossil clone $(MASTODONT_URL) || true diff --git a/src/lists.c b/src/lists.c index 5dc096d..6c57447 100644 --- a/src/lists.c +++ b/src/lists.c @@ -27,7 +27,6 @@ #include "string_helpers.h" // Files -#include "../static/index.chtml" #include "../static/account.chtml" #include "../static/list.chtml" #include "../static/lists.chtml" diff --git a/src/page_config.c b/src/page_config.c index 1aaccde..073d2d8 100644 --- a/src/page_config.c +++ b/src/page_config.c @@ -31,7 +31,6 @@ #include "l10n.h" // Pages -#include "../static/index.chtml" #include "../static/config_general.chtml" #include "../static/config_appearance.chtml" #include "../static/config_sidebar.chtml" diff --git a/src/status.c b/src/status.c index 26e399b..e19e30a 100644 --- a/src/status.c +++ b/src/status.c @@ -36,7 +36,7 @@ #include "emoji.h" // Pages -#include "../static/status.chtml" +#include "../static/status.ctmpl" #include "../static/notification.chtml" #include "../static/in_reply_to.chtml" #include "../static/status_interactions_label.chtml" @@ -581,38 +581,33 @@ char* construct_status(struct session* ssn, if (status->in_reply_to_id && status->in_reply_to_account_id) in_reply_to_str = get_in_reply_to(api, status, NULL); - size_t s = easprintf(&stat_html, data_status_html, - status->id, - (flags & STATUS_FOCUSED) == STATUS_FOCUSED ? - "focused" : "", - notif_info ? notif_info : "", - status->account.avatar, - formatted_display_name, /* Username */ - config_url_prefix, - status->account.acct, - status->account.acct, /* Account */ - status->visibility, /* visibility */ - config_url_prefix, - status->id, - status->muted ? "un" : "", - status->muted ? "Unmute thread" : "Mute thread", - config_url_prefix, - status->id, - status->pinned ? "un" : "", - status->pinned ? "Unpin" : "Pin", - config_url_prefix, - status->id, - status->bookmarked ? "un" : "", - status->bookmarked ? "Remove Bookmark" : "Bookmark", - delete_status ? delete_status : "", - in_reply_to_str ? in_reply_to_str : "", - parse_content, - attachments ? attachments : "", - interactions_html ? interactions_html : "", - emoji_reactions ? emoji_reactions : "", - interaction_btns); + struct status_template tmpl = { + .status_id = status->id, + .focused = ((flags & STATUS_FOCUSED) == STATUS_FOCUSED ? + "focused" : ""), + .notif_info = notif_info, + .avatar = status->account.avatar, + .username = formatted_display_name, + .prefix = config_url_prefix, + .acct = status->account.acct, + .visibility = status->visibility, + .unmute = status->muted ? "un" : "", + .unmute_btn = status->muted ? "Unmute thread" : "Mute thread", + .unpin = status->pinned ? "un" : "", + .unpin_btn = status->pinned ? "Unpin" : "Pin", + .unbookmark = status->bookmarked ? "un" : "", + .unbookmark_btn = status->bookmarked ? "Remove Bookmark" : "Bookmark" + .delete_status = delete_status, + .in_reply_to_str = in_reply_to_str, + .status_content = parse_content, + .attachments = attachments, + .interactions = interactions_html, + .emoji_reactions = emoji_reactions, + .interaction_btns = interaction_btns + }; + + stat_html = tmpl_gen_status(&tmpl, size); - if (size) *size = s; // Cleanup if (formatted_display_name != status->account.display_name && formatted_display_name) free(formatted_display_name); diff --git a/static/status.ctmpl b/static/status.ctmpl new file mode 100644 index 0000000..d90cbd7 --- /dev/null +++ b/static/status.ctmpl @@ -0,0 +1,32 @@ +#ifndef __status +#define __status +static const char data_status[] = {0X3C,0X74,0X61,0X62,0X6C,0X65,0X20,0X69,0X64,0X3D,0X22,0X25,0X73,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X74,0X61,0X74,0X75,0X73,0X20,0X25,0X73,0X20,0X75,0X69,0X2D,0X74,0X61,0X62,0X6C,0X65,0X22,0X3E,0XA,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X3C,0X74,0X72,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X74,0X64,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X70,0X66,0X70,0X2D,0X74,0X64,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X69,0X6D,0X67,0X20,0X73,0X72,0X63,0X3D,0X22,0X25,0X73,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X2F,0X74,0X64,0X3E,0XA,0X20,0X20,0X20,0X20,0X3C,0X74,0X64,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X74,0X61,0X74,0X75,0X73,0X2D,0X69,0X6E,0X66,0X6F,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X64,0X69,0X76,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X70,0X6F,0X73,0X74,0X65,0X72,0X2D,0X73,0X74,0X61,0X74,0X73,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X73,0X70,0X61,0X6E,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X75,0X73,0X65,0X72,0X6E,0X61,0X6D,0X65,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X73,0X70,0X61,0X6E,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X61,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X69,0X6E,0X73,0X74,0X61,0X6E,0X63,0X65,0X2D,0X69,0X6E,0X66,0X6F,0X22,0X20,0X68,0X72,0X65,0X66,0X3D,0X22,0X25,0X73,0X2F,0X40,0X25,0X73,0X22,0X3E,0X25,0X73,0X3C,0X2F,0X61,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X73,0X70,0X61,0X6E,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X61,0X6C,0X69,0X67,0X6E,0X65,0X6E,0X64,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X64,0X69,0X76,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X6D,0X65,0X6E,0X75,0X2D,0X63,0X6F,0X6E,0X74,0X61,0X69,0X6E,0X65,0X72,0X20,0X73,0X74,0X61,0X74,0X75,0X73,0X2D,0X76,0X69,0X73,0X69,0X62,0X69,0X6C,0X69,0X74,0X79,0X22,0X3E,0XA,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,0X64,0X69,0X76,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X6D,0X65,0X6E,0X75,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,0XA,0X20,0X20,0X20,0X20,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,0X74,0X61,0X74,0X75,0X73,0X2F,0X25,0X73,0X2F,0X69,0X6E,0X74,0X65,0X72,0X61,0X63,0X74,0X22,0X20,0X6D,0X65,0X74,0X68,0X6F,0X64,0X3D,0X22,0X70,0X6F,0X73,0X74,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,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,0X68,0X69,0X64,0X64,0X65,0X6E,0X22,0X20,0X6E,0X61,0X6D,0X65,0X3D,0X22,0X69,0X74,0X79,0X70,0X65,0X22,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X22,0X25,0X73,0X6D,0X75,0X74,0X65,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,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,0X73,0X75,0X62,0X6D,0X69,0X74,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X62,0X74,0X6E,0X2D,0X6D,0X65,0X6E,0X75,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,0X20,0X20,0X20,0X20,0X3C,0X2F,0X66,0X6F,0X72,0X6D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,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,0XA,0X20,0X20,0X20,0X20,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,0X74,0X61,0X74,0X75,0X73,0X2F,0X25,0X73,0X2F,0X69,0X6E,0X74,0X65,0X72,0X61,0X63,0X74,0X22,0X20,0X6D,0X65,0X74,0X68,0X6F,0X64,0X3D,0X22,0X70,0X6F,0X73,0X74,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,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,0X68,0X69,0X64,0X64,0X65,0X6E,0X22,0X20,0X6E,0X61,0X6D,0X65,0X3D,0X22,0X69,0X74,0X79,0X70,0X65,0X22,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X22,0X25,0X73,0X70,0X69,0X6E,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,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,0X73,0X75,0X62,0X6D,0X69,0X74,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X62,0X74,0X6E,0X2D,0X6D,0X65,0X6E,0X75,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,0X20,0X20,0X20,0X20,0X3C,0X2F,0X66,0X6F,0X72,0X6D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,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,0XA,0X20,0X20,0X20,0X20,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,0X74,0X61,0X74,0X75,0X73,0X2F,0X25,0X73,0X69,0X6E,0X74,0X65,0X72,0X61,0X63,0X74,0X22,0X20,0X6D,0X65,0X74,0X68,0X6F,0X64,0X3D,0X22,0X70,0X6F,0X73,0X74,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,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,0X68,0X69,0X64,0X64,0X65,0X6E,0X22,0X20,0X6E,0X61,0X6D,0X65,0X3D,0X22,0X69,0X74,0X79,0X70,0X65,0X22,0X20,0X76,0X61,0X6C,0X75,0X65,0X3D,0X22,0X25,0X73,0X62,0X6F,0X6F,0X6B,0X6D,0X61,0X72,0X6B,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,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,0X73,0X75,0X62,0X6D,0X69,0X74,0X22,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X62,0X74,0X6E,0X2D,0X6D,0X65,0X6E,0X75,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,0X20,0X20,0X20,0X20,0X3C,0X2F,0X66,0X6F,0X72,0X6D,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X6C,0X69,0X3E,0XA,0X20,0X20,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,0X2F,0X75,0X6C,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,0X73,0X70,0X61,0X6E,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X64,0X69,0X76,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X73,0X70,0X61,0X6E,0X20,0X63,0X6C,0X61,0X73,0X73,0X3D,0X22,0X73,0X74,0X61,0X74,0X75,0X73,0X2D,0X63,0X6F,0X6E,0X74,0X65,0X6E,0X74,0X22,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X3C,0X2F,0X73,0X70,0X61,0X6E,0X3E,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X20,0X20,0X25,0X73,0XA,0X20,0X20,0X20,0X20,0X3C,0X2F,0X74,0X64,0X3E,0XA,0X20,0X20,0X3C,0X2F,0X74,0X72,0X3E,0XA,0X3C,0X2F,0X74,0X61,0X62,0X6C,0X65,0X3E,0}; +struct status_template {const char* status_id; +const char* focused; +const char* notif_info; +const char* avatar; +const char* username; +const char* prefix; +const char* acct; +const char* visibility; +const char* unmute; +const char* unmute_btn; +const char* unpin; +const char* unpin_btn; +const char* unbookmark; +const char* unbookmark_btn; +const char* delete_status; +const char* in_reply_to_str; +const char* status_content; +const char* attachments; +const char* interactions; +const char* emoji_reactions; +const char* interaction_btns; +}; +char* tmpl_gen_status(struct status_template* data, unsigned* size){ +char* ret; +unsigned s = easprintf(&ret, data_status, data->status_id?data->status_id:"", data->focused?data->focused:"", data->notif_info?data->notif_info:"", data->avatar?data->avatar:"", data->username?data->username:"", data->prefix?data->prefix:"", data->acct?data->acct:"", data->acct?data->acct:"", data->visibility?data->visibility:"", data->prefix?data->prefix:"", data->status_id?data->status_id:"", data->unmute?data->unmute:"", data->unmute_btn?data->unmute_btn:"", data->prefix?data->prefix:"", data->status_id?data->status_id:"", data->unpin?data->unpin:"", data->unpin_btn?data->unpin_btn:"", data->prefix?data->prefix:"", data->status_id?data->status_id:"", data->unbookmark?data->unbookmark:"", data->unbookmark_btn?data->unbookmark_btn:"", data->delete_status?data->delete_status:"", data->in_reply_to_str?data->in_reply_to_str:"", data->status_content?data->status_content:"", data->attachments?data->attachments:"", data->interactions?data->interactions:"", data->emoji_reactions?data->emoji_reactions:"", data->interaction_btns?data->interaction_btns:""); +if (size) *size = s; +return ret; +} +#endif diff --git a/static/status.html b/static/status.html deleted file mode 100644 index 0c8c5f7..0000000 --- a/static/status.html +++ /dev/null @@ -1,50 +0,0 @@ - - %s - - - - -
- - -
- %s - %s - - - -
- %s - - %s - - %s - %s - %s - %s -
diff --git a/static/status.tmpl b/static/status.tmpl new file mode 100644 index 0000000..3ed0ea8 --- /dev/null +++ b/static/status.tmpl @@ -0,0 +1,50 @@ + + {{ %s : notif_info }} + + + + +
+ + +
+ {{%s:username}} + {{%s:acct}} + + + +
+ {{%s:in_reply_to_str}} + + {{%s:status_content}} + + {{%s:attachments}} + {{%s:interactions}} + {{%s:emoji_reactions}} + {{%s:interaction_btns}} +