Amon2

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

2.39 2011-07-07
    
    - upgrade jquery to 1.6.2(tokuhirom)

2.38 2011-06-14

    - optimize directory structure for dotcloud(tokuhirom).

2.37 2011-06-06

    - escape JSON data for IE7's Content-Type vulnerability.

2.36 2011-05-30

    - generate (404|50[023]).html for dotcloud.
    - auto_include considered harmful
    - Text::MicroTemplate is no longer required by Amon2 core.

2.35 2011-05-14

    - fixed deps: JSON 2 is required.

author/assets.pl  view on Meta::CPAN


sub files { <% content %> }

sub run {
    my ($class, $flavor) = @_;
    warn "THIS METHOD WAS DEPRECATED";

    my $files = $class->files;
    $flavor->mkpath('static/bootstrap/');
    while (my ($fname, $content) = each %$files) {
        $flavor->write_file_raw("static/$fname", uri_unescape($content));
    }
}

1;
...

    open my $fh, '>:utf8', 'lib/Amon2/Setup/Asset/Bootstrap.pm';
    print {$fh} $content;
    close $fh;

lib/Amon2/Plugin/Web/JSON.pm  view on Meta::CPAN

You can use JSONP by using L<Plack::Middleware::JSONP>.

=back

=head1 JSON and security

=over 4

=item Browse the JSON files directly.

This module escapes '<', '>', and '+' characters by "\uXXXX" form. Browser don't detects the JSON as HTML.

And also this module outputs C<< X-Content-Type-Options: nosniff >> header for IEs.

It's good enough, I hope.

=item JSON Hijacking

Latest browsers doesn't have a JSON hijacking issue(I hope). __defineSetter__ or UTF-7 attack was resolved by browsers.

But Firefox<=3.0.x and Android phones have issue on Array constructor, see L<http://d.hatena.ne.jp/ockeghem/20110907/p1>.

lib/Amon2/Setup/Asset/Bootstrap.pm  view on Meta::CPAN

