| Line | |
|---|
| 1 |
package Plagger::Plugin::Notify::OpenBrowser::FirefoxRemote; |
|---|
| 2 |
use base qw( Plagger::Plugin::Notify::OpenBrowser ); |
|---|
| 3 |
|
|---|
| 4 |
use strict; |
|---|
| 5 |
use Net::Telnet; |
|---|
| 6 |
|
|---|
| 7 |
sub init { |
|---|
| 8 |
my $self = shift; |
|---|
| 9 |
$self->Plagger::Plugin::init(@_); |
|---|
| 10 |
} |
|---|
| 11 |
|
|---|
| 12 |
sub open { |
|---|
| 13 |
my($self, $link) = @_; |
|---|
| 14 |
|
|---|
| 15 |
$self->{conn} ||= do { |
|---|
| 16 |
my $host = $self->conf->{host} || "localhost"; |
|---|
| 17 |
my $port = $self->conf->{port} || 4242; |
|---|
| 18 |
my $telnet = Net::Telnet->new(Port => $port); |
|---|
| 19 |
$telnet->open($host) |
|---|
| 20 |
or return $self->log(error => "Can't connect to $host:$port"); |
|---|
| 21 |
$self->log(info => "Connect MozRepl at $host:$port"); |
|---|
| 22 |
$telnet; |
|---|
| 23 |
}; |
|---|
| 24 |
|
|---|
| 25 |
$self->log(info => "Open $link in a remote Firefox"); |
|---|
| 26 |
$self->{conn}->cmd("window.openNewTabWith('$link')"); |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
1; |
|---|
| 30 |
|
|---|
| 31 |
__END__ |
|---|
| 32 |
|
|---|
| 33 |
=head1 NAME |
|---|
| 34 |
|
|---|
| 35 |
Plagger::Plugin::Notify::OpenBrowser::FirefoxRemote - Open updated entries in a browser |
|---|
| 36 |
|
|---|
| 37 |
=head1 SYNOPSIS |
|---|
| 38 |
|
|---|
| 39 |
- module: Notify::OpenBrowser::FirefoxRemote |
|---|
| 40 |
|
|---|
| 41 |
=head1 DESCRIPTION |
|---|
| 42 |
|
|---|
| 43 |
This plugins opens updated entries in a remote Firefox using MozRepl |
|---|
| 44 |
extension. You need to install MozRepl before running this plugin. |
|---|
| 45 |
See L<http://dev.hyperstruct.net/trac/mozlab/wiki/MozRepl> for more. |
|---|
| 46 |
|
|---|
| 47 |
=head1 CONFIG |
|---|
| 48 |
|
|---|
| 49 |
=over 4 |
|---|
| 50 |
|
|---|
| 51 |
=item port |
|---|
| 52 |
|
|---|
| 53 |
Port running Firefox MozRepl server. Defaults to 4242. |
|---|
| 54 |
|
|---|
| 55 |
=back |
|---|
| 56 |
|
|---|
| 57 |
=head1 TIPS |
|---|
| 58 |
|
|---|
| 59 |
You should use SSH port forwarding if you'd like to connect remote |
|---|
| 60 |
MozRepl instance. |
|---|
| 61 |
|
|---|
| 62 |
=head1 AUTHOR |
|---|
| 63 |
|
|---|
| 64 |
Tatsuhiko Miyagawa |
|---|
| 65 |
|
|---|
| 66 |
youpy |
|---|
| 67 |
|
|---|
| 68 |
=head1 SEE ALSO |
|---|
| 69 |
|
|---|
| 70 |
L<Plagger>, L<Plagger::Plugin::Notify::OpenBrowser> |
|---|
| 71 |
|
|---|
| 72 |
=cut |
|---|