diff --git a/blurp b/blurp index 5e56bed..7829230 100755 Binary files a/blurp and b/blurp differ diff --git a/blurp.go b/blurp.go index 6dab9b7..aad3e20 100644 --- a/blurp.go +++ b/blurp.go @@ -22,10 +22,12 @@ import ( ) var ( - user string // account username - weeks int // number of weeks of statuses to retain - rate int // requests per second - dry bool // whether or not to run in dry mode + user string // account username + weeks int // number of weeks of statuses to retain + rate int // requests per second + dry bool // whether or not to run in dry mode + skipFavourites bool // whether or not to skip deleting favourites + skipPinned bool // whether or not to skip deleting pinned statuses ) func init() { @@ -38,6 +40,8 @@ func init() { deleteCmd.Flags().IntVarP(&weeks, "weeks", "w", 2, "keep statuses NEWER than no. of weeks") deleteCmd.Flags().IntVarP(&rate, "rate", "r", 1, "send a request every 'r' seconds") deleteCmd.Flags().BoolVarP(&dry, "dry", "d", false, "dry run mode (NO DELETION)") + deleteCmd.Flags().BoolVarP(&skipFavourites, "skip-favourites", "f", false, "skip deletion of favourites") + deleteCmd.Flags().BoolVarP(&skipPinned, "skip-pinnned", "p", false, "skip deletion of pinned statuses") rootCmd.AddCommand(deleteCmd) } @@ -177,6 +181,11 @@ var deleteCmd = &cobra.Command{ os.Exit(1) } + if status.Favourited && skipFavourites { + slog.Info(fmt.Sprintf("skipping %s (skip favourites: %v)", status.ID, skipFavourites)) + continue + } + numHours := time.Duration(168 * weeks) if t.Before(time.Now().Add(-time.Hour * numHours)) { if !dry { @@ -275,6 +284,11 @@ func readAllPaged(authClient *auth.Client, accID string) ([]*models.Status, erro } params := &accounts.AccountStatusesParams{ID: accID, MaxID: maxID} + if skipPinned { + includePins := false + params.Pinned = &includePins + } + resp, err := authClient.Client.Accounts.AccountStatuses(params, authClient.Auth) if err != nil { slog.Error("error fetching page", "error", err)