diff --git a/dist/treebird20.css b/dist/treebird20.css
index fc0fad1..9da9912 100644
--- a/dist/treebird20.css
+++ b/dist/treebird20.css
@@ -159,6 +159,18 @@ table.present th, table.present td
margin-top: 5px;
}
+.error
+{
+ display: block;
+ border-radius: 4px;
+ background-color: #fcb0b0;
+ color: #000;
+ border: 1px solid #bb1c1f;
+ padding: 15px;
+ margin: 5px;
+ font-weight: bold;
+}
+
/*************************************************
* BUTTONS *
*************************************************/
diff --git a/src/base_page.c b/src/base_page.c
index 4d1555a..1dfa009 100644
--- a/src/base_page.c
+++ b/src/base_page.c
@@ -35,8 +35,8 @@ void render_base_page(struct base_page* page, mastodont_t* api)
char* login_string = "";
char* sidebar_str = NULL;
// Mastodont, used for notifications sidebar
- struct mstdnt_storage storage;
- struct mstdnt_notification* notifs;
+ struct mstdnt_storage storage = { 0 };
+ struct mstdnt_notification* notifs = NULL;
size_t notifs_len;
if (!g_config.changed && cookie)
@@ -48,7 +48,7 @@ void render_base_page(struct base_page* page, mastodont_t* api)
}
// Get / Show notifications on sidebar
- if (cookies.logged_in)
+ if (cookies.logged_in && cookies.access_token)
{
struct mstdnt_get_notifications_args args = {
.exclude_types = 0,
diff --git a/src/lists.c b/src/lists.c
index d99926d..970dcab 100644
--- a/src/lists.c
+++ b/src/lists.c
@@ -21,6 +21,7 @@
#include "../config.h"
#include "account.h"
#include "easprintf.h"
+#include "error.h"
#include "status.h"
#include "lists.h"
#include "string_helpers.h"
@@ -71,17 +72,16 @@ void content_lists(mastodont_t* api, char** data, size_t size)
if (mastodont_get_lists(api, &lists, &storage, &size_list))
{
- lists_format = "An error occured while fetching lists";
+ lists_page = construct_error(storage.error, NULL);
}
else {
lists_format = construct_lists(lists, size_list, NULL);
if (!lists_format)
lists_format = "Error in malloc!";
cleanup = 1;
+ lists_page = construct_lists_view(lists_format, NULL);
}
- lists_page = construct_lists_view(lists_format, NULL);
-
struct base_page b = {
.locale = L10N_EN_US,
.content = lists_page,
diff --git a/src/page_config.c b/src/page_config.c
index 35d1f69..add29a6 100644
--- a/src/page_config.c
+++ b/src/page_config.c
@@ -43,7 +43,7 @@ void content_config(mastodont_t* api, char** data, size_t size)
struct base_page b = {
.locale = L10N_EN_US,
.content = data_config_html,
- .sidebar_left = NULL
+ .sidebar_left = data_config_sidebar_html
};
render_base_page(&b, api);
diff --git a/src/string_helpers.h b/src/string_helpers.h
index 77736b8..0305ba0 100644
--- a/src/string_helpers.h
+++ b/src/string_helpers.h
@@ -20,6 +20,9 @@
#define STRING_HELPERS_H
#include
+/** Returns str. If NULL, returns empty string */
+#define STR_NULL_EMPTY(str) ((str) ? (str) : "")
+
/**
* Constructs a string based on a function
*
diff --git a/src/timeline.c b/src/timeline.c
index 31cb7da..483207d 100644
--- a/src/timeline.c
+++ b/src/timeline.c
@@ -26,6 +26,7 @@
#include "reply.h"
#include "navigation.h"
#include "query.h"
+#include "string_helpers.h"
#include "../static/navigation.chtml"
@@ -33,10 +34,12 @@ void tl_public(mastodont_t* api, int local)
{
int cleanup = 0;
size_t status_count, statuses_html_count;
- struct mstdnt_status* statuses;
+ struct mstdnt_status* statuses = NULL;
struct mstdnt_storage storage = { 0 };
- char* status_format, *post_box, *navigation_box;
- char* output = NULL;
+ char* status_format = NULL,
+ *post_box,
+ *navigation_box = NULL,
+ *output = NULL;
char* start_id;
struct mstdnt_args args = {
@@ -63,16 +66,21 @@ void tl_public(mastodont_t* api, int local)
cleanup = 1;
}
- // If not set, set it
- start_id = post.start_id ? post.start_id : statuses[0].id;
-
// Create post box
post_box = construct_post_box(NULL, "", NULL);
- navigation_box = construct_navigation_box(start_id,
- statuses[0].id,
- statuses[status_count-1].id,
- NULL);
- easprintf(&output, "%s%s%s", post_box, status_format, navigation_box);
+ if (statuses)
+ {
+ // If not set, set it
+ start_id = post.start_id ? post.start_id : statuses[0].id;
+ navigation_box = construct_navigation_box(start_id,
+ statuses[0].id,
+ statuses[status_count-1].id,
+ NULL);
+ }
+ easprintf(&output, "%s%s%s",
+ post_box,
+ STR_NULL_EMPTY(status_format),
+ STR_NULL_EMPTY(navigation_box));
struct base_page b = {
.locale = L10N_EN_US,
diff --git a/static/config_sidebar.html b/static/config_sidebar.html
new file mode 100644
index 0000000..a298a8f
--- /dev/null
+++ b/static/config_sidebar.html
@@ -0,0 +1,4 @@
+
+
+
+