Skip to content

Commit

Permalink
remove dependency on LJ::Util::blogger_deserialize
Browse files Browse the repository at this point in the history
This function, defined in Apache::LiveJournal::Interface::Blogger,
is simple enough to reproduce in a locally scoped version, minus
the clause for parsing the subject out of HTML title tags, which
is irrelevant here.
  • Loading branch information
kareila committed Apr 3, 2017
1 parent 171677c commit 5a9e202
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion htdocs/mobile/post.bml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ _info?><?_code

my $err = sub { BML::finish(); return $_[0] };

my $parse_content = sub {
my $content = $_[0];
my $event = { 'props' => {} };
if ($content =~ s/(^|\n)lj-mood:\s*(.*)\n//i) {
$event->{'props'}->{'current_mood'} = $2;
}
if ($content =~ s/(^|\n)lj-music:\s*(.*)\n//i) {
$event->{'props'}->{'current_music'} = $2;
}
$content =~ s/^\s+//; $content =~ s/\s+$//;
$event->{'event'} = $content;
return $event;
};

$u = LJ::get_remote()
or return $err->( BML::ml( ".post.login", { aopts => "href='login'" } ) );

Expand All @@ -36,7 +50,7 @@ _info?><?_code
return "" unless LJ::did_post();
return "<b>$ML{'.post.error'}</b> $ML{'error.invalidform'}" unless LJ::check_form_auth();

my $event = LJ::Util::blogger_deserialize($POST{'event'});
my $event = $parse_content->($POST{'event'});
my $journal = $POST{'usejournal'};

my $sec = $POST{'security'};
Expand Down

0 comments on commit 5a9e202

Please sign in to comment.