App-mojopaste

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

 - Fix "...did you mean do "./script/mojopaste"? at t/config.t line 10."

0.25 2017-06-20T00:20:46+0200
 - Mojolicious has deprecated Mojo::Util::slurp() and spurt()
 - Fix failing tests

0.24 2016-10-13T10:01:53+0200
 - Writing/reading files are more robust

0.23 2016-09-08T20:08:22+0200
 - Fix rendering 404 for paste_not_found() and .txt extension

0.22 2016-09-06T21:18:39+0200
 - Will never allow robots
 - Will only graph csv data

0.21 2016-06-30T14:44:51+0200
 - Change default paste directory
 - Can embed paste and graphs
 - Fix using the whole window and nothing more when showing a graph

Changes  view on Meta::CPAN

 - Add support for header and description for graph view #7
 - Change from dark to light color theme

0.18 2016-01-15T07:52:58+0100
 - Try to fix failing MSWin32 test
   http://www.cpantesters.org/cpan/report/873ffedb-6bf4-1014-a355-7b0739136c96

0.17 2016-01-13T21:36:27+0100
 - Fix unicode.t by bumping Mojolicious version #10
 - Cannot make empty paste
 - Non-existing paste will result in 404 instead of 500 #8
   Contributor: Stephan Jauernick
 - Use File::Spec to construct correct paths on all OS #8
   Contributor: Stephan Jauernick

0.16 2016-01-13T09:25:51+0100
 - Recommends JSON::Syck
 - Recommends Text::CSV
 - No need to encode/decode UTF-8 anymore

0.15 2015-04-30T10:17:13+0200
 - Change "Powered by" URL
 - Change styling for .morris-hover
 - Change 404 page to show that the paste could not be found.

0.14 2015-04-20T17:03:36+0200
 - Fix unit tests

0.13 2015-04-20T16:54:30+0200
 - SECURITY FIX! Cannot read ../../private/file #6
 - Capture chart errors
 - Will construct default ykeys from all chart elements

0.11 2015-04-20T15:15:43+0200

Changes  view on Meta::CPAN

0.0402 2013-09-09T16:08:21Z
 - Fix pasting unicode characters

0.0401 2013-09-06T23:34:51Z
 - Fix Makefile.PL

0.04 2013-09-05T23:55:30Z
 - Fix including jquery.js from Mojo
 - Render as HTML5
 - Looks better on iPhone
 - Render 404 when paste is not found
 - Trying to trick the dumbest robots

0.03 2013-09-05T16:54:59Z
 - Fix typo in PREREQ_PM

0.02 2013-09-05T16:48:08Z
 - Fix repository path

0.01 2013-09-05T16:46:19Z
 - Add bin/mojopaste

script/mojopaste  view on Meta::CPAN

  title         => 'Mojopaste',
);

my $backend = app->config('backend');
plugin $backend =~ /::/ ? $backend : "App::mojopaste::Backend::$backend";

helper no_such_paste => sub {
  my ($c, $err) = @_;
  $c->app->log->debug("no_such_paste: $err");
  $c->stash($_ => 'Could not find paste') for qw(error heading title);
  $c->render(description => '', layout => 'mojopaste', status => 404);
};

helper set_title => sub {
  my ($c, $prefix, $suffix) = @_;
  my $brand_name = $c->stash('brand_name') || 'Mojopaste';
  $suffix = $suffix ? "$brand_name $suffix" : $brand_name;
  $prefix =~ s![\n\r]+! !g;
  $prefix =~ s!^\W+!!g;
  $prefix = substr $prefix, 0, 56 - length $suffix;
  return $c->stash(title => "$prefix - $suffix");

t/mojopaste.t  view on Meta::CPAN

$t->post_ok('/', form => {paste => $raw, p => 1})->status_is(302)->header_like('Location', qr[^/\w{12}$]);

my ($id) = $t->tx->res->headers->location =~ m!/(\w+)$!;
$t->get_ok($t->tx->res->headers->location)->status_is(200)
  ->text_is('title', 'somefile.js var foo = 123; // cool! var toooooo - Mojopaste')->element_exists(qq(a[href="/"]))
  ->element_exists(qq(a[href="/$id.txt"]))->element_exists(qq(a[href="/?edit=$id"]))
  ->element_exists_not(qq(a[href\$="/chart"]))    # $ENV{PASTE_ENABLE_CHARTS} is not set
  ->element_exists('pre')->text_is('pre', $raw);

# $ENV{PASTE_ENABLE_CHARTS} is not set
$t->get_ok("/$id/chart")->status_is(404);
$t->get_ok("/$id")->status_is(200)->header_like('X-Plain-Text-URL', qr{:\d+/$id\.txt$})->element_exists('nav');
$t->get_ok("/$id?embed=text")->status_is(200)->element_exists_not('nav');
$t->get_ok("/$id.txt")->content_is($raw);
ok !$t->tx->res->headers->header('X-Plain-Text-URL'), 'no X-Plain-Text-URL';

$t->get_ok("/?edit=$id")->text_is('title', 'somefile.js var foo = 123; // cool! var to - Mojopaste edit')
  ->text_is('textarea', $raw);

require File::Path;
File::Path::remove_tree($ENV{PASTE_DIR}, {keep_root => 1});

t/nonexisting.t  view on Meta::CPAN

BEGIN { $ENV{PASTE_ENABLE_CHARTS} = 1 }
use lib '.';
use t::Helper;

my $t = t::Helper->t;
my $id = substr Mojo::Util::md5_sum('nope'), 0, 12;

for my $p ("/$id", "/?edit=$id", "/$id/chart") {
  $t->get_ok($p)->status_is(404)->text_is('title', 'Could not find paste')->content_like(qr{Could not find paste});
}

done_testing;

t/safe-params.t  view on Meta::CPAN

use lib '.';
use t::Helper;

my $t = t::Helper->t;
$t->get_ok("/?edit=../../Makefile.PL")->status_is(404)->content_unlike(qr{use ExtUtils::MakeMaker;});

done_testing;



( run in 2.816 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )