Modify

Opened 6 years ago

Closed 5 years ago

Last modified 17 months ago

#4029 closed enhancement (fixed)

Patches to enhance TracPastePlugin

Reported by: otaku42 Owned by: otaku42
Priority: normal Component: TracPastePlugin
Severity: normal Keywords:
Cc: dclark@…, rjollos Trac Release: 0.11

Description (last modified by otaku42)

Attached is a series of patches that improve TracPastePlugin and/or implement new features.

01_recent_pastes_configurable.patch
Default number of recent pastes that get displayed on the "main" pastebin page can be configured in trac.ini, section [pastebin], option default_recent (default: 10).
02_recent_pastes_rss_feed.patch
Allow to fetch list of recent pastes as RSS feed. This allows for example to let a Supybot announce new pastes in IRC channels. Similar to the timeline RSS feed, the number of items that get displayed in the feed can be adjusted using the max query parameter. The maximum amount of items that may be requested this way can be limited in trac.ini, section [pastebin], option max_recent (default: 30).
03_other_formats_configurable.patch
The Download in other formats functionality can be disabled in trac.ini, section [pastebin], option enable_other_formats (default: enabled). For example, this might help a little to prevent search engine spiders from getting HTML-ized spam pastes and using them to boost page rank of spamvertized sites.
04_other_formats_filter.patch
Allows finer-grained control over which pastes may be downloaded in other formats. Download is disabled if the MIME-type of a paste matches one of the filters defined in trac.ini, section [pastebin], option filter_other_formats. * may be used as wildcard.
05_use_same_formatter_in_reply.patch
When replying to a paste, the formatter that was used in the paste that is replied to will be pre-selected for the reply.
06_show_metadata.patch
Show additional information (Content-Type and formatter/highlighter) when viewing a paste.
07_rename_permission.patch
Rename permission PASTEBIN_USE to PASTEBIN_VIEW. Introduce new permission PASTEBIN_ADMIN.
08_finegrained_permission.patch
Implement fine-grained permissions for creating new pastes (PASTEBIN_CREATE) and replying to existing ones (PASTEBIN_REPLY). PASTEBIN_CREATE and PASTEBIN_REPLY both include the PASTEBIN_VIEW permission.
09_delete_pastes.patch
Introduce new permission PASTEBIN_DELETE; users with this permission are allowed to delete pastes.
10_turing_test.patch
Implements a simple turing test that might help against spambots. A new field is added to the form that's used for creating pastes. Pastes will not be accepted if anything is filled into this field; the idea behind it is that many spambots will fill each field of a form, and thus can be identified this way. The field is hidden with CSS, and for cases where CSS is not supported a clear warning is displayed along with the field. This feature can be disabled in trac.ini, section [pastebin], option turing_test. It's enabled by default.

I have some more patches in my queue which I will add to this ticket over time. Comments and suggestions welcome.

Attachments (11)

01_recent_pastes_configurable.patch (1.2 KB) - added by otaku42 6 years ago.
02_recent_pastes_rss_feed.patch (4.7 KB) - added by otaku42 6 years ago.
03_other_formats_configurable.patch (2.4 KB) - added by otaku42 6 years ago.
04_other_formats_filter.patch (3.9 KB) - added by otaku42 6 years ago.
05_use_same_formatter_in_reply.patch (464 bytes) - added by otaku42 6 years ago.
06_show_metadata.patch (2.2 KB) - added by otaku42 6 years ago.
07_rename_permission.patch (1021 bytes) - added by otaku42 6 years ago.
08_finegrained_permissions.patch (5.3 KB) - added by otaku42 6 years ago.
09_delete_pastes.patch (4.0 KB) - added by otaku42 6 years ago.
10_turing_test.patch (3.2 KB) - added by otaku42 6 years ago.
10_turing_test_for_r6222.patch.gz (1.2 KB) - added by dclark 5 years ago.
Turning test patch updated for current svn version (gzipped to get past spam filter)

Download all attachments as: .zip

Change History (24)

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

Changed 6 years ago by otaku42

comment:1 follow-up: Changed 6 years ago by osimons

I've quickly skimmed through the patches:

  • 01-06 looks generally useful and adds nice improvements to the features and configuration.
  • 07-09 mostly deals with permissions, but I think I'd want the core of these patches implemented using the resource system instead. Certainly anything with fine-grained permissions should have pastes as resources to allow other plugins to implement permission policies that also filter pastes.
  • 10 i'm not so keen on. All other plugins that deal with spam implement optional plugins to the trac:SpamFilter plugin, so that if you have that installed then it will also automatically check the entered pastes. That means implementing something like an IPasteManipulator interface to allow other plugins to hook into the paste creation and potentially veto the changes. An IPasteListener would also be nice while you are at it... :-)

comment:2 Changed 6 years ago by osimons

Oops. Missed one comment: The 02-RSS feature should really be a timeline provider - providing items to the general timeline of the project. I really don't see the point of a separate paste-only feed.

comment:3 in reply to: ↑ 1 Changed 6 years ago by otaku42

Replying to osimons:

I've quickly skimmed through the patches:

Thanks for your feedback.

  • 07-09 mostly deals with permissions, but I think I'd want the core of these patches implemented using the resource system instead.

Although I have hacked some Trac plugins, I'm unexperienced when it comes to the more advanced features that Trac offers. Can you please advise where I can find more details about the changes you're suggesting here? Pointing to another plugin that implements the things the way you've described above would be enough for a start, I think.

  • 10 ... That means implementing something like an IPasteManipulator interface to allow other plugins to hook into the paste creation

Agreed. Patch 10 is meant as a quick and dirty solution that just works, until I figure out how to implement a more general interface to the spamfilter plugin.

An IPasteListener would also be nice while you are at it... :-)

That would allow other plugins to react on newly posted pastes, right?

Replying to osimons:

The 02-RSS feature should really be a timeline provider - providing items to the general timeline of the project.

Ack, that's actually on my to do list already. Patch 2 was my original motivation to start working on this plugin; I've implemented it to allow pastes to be announced in a IRC support channel by a Supybot that I run.

comment:4 Changed 6 years ago by osimons

My FullBlogPlugin I suppose already have all these features - posts as resources, fine-grained permissions, timeline feed for all details, search provider, optional spamfilter module, and both manipulator and listener interfaces to make these integrations possible ++. See its source (including the sample plugins). There should be enough hints in there to get you started :-)

comment:5 in reply to: ↑ description Changed 6 years ago by otaku42

  • Owner changed from mitsuhiko to otaku42

Replying to otaku42:

01_recent_pastes_configurable.patch ...
03_other_formats_configurable.patch ...
04_other_formats_filter.patch ...
05_use_same_formatter_in_reply.patch ...
06_show_metadata.patch ...

Committed in r4885, r4886, r4887, r4888 and r4889 respectively.

comment:6 Changed 6 years ago by otaku42

  • Status changed from new to assigned

comment:7 in reply to: ↑ description Changed 6 years ago by otaku42

Replying to otaku42:

02_recent_pastes_rss_feed.patch ...

Voided by r4892.

comment:8 Changed 5 years ago by dclark

  • Cc dclark@… added; anonymous removed

Going to give #10 a try to see if it helps with paste spam I've been getting recently. Adding name to cc: list as I'm interested in any updates to this ticket.

Changed 5 years ago by dclark

Turning test patch updated for current svn version (gzipped to get past spam filter)

comment:9 Changed 5 years ago by dclark

Updated 10_turing_test.patch to work against current svn - 10_turing_test_for_r6222.patch.gz - note that the css to hide the turning test works under icecat (firefox) 3.0.11, but not under 3.5.

Last edited 17 months ago by rjollos (previous) (diff)

comment:10 Changed 5 years ago by anonymous

  • Cc rjollos added

comment:11 in reply to: ↑ description Changed 5 years ago by otaku42

Replying to otaku42:

07_rename_permission.patch ...
08_finegrained_permission.patch ...

r4983

09_delete_pastes.patch ...

r4984

10_turing_test.patch ...

That's the only patch of the series that's left open. I'm tending to replace it with an implementation of such a feature following osimmon's suggestion above (plugging it into the spamfilter framework). But I won't have the time for that anytime soon, it seems :(

comment:12 follow-up: Changed 5 years ago by lkraav

  • Description modified (diff)

since only patch 10 is left to be implemented, perhaps we can close this ticket and move spam filtering implementation to a new ticket?

comment:13 in reply to: ↑ 12 Changed 5 years ago by otaku42

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from assigned to closed

Replying to lkraav:

since only patch 10 is left to be implemented, perhaps we can close this ticket and move spam filtering implementation to a new ticket?

Good point. Closing this ticket as fixed, spam filter integration has been moved to #6144.

Add Comment

Modify Ticket

Action
as closed The owner will remain otaku42.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.