diff --git a/Slon/Api/V1/Statuses.HC b/Slon/Api/V1/Statuses.HC
index 7645a11..12999f2 100644
--- a/Slon/Api/V1/Statuses.HC
+++ b/Slon/Api/V1/Statuses.HC
@@ -94,7 +94,7 @@ JsonArray* @slon_api_v1_statuses_lookup_descendants_by_id(U8* id, JsonArray* sta
JsonObject* @slon_api_v1_statuses_find_by_id(U8* id, U8* account_id)
{
- if (!id || !account_id) {
+ if (!id) {
return NULL;
}
JsonObject* status = NULL;
@@ -103,6 +103,9 @@ JsonObject* @slon_api_v1_statuses_find_by_id(U8* id, U8* account_id)
if (status) {
return status;
}
+ if (!account_id) {
+ return NULL;
+ }
// Then, lookup in home timeline
status = @slon_api_v1_statuses_lookup_by_id(id, db->o("timelines")->o("home")->a(account_id));
if (status) {
@@ -274,23 +277,24 @@ U0 @slon_api_v1_statuses_delete(SlonHttpSession* session)
U0 @slon_api_v1_statuses_get(SlonHttpSession* session)
{
+
+ if (session->path_count() < 4) {
+ session->status(400);
+ return;
+ }
+
+ if (session->path_count() > 4 && !StrICmp("history", session->path(4))) {
+ // NOTE: We probably won't support this any time soon
+ session->send(SLON_EMPTY_JSON_ARRAY);
+ return;
+ }
+
+ U8* id = session->path(3);
+ JsonObject* status = NULL;
+
if (@slon_api_authorized(session)) {
SLON_AUTH_ACCOUNT_ID
- if (session->path_count() < 4) {
- session->status(400);
- return;
- }
-
- if (session->path_count() > 4 && !StrICmp("history", session->path(4))) {
- // NOTE: We probably won't support this any time soon
- session->send(SLON_EMPTY_JSON_ARRAY);
- return;
- }
-
- U8* id = session->path(3);
- JsonObject* status = NULL;
-
if (session->path_count() > 4 && !StrICmp("context", session->path(4))) {
JsonObject* context = Json.CreateObject();
context->set("ancestors", Json.CreateArray(), JSON_ARRAY);
@@ -321,7 +325,12 @@ U0 @slon_api_v1_statuses_get(SlonHttpSession* session)
}
session->status(404);
} else {
- session->status(401);
+ status = @slon_api_v1_statuses_find_by_id(id, NULL);
+ if (status) {
+ session->send(status);
+ return;
+ }
+ session->status(404);
}
}
diff --git a/Slon/Modules/Web.HC b/Slon/Modules/Web.HC
index c0b683b..322f370 100644
--- a/Slon/Modules/Web.HC
+++ b/Slon/Modules/Web.HC
@@ -7,36 +7,37 @@ U0 @slon_web_user_get(SlonHttpSession* session)
U8** path_segments = String.Split(StrFind("@", session->path()) + 1, '/', &path_segments_count);
U8* user = path_segments[0];
-
- if (path_segments_count == 1) {
- JsonObject* actor = db->o("actors")->@(user);
- if (!actor) {
- session->status(404);
- goto slon_web_user_get_return;
- }
- // gib profil pl0x
-
- I64 html_file_size;
- U8* html_file_data = FileRead("M:/Slon/Static/html/user.html", &html_file_size);
- U8* user_file_data = Json.Stringify(actor);
-
- U8* html_data = @slon_calloc(session, (html_file_size * 2) + (StrLen(user_file_data) * 2));
- String.Append(html_data, html_file_data);
- String.Append(html_data, "");
- session->content_type("text/html");
- session->send(html_data, StrLen(html_data));
-
- Free(html_file_data);
- Free(user_file_data);
- @slon_free(session, html_data);
- goto slon_web_user_get_return;
- } else {
- // do something here (statuses, followers, media, etc.)
+ JsonObject* actor = db->o("actors")->@(user);
+ if (!actor) {
session->status(404);
+ goto slon_web_user_get_return;
}
+ I64 html_file_size;
+ U8* html_file_data = FileRead("M:/Slon/Static/html/user.html", &html_file_size);
+ U8* user_file_data = Json.Stringify(actor);
+
+ U8* html_data = @slon_calloc(session, (html_file_size * 2) + (StrLen(user_file_data) * 2));
+ String.Append(html_data, html_file_data);
+
+ switch (path_segments_count) {
+ case 1:
+ String.Append(html_data, "");
+ session->content_type("text/html");
+ session->send(html_data, StrLen(html_data));
+
+ Free(html_file_data);
+ Free(user_file_data);
+ @slon_free(session, html_data);
+
slon_web_user_get_return:
Free(path_segments);
}
diff --git a/Slon/Static/html/user.html b/Slon/Static/html/user.html
index 061b048..90af979 100644
--- a/Slon/Static/html/user.html
+++ b/Slon/Static/html/user.html
@@ -26,4 +26,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Slon/Static/js/statuses.js b/Slon/Static/js/statuses.js
index 5903cdb..3de61ff 100644
--- a/Slon/Static/js/statuses.js
+++ b/Slon/Static/js/statuses.js
@@ -23,7 +23,7 @@ function updateStatusContainers() {
let desc = "Term";
for (var y = 0; y < height; y++) {
- let ch = y < 4 ? desc[y] : "\u2551";
+ let ch = y < 4 ? desc[y] : "\u2551";
post_html += "" + ch + "\u2551
";
}
@@ -38,7 +38,7 @@ function updateStatusContainers() {
}
}
-function smolDate(a){return a.split(" ago")[0].replace("a ","1").replace("an ","1").replace("days","d").replace("day","d").replace("hours","h").replace("hour","h").replace("minutes","m").replace("minute","m").replace("seconds","s").replace("second","s").replace("few","").replace(" ","")};
+function smolDate(a) { return a.split(" ago")[0].replace("a ", "1").replace("an ", "1").replace("days", "d").replace("day", "d").replace("hours", "h").replace("hour", "h").replace("minutes", "m").replace("minute", "m").replace("seconds", "s").replace("second", "s").replace("few", "").replace(" ", "") };
function updateStatuses(user, statuses) {
let pageContent = document.getElementsByClassName("page-content")[0];
@@ -54,7 +54,7 @@ function updateStatuses(user, statuses) {
content_html += "