sub files { {
  "bootstrap/alert.js" => "/*!\n  * Bootstrap alert.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bootstra...
  "bootstrap/alert.js.map" => "{\"version\":3,\"file\":\"alert.js\",\"sources\":[\"../src/alert.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): alert.js\\n * Lic...
  "bootstrap/button.js" => "/*!\n  * Bootstrap button.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bootst...
  "bootstrap/button.js.map" => "{\"version\":3,\"file\":\"button.js\",\"sources\":[\"../src/button.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): button.js\\n *...
  "bootstrap/carousel.js" => "/*!\n  * Bootstrap carousel.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bo...
  "bootstrap/carousel.js.map" => "{\"version\":3,\"file\":\"carousel.js\",\"sources\":[\"../src/carousel.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): carousel...
  "bootstrap/collapse.js" => "/*!\n  * Bootstrap collapse.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bo...
  "bootstrap/collapse.js.map" => "{\"version\":3,\"file\":\"collapse.js\",\"sources\":[\"../src/collapse.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): collapse...
  "bootstrap/css/bootstrap-grid.css" => "/*!\n * Bootstrap Grid v4.4.1 (https://getbootstrap.com/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/mast...
  "bootstrap/css/bootstrap-grid.css.map" => "{\"version\":3,\"sources\":[\"../../scss/bootstrap-grid.scss\",\"bootstrap-grid.css\",\"../../scss/_grid.scss\",\"../../scss/mixins/_grid.scss\",\"../../scss/mixins/_breakpoints.scss\",\"../../scss/_variab...
  "bootstrap/css/bootstrap-grid.min.css" => "/*!\n * Bootstrap Grid v4.4.1 (https://getbootstrap.com/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/...
  "bootstrap/css/bootstrap-grid.min.css.map" => "{\"version\":3,\"sources\":[\"../../scss/bootstrap-grid.scss\",\"dist/css/bootstrap-grid.css\",\"../../scss/_grid.scss\",\"../../scss/mixins/_grid.scss\",\"../../scss/mixins/_breakpoints.scss\",\"../.....
  "bootstrap/css/bootstrap-reboot.css" => "/*!\n * Bootstrap Reboot v4.4.1 (https://getbootstrap.com/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/...
  "bootstrap/css/bootstrap-reboot.css.map" => "{\"version\":3,\"sources\":[\"../../scss/bootstrap-reboot.scss\",\"bootstrap-reboot.css\",\"../../scss/_reboot.scss\",\"../../scss/_variables.scss\",\"../../scss/vendor/_rfs.scss\",\"../../scss/mixins/_h...
  "bootstrap/css/bootstrap-reboot.min.css" => "/*!\n * Bootstrap Reboot v4.4.1 (https://getbootstrap.com/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/b...
  "bootstrap/css/bootstrap-reboot.min.css.map" => "{\"version\":3,\"sources\":[\"../../scss/bootstrap-reboot.scss\",\"../../scss/_reboot.scss\",\"dist/css/bootstrap-reboot.css\",\"../../scss/vendor/_rfs.scss\",\"bootstrap-reboot.css\",\"../../scss/mi...
  "bootstrap/css/bootstrap.css" => "/*!\n * Bootstrap v4.4.1 (https://getbootstrap.com/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE...
  "bootstrap/css/bootstrap.css.map" => "{\"version\":3,\"sources\":[\"../../scss/bootstrap.scss\",\"bootstrap.css\",\"../../scss/_root.scss\",\"../../scss/_reboot.scss\",\"../../scss/_variables.scss\",\"../../scss/vendor/_rfs.scss\",\"../../scss/mixi...
  "bootstrap/css/bootstrap.min.css" => "/*!\n * Bootstrap v4.4.1 (https://getbootstrap.com/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LIC...
  "bootstrap/css/bootstrap.min.css.map" => "{\"version\":3,\"sources\":[\"../../scss/bootstrap.scss\",\"../../scss/_root.scss\",\"../../scss/_reboot.scss\",\"dist/css/bootstrap.css\",\"../../scss/vendor/_rfs.scss\",\"bootstrap.css\",\"../../scss/mixi...
  "bootstrap/dropdown.js" => "/*!\n  * Bootstrap dropdown.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bo...
  "bootstrap/dropdown.js.map" => "{\"version\":3,\"file\":\"dropdown.js\",\"sources\":[\"../src/dropdown.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): dropdown...
  "bootstrap/index.js" => "/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.4.0): index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ------------------------...
  "bootstrap/index.js.map" => "{\"version\":3,\"sources\":[\"../src/index.js\"],\"names\":[\"\$\",\"TypeError\",\"version\",\"fn\",\"jquery\",\"split\",\"minMajor\",\"ltMajor\",\"minMinor\",\"minPatch\",\"maxMajor\",\"Error\"],\"mappings\":\"AAaA;;;;...
  "bootstrap/js/bootstrap.bundle.js" => "/*!\n  * Bootstrap v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/boo...
  "bootstrap/js/bootstrap.bundle.js.map" => "{\"version\":3,\"file\":\"bootstrap.bundle.js\",\"sources\":[\"../../js/src/util.js\",\"../../js/src/alert.js\",\"../../js/src/button.js\",\"../../js/src/carousel.js\",\"../../js/src/collapse.js\",\"../../...
  "bootstrap/js/bootstrap.bundle.min.js" => "/*!\n  * Bootstrap v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs...
  "bootstrap/js/bootstrap.bundle.min.js.map" => "{\"version\":3,\"sources\":[\"../../js/src/util.js\",\"../../js/src/alert.js\",\"../../js/src/button.js\",\"../../js/src/carousel.js\",\"../../js/src/collapse.js\",\"../../node_modules/popper.js/dist/e...
  "bootstrap/js/bootstrap.js" => "/*!\n  * Bootstrap v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bootstrap/...
  "bootstrap/js/bootstrap.js.map" => "{\"version\":3,\"file\":\"bootstrap.js\",\"sources\":[\"../../js/src/util.js\",\"../../js/src/alert.js\",\"../../js/src/button.js\",\"../../js/src/carousel.js\",\"../../js/src/collapse.js\",\"../../js/src/dropdow...
  "bootstrap/js/bootstrap.min.js" => "/*!\n  * Bootstrap v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bootst...
  "bootstrap/js/bootstrap.min.js.map" => "{\"version\":3,\"sources\":[\"../../js/src/util.js\",\"../../js/src/alert.js\",\"../../js/src/button.js\",\"../../js/src/carousel.js\",\"../../js/src/collapse.js\",\"../../js/src/dropdown.js\",\"../../js/src/...
  "bootstrap/modal.js" => "/*!\n  * Bootstrap modal.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bootstra...
  "bootstrap/modal.js.map" => "{\"version\":3,\"file\":\"modal.js\",\"sources\":[\"../src/modal.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): modal.js\\n * Lic...
  "bootstrap/popover.js" => "/*!\n  * Bootstrap popover.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/boot...
  "bootstrap/popover.js.map" => "{\"version\":3,\"file\":\"popover.js\",\"sources\":[\"../src/popover.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): popover.js\...
  "bootstrap/scrollspy.js" => "/*!\n  * Bootstrap scrollspy.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/...
  "bootstrap/scrollspy.js.map" => "{\"version\":3,\"file\":\"scrollspy.js\",\"sources\":[\"../src/scrollspy.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): scrol...
  "bootstrap/tab.js" => "/*!\n  * Bootstrap tab.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bootstrap/bl...
  "bootstrap/tab.js.map" => "{\"version\":3,\"file\":\"tab.js\",\"sources\":[\"../src/tab.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): tab.js\\n * Licensed un...
  "bootstrap/toast.js" => "/*!\n  * Bootstrap toast.js v4.4.1 (https://getbootstrap.com/)\n  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n  * Licensed under MIT (https://github.com/twbs/bootstra...
  "bootstrap/toast.js.map" => "{\"version\":3,\"file\":\"toast.js\",\"sources\":[\"../src/toast.js\"],\"sourcesContent\":[\"/**\\n * --------------------------------------------------------------------------\\n * Bootstrap (v4.4.1): toast.js\\n * Lic...

lib/Amon2/Setup/Asset/Bootstrap.pm  view on Meta::CPAN

}
 }

