Доброго всем
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
Mojolicious::Plugin::StaticShare - browse, upload, copy, move, delete, edit, rename static files and dirs.
0.072
# 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.
This plugin allow to share static files/dirs/markdown and has public and admin functionality:
Can browse and upload files if name not exists.
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).
admin=<admin_pass> option
Absolute or relative file system path root directory. Defaults to '.'.
root_dir => '/mnt/usb', root_dir => 'foo',
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 password (be sure https) for admin tasks. None defaults.
admin_pass => '$%^!!9nes--', #
Signin to admin interface https://myhost/my/share/foo/bar?admin=$%^!!9nes--
https://myhost/my/share/foo/bar?admin=$%^!!9nes--
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,
Plugin make any stash variables for rendering: pth, url_path, file_path, language, dirs, files, index
pth
url_path
file_path
language
dirs
files
index
Path of request exept root_url option, as Mojo::Path object.
root_url
Path of request with root_url option, as Mojo::Path object.
Req header AcceptLanguage as HTTP::AcceptLanguage object.
List of scalars dirnames. Not sorted.
List of hashrefs (name, size, mtime keys) files. Not sorted.
name, size, mtime
Filename for markdown or pod rendering in page below the column dirs and column files.
String or arrayref strings. Simply push @{$app->renderer->paths}, <templates_dir>;. None defaults.
push @{$app->renderer->paths}, <templates_dir>;
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
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,
Module name for render markdown. Must contains sub markdown($str) or method parse($str). Defaults to Text::Markdown::Hoedown.
markdown($str)
parse($str)
markdown_pkg => 'Foo::Markup';
Does not need to install if render_markdown => 0 or never render md files.
render_markdown => 0
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,
Arrayref to match files to include to directory index page. Defaults to [qw(README.md INDEX.md README.pod INDEX.pod)].
[qw(README.md INDEX.md README.pod INDEX.pod)]
dir_index => [qw(DIR.md)], dir_index => 0, # disable include markdown to index dir page
Boolean to disable/enable uploads for public users. Defaults to undef (disable).
public_uploads=>1, # enable
max_upload_size=>0, # unlimited POST
Numeric value limiting uploads size for route. WARN-EXPIRIMENTAL patching of Mojo::Transaction::HTTP#server_read for emit chunk event.
See also Mojolicious#max_request_size, Mojolicious#build_tx.
You can place attributes like:
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...
Mojolicious::Plugin::StaticShare inherits all methods from Mojolicious::Plugin and implements the following new ones.
$plugin->register(Mojolicious->new);
Register plugin in Mojolicious application.
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 ... ...
Everywhere and everything: module, files, content.
It was not tested but I hope you dont worry and have happy.
Mojolicious::Plugin::Directory
Mojolicious, Mojolicious::Guides, http://mojolicious.org.
Михаил Че (Mikhail Che), <mche[-at-]cpan.org>
<mche[-at-]cpan.org>
Please report any bugs or feature requests at https://github.com/mche/Mojolicious-Plugin-StaticShare/issues. Pull requests also welcome.
Copyright 2017 Mikhail Che.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mojolicious::Plugin::StaticShare, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::StaticShare
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::StaticShare
For more information on module installation, please visit the detailed CPAN module installation guide.