Skip to content

Commit bc59325

Browse files
committed
Version 0.6.0; check Changelog
1 parent 4e6bc4e commit bc59325

File tree

15 files changed

+208
-212
lines changed

15 files changed

+208
-212
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SMServer
22

3-
![The iphone & web interfaces side by side](assets/smserver.png)
3+
<img src="assets/smserver.png" style="border-radius: 4px;"/>
44
<span style="font-weight: 200; font-size: 12px">The web interface shown with personal information blurred out</span>
55

66
**SMServer is an iPhone app, written in SwiftUI, which allows for one to send and receive text messages (and iMessages) from their Web browser**

assets/smserver.png

-662 KB
Loading

docs/API.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# API
22

3-
All non-image get requests are made to \<ip>:\<port>/requests. Requests for attachments are made to /attachments, and requests for profile images are made to /profile.
4-
5-
All post requests are directed to /send. In the latest version, this is the only way to send texts and/or attachments.
3+
All plain text GET requests must be made to \<ip>:\<port>/requests (e.g. 192.168.0.127:8741/requests). Requests for binary data (whether it be pictures from the camera roll, profile pictures, or attachments) must be sent to /data. All post requests must be directed to /send.
64

75
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.
86

97
# `/requests` requests:
108

119
All requests to `/requests` return JSON information.
1210

13-
## `person`, `num`, `offset`, `read`
11+
The below sections detail the query key/value pairs that you can combine to get the information you need from the API.
12+
13+
## `person`, `num`, `offset`, `read`, `from`
1414

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

@@ -23,9 +23,11 @@ $\qquad$ As of version 0.5.4, you may also send multiple addresses to this param
2323

2424
- read: Parameter is not necessary, but value is consequential. The value of this parameter must be a string, either `true` or `false`. If it is `true`, or the parameter is not included but the 'mark conversation as read when viewed on web interface' option is checked in the app's settings, the conversation whose messages are being requested will be marked as read on the host device.
2525

26+
- from: Parameter is not necessary, but value is consequential. The value of this parameter must be an int, either 0, 1, or 2. If you pass 0 for this key, this request will grab texts both to and from you in this conversation. If you pass 1 in for this key, it will grab only texts that are from you, and if you pass in 2, it will only grab texts that are to you.
27+
2628
Example queries:
2729
- /requests?person=chat192370112946281736&num=500
28-
- /requests?person=+15202621138
30+
- /requests?person=+15202621138&from=2
2931
- /requests?person=[email protected]&num=50&offset=100&read=false
3032
- /requests?person=[email protected]&offset=200
3133
- /requests?person=[email protected],+15202621138,[email protected]&num=100&read=true
@@ -117,44 +119,47 @@ Example queries:
117119

118120
# `/send` requests
119121

120-
Requests to this url are all sent using `POST`, are what are used to send texts and attachments. There are four arguments that can be sent to this, and it accepts multiple files as well. For the text to actually send, you must include the chat, and then either at least 1 file, or something that is more than 0 characters for one of the other parameters.
122+
Requests to this url are all sent using `POST`, as opposed to `GET`, as multipart/form-data forms (as opposed to application/x-www-form-urlencoded). In practice, it's generally safe to not encode anything in requests to this url, but only percent encodings (e.g. using `%20` for spaces and `%2B` for plus signs) will be accepted and parsed correctly. For example, replacing spaces with plus signs (as is specified in [RFC1738](https://www.ietf.org/rfc/rfc1738.txt) will cause the string to be used raw, and none of the plus signs will be replaced with spaces.
123+
124+
There are five key/value pairs that can be sent to this URL, and it accepts multiple files as well. For the text to actually send, you must include the chat, and then either at least 1 file, or something that is more than 0 characters for one of the other parameters.
121125

122126
As with all other requests (besides to the gatekeeper), you must authenticate before sending any requests to this url, or else nothing will happen.
123127

124128
## Arguments
125129

126130
## text
127131

128-
This argument contains the body of the text you want to send. This parameter is not necessary for every request
132+
The value for this key simply contains the body of the text you want to send.
129133

130134
## subject
131135

