One-click software

FossilOrigin-Name: 8b33dfcad1b752e7aec7bd1bd8e36fe70fd4ab7d02760a63f5ee893631bb6147
This commit is contained in:
me@ow.nekobit.net 2022-04-04 18:23:07 +00:00
parent ac90e149ab
commit daec37ce50
9 changed files with 69 additions and 11 deletions

View File

@ -82,7 +82,8 @@ $(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 > $@
$(MASTODONT_DIR):
git clone $(MASTODONT_URL) || true

1
dist/svg/star-repeat.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg width="20" height="20" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g><g stroke-width="1.98"><path d="m19.15 8.5061 2.7598 2.7598-2.7598 2.7598"/><path d="m14.756 11.325s2.5484-0.05032 6.3258 0.01026m-15.639 10.807-2.7598-2.7598 2.7598-2.7598"/><path d="m22.4 15.327v1.2259c0 1.156-1.2356 2.7598-2.7598 2.7598h-16.664"/></g><polygon transform="matrix(.60736 0 0 .60736 .60106 .63577)" points="18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2 15.09 8.26 22 9.27 17 14.14" stroke-width="2.9656"/></g></svg>

After

Width:  |  Height:  |  Size: 641 B

19
dist/treebird20.css vendored
View File

@ -655,12 +655,19 @@ svg.in-reply-to-icon
position: relative;
}
.account-note
{
word-break: break-all;
}
.account-info
{
background: linear-gradient(#e4e4e4, #efefef);
color: #000;
padding: 2px 50px;
padding: 15px 50px;
border-bottom: 1px solid #cacaca;
max-height: 200px;
overflow: auto;
}
.acct-pfp
@ -726,7 +733,7 @@ svg.in-reply-to-icon
padding: 5px 20px;
border-radius: 24px;
background: inherit;
box-shadow: inset 0px 2px 5px rgba(0, 0, 0, 0.2);
box-shadow: inset 0px 0px 2px rgba(0, 0, 0, 0.2);
}
.follow-btnm.active
@ -779,6 +786,14 @@ svg.in-reply-to-icon
stroke: #fcd202;
}
.status-interact svg.like:hover,
.status-interact svg.like:active,
.status-interact svg.like:focus
{
stroke: #08d3a5;
pointer: select;
}
.status-interact svg.like:hover,
.status-interact svg.like:active,
.statis-interact svg.like:focus

View File

@ -27,6 +27,20 @@
// Files
#include "../static/index.chtml"
#include "../static/account.chtml"
#include "../static/account_info.chtml"
char* construct_account_info(struct mstdnt_account* acct,
size_t* size)
{
char* acct_info_html;
size_t s;
s = easprintf(&acct_info_html, data_account_info_html,
acct->note);
if (size) *size = s;
return acct_info_html;
}
char* construct_account_page(mastodont_t* api,
struct mstdnt_account* acct,
@ -37,6 +51,7 @@ char* construct_account_page(mastodont_t* api,
int cleanup = 0;
int result_size;
char* statuses_html;
char* info_html = NULL;
char* result;
// Load statuses html
@ -45,6 +60,11 @@ char* construct_account_page(mastodont_t* api,
statuses_html = "Error in malloc!";
else
cleanup = 1;
if (acct->note)
{
info_html = construct_account_info(acct, NULL);
}
result_size = easprintf(&result, data_account_html,
acct->header,
@ -57,6 +77,7 @@ char* construct_account_page(mastodont_t* api,
"Followers",
acct->followers_count,
acct->avatar,
info_html ? info_html : "",
statuses_html);
if (result_size == -1)
@ -64,6 +85,7 @@ char* construct_account_page(mastodont_t* api,
if (res_size) *res_size = result_size;
if (cleanup) free(statuses_html);
if (info_html) free(info_html);
return result;
}

View File

@ -22,6 +22,8 @@
#include <mastodont.h>
#include "session.h"
char* construct_account_info(struct mstdnt_account* acct,
size_t* size);
char* construct_account_page(mastodont_t* api,
struct mstdnt_account* acct,
struct mstdnt_status* statuses,

View File

@ -91,9 +91,12 @@ int try_interact_status(struct session* ssn, mastodont_t* api, char* id)
if (!(ssn->post.itype && id)) return 1;
// Pretty up the type
if (strcmp(ssn->post.itype, "like") == 0)
if (strcmp(ssn->post.itype, "like") == 0 ||
strcmp(ssn->post.itype, "likeboost") == 0)
mastodont_favourite_status(api, id, &storage, NULL);
else if (strcmp(ssn->post.itype, "repeat") == 0)
// Not else if because possibly a like-boost
if (strcmp(ssn->post.itype, "repeat") == 0 ||
strcmp(ssn->post.itype, "likeboost") == 0)
mastodont_reblog_status(api, id, &storage, NULL);
else if (strcmp(ssn->post.itype, "bookmark") == 0)
mastodont_bookmark_status(api, id, &storage, NULL);
@ -219,6 +222,7 @@ char* construct_status(mastodont_t* api,
emoji_reactions ? emoji_reactions : "",
config_url_prefix,
status->id,
status->id,
reply_count ? reply_count : "",
config_url_prefix,
status->id,
@ -232,6 +236,8 @@ char* construct_status(mastodont_t* api,
favourites_count ? favourites_count : "",
config_url_prefix,
status->id,
config_url_prefix,
status->id,
status->id);
if (size) *size = s;
@ -269,10 +275,11 @@ void status_interact(struct session* ssn, mastodont_t* api, char** data)
try_interact_status(ssn, api, data[0]);
printf("Status: 303 See Other\r\n"
"Location: %s\r\n"
"Location: %s#id-%s\r\n"
"Content-Length: 14\r\n\r\n"
"Redirecting...",
referer ? referer : "/");
referer ? referer : "/",
data[0]);
}
void status_view(struct session* ssn, mastodont_t* api, char** data)

View File

@ -27,9 +27,7 @@
<img class="acct-pfp" src="%s">
</div>
<div class="account-info">
<p>Hello world</p>
</div>
%s
<div class="account-content">
%s

3
static/account_info.html Normal file
View File

@ -0,0 +1,3 @@
<div class="account-info">
<div class="account-note">%s</div>
</div>

View File

@ -47,7 +47,7 @@
<table class="ui-table">
<tr>
<td>
<form action="%s/status/%s/reply" method="post">
<form action="%s/status/%s/reply#id-%s" method="post">
<label class="pointer">
<svg class="reply" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9l6 6-6 6"/><path d="M4 4v7a4 4 0 0 0 4 4h11"/></svg>
<span class="count">%s</span>
@ -75,6 +75,15 @@
</label>
</form>
</td>
<td>
<form action="%s/status/%s/interact" method="post">
<input type="hidden" name="itype" value="likeboost">
<label class="pointer">
<svg width="20" height="20" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g><g stroke-width="1.98"><path d="m19.15 8.5061 2.7598 2.7598-2.7598 2.7598"/><path d="m14.756 11.325s2.5484-0.05032 6.3258 0.01026m-15.639 10.807-2.7598-2.7598 2.7598-2.7598"/><path d="m22.4 15.327v1.2259c0 1.156-1.2356 2.7598-2.7598 2.7598h-16.664"/></g><polygon transform="matrix(.60736 0 0 .60736 .60106 .63577)" points="18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2 15.09 8.26 22 9.27 17 14.14" stroke-width="2.9656"/></g></svg>
<input class="hidden" type="submit" value="Like">
</label>
</form>
</td>
<td>
<form action="%s/status/%s#id-%s" method="post">
<label class="pointer">