diff --git a/src/l10n.h b/src/l10n.h index 39b31ce..c716113 100644 --- a/src/l10n.h +++ b/src/l10n.h @@ -74,6 +74,11 @@ enum l10n_string L10N_VIS_LOCAL, /* LOGIN */ + L10N_LOGIN, + L10N_REGISTER, + L10N_USERNAME, + L10N_PASSWORD, + L10N_LOGIN_BTN, L10N_LOGIN_HEADER, L10N_LOGIN_FAIL, @@ -143,6 +148,11 @@ static const char* const L10N[][_L10N_LEN] = { "Local", /* LOGIN */ + "Login", + "Register" + "Username", + "Password", + "Login", "Login / Register", "Couldn't login", @@ -209,6 +219,11 @@ static const char* const L10N[][_L10N_LEN] = { "Local", /* LOGIN */ + "Login", + "Register" + "Username", + "Password", + "Login", "Login / Register", "Couldn't login", diff --git a/src/login.c b/src/login.c index 956b945..9669ffa 100644 --- a/src/login.c +++ b/src/login.c @@ -70,11 +70,23 @@ void content_login(mastodont_t* api, char** data, size_t data_size) fputs("Status: 302 Found\r\n", stdout); printf("Set-Cookie: access_token=%s; Path=/; Max-Age=31536000\r\n", token.access_token); printf("Set-Cookie: logged_in=t; Path=/; Max-Age=31536000\r\n"); - printf("Location: %s/\r\n", config_url_prefix); + // if config_url_prefix is empty, make it root + printf("Location: %s/\r\n", + config_url_prefix[0] == '\0' ? + "/" : config_url_prefix); + return; } } - easprintf(&page, "%s%s", error ? error : "", data_login_html); + // Concat + easprintf(&page, data_login_html, + L10N[L10N_EN_US][L10N_LOGIN], + error ? error : "", + config_url_prefix, + L10N[L10N_EN_US][L10N_USERNAME], + L10N[L10N_EN_US][L10N_PASSWORD], + L10N[L10N_EN_US][L10N_LOGIN_BTN]); + struct base_page b = { .locale = L10N_EN_US, .content = page, diff --git a/src/notifications.c b/src/notifications.c index 864630e..cd380ac 100644 --- a/src/notifications.c +++ b/src/notifications.c @@ -37,20 +37,21 @@ char* construct_notification(struct mstdnt_notification* notif, int* size) char* construct_notification_compact(struct mstdnt_notification* notif, int* size) { char* notif_html; - char* notif_stats; + char* notif_stats = NULL; - easprintf(¬if_stats, "%d - %d - %d", - notif->status->replies_count, - notif->status->reblogs_count, - notif->status->favourites_count); + if (notif->status) + easprintf(¬if_stats, "%d - %d - %d", + notif->status->replies_count, + notif->status->reblogs_count, + notif->status->favourites_count); size_t s = easprintf(¬if_html, data_notification_compact_html, notif->account->avatar, notif->account->display_name, "interacted", - notif->status->content, - notif_stats); + notif->status ? notif->status->content : "", + notif_stats ? notif_stats : ""); if (size) *size = s; diff --git a/static/login.html b/static/login.html index 0f7f5b8..b60910b 100644 --- a/static/login.html +++ b/static/login.html @@ -1,17 +1,19 @@
-

Login

+

%s

-
+ %s + +
- +
- +
- +