From 51fce03f59c43f496c8ef2473dc21709c0919473 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 14 May 2020 00:05:39 -0400 Subject: better-organized colophon/oddmuse --- colophon/oddmuse-config.md | 232 ------------------------------------------- colophon/oddmuse-version.md | 52 ---------- colophon/oddmuse.md | 14 +++ colophon/oddmuse/config | 151 ++++++++++++++++++++++++++++ colophon/oddmuse/omecp.pl | 1 + colophon/oddmuse/server.conf | 6 ++ colophon/oddmuse/server.pl | 55 ++++++++++ colophon/oddmuse/version.md | 52 ++++++++++ 8 files changed, 279 insertions(+), 284 deletions(-) delete mode 100644 colophon/oddmuse-config.md delete mode 100644 colophon/oddmuse-version.md create mode 100644 colophon/oddmuse.md create mode 100644 colophon/oddmuse/config create mode 100644 colophon/oddmuse/omecp.pl create mode 100644 colophon/oddmuse/server.conf create mode 100644 colophon/oddmuse/server.pl create mode 100644 colophon/oddmuse/version.md (limited to 'colophon') diff --git a/colophon/oddmuse-config.md b/colophon/oddmuse-config.md deleted file mode 100644 index 802358ad..00000000 --- a/colophon/oddmuse-config.md +++ /dev/null @@ -1,232 +0,0 @@ -## config - -

-# -*- mode: perl -*-
-use utf8; # this file contains utf8 strings.
-do "$ENV{OMHOME}/omecp.pl";
-
-$CookieName    = 'ECwiki';
-$SiteName      = 'EmacsConf';
-$HomePage      = 'main';
-$RCName        = "recent_changes";
-$FullUrl       = 'https://emacsconf.org';
-$ScriptName    = "$FullUrl";
-# $LogoUrl       = '/s/emacsconf-logo1-64.png';
-$StyleSheet    = '/s/ecom.css';
-$UploadAllowed = 1;
-
-#$SurgeProtectionTime = 10;
-#$SurgeProtectionViews = 50;
-
-# As we're now behind a caching proxy, the environment variable
-# REMOTE_ADDR is no longer what we want. We now want
-# HTTP_X_FORWARDED_FOR.
-$ENV{REMOTE_ADDR} = $ENV{HTTP_X_FORWARDED_FOR};
-
-$HtmlHeaders .= ''
-  . '';
-
-$SmartTitlesBrowserTitle = '%s - %s - %s';
-$SmartTitlesBrowserTitleWithoutSubtitle = '%s - %s';
-
-$FooterNote = '

Permission is granted to copy, distribute and/or -modify this document under the terms of the -GNU Free Documentation License, -Version 1.3 or any later version published by the -Free Software Foundation.

-

Colophon

'; - -$UrlProtocols .= "|data|xmpp"; - -@UserGotoBarPages = ($RCName); -# $UserGotoBar = '2019'; - -$UserGotoBarPrev = 'EmacsConf'; -sub GetGotoBar { - my $id = shift; - return $q->span({-class=>'gotobar bar'}, - $UserGotoBarPrev, - (map { GetPageLink($_) } @UserGotoBarPages), - $UserGotoBar); -} - -# Allow namespaces starting with a digit -# From https://github.com/kensanata/oddmuse/issues/19#issuecomment-503984930 -$InterSitePattern = '[\p{Uppercase}\d][\w_ ]*'; -# Redefine these as well if you change $InterSitePattern since InitLinkPatterns is called before InitConfig! -$InterLinkPattern = "($InterSitePattern:[-a-zA-Z0-9\x{0080}-\x{fffd}_=!?#\$\@~`\%&*+\\/:;.,]*[-a-zA-Z0-9\x{0080}-\x{fffd}_=#\$\@~`\%&*+\\/])$QDelim"; -$FreeInterLinkPattern = "($InterSitePattern:[-a-zA-Z0-9\x{0080}-\x{fffd}_=!?#\$\@~`\%&*+\\/:;.,()' ]+)"; - -# Link to author page at the root namespace -# From https://github.com/kensanata/oddmuse/issues/20#issuecomment-500402339 -sub GetAuthorLink { - my ($username, $host) = @_; - $username = FreeToNormal($username); - $username =~ s/^(?:$InterSitePattern:)?$FreeLinkPattern/$1/; - my $name = NormalToFree($username); - if (ValidId($username) ne '') { # ValidId() returns error string - $username = ''; # Just pretend it isn't there. - } - if ($username) { - local $ScriptName = $NamespacesRoot; - return ScriptLink(UrlEncode($username), $name, 'author'); - } - return T('Anonymous') if $host eq 'Anonymous'; - return ColorCode($host); -} - -# Fix visiting Main:X if the page doesn't exist but namespace X does. -# Redirect! -# From https://github.com/kensanata/oddmuse/issues/19#issuecomment-513640039 -push(@MyInitVariables, \&MyNamespacesFix); -sub MyNamespacesFix { - if (not GetParam('title', '') - and GetParam('action', 'browse') eq 'browse') { - my $id = FreeToNormal(GetId()); - if (not $NamespaceCurrent - and (not $IndexHash{$id} - or OpenPage($id) and PageMarkedForDeletion()) - and $Namespaces{$id}) { - print GetRedirectPage("$id/", NormalToFree($id)); - exit; - } - } -}; - -@QuestionaskerQuestions = - (['Please say HELLO.' => sub { - shift =~ /^\s*(hello*|hewo*|hi*|h(i|e)ya*)!*\s*$/i }], - ); - -# If enabling Markdown, to allow users to switch between Creole and Markdown -# see https://oddmuse.org/wiki/Creole_or_Markdown - -$CommentsPrefix = 'comments_on_'; - -# Add 'Back to ' prefix to the link back to the article -# with adaptation from https://oddmuse.org/wiki/Comments_on_Comment_Pages -*MyOldGetFooterLinks = *GetFooterLinks; -*GetFooterLinks = *MyNewGetFooterLinks; - -sub MyNewGetFooterLinks { - my $html = MyOldGetFooterLinks(@_); - my ($id, $rev) = @_; - if ($id and $rev ne 'history' and $rev ne 'edit' - and $CommentsPrefix) { - if ($id =~ /^$CommentsPrefix(.*)/o) { - my $from = NormalToFree($1); - my $to = T('Back to ') . $from; - $html =~ s/>$from$to! Colophon!; - return $html; -} - -# [[vid:addr]] rule for embedding videos -push(@MyRules, \&VidRule); - -sub VidRule{ - if (/\G\[\[vid:(\d+\/[a-z0-9-_\.]*)\]\]/cgi) { - my $vid = $1; - return qq{ -
-Download}; - } - return; -} - -# [[vidlink:addr]] rule for linking to videos -push(@MyRules, \&VidLinkRule); - -sub VidLinkRule{ - if (/\G\[\[vidlink:(\d+\/[a-z0-9-_\.]*)\|(.*)\]\]/cgi) { - my ($vid, $cap) = ($1, $2); - return qq{$cap}; - } - return; -} -
- -## server.conf - -```conf -{ - hypnotoad => { - listen => ['http://127.0.0.1:11937'], - workers => 10 - } -}; -``` - -## server.pl - -```perl -#!/usr/bin/env perl - -# Copyright (C) 2015-2016 Alex Schroeder - -# This program is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program. If not, see . - -use Mojolicious::Lite; - -# This needs to be in a different section, sometimes? -plugin CGI => { - support_semicolon_in_query_string => 1, -}; - -plugin CGI => { - # route => '/wiki', - route => '/', - # We need this for older versions of Mojolicious::Plugin::CGI - script => 'wiki.pl', - run => \&OddMuse::DoWikiRequest, - before => sub { - no warnings; - $OddMuse::RunCGI = 0; - # The default data directory is determined by the environment variable - # WikiDataDir and falls back to the following - # $OddMuse::DataDir = '/tmp/oddmuse'; - use warnings; - require './build/wiki.pl' unless defined &OddMuse::DoWikiRequest; - }, - env => { - "OMHOME" => "/home/omec" - }, - # path to where STDERR from cgi script goes - errlog => ($ENV{WikiDataDir} || '/tmp/oddmuse') - . "/wiki.log", -}; - -#plugin SetUserGroup => {user => "omec", group => "omec"}; - -#get '/' => sub { -# my $self = shift; -# $self->redirect_to('/wiki'); -#}; - -app->plugin('Config'); -app->start; -``` - -## ~/omecp.pl - -```perl -$AdminPass = 'redacted'; -``` diff --git a/colophon/oddmuse-version.md b/colophon/oddmuse-version.md deleted file mode 100644 index 35148145..00000000 --- a/colophon/oddmuse-version.md +++ /dev/null @@ -1,52 +0,0 @@ -
-wiki.pl (2.3.14-25-g2cba2d30), see Oddmuse
-
-anchors.pl (2.3.14-25-g2cba2d30), see Local Anchor Extension
-
-creole.pl (2.3.14-25-g2cba2d30), see Creole Markup Extension
-
-div-foo.pl (2.3.14-25-g2cba2d30), see Div Foo Extension
-
-image.pl (2.3.14-25-g2cba2d30), see Image Extension
-
-markup.pl (2.3.14-25-g2cba2d30), see Markup Extension
-
-namespaces.pl (2.3.14-25-g2cba2d30), see Namespaces Extension
-
-questionasker.pl (2.3.14-25-g2cba2d30), see QuestionAsker Extension
-
-smarttitles.pl (2.3.14-25-g2cba2d30), see Smarttitles Extension
-
-tables.pl (2.3.14-25-g2cba2d30), see Table Markup Extension
-
-Mojolicious::Plugin::CGI
-
-Perl v5.28.1
-
-no mod_perl
-
-CGI: 4.40
-
-LWP::UserAgent 6.36
-
-XML::RSS: 1.59
-
-XML::Parser: 2.44
-
-diff (GNU diffutils) 3.7
-Copyright (C) 2018 Free Software Foundation, Inc.
-License GPLv3+: GNU GPL version 3 or later .
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.
-
-Written by Paul Eggert, Mike Haertel, David Hayes,
-Richard Stallman, and Len Tower.
-
-diff3 (GNU diffutils) 3.7
-Copyright (C) 2018 Free Software Foundation, Inc.
-License GPLv3+: GNU GPL version 3 or later .
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.
-
-Written by Randy Smith.
-
diff --git a/colophon/oddmuse.md b/colophon/oddmuse.md new file mode 100644 index 00000000..8b719fc3 --- /dev/null +++ b/colophon/oddmuse.md @@ -0,0 +1,14 @@ +Our Oddmuse setup used a number of +[extensions](//oddmuse.org/wiki/Module) to add additional useful +features. Most notably, we used the +[Namespaces](//oddmuse.org/wiki/Namespaces_Extension) module to allow +creation of what are in effect sub-wikis for each conference year. + +Here's more information about our old Oddmuse setup, along with the +various configuration files we used to use: + +- [[Oddmuse extensions and their versions|oddmuse/version]] +- [[oddmuse/config]] file +- [[oddmuse/server.conf]] +- [[oddmuse/server.pl]] +- [[oddmuse/omecp.pl]] diff --git a/colophon/oddmuse/config b/colophon/oddmuse/config new file mode 100644 index 00000000..7ff1d54b --- /dev/null +++ b/colophon/oddmuse/config @@ -0,0 +1,151 @@ +# -*- mode: perl -*- +use utf8; # this file contains utf8 strings. +do "$ENV{OMHOME}/omecp.pl"; + +$CookieName = 'ECwiki'; +$SiteName = 'EmacsConf'; +$HomePage = 'main'; +$RCName = "recent_changes"; +$FullUrl = 'https://emacsconf.org'; +$ScriptName = "$FullUrl"; +# $LogoUrl = '/s/emacsconf-logo1-64.png'; +$StyleSheet = '/s/ecom.css'; +$UploadAllowed = 1; + +#$SurgeProtectionTime = 10; +#$SurgeProtectionViews = 50; + +# As we're now behind a caching proxy, the environment variable +# REMOTE_ADDR is no longer what we want. We now want +# HTTP_X_FORWARDED_FOR. +$ENV{REMOTE_ADDR} = $ENV{HTTP_X_FORWARDED_FOR}; + +$HtmlHeaders .= '' + . ''; + +$SmartTitlesBrowserTitle = '%s - %s - %s'; +$SmartTitlesBrowserTitleWithoutSubtitle = '%s - %s'; + +$FooterNote = '

Permission is granted to copy, distribute and/or +modify this document under the terms of the +GNU Free Documentation License, +Version 1.3 or any later version published by the +Free Software Foundation.

+

Colophon

'; + +$UrlProtocols .= "|data|xmpp"; + +@UserGotoBarPages = ($RCName); +# $UserGotoBar = '2019'; + +$UserGotoBarPrev = 'EmacsConf'; +sub GetGotoBar { + my $id = shift; + return $q->span({-class=>'gotobar bar'}, + $UserGotoBarPrev, + (map { GetPageLink($_) } @UserGotoBarPages), + $UserGotoBar); +} + +# Allow namespaces starting with a digit +# From https://github.com/kensanata/oddmuse/issues/19#issuecomment-503984930 +$InterSitePattern = '[\p{Uppercase}\d][\w_ ]*'; +# Redefine these as well if you change $InterSitePattern since InitLinkPatterns is called before InitConfig! +$InterLinkPattern = "($InterSitePattern:[-a-zA-Z0-9\x{0080}-\x{fffd}_=!?#\$\@~`\%&*+\\/:;.,]*[-a-zA-Z0-9\x{0080}-\x{fffd}_=#\$\@~`\%&*+\\/])$QDelim"; +$FreeInterLinkPattern = "($InterSitePattern:[-a-zA-Z0-9\x{0080}-\x{fffd}_=!?#\$\@~`\%&*+\\/:;.,()' ]+)"; + +# Link to author page at the root namespace +# From https://github.com/kensanata/oddmuse/issues/20#issuecomment-500402339 +sub GetAuthorLink { + my ($username, $host) = @_; + $username = FreeToNormal($username); + $username =~ s/^(?:$InterSitePattern:)?$FreeLinkPattern/$1/; + my $name = NormalToFree($username); + if (ValidId($username) ne '') { # ValidId() returns error string + $username = ''; # Just pretend it isn't there. + } + if ($username) { + local $ScriptName = $NamespacesRoot; + return ScriptLink(UrlEncode($username), $name, 'author'); + } + return T('Anonymous') if $host eq 'Anonymous'; + return ColorCode($host); +} + +# Fix visiting Main:X if the page doesn't exist but namespace X does. +# Redirect! +# From https://github.com/kensanata/oddmuse/issues/19#issuecomment-513640039 +push(@MyInitVariables, \&MyNamespacesFix); +sub MyNamespacesFix { + if (not GetParam('title', '') + and GetParam('action', 'browse') eq 'browse') { + my $id = FreeToNormal(GetId()); + if (not $NamespaceCurrent + and (not $IndexHash{$id} + or OpenPage($id) and PageMarkedForDeletion()) + and $Namespaces{$id}) { + print GetRedirectPage("$id/", NormalToFree($id)); + exit; + } + } +}; + +@QuestionaskerQuestions = + (['Please say HELLO.' => sub { + shift =~ /^\s*(hello*|hewo*|hi*|h(i|e)ya*)!*\s*$/i }], + ); + +# If enabling Markdown, to allow users to switch between Creole and Markdown +# see https://oddmuse.org/wiki/Creole_or_Markdown + +$CommentsPrefix = 'comments_on_'; + +# Add 'Back to ' prefix to the link back to the article +# with adaptation from https://oddmuse.org/wiki/Comments_on_Comment_Pages +*MyOldGetFooterLinks = *GetFooterLinks; +*GetFooterLinks = *MyNewGetFooterLinks; + +sub MyNewGetFooterLinks { + my $html = MyOldGetFooterLinks(@_); + my ($id, $rev) = @_; + if ($id and $rev ne 'history' and $rev ne 'edit' + and $CommentsPrefix) { + if ($id =~ /^$CommentsPrefix(.*)/o) { + my $from = NormalToFree($1); + my $to = T('Back to ') . $from; + $html =~ s/>$from$to! Colophon!; + return $html; +} + +# [[vid:addr]] rule for embedding videos +push(@MyRules, \&VidRule); + +sub VidRule{ + if (/\G\[\[vid:(\d+\/[a-z0-9-_\.]*)\]\]/cgi) { + my $vid = $1; + return qq{ +
+Download}; + } + return; +} + +# [[vidlink:addr]] rule for linking to videos +push(@MyRules, \&VidLinkRule); + +sub VidLinkRule{ + if (/\G\[\[vidlink:(\d+\/[a-z0-9-_\.]*)\|(.*)\]\]/cgi) { + my ($vid, $cap) = ($1, $2); + return qq{$cap}; + } + return; +} diff --git a/colophon/oddmuse/omecp.pl b/colophon/oddmuse/omecp.pl new file mode 100644 index 00000000..c7440144 --- /dev/null +++ b/colophon/oddmuse/omecp.pl @@ -0,0 +1 @@ +$AdminPass = 'redacted'; diff --git a/colophon/oddmuse/server.conf b/colophon/oddmuse/server.conf new file mode 100644 index 00000000..6d10a9d4 --- /dev/null +++ b/colophon/oddmuse/server.conf @@ -0,0 +1,6 @@ +{ + hypnotoad => { + listen => ['http://127.0.0.1:11937'], + workers => 10 + } +}; diff --git a/colophon/oddmuse/server.pl b/colophon/oddmuse/server.pl new file mode 100644 index 00000000..8f117219 --- /dev/null +++ b/colophon/oddmuse/server.pl @@ -0,0 +1,55 @@ +#!/usr/bin/env perl + +# Copyright (C) 2015-2016 Alex Schroeder + +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see . + +use Mojolicious::Lite; + +# This needs to be in a different section, sometimes? +plugin CGI => { + support_semicolon_in_query_string => 1, +}; + +plugin CGI => { + # route => '/wiki', + route => '/', + # We need this for older versions of Mojolicious::Plugin::CGI + script => 'wiki.pl', + run => \&OddMuse::DoWikiRequest, + before => sub { + no warnings; + $OddMuse::RunCGI = 0; + # The default data directory is determined by the environment variable + # WikiDataDir and falls back to the following + # $OddMuse::DataDir = '/tmp/oddmuse'; + use warnings; + require './build/wiki.pl' unless defined &OddMuse::DoWikiRequest; + }, + env => { + "OMHOME" => "/home/omec" + }, + # path to where STDERR from cgi script goes + errlog => ($ENV{WikiDataDir} || '/tmp/oddmuse') + . "/wiki.log", +}; + +#plugin SetUserGroup => {user => "omec", group => "omec"}; + +#get '/' => sub { +# my $self = shift; +# $self->redirect_to('/wiki'); +#}; + +app->plugin('Config'); +app->start; diff --git a/colophon/oddmuse/version.md b/colophon/oddmuse/version.md new file mode 100644 index 00000000..35148145 --- /dev/null +++ b/colophon/oddmuse/version.md @@ -0,0 +1,52 @@ +
+wiki.pl (2.3.14-25-g2cba2d30), see Oddmuse
+
+anchors.pl (2.3.14-25-g2cba2d30), see Local Anchor Extension
+
+creole.pl (2.3.14-25-g2cba2d30), see Creole Markup Extension
+
+div-foo.pl (2.3.14-25-g2cba2d30), see Div Foo Extension
+
+image.pl (2.3.14-25-g2cba2d30), see Image Extension
+
+markup.pl (2.3.14-25-g2cba2d30), see Markup Extension
+
+namespaces.pl (2.3.14-25-g2cba2d30), see Namespaces Extension
+
+questionasker.pl (2.3.14-25-g2cba2d30), see QuestionAsker Extension
+
+smarttitles.pl (2.3.14-25-g2cba2d30), see Smarttitles Extension
+
+tables.pl (2.3.14-25-g2cba2d30), see Table Markup Extension
+
+Mojolicious::Plugin::CGI
+
+Perl v5.28.1
+
+no mod_perl
+
+CGI: 4.40
+
+LWP::UserAgent 6.36
+
+XML::RSS: 1.59
+
+XML::Parser: 2.44
+
+diff (GNU diffutils) 3.7
+Copyright (C) 2018 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later .
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Paul Eggert, Mike Haertel, David Hayes,
+Richard Stallman, and Len Tower.
+
+diff3 (GNU diffutils) 3.7
+Copyright (C) 2018 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later .
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Randy Smith.
+
-- cgit v1.2.3