From: b Date: Sun, 24 Sep 2023 15:18:54 +0000 (+0000) Subject: Adapted for new config tool. X-Git-Tag: v1.0.0~65 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=f59f43da0c55e42fad09a6c34f15b0e923730c2a;p=botm%2Foldlogs Adapted for new config tool. --- diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f0c8ec2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "config"] + path = config + url = ../../botm/config +[submodule "exec"] + path = exec + url = ../../botm/exec diff --git a/2words.1.c b/2words.1.c deleted file mode 100644 index 5fd947a..0000000 --- a/2words.1.c +++ /dev/null @@ -1,34 +0,0 @@ -// 2words.c is generated from 2words.1.c -// 28.09.2016 -// -// This is the wrapper for 2words.pl. -// It's run with SETUID to have accesss to some files where the www server -// should not. That's why it has a C wrapper. In modern systems running scripts -// directly with SETUID is considered unsafe and not allowed. -// -// Copyright (C) 2016 Balthasar Szczepański -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero 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 Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include -#include - -###TWOWORDS_PL; -###TWOWORDS_PL_ERRLOG; - -int main(int argc, char *argv[], char *envp[]) -{ - freopen(TWOWORDS_PL_ERRLOG,"at",stderr); - return execve(TWOWORDS_PL,argv,envp); -} diff --git a/2words.1.pl b/2words.1.pl index 590d88b..03ef99f 100644 --- a/2words.1.pl +++ b/2words.1.pl @@ -1,54 +1,59 @@ -###PERL; -# +###RUN_PERL: #!/usr/bin/perl + # /bsta/2words # 2words is generated from 2words.1.pl. -# 09.01.2023 # # The wordgame interface # -# Copyright (C) 2016 - 2017, 2023 Balthasar Szczepański +# Copyright (C) 2016 - 2017, 2023 Balthasar Szczepański # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero 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 free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# 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 Affero General Public License for more details. # -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . use strict; #use warnings; -###LIB; +###PERL_LIB: use lib /botm/lib/bsta use bsta_lib qw(failpage gethttpheader getcgi entityencode readdatafile writedatafile urlencode bb2ht); use File::Copy; -###STORY_PATH; -###LOGO_PATH; -###FAVICON_PATH; -###WEBSITE; -###WEBSITE_NAME; -###CSS_PATH; -###TWOWORDS_PATH; -###CGI_PATH; -###SETTINGS_PATH; -###INDEX_PATH; -###INTF_DATE; -###DATA_PATH; -###VIEWER_PATH; -###DEFAULT_PATH; -###STATE_PATH; -###WWW_PATH; -###STORY_LENGTH; -###PAGE_LENGTH; -###FIRSTPAGE_LENGTH; -###COIN_PATH; -###COIN_DATE; -###LIST_PATH; +###PERL_CGI_PATH: CGI_PATH = /bsta/ +###PERL_CGI_2WORDS_PATH: CGI_2WORDS_PATH = /bsta/2words +###PERL_CGI_CSS_PATH: CGI_CSS_PATH = /bsta/bsta.css +###PERL_CGI_LOGO_PATH: CGI_LOGO_PATH = /bsta/botmlogo.png +###PERL_CGI_VIEWER_PATH: CGI_VIEWER_PATH = /bsta/v + +###PERL_DATA_PATH: DATA_PATH = /botm/data/bsta/ +###PERL_DATA_COIN_PATH: DATA_COIN_PATH = /botm/data/bsta/coincidence +###PERL_DATA_DEFAULT_PATH: DATA_DEFAULT_PATH = /botm/data/bsta/default +###PERL_DATA_LIST_PATH: DATA_LIST_PATH = /botm/data/bsta/list +###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings +###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state +###PERL_DATA_STORY_PATH: DATA_STORY_PATH = /botm/data/bsta/story + +###PERL_WWW_PATH: WWW_PATH = /botm/www/1190/bsta/ +###PERL_WWW_INDEX_PATH: WWW_INDEX_PATH = /botm/www/1190/bsta/index.htm + +###PERL_WEBSITE: WEBSITE = 1190.bicyclesonthemoon.info +###PERL_WEBSITE_NAME: WEBSITE_NAME = Bicycles on the Moon +###PERL_FAVICON_PATH: FAVICON_PATH = /img/favicon.png + +###PERL_COIN_DATE: COIN_DATE = 13-Nov-2016 22:15 +###PERL_INTF_DATE: INTF_DATE = 28-Sep-2016 20:34 + +###PERL_STORY_LENGTH: STORY_LENGTH = 16 +###PERL_PAGE_LENGTH: PAGE_LENGTH = 16 +###PERL_FIRSTPAGE_LENGTH: FIRSTPAGE_LENGTH = 4 + my %http; my %cgi; @@ -84,7 +89,7 @@ my $page; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; -###PATH; +###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin; if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) { $method=$1; @@ -130,12 +135,12 @@ if ($cgi{'words'} ne '') { $words=$cgi{'words'}; } -%settings=readdatafile(SETTINGS_PATH); -%state=readdatafile(STATE_PATH); +%settings=readdatafile(DATA_SETTINGS_PATH); +%state=readdatafile(DATA_STATE_PATH); $ongstate=int($state{'state'}); $storylock=0; -if (open ($storyfile,"+<",STORY_PATH)){ +if (open ($storyfile,"+<",DATA_STORY_PATH)){ $storylock=1; if (flock($storyfile,2)) { $storylock=2; @@ -176,7 +181,7 @@ if (open ($storyfile,"+<",STORY_PATH)){ $story{'state'}='0'; $turn=0; if($ongstate == 0) { - writeindex(INDEX_PATH,0,0,0); + writeindex(WWW_INDEX_PATH,0,0,0); } writedatafile($storyfile,%story); } @@ -204,7 +209,7 @@ if (open ($storyfile,"+<",STORY_PATH)){ if ($cgi{'next'} ne '') { if (split(/\r?\n/,$story{'content'}) >= (STORY_LENGTH-1)) { - $storypath = STORY_PATH.$storyid; + $storypath = DATA_STORY_PATH.$storyid; writedatafile($storypath,%story); $newstory{'id'} = $storyid + 1; $newstory{'letter'}=''; @@ -217,7 +222,7 @@ if (open ($storyfile,"+<",STORY_PATH)){ $intfmode=0; $intfpause=0; if($ongstate == 0) { - writeindex(INDEX_PATH,0,0,0); + writeindex(WWW_INDEX_PATH,0,0,0); } writedatafile($storyfile,%newstory); } @@ -231,14 +236,14 @@ if (open ($storyfile,"+<",STORY_PATH)){ $intfpass = 2; $story{'pass'} = '2'; if($ongstate == 0) { - writeindex(INDEX_PATH,2,0,0); + writeindex(WWW_INDEX_PATH,2,0,0); } } elsif(lc($2).' '.lc($4) eq $settings{'unlock'}) { if ($intfpass == 0) { if($ongstate == 0) { my %framedata = readdatafile(DATA_PATH.0); - my %default = readdatafile(DEFAULT_PATH); + my %default = readdatafile(DATA_DEFAULT_PATH); my $inpath; my $outpath; @@ -246,7 +251,7 @@ if (open ($storyfile,"+<",STORY_PATH)){ $gotolist{'title-0'} = $framedata{'title'}; $gotolist{'ongtime-0'} = $framedata{'ongtime'}; writedatafile(DATA_PATH.0,%framedata); - writedatafile(LIST_PATH,%gotolist); + writedatafile(DATA_LIST_PATH,%gotolist); foreach my $ind (keys %default) { unless(defined($framedata{$ind})){ @@ -264,7 +269,7 @@ if (open ($storyfile,"+<",STORY_PATH)){ $intfpause=0; $story{'pass'} = '1'; $story{'state'} = '0'; - writeindex(INDEX_PATH,1,0,0); + writeindex(WWW_INDEX_PATH,1,0,0); } } else { @@ -295,7 +300,7 @@ if (open ($storyfile,"+<",STORY_PATH)){ $intfmode -= 1; } $story{'state'} = $intfstate; - writeindex(INDEX_PATH,1,$intfmode,$intfpause); + writeindex(WWW_INDEX_PATH,1,$intfmode,$intfpause); writedatafile($storyfile,%story); } @storylines = split(/\r?\n/,$story{'content'}); @@ -316,9 +321,9 @@ print ''."\n"; print 'Two words • '.WEBSITE_NAME.''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print '
'."\n"; print '
'."\n"; @@ -341,7 +346,7 @@ if ($page == 0) { } if ($turn) { - print '
'."\n"; + print ''."\n"; if ($message eq '') { if ($story{"content"} eq '') { print 'Two words, please:
'."\n"; @@ -399,22 +404,22 @@ if(($intfpass == 1) && ($ongstate == 0)) { print '
'."\n"; print '
'."\n"; for (my $i = $storyid-1-(($page!=0)?((($page-1)*PAGE_LENGTH)+FIRSTPAGE_LENGTH):0); $i > ($storyid-1-($page*PAGE_LENGTH)- FIRSTPAGE_LENGTH) && $i >= 0; --$i) { - $storypath = STORY_PATH.$i; + $storypath = DATA_STORY_PATH.$i; %newstory = readdatafile($storypath); print '

'.entityencode($newstory{'content'}).'

'."\n"; } print '
'."\n"; print '