sub run {
    my ($class, $flavor) = @_;
    warn "THIS METHOD WAS DEPRECATED";

    my $files = $class->files;
    $flavor->mkpath('static/bootstrap/');
    while (my ($fname, $content) = each %$files) {
        $flavor->write_file_raw("static/$fname", uri_unescape($content));
    }
}

1;

lib/Amon2/Setup/Asset/MicroDispatcherJS.pm  view on Meta::CPAN

    <script src="<: uri_for('/static/js/micro_dispatcher.js') :>"></script>
,,,
}

sub files {
    return {
  'js/micro_dispatcher.js' => '// micro_dispatcher.js - (C) tokuhirom, MIT License.
(function() {
    var namedParam    = /:([\\w\\d]+)/g;
    var splatParam    = /\\*([\\w\\d]+)/g;
    var escapeRegExp  = /[\\-\\[\\]{}()+?.,\\\\\\^$|#\\s]/g;

    // http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
    var toString = Object.prototype.toString;
    function isRegExp(obj) {
        return toString.call(obj)==\'[object RegExp]\';
    }

    function Dispatcher() {
        this.routes = [];
    }

lib/Amon2/Setup/Asset/MicroDispatcherJS.pm  view on Meta::CPAN

                var route = this.routes[i][0];
                var callback = this.routes[i][1];
                var matched = route.exec(path);
                if (matched) {
                    var args = matched.slice(1);
                    callback.apply(this, args);
                }
            }
        },
        _compileRoute : function(route) {
            route = route.replace(escapeRegExp, "\\\\$&").replace(namedParam, "([^\\/]+)").replace(splatParam, "(.*?)");
            return new RegExp(\'^\' + route + \'$\');
        }
    };
    this.MicroDispatcher = Dispatcher;
})();
'
}
;
}

lib/Amon2/Setup/Asset/jQuery.pm  view on Meta::CPAN


sub tags {
    <<',,,';
    <script src="<: uri_for('/static/js/jquery-3.6.1.min.js') :>"></script>
,,,
}

sub files {
    return {
  'js/jquery-3.6.1.min.js' => '/*! jQuery v3.6.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof windo...
'
}
;
}

# for backward compatibility
sub run {
    warn "THIS METHOD WAS DEPRECATED";
    my ($self, $flavor) = @_;
    $flavor->mkpath('static/js/');

lib/Amon2/Web.pm  view on Meta::CPAN

}

sub uri_for {
    my ($self, $path, $query) = @_;
    my $root = $self->req->{env}->{SCRIPT_NAME} || '/';
    $root =~ s{([^/])$}{$1/};
    $path =~ s{^/}{};

    my @q;
    while (my ($key, $val) = each %$query) {
        $val = URI::Escape::uri_escape(Encode::encode($self->encoding, $val));
        push @q, "${key}=${val}";
    }
    $root . $path . (scalar @q ? '?' . join('&', @q) : '');
}

sub render {
    my $self = shift;
    my $html = $self->create_view()->render(@_);

    for my $code ($self->get_trigger_code('HTML_FILTER')) {

share/flavor/Minimum/lib/__PATH__/Web/View.pm  view on Meta::CPAN

    }
    my $view = Text::Xslate->new(+{
        'syntax'   => 'Kolon',
        'module'   => [
            'Text::Xslate::Bridge::Star',
            '<% $view_functions_package // ($module ~ "::Web::ViewFunctions") %>',
        ],
        'function' => {
        },
        ($context->debug_mode ? ( warn_handler => sub {
            Text::Xslate->print( # print method escape html automatically
                '[[', @_, ']]',
            );
        } ) : () ),
        %$view_conf
    });
    return $view;
}

1;



( run in 0.898 second using v1.01-cache-2.11-cpan-c21f80fb71c )