-
-
05 Dec 2018 11:59:38 UTC
- Distribution: Mojolicious-Plugin-StaticShare
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (324 / 0 / 34)
- Kwalitee
Bus factor: 1- 33.21% Coverage
- License: perl_5
- Perl: v5.14.0
- Activity
24 month- Tools
- Download (1.25MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
++ed by:1 non-PAUSE userand 1 contributors- ÐÐ¸Ñ Ð°Ð¸Ð» Че (Mikhail Che) <mche[-at-]cpan.org>
- Dependencies
- HTTP::AcceptLanguage
- Mojolicious
- Time::Piece
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- Mojolicious::Plugin::StaticShare
- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- OPTIONS
- Extended markdown & pod
- METHODS
- MULTI PLUGIN
- UTF-8
- WINDOWS OS
- SEE ALSO
- AUTHOR
- BUGS / CONTRIBUTING
- COPYRIGHT
Доброго всем
Mojolicious::Plugin::StaticShare
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
NAME
Mojolicious::Plugin::StaticShare - browse, upload, copy, move, delete, edit, rename static files and dirs.
VERSION
0.070
SYNOPSIS
# Mojolicious $app->plugin('StaticShare', <options>); # Mojolicious::Lite plugin 'StaticShare', <options>; # oneliner $ perl -MMojolicious::Lite -E 'plugin("StaticShare", root_url=>"/my/share",)->secrets([rand])->start' daemon
"MULTI-PLUGIN" also.
DESCRIPTION
This plugin allow to share static files/dirs/markdown and has public and admin functionality:
Public interface
Can browse and upload files if name not exists.
Admin interface
Can copy, move, delete, rename and edit content of files/dirs.
Append param
admin=<admin_pass> option
to any url inside root_url requests (see below).OPTIONS
root_dir
Absolute or relative file system path root directory. Defaults to '.'.
root_dir => '/mnt/usb', root_dir => 'foo',
root_url
This prefix to url path. Defaults to '/'.
root_url => '/', # mean route '/*pth' root_url => '', # mean also route '/*pth' root_url => '/my/share', # mean route '/my/share/*pth'
See Mojolicious::Guides::Routing#Wildcard-placeholders.
admin_pass
Admin password (be sure https) for admin tasks. None defaults.
admin_pass => '$%^!!9nes--', #
Signin to admin interface
https://myhost/my/share/foo/bar?admin=$%^!!9nes--
render_dir
Template path, format, handler, etc which render directory index. Defaults to builtin things.
render_dir => 'foo/dir_index', render_dir => {template => 'foo/my_directory_index', foo=>...}, # Disable directory index rendering render_dir => 0,
Usefull stash variables
Plugin make any stash variables for rendering:
pth
,url_path
,file_path
,language
,dirs
,files
,index
pth
Path of request exept
root_url
option, as Mojo::Path object.url_path
Path of request with
root_url
option, as Mojo::Path object.language
Req header AcceptLanguage as HTTP::AcceptLanguage object.
dirs
List of scalars dirnames. Not sorted.
files
List of hashrefs (
name, size, mtime
keys) files. Not sorted.index
Filename for markdown or pod rendering in page below the column dirs and column files.
templates_dir
String or arrayref strings. Simply
push @{$app->renderer->paths}, <templates_dir>;
. None defaults.Mainly needs for layouting markdown. When you set this option then you can define layout inside markdown/pod files like syntax:
% layouts/foo.html.ep # Foo header
render_markdown
Same as render_dir but for markdown files. Defaults to builtin things.
render_markdown => 'foo/markdown', render_markdown => {template => 'foo/markdown', foo=>...}, # Disable markdown rendering render_markdown => 0,
markdown_pkg
Module name for render markdown. Must contains sub
markdown($str)
or methodparse($str)
. Defaults to Text::Markdown::Hoedown.markdown_pkg => 'Foo::Markup';
Does not need to install if
render_markdown => 0
or never render md files.render_pod
Template path, format, handler, etc which render pod files. Defaults to builtin things.
render_pod=>'foo/pod', render_pod => {template => 'foo/pod', layout=>'pod', foo=>...}, # Disable pod rendering render_pod => 0,
dir_index
Arrayref to match files to include to directory index page. Defaults to
[qw(README.md INDEX.md README.pod INDEX.pod)]
.dir_index => [qw(DIR.md)], dir_index => 0, # disable include markdown to index dir page
public_uploads
Boolean to disable/enable uploads for public users. Defaults to undef (disable).
public_uploads=>1, # enable
max_upload_size
max_upload_size=>0, # unlimited
Numeric value limiting uploads size for route. See Mojolicious#max_request_size, Mojolicious#build_tx.
Extended markdown & pod
You can place attributes like:
id (# as prefix)
classnames (dot as prefix and separator)
css-style rules (key:value; colon separator and semicolon terminator)
to markup elements as below.
In markdown:
# {#foo123 .class1 .class2 padding: 0 0.5rem;} Header 1 {.brown-text} brown paragraph text ...
In pod:
=head2 {.class1.blue-text border-bottom: 1px dotted;} Header 2 {.red-text} red color text...
METHODS
Mojolicious::Plugin::StaticShare inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register(Mojolicious->new);
Register plugin in Mojolicious application.
MULTI PLUGIN
A possible:
# Mojolicious $app->plugin('StaticShare', <options-1>) ->plugin('StaticShare', <options-2>); # and so on ... # Mojolicious::Lite app->config(...) ->plugin('StaticShare', <options-1>) ->plugin('StaticShare', <options-2>) # and so on ... ...
UTF-8
Everywhere and everything: module, files, content.
WINDOWS OS
It was not tested but I hope you dont worry and have happy.
SEE ALSO
Mojolicious::Plugin::Directory
Mojolicious, Mojolicious::Guides, http://mojolicious.org.
AUTHOR
Михаил Че (Mikhail Che),
<mche[-at-]cpan.org>
BUGS / CONTRIBUTING
Please report any bugs or feature requests at https://github.com/mche/Mojolicious-Plugin-StaticShare/issues. Pull requests also welcome.
COPYRIGHT
Copyright 2017 Mikhail Che.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Mojolicious::Plugin::StaticShare, copy and paste the appropriate command in to your terminal.
cpanm Mojolicious::Plugin::StaticShare
perl -MCPAN -e shell install Mojolicious::Plugin::StaticShare
For more information on module installation, please visit the detailed CPAN module installation guide.