2 Commits

Author SHA1 Message Date
Storm Dragon fb897bd897 unbookmark added. Bookmarks implementation should be complete now. 2025-08-11 03:21:34 -04:00
Storm Dragon 3994cd2f46 Changed rtsof to boostsof, the command should actually work now. 2025-08-11 03:14:44 -04:00
+64 -14
View File
@@ -147,7 +147,7 @@ BEGIN {
# dmpause=0 # DM refresh rate (0=use main pause)
# === NOTIFICATIONS ===
# notificationpause=0 # Notification refresh rate (0=use main pause)
# notificationpause=2 # Notification refresh rate (0=every cycle, 2=default)
# === INTERACTION ===
# mentions=0 # Legacy flag (mentions included automatically)
@@ -256,7 +256,7 @@ EOF
dmupdate credurl blockurl blockdelurl muteurl mutedelurl friendsurl
modifyliurl adduliurl delliurl getliurl getlisurl getfliurl
creliurl delliurl deluliurl crefliurl delfliurl
getuliurl getufliurl dmsenturl reblogurl boostsbyurl dmidurl
getuliurl getufliurl dmsenturl reblogurl boostsbyurl bookmarkurl unbookmarkurl dmidurl
statusliurl followliurl leaveliurl followersurl
oauthurl oauthauthurl oauthaccurl oauthbase wtrendurl
atrendurl lookupidurl
@@ -282,7 +282,7 @@ EOF
nocounter linelength friendsurl followersurl lists
modifyliurl adduliurl delliurl getliurl getlisurl getfliurl
creliurl delliurl deluliurl crefliurl delfliurl atrendurl
getuliurl getufliurl dmsenturl reblogurl boostsbyurl wtrendurl
getuliurl getufliurl dmsenturl reblogurl boostsbyurl bookmarkurl unbookmarkurl wtrendurl
statusliurl followliurl leaveliurl dmidurl nostreamreplies
frupdurl filterusers filterats filterrts filterflags
filteratonly nofilter
@@ -388,6 +388,8 @@ EOF
$idurl = "${apibase}/statuses/%I";
$delurl = "${apibase}/statuses/%I";
$reblogurl = "${apibase}/statuses/%I/reblog";
$bookmarkurl = "${apibase}/statuses/%I/bookmark";
$unbookmarkurl = "${apibase}/statuses/%I/unbookmark";
$wurl = "${apibase}/accounts/%I";
$followurl = "${apibase}/accounts/%I/follow";
$leaveurl = "${apibase}/accounts/%I/unfollow";
@@ -691,7 +693,7 @@ if ($termrl && $termrl->ReadLine eq 'Term::ReadLine::Gnu') {
/listfriends /followers /following /dump /du /eval /ev
/version /update /versioncheck /updatecheck
/thread /th /entities /ent /delete
/deletelast /rtsof /vote /whois /w /me
/deletelast /boostsof /rtsof /bookmark /unbookmark /vote /whois /w /me
);
} else {
# Dynamic extraction from source code
@@ -1328,8 +1330,10 @@ $idurl ||= "${apibase}/statuses/%I";
$delurl ||= "${apibase}/statuses/%I";
$reblogurl ||= "${apibase}/statuses/%I/reblog";
$boostsbyurl ||= "${apibase}/statuses/%I/reblogged_by";
$bookmarkurl ||= "${apibase}/statuses/%I/bookmark";
$unbookmarkurl ||= "${apibase}/statuses/%I/unbookmark";
# Twitter endpoints removed - not available in fediverse
# $boostsbyurl: Use /api/v1/statuses/%I/reblogged_by instead
# $boostsofmeurl: No direct equivalent in fediverse (privacy feature)
$wurl ||= "${apibase}/accounts/%I";
@@ -1409,7 +1413,7 @@ $dmpause = 4 if (!defined $dmpause); # NOT ||= ... zero is a VALID value!
$dmpause = 0 if ($anonymous);
$dmpause = 0 if ($pause eq '0');
$dmmarkread = 1 if (!defined $dmmarkread); # Default to enabled
$notificationpause = 6 if (!defined $notificationpause); # NOT ||= ... zero is a VALID value!
$notificationpause = 2 if (!defined $notificationpause); # NOT ||= ... zero is a VALID value!
$notificationpause = 0 if ($anonymous);
$notificationpause = 0 if ($pause eq '0');
$notifies ||= 'boost,favourite,favorite'; # Default notification types for sound alerts (both spellings)
@@ -3191,6 +3195,8 @@ Example:
/url a5 - opens all URLs in post a5
/delete a5 - deletes post a5, if it's your post
/boost a5 - boosts post a5
/bookmark a5 - bookmarks post a5
/unbookmark a5 - removes bookmark from post a5
/vote a5 2 - vote for option 2 on poll in post a5
/vote a5 1,3 - vote for options 1 and 3 (if multiple choice)
/replyall a5 message - reply to all users mentioned in post a5
@@ -3933,8 +3939,7 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
if ($post->{'reblog'}->{'id_str'});
print $stdout "-- status boosted\n"
unless(&updatest($text, 1, 0, undef,
$post->{'reblog'}->{'id_str'}
|| $post->{'id_str'}));
$post->{'id_str'}));
return 0;
}
# we can't or user requested /ert /ort
@@ -3953,11 +3958,11 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
goto POSTPRINT; # fugly! FUGLY!
}
if (m#^/(re)?rts?of?me?(\s+\+\d+)?$# && !$noreblogs) {
if (m#^/(re)?(boosts|rts?)of?me?(\s+\+\d+)?$# && !$noreblogs) {
#TODO
# when more fields are added, integrate them over the JSON_ref
my $mode = $1;
my $countmaybe = $2;
my $countmaybe = $3;
$countmaybe =~ s/[^\d]//g if (length($countmaybe));
$countmaybe += 0;
@@ -3965,8 +3970,8 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
print $stdout "-- Sorry, fediverse doesn't provide 'reposts of me' (privacy feature)\n";
return 0;
}
if (m#^/rts?of\s+([zZ]?[a-zA-Z]?[0-9]+)$# && !$noreblogs) {
my $code = lc($1);
if (m#^/(boosts|rts?)of\s+([zZ]?[a-zA-Z]?[0-9]+)$# && !$noreblogs) {
my $code = lc($2);
my $post = &get_post($code);
my $id;
@@ -3997,6 +4002,22 @@ m#^/(un)?f(boost|a|av|ave|avorite|avourite)? ([zZ]?[a-zA-Z]?[0-9]+)$#) {
return 0;
}
# Bookmark/Unbookmark commands
if (m#^/(un)?bookmark ([zZ]?[a-zA-Z]?[0-9]+)$#) {
my $mode = $1;
my $code = lc($2);
my $post = &get_post($code);
if (!defined($post)) {
print $stdout "-- no such post (yet?): $code\n";
return 0;
}
&cordbookmark($post->{'id_str'}, 1,
(($mode eq 'un') ? $unbookmarkurl : $bookmarkurl),
&descape($post->{'text'}),
(($mode eq 'un') ? 'removed' : 'created'));
return 0;
}
# enable and disable NewRTs from users
# we allow this even if newRTs are off from -noreblogs
if (s#^/rts(on|off)\s+## && length) {
@@ -7390,6 +7411,31 @@ sub cordfav {
return $en;
}
# create or destroy a bookmark
sub cordbookmark {
my $id = shift;
my $interactive = shift;
my $basebookmark = shift;
my $text = shift;
my $verb = shift;
# Substitute the post ID into the URL template
my $bookmark_url = $basebookmark;
$bookmark_url =~ s/%I/$id/;
print $stdout "-- DEBUG: cordbookmark called with id=$id, url=$bookmark_url\n" if ($verbose);
my ($en, $em) = &central_cd_dispatch("id=$id", $interactive, $bookmark_url);
print $stdout "-- DEBUG: central_cd_dispatch returned en=$en, em=$em\n" if ($verbose);
if ($interactive) {
if (!$en) {
print $stdout "-- bookmark $verb for post id #${id}: \"$text\"\n";
} else {
print $stdout "*** (was the bookmark already ${verb}?)\n";
}
}
return $en;
}
# follow or unfollow a user
sub foruuser {
my $uname = shift;
@@ -8318,11 +8364,15 @@ sub sendnotifies { # this is a default subroutine of a sort, right?
my $notify_enabled = $notify_list{$class} ? 'YES' : 'NO';
print $stdout "-- DEBUG: notify_list{$class} = $notify_enabled\n" if ($verbose);
# Special debug for favorite notifications
# Special debug for favorite and mention notifications
if ($class eq 'favourite' || $class eq 'favorite') {
print $stdout "-- DEBUG: FAVORITE NOTIFICATION - class='$class', enabled=$notify_enabled, initial_load=$initial_load_in_progress\n";
print $stdout "-- DEBUG: notify_list keys: " . join(',', keys %notify_list) . "\n";
}
if ($class eq 'mention') {
print $stdout "-- DEBUG: MENTION NOTIFICATION - class='$class', enabled=$notify_enabled, initial_load=$initial_load_in_progress\n";
print $stdout "-- DEBUG: notify_list keys: " . join(',', keys %notify_list) . "\n";
}
# Send notification if we have a valid class, it's enabled, AND initial load is complete
if (length($class) && $notify_list{$class} && !$initial_load_in_progress) {
@@ -8626,7 +8676,7 @@ sub defaultautocompletion {
'/reply', '/url', '/thread', '/repost', '/replyall',
'/replies', '/timelines', '/timeline', '/visibility', '/ruler', '/exit', '/me', '/vcheck',
'/orepost', '/erepost', '/frepost', '/liston',
'/listoff', '/dmsent', '/rtsof', '/rtson', '/rtsoff',
'/listoff', '/dmsent', '/boostsof', '/rtsof', '/bookmark', '/unbookmark', '/rtson', '/rtsoff',
'/lists', '/withlist', '/add', '/padd', '/push',
'/pop', '/followers', '/following', '/friends', '/lfollow',
'/lleave', '/listfollowers', '/listfriends',