The 'actor' command from the command-line allows non-signed queries.

This commit is contained in:
default 2023-12-10 10:36:14 +01:00
parent 90179f8459
commit 8823325bd9

18
main.c
View file

@ -27,7 +27,7 @@ int usage(void)
printf("follow {basedir} {uid} {actor} Follows an actor\n"); printf("follow {basedir} {uid} {actor} Follows an actor\n");
printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n");
printf("request {basedir} {uid} {url} Requests an object\n"); printf("request {basedir} {uid} {url} Requests an object\n");
printf("actor {basedir} {uid} {url} Requests an actor\n"); printf("actor {basedir} [{uid}] {url} Requests an actor\n");
printf("note {basedir} {uid} {'text'} Sends a note to followers\n"); printf("note {basedir} {uid} {'text'} Sends a note to followers\n");
printf("resetpwd {basedir} {uid} Resets the password of a user\n"); printf("resetpwd {basedir} {uid} Resets the password of a user\n");
printf("ping {basedir} {uid} {actor} Pings an actor\n"); printf("ping {basedir} {uid} {actor} Pings an actor\n");
@ -179,6 +179,22 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
if (argi == argc && strcmp(cmd, "actor") == 0) { /** **/
/* query an actor without user (non-signed) */
xs *actor = NULL;
int status;
status = actor_request(NULL, user, &actor);
printf("status: %d\n", status);
if (valid_status(status)) {
xs_json_dump(actor, 4, stdout);
printf("\n");
}
return 0;
}
if (!user_open(&snac, user)) { if (!user_open(&snac, user)) {
printf("invalid user '%s'\n", user); printf("invalid user '%s'\n", user);
return 1; return 1;