}\r
}\r
else if (tagname == "img")\r
+ {\r
+ ++count[depth]\r
+ sub(###AWK_own_url_regexp;, "/", bbtree[ind(count,depth)])\r
+ --count[depth]\r
html=html"<img src=\""\r
+ }\r
else if (tagname == "url")\r
{\r
if(tagvalue=="")\r
--count[depth]\r
debug = debug "###nl;implied value: " tagvalue\r
}\r
+ sub(###AWK_own_url_regexp;, "/", tagvalue)\r
html=html"<a href=\""tagvalue"\" class=\"postlink\">"\r
}\r
else if (tagname == "size")\r
-# Copyright (C) 2023 Balthasar Szczepański
+# Copyright (C) 2023, 2024 Balthasar Szczepański
# bot2m.pl automatically generated from bot2m.1.pl
# This file is part of OTT mirror.
'html_entity_decode',
'url_decode',
'merge_url',
- 'system_encoded'
+ 'system_encoded', 'readdir_decoded', 'opendir_encoded'
);
use post_common (
'wget'
###PERL_OWN_DOMAIN: use constant OWN_DOMAIN => '1190.bicyclesonthemoon.info'
###PERL_WWW_IMG_PATH: use constant WWW_IMG_PATH => '/botm/www/1190/ott/image'
###PERL_IMG_URL: use constant IMG_URL => 'http://1190.bicyclesonthemoon.info/ott/image'
+###PERL_OWN_URL: use constant OWN_URL => 'http://1190.bicyclesonthemoon.info/ott'
###PERL_TMP_PATH: use constant TMP_PATH => '/botm/tmp/post';
###PERL_WAYBACK: use constant WAYBACK => 'http://web.archive.org/web/';
###PERL_BIN_IMG_PATH: use constant BIN_IMG_PATH => '/botm/bin/ottmirror/image';
decode_argv();
my $dh;
-if (opendir $dh, encode('locale_fs', MPOST_PATH)) {
- my @fl = readdir $dh; # <-- encoding???
+my $force = 0;
+if ((scalar @ARGV) > 0) {
+ if ($ARGV[0] eq '--force') {
+ # TODO: better --force handling
+ $force = 1;
+ }
+}
+if (opendir_encoded($dh, MPOST_PATH())) {
+ my @fl = readdir_decoded($dh);
closedir $dh;
foreach my $fn (@fl) {
if ($fn =~ /^[0-9]+$/) {
- my %post = read_data_file(join_path('/',MPOST_PATH,$fn), 'utf8');
+ my %post = read_data_file(join_path('/',MPOST_PATH,$fn));
if ($post{'disable_bbcode'}) {
next;
}
- my $changed = 0;
+ my $changed = $force;
my $message = $post{'bb'};
my $new_message = '';
$message =~ s/<br\/>/\n/gs;
else {
$new_post{'notify'} = '0';
}
- write_data_file($tmp_file, 'utf8', 0, \%new_post);
- my $r = system_encoded(SENDPOST, (SENDPOST, '--mirror', '--edit=m'.$fn, $tmp_file));
+ write_data_file($tmp_file, \%new_post);
+ my $r = system_encoded(SENDPOST, (SENDPOST, '--mirror', '--edit=m'.$fn, $tmp_file, '--mirror-url='.OWN_URL()));
unlink $tmp_file;
}
}
-Subproject commit fc9affec336a16cde93b2675a836bdd01d1c2210
+Subproject commit 778dbca76f413af0b5d2c442a482b4d4eebaf2cb
smiley_regexp2 : ((\.)|(http:\/\/((for(ums3?|a)\.xkcd\.com)|echochamber\.me)))\/images\/smilies
avatar_regexp : ((src)|(href))=.http:\/\/((for(ums3?|a)\.xkcd\.com)|echochamber\.me)\/download\/file.php\?avatar=
attachment_regexp: ((src)|(href))=.http:\/\/(www\.)?((for(ums3?|a)\.xkcd\.com)|echochamber\.me)\/download\/file.php\?(mode=view\&)?id=
-own_image_regexp : ((1190.bicyclesonthemoon.(dnsd.)?info)|(1190-botm.dnsdynamic.com))\/ott\/image\/
+own_image_regexp : ((1190.bicyclesonthemoon.(dnsd.)?info)|(1190-botm.dnsdynamic.com))\/ottest\/image\/
+own_domain_regexp: ((1190.bicyclesonthemoon.(dnsd.)?info)|(1190-botm.dnsdynamic.com)|(moonbase.chirpingmustard.com))
own_domain : 1190.bicyclesonthemoon.info
-own_url : http://1190.bicyclesonthemoon.info/ott
+own_url : http://1190.bicyclesonthemoon.info/ottest
bot3name : bothasar_p
bot3_url : http://1190.bicyclesonthemoon.info/bothasar_p/
default_subject: Re: 1190: "Time"
avatar_regexp : ((src)|(href))=.http:\/\/((for(ums3?|a)\.xkcd\.com)|echochamber\.me)\/download\/file.php\?avatar=
attachment_regexp: ((src)|(href))=.http:\/\/(www\.)?((for(ums3?|a)\.xkcd\.com)|echochamber\.me)\/download\/file.php\?(mode=view\&)?id=
own_image_regexp : ((1190.bicyclesonthemoon.(dnsd.)?info)|(1190-botm.dnsdynamic.com))\/ottest\/image\/
+own_domain_regexp: ((1190.bicyclesonthemoon.(dnsd.)?info)|(1190-botm.dnsdynamic.com)|(moonbase.chirpingmustard.com))
own_domain : 1190.bicyclesonthemoon.info
own_url : http://1190.bicyclesonthemoon.info/ottest
AWK_bot3name_encoded = @_ESCAPE($_bot3name_encoded)
AWK_links_regexp = /$links_regexp/
AWK_own_image_regexp = /$own_image_regexp/
+AWK_own_url_regexp = /^https?:\\/\\/$own_domain_regexp\\//
AWK_own_url_encoded = @_ESCAPE($_own_url_encoded)
AWK_prosilver_regexp = /$prosilver_regexp/
AWK_prosilver_regexp2 = /$prosilver_regexp2/
PERL_OWN_DOMAIN = @_PERL_CONSTANT_STR( OWN_DOMAIN , $own_domain)
PERL_WWW_IMG_PATH = @_PERL_CONSTANT_STR( WWW_IMG_PATH, $_www_img_path)
PERL_IMG_URL = @_PERL_CONSTANT_STR( IMG_URL , $_url_img)
+PERL_OWN_URL = @_PERL_CONSTANT_STR( OWN_URL , $own_url)
PERL_TMP_PATH = @_PERL_CONSTANT_STR( TMP_PATH , $tmp_path)
PERL_WAYBACK = @_PERL_CONSTANT_STR( WAYBACK , $wayback_addr)
PERL_BIN_IMG_PATH = @_PERL_CONSTANT_STR( BIN_IMG_PATH, $_bin_image_path)