Доброго всем

Mojolicious::Plugin::StaticShare

¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !

NAME

Mojolicious::Plugin::StaticShare - browse, upload, copy, move, delete static files/dirs.

SYNOPSIS

# Mojolicious
$self->plugin('StaticShare', <options>);

# Mojolicious::Lite
plugin 'StaticShare', <options>;

# oneliner
$ perl -MMojolicious::Lite -E 'plugin("StaticShare", root_url=>"/my/share",)->secrets([rand])->start' daemon

DESCRIPTION

This plugin for share static files/dirs and has public and admin functionality:

Public interface

Can browse and upload files if name not exists.

Admin interface

Can copy, move, delete 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

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 dirs and files.

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 {}. 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 0 (disable).

public_uploads=>1, # enable

UTF-8

Everywhere and everything: module, files, content.

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.

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.