forked from mirrors/treebird
Notifications base
FossilOrigin-Name: 33576b114c13138c386df1a1c65c45a6e045586363edd398d78a4e84cdf10687
This commit is contained in:
parent
40348e7a6b
commit
c407aac8ce
8 changed files with 94 additions and 2 deletions
8
Makefile
8
Makefile
|
@ -54,6 +54,14 @@ $(PAGES_DIR)/emoji_reaction.chtml: $(PAGES_DIR)/emoji_reaction.html
|
|||
./filec $< data_emoji_reaction_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.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 > $@
|
||||
|
||||
$(MASTODONT_DIR):
|
||||
git clone $(MASTODONT_URL) || true
|
||||
|
|
|
@ -32,12 +32,11 @@
|
|||
#include "status.h"
|
||||
#include "lists.h"
|
||||
#include "timeline.h"
|
||||
#include "notifications.h"
|
||||
#include "test.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Content type is always HTML
|
||||
|
||||
// Global init
|
||||
mastodont_global_curl_init();
|
||||
|
||||
|
@ -69,6 +68,7 @@ int main(void)
|
|||
{ "/lists", content_lists },
|
||||
{ "/federated", content_tl_federated },
|
||||
{ "/local", content_tl_local },
|
||||
{ "/notifications", content_notifications },
|
||||
};
|
||||
|
||||
handle_paths(&api, paths, sizeof(paths)/sizeof(paths[0]));
|
||||
|
|
50
src/notifications.c
Normal file
50
src/notifications.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Treebird - Lightweight frontend for Pleroma
|
||||
* Copyright (C) 2022 Nekobit
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "notifications.h"
|
||||
#include "base_page.h"
|
||||
#include "string_helpers.h"
|
||||
#include "easprintf.h"
|
||||
|
||||
// Pages
|
||||
#include "../static/notifications_page.chtml"
|
||||
|
||||
static char* construct_notifications_voidwrap(void* passed, size_t index, int* res)
|
||||
{
|
||||
return construct_notifications((struct mstdnt_notification*)passed + index, res);
|
||||
}
|
||||
|
||||
char* construct_notifications(struct mstdnt_notification* notifs, size_t size, size_t* ret_size)
|
||||
{
|
||||
return construct_func_strings(construct_notifications_voidwrap, notifs, size, ret_size);
|
||||
}
|
||||
|
||||
void content_notifications(mastodont_t* api, char** data, size_t data_size)
|
||||
{
|
||||
|
||||
|
||||
struct base_page b = {
|
||||
.locale = L10N_EN_US,
|
||||
.content = data_notifications_page_html,
|
||||
.sidebar_right = NULL
|
||||
};
|
||||
|
||||
// Output
|
||||
render_base_page(&b);
|
||||
}
|
||||
|
25
src/notifications.h
Normal file
25
src/notifications.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Treebird - Lightweight frontend for Pleroma
|
||||
* Copyright (C) 2022 Nekobit
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NOTIFICATIONS_H
|
||||
#define NOTIFICATIONS_H
|
||||
#include <mastodont.h>
|
||||
|
||||
void content_notifications(mastodont_t* api, char** data, size_t data_size);
|
||||
|
||||
#endif // NOTIFICATION_H
|
1
static/notification.html
Normal file
1
static/notification.html
Normal file
|
@ -0,0 +1 @@
|
|||
notif
|
1
static/notification_compact.html
Normal file
1
static/notification_compact.html
Normal file
|
@ -0,0 +1 @@
|
|||
notif_compact
|
3
static/notifications.html
Normal file
3
static/notifications.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<ul class="notifications-container">
|
||||
|
||||
</ul>
|
4
static/notifications_page.html
Normal file
4
static/notifications_page.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div class="simple-page">
|
||||
<h1>Notifications</h1>
|
||||
%s
|
||||
</div>
|
Loading…
Reference in a new issue