Skip to content

Commit aa42294

Browse files
committed
Fixed API information
1 parent bc59325 commit aa42294

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

docs/API.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,29 @@ All plain text GET requests must be made to \<ip>:\<port>/requests (e.g. 192.168
44

55
All request parameters require a value, but only some of the values are consequential. However, the app will not interpret a parameter as a parameter unless it has an accompanying value -- For example, to retrieve the list of conversations, one must make a request to /requests with a parameter of 'chat', but 'GET /requests?chat' will return nothing. Something like 'GET /requests?chat=0' will return the correct information.
66

7+
Requests to all of these API endpoints besides `/requests?password` will return nothing, unless you authenticate first, at `/requests?password`. Details are under the first subsection of the `/requests` requests
8+
79
# `/requests` requests:
810

9-
All requests to `/requests` return JSON information.
11+
All requests to `/requests` besides `?password` return JSON information. `?password` returns plain text.
1012

1113
The below sections detail the query key/value pairs that you can combine to get the information you need from the API.
1214

15+
## `password`
16+
17+
Authenticates with the server, so that you can retrieve more information from it.
18+
19+
- password: Parameter is necessary, and value is consequential. If yoyou pass in the same password as is specified in the main view of the app, it will return `false` as plain text. If it is the same password, it will return `true`, and you will be able to make further requests to other API endpoints.
20+
21+
Example queries:
22+
- /requests?password=toor
23+
1324
## `person`, `num`, `offset`, `read`, `from`
1425

1526
Retrieves the most recent \$num messages to or from \$person, offset by \$offset.
1627

17-
- person: parameter is necessary, and value is consequential; must be chat_identifier of conversation. chat_identifier will be the email address or phone number of an individual, or the chat_identifier for a group chat (normally the string 'chat' followed by 16-20 numerical digits). chat_identifiers for group chats and email addresses must be exact, and phone numbers must include the entire phone number (including country codes, area codes, and other identifiers where necessary), with a plus sign at the beginning, e.g. "+16378269173". Using parentheses or dashes will mess it up and return nothing. \
18-
$\qquad$ As of version 0.5.4, you may also send multiple addresses to this parameter, separated by single commas, and it will return a merged text list with all of the texts from the listed addresses included. This can be useful if you'd like to treat multiple conversations as one, such as if you have multiple conversations for talking with one person.
28+
- person: Parameter is necessary, and value is consequential; must be chat_identifier of conversation. chat_identifier will be the email address or phone number of an individual, or the chat_identifier for a group chat (normally the string 'chat' followed by 16-20 numerical digits). chat_identifiers for group chats and email addresses must be exact, and phone numbers must include the entire phone number (including country codes, area codes, and other identifiers where necessary), with a plus sign at the beginning, e.g. "+16378269173". Using parentheses or dashes will mess it up and return nothing.
29+
&nbsp;&nbsp;&nbsp;&nbsp; As of version 0.5.4, you may also send multiple addresses to this parameter, separated by single commas, and it will return a merged text list with all of the texts from the listed addresses included. This can be useful if you'd like to treat multiple conversations as one, such as if you have multiple conversations for talking with one person.
1930

2031
- num: Parameter is not necessary, but value is consequential. The value of this parameter must be an integer, and will be the number of most recent messages that are returned from the app. If it is 0, it will return all the messages to or from this person, and if it is not specified, it will use the default number of messages on the app, which is currently 100 at the time of writing this.
2132

docs/Changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
2-
0.5.4 &rightarrow; Unreleased
2+
0.6.0 &rightarrow; 0.6.1
3+
- Fixed issue that would offset sender names in `printListOfTexts` when `append` was false
4+
- Fixed font-weight display issues
5+
6+
0.5.4 &rightarrow; 0.6.0
37
- Made a new build script which makes it __much__ easier and faster to build SMServer from scratch
48
- Added experimental option to combine conversations that belong to the same contact
59
- Added Drag 'n' drop for attachments in the web interface
Binary file not shown.

src/SMServer/ChatDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ final class ChatDelegate {
820820
}
821821

822822
if text["room_name"]?.count ?? 0 > 0 && text["is_from_me"] == "0" {
823-
let name = getDisplayNameWithDb(sms_db: db, contact_db: contact_db, chat_id: text["chat_identifier"] ?? "")
823+
let name = getDisplayNameWithDb(sms_db: db, contact_db: contact_db, chat_id: text["handle_id"] ?? "")
824824
text["sender"] = name
825825
}
826826

src/SMServer/html/chats.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@
460460
var orig = null; /// if you do insertBefore(node, null), it just appends.
461461
if (!append) {
462462
orig = document.getElementById(ft[0].id);
463-
for (var j = 1; j < ft.length && orig.id === ft[0].id; j++) orig = orig.nextSibling;
463+
while (orig !== null && orig !== undefined && orig.id === ft[0].id) orig = orig.nextSibling;
464464
}
465465

466466
if (add_spacer)

src/SMServer/html/style.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ html {
5050
p, h2, a, button {
5151
font-family: var(--main-font);
5252
text-decoration: none;
53-
font-weight: 300;
5453
}
5554
:focus {
5655
outline: none !important;
@@ -354,7 +353,6 @@ i#chargingSymbol {
354353
font-family: var(--main-font);
355354
max-width: 40vw;
356355
margin: 2px 0;
357-
font-weight: 300;
358356
font-size: 18px;
359357
padding: 7px 12px;
360358
line-height: 21px; /* Specific but that's what it is */
@@ -380,7 +378,6 @@ i#chargingSymbol {
380378
}
381379
.sender {
382380
font-size: 14px;
383-
font-weight: lighter;
384381
margin: 10px 0 0 5px;;
385382
color: #bbb;
386383
}
@@ -506,7 +503,6 @@ i#chargingSymbol {
506503
grid-row: 1;
507504
border-radius: calc(var(--send-box-size) / 2);
508505
margin: auto 0;
509-
font-weight: 300;
510506
}
511507
#sendbox.subjectInput {
512508
border-radius: 0 0 calc(var(--send-box-size) / 2) calc(var(--send-box-size) / 2);

0 commit comments

Comments
 (0)