odin-cgi
23 months agomason/common/autohandler: Add an AGPL link to the HTML header. master
Mark Wooding [Thu, 12 May 2022 10:52:59 +0000 (11:52 +0100)]
mason/common/autohandler: Add an AGPL link to the HTML header.

6 years agomason/pastebin/%show: Don't flush FS buffers in `filter' child.
Mark Wooding [Tue, 14 Nov 2017 18:06:20 +0000 (18:06 +0000)]
mason/pastebin/%show: Don't flush FS buffers in `filter' child.

6 years agocgi/ip: Be a FastCGI program.
Mark Wooding [Sat, 8 Jul 2017 00:38:50 +0000 (01:38 +0100)]
cgi/ip: Be a FastCGI program.

Use Ian Jackson's `cgi-fcgi-interp' wrapper to make it happen.

6 years agocgi/ip: Fix header comment.
Mark Wooding [Sat, 8 Jul 2017 00:38:31 +0000 (01:38 +0100)]
cgi/ip: Fix header comment.

6 years agomason/common/autohandler: Include `X-AGPL-Source' header.
Mark Wooding [Fri, 7 Jul 2017 23:45:08 +0000 (00:45 +0100)]
mason/common/autohandler: Include `X-AGPL-Source' header.

For consistency with the `ip' service, which doesn't have anywhere else
to put the link.

6 years agoMake a licensing decision: it's all AGPLv3+.
Mark Wooding [Fri, 7 Jul 2017 21:23:16 +0000 (22:23 +0100)]
Make a licensing decision: it's all AGPLv3+.

  * Include the license.

  * Add copyright headers to all of the files.

  * Add a configuration tweak to say where the source lives.

  * Add links to the source where appropriate.

6 years agolib/Odin.pm: Fix default URLs.
Mark Wooding [Fri, 7 Jul 2017 21:21:27 +0000 (22:21 +0100)]
lib/Odin.pm: Fix default URLs.

  * We have proper HTTPS, and expect people to use it.

  * The static content is in a subdirectory for easier webserver
    configuration.

This reflects the actual deployed configuration.

6 years agobin/populate-lang-table, mason/pastebin/%show: Add Markdown support.
Mark Wooding [Mon, 10 Apr 2017 16:29:09 +0000 (17:29 +0100)]
bin/populate-lang-table, mason/pastebin/%show: Add Markdown support.

Set paranoid options and away we go.

6 years agomason/pastebin/%show: Factor out piping the content through a filter.
Mark Wooding [Mon, 10 Apr 2017 16:28:41 +0000 (17:28 +0100)]
mason/pastebin/%show: Factor out piping the content through a filter.

7 years agobin/populate-lang-table, mason/pastebin/%show: Segregate `highlight' languages.
Mark Wooding [Mon, 10 Apr 2017 14:54:51 +0000 (15:54 +0100)]
bin/populate-lang-table, mason/pastebin/%show: Segregate `highlight' languages.

Rename languages processed by `highlight' to be `hl:BLAH'.  This will
break existing deployments.  Benefit: now I can add new language tags
which don't interfere with `highlight'.

7 years agomason/pastebin/: Add `New' links to the `show' and `edit' pages.
Mark Wooding [Mon, 10 Apr 2017 14:50:38 +0000 (15:50 +0100)]
mason/pastebin/: Add `New' links to the `show' and `edit' pages.

7 years agocgi/ip: New simple service to print client's IP address.
Mark Wooding [Sat, 1 Apr 2017 10:11:49 +0000 (11:11 +0100)]
cgi/ip: New simple service to print client's IP address.

Supports IPv6. ;-)

7 years agobin/pastebin.userv: New `langs' subcommand prints language names.
Mark Wooding [Fri, 3 Feb 2017 10:53:28 +0000 (10:53 +0000)]
bin/pastebin.userv: New `langs' subcommand prints language names.

7 years agolib/Odin.pm: Provide substitutions on mail recipient addresses.
Mark Wooding [Mon, 27 Jun 2016 16:50:00 +0000 (17:50 +0100)]
lib/Odin.pm: Provide substitutions on mail recipient addresses.

The most useful thing is `%l' to include the original Odin local-part in
the forwarded address.  For completeness, we also have `%d' which is the
default domain-part.

7 years agolib/Odin.pm: Include `creator' when reserving addresses.
Mark Wooding [Mon, 27 Jun 2016 16:49:06 +0000 (17:49 +0100)]
lib/Odin.pm: Include `creator' when reserving addresses.

Otherwise reservation just fails immediately because I'm a stoat.

8 years agobin/pastebin.userv, lib/Odin.pm: Centralize language-tag checking.
Mark Wooding [Thu, 26 Nov 2015 15:45:28 +0000 (15:45 +0000)]
bin/pastebin.userv, lib/Odin.pm: Centralize language-tag checking.

Move the actual checking logic into the main library.  Do the checking
in both `new' and `update' operations.