132-
This argument contains the subject of the text that you want to send. For it to actually be included with the text, it must be at least 1 character long (not just ""), and you must have the `Enable subject line in web interface (and API)` option toggled on in your app's settings. If it is 0-length or the subject setting is toggled off, the text will still be sent but it won't have a subject.
136+
The value for this key contains the subject of the text that you want to send. For it to actually be included with the text, it must be at least 1 character long (not just ""); if it is 0-length or you simply don't include this key/value pair, the text will still be sent but it won't have a subject.
133137

134138
## chat
135139

136-
This argument contains the chat_identifier of the recipient, specified as in the `person` parameter above. Before 0.1.0+debug77, these could only be an address for an existing conversation, but with version 0.1.0+debug77 of SMServer (and 0.1.0-85+debug of libsmserver), you can post requests for new conversations; new conversations do not yet support attachments, though.
140+
The value for this key contains the chat_identifier of the recipient, specified as in the `person` parameter above. Before 0.1.0+debug77, these could only be an address for an existing conversation, but with version 0.1.0+debug77 of SMServer (and 0.1.0-85+debug of libsmserver), you can post requests for new conversations; new conversations do not yet support attachments, though.
137141

138-
This parameter is necessary for every request, or else the app won't know who to send the text to. Also, plus signs should not be replaced with an escape character for these requests; they should stay plus signs.
142+
This parameter is necessary for every request, or else the app won't know who to send the text to.
139143

140144
## photos
141145

142-
This argument will contain a list of the path of the photos (from the camera roll) that you want to send with this text, but separated by colons and without the `/var/mobile/Media/` section of their path. For example, if you wanted to send three photos with this text, this parameter would look something like `DCIM/100APPLE/IMG_0001.JPG:DCIM/100APPLE/IMG_0002.JPG:DCIM/100APPLE/IMG_0003.JPG`.
146+
The value for this key will contain a list of the path of the photos (from the camera roll) that you want to send with this text, but deliminted by colons and without the `/var/mobile/Media/` section of their path. For example, if you wanted to send three photos with this text, this parameter would look something like `DCIM/100APPLE/IMG_0001.JPG:DCIM/100APPLE/IMG_0002.JPG:DCIM/100APPLE/IMG_0003.JPG`.
143147

144148
## files
145149

146-
These need to be sent with the key 'attachments'. Other than that, just send them as normal. It does support sending multiple attachments, but (obviously), the more attachments you send, the longer it'll take, and the higher likelihood it'll fail along the way.
150+
These need to be sent with the key 'attachments'. Other than that, just send them as normal. It does support sending multiple attachments, but (obviously), the more attachments you send, the longer it'll take, and the higher likelihood it'll fail along the way.
147151

148152
## Example requests
149153

150-
### Python3 &mdash;
154+
### Python3
151155

152156
Sending a text with a subject and no attachments:
153157
```python
154158
from requests import post
155159

156-
# It's safest to explicitly replace spaces with `%20`, since (last time I tested) python replaced
157-
# all spaces with plus signs, which are not filtered out.
160+
# It's safest to explicitly encode spaces as `%20`, since python replaces all spaces with plus signs,
161+
# which are not filtered out. If your scripting language does not replace spaces with plus signs,
162+
# you need not manually encode them.
158163
vals = {'text': 'Hello%20world!', 'subject': 'This%20is%20a%20test', 'chat': '[email protected]'}
159164
url = 'https://192.168.0.127:8741/send'
160165

@@ -176,6 +181,7 @@ url = 'https://192.168.0.127:8741/send'
176181
# The server's certificate is self-signed, so make to include the `verify` parameter in the request
177182
post(url, files=files_values, data=vals, verify=False)
178183
```
184+
I've read that the value for `attachments` in `files_values` could be a list of tuples (a list of variables like `file` in the example above), but doing that has caused python to fail to post the request every time I've tried it, so I would recommend just iterating over each attachment and sending them individually.
179185

180186
Sending a text with a subject and a photo from the camera roll:
181187
```python
@@ -190,6 +196,13 @@ url = 'https://192.168.0.127:8741/send'
190196
post(url, data=vals, verify=False)
191197
```
192198

