1
0
Эх сурвалжийг харах

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

default 2 жил өмнө
parent
commit
8823325bd9
1 өөрчлөгдсөн 17 нэмэгдсэн , 1 устгасан
  1. 17 1
      main.c

+ 17 - 1
main.c

@@ -27,7 +27,7 @@ int usage(void)
     printf("follow {basedir} {uid} {actor}      Follows an actor\n");
     printf("unfollow {basedir} {uid} {actor}    Unfollows an actor\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("resetpwd {basedir} {uid}            Resets the password of a user\n");
     printf("ping {basedir} {uid} {actor}        Pings an actor\n");
@@ -179,6 +179,22 @@ int main(int argc, char *argv[])
         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)) {
         printf("invalid user '%s'\n", user);
         return 1;