diff options
| author | 2024-09-20 10:47:14 +0200 | |
|---|---|---|
| committer | 2024-09-20 10:47:14 +0200 | |
| commit | 2d2a685ec8bb30452fbf66025391f34f2bd03685 (patch) | |
| tree | 0da1501b7a71e4ca13dd24ceb744b9bf569e94cf /main.c | |
| parent | Move migration work. (diff) | |
| download | snac2-2d2a685ec8bb30452fbf66025391f34f2bd03685.tar.gz snac2-2d2a685ec8bb30452fbf66025391f34f2bd03685.tar.xz snac2-2d2a685ec8bb30452fbf66025391f34f2bd03685.zip | |
More migration work.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 16 |
1 files changed, 12 insertions, 4 deletions
| @@ -47,8 +47,8 @@ int usage(void) | |||
| 47 | printf("unlimit {basedir} {uid} {actor} Unlimits an actor\n"); | 47 | printf("unlimit {basedir} {uid} {actor} Unlimits an actor\n"); |
| 48 | printf("verify_links {basedir} {uid} Verifies a user's links (in the metadata)\n"); | 48 | printf("verify_links {basedir} {uid} Verifies a user's links (in the metadata)\n"); |
| 49 | printf("search {basedir} {uid} {regex} Searches posts by content\n"); | 49 | printf("search {basedir} {uid} {regex} Searches posts by content\n"); |
| 50 | printf("alias {basedir} {uid} {account} Sets account (@user@host or actor url) as an alias\n"); | ||
| 51 | printf("export_csv {basedir} {uid} Exports data as CSV files into current directory\n"); | 50 | printf("export_csv {basedir} {uid} Exports data as CSV files into current directory\n"); |
| 51 | printf("alias {basedir} {uid} {account} Sets account (@user@host or actor url) as an alias\n"); | ||
| 52 | printf("migrate {basedir} {uid} Migrates to the account defined as the alias\n"); | 52 | printf("migrate {basedir} {uid} Migrates to the account defined as the alias\n"); |
| 53 | 53 | ||
| 54 | return 1; | 54 | return 1; |
| @@ -292,12 +292,20 @@ int main(int argc, char *argv[]) | |||
| 292 | status = webfinger_request(url, &actor, &uid); | 292 | status = webfinger_request(url, &actor, &uid); |
| 293 | 293 | ||
| 294 | if (valid_status(status)) { | 294 | if (valid_status(status)) { |
| 295 | snac.config = xs_dict_set(snac.config, "alias", actor); | 295 | if (strcmp(actor, snac.actor) == 0) { |
| 296 | snac_log(&snac, xs_fmt("You can't be your own alias")); | ||
| 297 | return 1; | ||
| 298 | } | ||
| 299 | else { | ||
| 300 | snac.config = xs_dict_set(snac.config, "alias", actor); | ||
| 296 | 301 | ||
| 297 | user_persist(&snac, 1); | 302 | user_persist(&snac, 1); |
| 303 | } | ||
| 298 | } | 304 | } |
| 299 | else | 305 | else { |
| 300 | snac_log(&snac, xs_fmt("Webfinger error for %s %d", url, status)); | 306 | snac_log(&snac, xs_fmt("Webfinger error for %s %d", url, status)); |
| 307 | return 1; | ||
| 308 | } | ||
| 301 | 309 | ||
| 302 | return 0; | 310 | return 0; |
| 303 | } | 311 | } |