193-
To be able to send a text with a subject, the `subject` variable in `vals` must not be empty, and you must have the option `Enable subject functionality` toggled on in the app
194-
195-
I've read that the value for `attachments` in `files_values` could be a list of tuples (a list of variables like `file`), but doing that has caused python to fail every time I've tried it, so I would recommend just iterating over each attachment and sending them individually.
199+
### Curl
200+
Sending a text with a body, subject, and attachments with curl
201+
```bash
202+
curl -k -F "attachments=@/home/user/Pictures/image1.png" \
203+
-F "attachments=@/home/user/Pictures/image2.png" \
204+
-F "text=Hello there" \
205+
-F "subject=Subject" \
206+
-F "chat=+11231231234" \
207+
"https://192.168.0.127:8741/send"
208+
```

docs/Changelog.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
# Changelog
22
0.5.4 &rightarrow; Unreleased
3-
- Made a new build script which makes it __much__ easier to build SMServer from scratch
3+
- Made a new build script which makes it __much__ easier and faster to build SMServer from scratch
44
- Added experimental option to combine conversations that belong to the same contact
5+
- Added Drag 'n' drop for attachments in the web interface
6+
- Added extra option in API to grab only texts to or from you in a certain conversation
57
- Changed cert and hid new password to prevent people from stealing private key
68
- Changed some glyphs in the web interface to look prettier
79
- Web interface now checks to make sure there are more texts to be loaded before adding a 'more texts' button
810
- Rewrote text-receiving backend to prevent race condition from duplicating texts in web interface
11+
- Downloaded attachments now have correct name and filetype
12+
- Web interface waits more accurately for attachments to fully upload before displaying the new text.
13+
- Fixed multiple issues with rich links displaying incorrectly or not at all
14+
- Fixed multiple issues with just-sent texts having incorrect attributes and thus causing weird graphical issues
15+
- Fixed issue with rich Links not showing reactions at all
916
- Fixed issue with duplicate typing indicators appearing in web interface
17+
- Fixed issue with file descriptor not appearing in text description when file didn't have a specific mimetype.
1018
- Fixed issue with profile picture displays getting cut off
1119
- Fixed issue with sender names in group chats appearing above time displays
1220
- Fixed issues with unread indicator displays
1321
- Fixed many issues with sender and time display placement in group chats
1422
- Fixed issue with links redirecting to the wrong site if they didn't have `http(s)://` prefix
23+
- Fixed padding issue within texts on Firefox
1524

1625
0.5.3 &rightarrow; 0.5.4
1726
- Texts now have prettier bubble tails and no tails when sent close after each other

docs/IMCore_and_ChatKit.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,15 @@ IMDaemonController* controller = [%c(IMDaemonController) sharedController];
4343