8 years agobin/pastebin.userv: Don't throw the supplied content away.
Mark Wooding [Thu, 26 Nov 2015 15:44:33 +0000 (15:44 +0000)]
bin/pastebin.userv: Don't throw the supplied content away.

Oh, where do I start?  There's just so much edit debris here that it's
not funny.

8 years agobin/pastebin.userv: Correct usage and parsing for the `update' command.
Mark Wooding [Thu, 26 Nov 2015 15:25:58 +0000 (15:25 +0000)]
bin/pastebin.userv: Correct usage and parsing for the `update' command.

8 years agobin/pastebin.userv: Print the correct tag when making a new paste.
Mark Wooding [Thu, 26 Nov 2015 15:16:49 +0000 (15:16 +0000)]
bin/pastebin.userv: Print the correct tag when making a new paste.

8 years agoAllow users to give away local parts to other users.
Mark Wooding [Fri, 16 Oct 2015 10:05:34 +0000 (11:05 +0100)]
Allow users to give away local parts to other users.

Keep track of who created things initially so that we can track down
abuse if it occurs.

8 years agoMakefile: Set correct permissions on the Exim filter file.
Mark Wooding [Sun, 9 Aug 2015 16:04:17 +0000 (17:04 +0100)]
Makefile: Set correct permissions on the Exim filter file.

8 years agolib/Odin.pm, exim-filter.in: Force mail local parts to lower case.
Mark Wooding [Sun, 9 Aug 2015 16:00:49 +0000 (17:00 +0100)]
lib/Odin.pm, exim-filter.in: Force mail local parts to lower case.

This needs to be done both at generation time, and at lookup time.  Just
in case something tries to use upper-case letters.

8 years agoMerge branch 'master' of git://git.distorted.org.uk/~mdw/odin-cgi
Mark Wooding [Fri, 7 Aug 2015 06:56:29 +0000 (07:56 +0100)]
Merge branch 'master' of git://git.distorted.org.uk/~mdw/odin-cgi

* 'master' of git://git.distorted.org.uk/~mdw/odin-cgi:
  lib/Odin.pm: Alter `redir_query' to break ties by local part.
  bin/mailredir.userv, lib/Odin.pm: Modify multiple redirections at once.
  bin/mailredir.userv, lib/Odin.pm: Allocate multiple local parts at once.
  lib/Odin.pm: New function for parsing and checking integer arguments.

8 years agoexim-filter.in: Need fully qualified server name for some reason.
Mark Wooding [Fri, 7 Aug 2015 06:50:44 +0000 (07:50 +0100)]
exim-filter.in: Need fully qualified server name for some reason.

8 years agolib/Odin.pm: Alter `redir_query' to break ties by local part.
Mark Wooding [Tue, 4 Aug 2015 16:15:14 +0000 (17:15 +0100)]
lib/Odin.pm: Alter `redir_query' to break ties by local part.

Otherwise the order is unstable across database modifications, at least
with PostgreSQL.

8 years agobin/mailredir.userv, lib/Odin.pm: Modify multiple redirections at once.
Mark Wooding [Tue, 4 Aug 2015 16:13:47 +0000 (17:13 +0100)]
bin/mailredir.userv, lib/Odin.pm: Modify multiple redirections at once.

Allow multiple local parts to the `set' command, and alter the
`modify_redir' function to handle all of the changes in a single
transaction.

8 years agobin/mailredir.userv, lib/Odin.pm: Allocate multiple local parts at once.
Mark Wooding [Tue, 4 Aug 2015 16:12:26 +0000 (17:12 +0100)]
bin/mailredir.userv, lib/Odin.pm: Allocate multiple local parts at once.

Add a new `-n' option which requests multiple local parts.  The
`new_redir' function is modified to handle all of the requests as a
single database transaction.

8 years agolib/Odin.pm: New function for parsing and checking integer arguments.
Mark Wooding [Tue, 4 Aug 2015 16:10:44 +0000 (17:10 +0100)]
lib/Odin.pm: New function for parsing and checking integer arguments.

8 years agoNew things for a mail redirection service, with randomized local parts.
Mark Wooding [Fri, 24 Jul 2015 18:07:10 +0000 (19:07 +0100)]
New things for a mail redirection service, with randomized local parts.

This is a spiritual successor to my old `cryptomail.distorted.org.uk'
service, somewhat simplified, and heavily influenced by Ian
Jackson's (independent, I think) `evade.org.uk'/`fyvzl.net' service.

8 years agolib/Odin.pm: Leave reading user configuration to the very end.
Mark Wooding [Fri, 24 Jul 2015 17:54:01 +0000 (18:54 +0100)]
lib/Odin.pm: Leave reading user configuration to the very end.

The configuration file might want to call into the library for things.

8 years agolib/Odin.pm: New function for inserting records into databases.
Mark Wooding [Fri, 24 Jul 2015 17:52:12 +0000 (18:52 +0100)]
lib/Odin.pm: New function for inserting records into databases.

SQL `INSERT' is really annoying because it separates the list of column
names from the values.  Add a new function which takes column-name/value
pairs and sorts out the mess.

