diff options
| author | 2023-12-10 10:36:14 +0100 | |
|---|---|---|
| committer | 2023-12-10 10:36:14 +0100 | |
| commit | 8823325bd93afd05370ce175edde90beaaef027e (patch) | |
| tree | ba625e7f1b2798d2119551dfc03955f653110f8c /main.c | |
| parent | activitypub_request() may have a NULL user. (diff) | |
| download | penes-snac2-8823325bd93afd05370ce175edde90beaaef027e.tar.gz penes-snac2-8823325bd93afd05370ce175edde90beaaef027e.tar.xz penes-snac2-8823325bd93afd05370ce175edde90beaaef027e.zip | |
The 'actor' command from the command-line allows non-signed queries.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 18 |
1 files changed, 17 insertions, 1 deletions
| @@ -27,7 +27,7 @@ int usage(void) | |||
| 27 | printf("follow {basedir} {uid} {actor} Follows an actor\n"); | 27 | printf("follow {basedir} {uid} {actor} Follows an actor\n"); |
| 28 | printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); | 28 | printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); |
| 29 | printf("request {basedir} {uid} {url} Requests an object\n"); | 29 | printf("request {basedir} {uid} {url} Requests an object\n"); |
| 30 | printf("actor {basedir} {uid} {url} Requests an actor\n"); | 30 | printf("actor {basedir} [{uid}] {url} Requests an actor\n"); |
| 31 | printf("note {basedir} {uid} {'text'} Sends a note to followers\n"); | 31 | printf("note {basedir} {uid} {'text'} Sends a note to followers\n"); |
| 32 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); | 32 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); |
| 33 | printf("ping {basedir} {uid} {actor} Pings an actor\n"); | 33 | printf("ping {basedir} {uid} {actor} Pings an actor\n"); |
| @@ -179,6 +179,22 @@ int main(int argc, char *argv[]) | |||
| 179 | return 0; | 179 | return 0; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | if (argi == argc && strcmp(cmd, "actor") == 0) { /** **/ | ||
| 183 | /* query an actor without user (non-signed) */ | ||
| 184 | xs *actor = NULL; | ||
| 185 | int status; | ||
| 186 | |||
| 187 | status = actor_request(NULL, user, &actor); | ||
| 188 | |||
| 189 | printf("status: %d\n", status); | ||
| 190 | if (valid_status(status)) { | ||
| 191 | xs_json_dump(actor, 4, stdout); | ||
| 192 | printf("\n"); | ||
| 193 | } | ||
| 194 | |||
| 195 | return 0; | ||
| 196 | } | ||
| 197 | |||
| 182 | if (!user_open(&snac, user)) { | 198 | if (!user_open(&snac, user)) { |
| 183 | printf("invalid user '%s'\n", user); | 199 | printf("invalid user '%s'\n", user); |
| 184 | return 1; | 200 | return 1; |