4444
/// Attempt to connect directly to the daemon
4545
if ([controller connectToDaemon]) {
46-
/// Send the code that you want it to run, basically
47-
[controller sendQueryWithReply:NO query: ^{
48-
/// Do your IMCore/ChatKit stuff here
49-
/// e.g. send a text, send a reaction, create a new conversation, etc
50-
}];
46+
/// Do your IMCore/ChatKit stuff here
47+
/// e.g. send a text, send a reaction, create a new conversation, etc
5148
} else {
5249
/// If it failed to connect to the daemon for whatever reason
5350
NSLog(@"Couldn't connect to daemon :(");
5451
}
5552
```
5653

57-
Now, this is the basic context that you need to interface with IMAgent and run your IMCore/ChatKit code. Now that we've got that out of the way, just assume that the rest of the code in this article is being run within the `query` block above unless explicitly stated otherwise.
54+
Now, this is the basic context that you need to interface with IMAgent and run your IMCore/ChatKit code. Now that we've got that out of the way, just assume that the rest of the code in this article is being run within the `if` block above unless it explicitly states otherwise.
5855

5956
## Sending a text
6057
&nbsp;&nbsp;&nbsp;&nbsp; This was, by far, the most crucial function to get working. A web interface to simply browse your texts but not send any wouldn't get anyone's interest. This also did take me a significantly long time to get working, but that was due mainly to my own inability to read. [This page](https://iphonedevwiki.net/index.php/ChatKit.framework) on the iPhoneDevWiki has basic information about how to send a text to a pre-existing conversation, but when I read through it, I missed the section that said *"Note that this will still only work from the MobileSMS process, even though `[CKConversationList sharedConversationList]` is NOT always null in other processes."* Once I set up IPC with libmryipc, I was able to send information through the IPC to the MobileSMS process to send the text. Now, however, since I connect directly to the IMDaemon, I don't need to inject into the MobileSMS process to send a text. \
@@ -86,8 +83,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
8683
});
8784
```
8885
89-
&nbsp;&nbsp;&nbsp;&nbsp; There is one caveat about the above code: It seemed to work fine on iOS 13, but when I've tried in on iOS 14, it appears that the sucess rate of sending an attachment drops to about ~20% or less. I don't know why this is, and as of October 17, 2020, I'm still working on figuring it out and making it work better. I'll try to update this document once I figure it out. \
90-
&nbsp;&nbsp;&nbsp;&nbsp; If you'd prefer not to use ChatKit, but rather pure IMCore, I've found another way to send a message using only IMCore, but I haven't yet figured out how to attach attachments to the message. Once again, I'll update this document once I do figure that out (if I ever do). Here's the code:
86+
&nbsp;&nbsp;&nbsp;&nbsp; If you'd prefer not to use ChatKit, but rather pure IMCore, I've found another way to send a message using only IMCore, but I haven't yet figured out how to attach attachments to the message. I'll update this document once I do figure that out (if I ever do). Here's the code:
9187
9288
```objectivec
9389
__NSCFString *address = (__NSCFString *)@"+11231231234"; /// Must have the full phone number. just "1231234" wont work.

docs/INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
`-n` if this is your first time running \
99
`-i` if you'd like to make a `.ipa` package \
1010
`-d` if you'd like to make a `.deb` package \
11-
`-v` if you'd like verbose output \
11+
`-v` if you'd like verbose output
1212

1313
For example, if you'd like to make a `.deb` package and you've never run this before, run `./make.sh -dn`

make.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ then
7070
-n, --new : Runs processes that only need to happen once, specifically creating a certificate
7171
and adding support swift files. You must run this at least once after cloning the
7272
repo or else it won't build.
73-
-d, --deb : Builds a .deb. Requires a jailbroken iDevice on the local network to ssh into to
74-
create the archive
73+
-d, --deb : Builds a .deb. Requires either the command line utility \033[1mdpkg\033[0m, or a jailbroken
74+
iDevice on the local network to ssh into to create the archive
7575
-i, --ipa : Builds a .ipa
7676
-v, --verbose : Runs verbose; doesn't hide any output
7777
-k, --keep : Don't remove extracted \033[1mSMServer.app\033[0m files when cleaning up
@@ -118,13 +118,10 @@ fi
118118
if [ "$deb" = true ] || [ "$ipa" = true ]
119119
then
120120
rm -rf ${ROOTDIR}/package/SMServer.xcarchive
121-
pn "\033[34m==>\033[0m Clean building package..."
122-
xcodebuild clean build -workspace ${ROOTDIR}/src/SMServer.xcworkspace -scheme SMServer -destination generic/platform=iOS
121+
pn "\033[34m==>\033[0m Cleaning and archiving package..."
122+
xcodebuild clean archive -workspace ${ROOTDIR}/src/SMServer.xcworkspace -scheme SMServer -archivePath ${ROOTDIR}/package/SMServer.xcarchive -destination generic/platform=iOS
123123

124-
[ $? -ne 0 ] && err "Failed to build package. Run again with \033[1m-v\033[0m to see why"
125-
126-
pn "\033[34m==>\033[0m Archiving package..."
127-
xcodebuild archive -workspace ${ROOTDIR}/src/SMServer.xcworkspace -scheme SMServer -archivePath ${ROOTDIR}/package/SMServer.xcarchive -destination generic/platform=iOS
124+
[ $? -ne 0 ] && err "Failed to archive package. Run again with \033[1m-v\033[0m to see why"
128125

129126
pn "\033[34m==>\033[0m Codesigning..."
130127
codesign --entitlements ${ROOTDIR}/src/app.entitlements -f -s "${DEV_CERT}" ${ROOTDIR}/package/SMServer.xcarchive/Products/Applications/SMServer.app
@@ -166,7 +163,7 @@ then
166163
then
167164
pn "\033[0mPlease enter your iDevice's \033[1mssh password\033[0;34m: " -n
168165
read -s THEOS_DEVICE_PASS
169-
echo "" # Just for the newline
166+
pn "" # Just for the newline
170167
fi
171168

172169

Binary file not shown.

0 commit comments

Comments
 (0)