8 years agolib/Odin.pm, bin/*.userv: New function for printing tabular reports.
Mark Wooding [Fri, 24 Jul 2015 17:50:56 +0000 (18:50 +0100)]
lib/Odin.pm, bin/*.userv: New function for printing tabular reports.

8 years agolib/Odin.pm, mason/pastebin/dhandler: Apply a size limit on pastes.
Mark Wooding [Fri, 24 Jul 2015 17:46:40 +0000 (18:46 +0100)]
lib/Odin.pm, mason/pastebin/dhandler: Apply a size limit on pastes.

8 years agomason/pastebin/dhandler: Pick a better status code for `.badhash'.
Mark Wooding [Fri, 24 Jul 2015 17:45:28 +0000 (18:45 +0100)]
mason/pastebin/dhandler: Pick a better status code for `.badhash'.

8 years agosql/update-*-v2.sql: Scripts to upgrade existing database schemata.
Mark Wooding [Fri, 24 Jul 2015 17:58:24 +0000 (18:58 +0100)]
sql/update-*-v2.sql: Scripts to upgrade existing database schemata.

8 years agoStore Unix timestamps in the database, rather than SQL ones.
Mark Wooding [Fri, 24 Jul 2015 17:33:03 +0000 (18:33 +0100)]
Store Unix timestamps in the database, rather than SQL ones.

This will make doing calculations with them easier, and removes some
really annoying database-portability problems.

8 years agolib/Odin.pm, mason/common/autohandler: Track time of the current job.
Mark Wooding [Fri, 24 Jul 2015 17:35:21 +0000 (18:35 +0100)]
lib/Odin.pm, mason/common/autohandler: Track time of the current job.

8 years agolib/Odin.pm, bin/pastebin.userv: Use our own simple option parser.
Mark Wooding [Fri, 24 Jul 2015 17:00:32 +0000 (18:00 +0100)]
lib/Odin.pm, bin/pastebin.userv: Use our own simple option parser.

Perl's Getopt::Std doesn't let us handle options which are repeated.
Getopt::Long can do this, but it involves a lot of messing about to set
it up, and it has slightly bizarre option-cuddling behaviour.  So we
implement a very simple option parser and use it instead.

8 years agoThe official `plain text' language is `txt'.
Mark Wooding [Fri, 24 Jul 2015 17:41:45 +0000 (18:41 +0100)]
The official `plain text' language is `txt'.

Expunge the various references to our fictional `plain-text' language.

8 years agomason/pastebin/, static/odin.css: Cope if client doesn't send cookies.
Mark Wooding [Mon, 6 Jul 2015 11:36:22 +0000 (12:36 +0100)]
mason/pastebin/, static/odin.css: Cope if client doesn't send cookies.

Previously the edit key would just get lost.  Instead, detect the
situation and show a page with a fierce warning: because we can't hide
the edit key anywhere other than the actual page URL, the link is unsafe
to share, so it's important to make it obvious which link is safe.

8 years agomason/pastebin/dhandler: Some small refactorings.
Mark Wooding [Mon, 6 Jul 2015 11:34:33 +0000 (12:34 +0100)]
mason/pastebin/dhandler: Some small refactorings.

8 years agomason/pastebin/%show: The `edit' argument is never omitted.
Mark Wooding [Mon, 6 Jul 2015 11:29:40 +0000 (12:29 +0100)]
mason/pastebin/%show: The `edit' argument is never omitted.

So there's no point in making it optional.

8 years agouserv.rc: New example Userv configuration file.
Mark Wooding [Sat, 4 Jul 2015 16:57:44 +0000 (17:57 +0100)]
userv.rc: New example Userv configuration file.

8 years agosql/setup-shorturl.sql: Add index by (url, owner).
Mark Wooding [Sat, 4 Jul 2015 17:02:40 +0000 (18:02 +0100)]
sql/setup-shorturl.sql: Add index by (url, owner).

When we're trying to create a new entry, we search for an existing entry
for the same URL and a similar owner.  The index means we avoid having
to do a full scan of the table for this.

8 years agosql/setup-shorturl.sql: Drop old tables if they're missing.
Mark Wooding [Sat, 4 Jul 2015 17:00:45 +0000 (18:00 +0100)]
sql/setup-shorturl.sql: Drop old tables if they're missing.

8 years agosql/setup-pastebin.sql: Missing comma.
Mark Wooding [Sat, 4 Jul 2015 16:57:17 +0000 (17:57 +0100)]
sql/setup-pastebin.sql: Missing comma.

8 years agobin/populate-lang-table: Store description with new language.
Mark Wooding [Sat, 4 Jul 2015 16:56:50 +0000 (17:56 +0100)]
bin/populate-lang-table: Store description with new language.

Stupid bug fix.

8 years agoInitial commit.
Mark Wooding [Fri, 3 Jul 2015 19:23:08 +0000 (20:23 +0100)]
Initial commit.

Seems to work.  Mostly.