Permalink
Browse files

Revert "added OpenSocial plugin"

This reverts commit 8b6c289.
  • Loading branch information...
1 parent 8b6c289 commit a0aea770b3fa1f0f97ad3dd1e1011106e9ce3755 @typester typester committed Feb 19, 2010
Showing with 3 additions and 154 deletions.
  1. +1 −1 assets/plugins/ControlPanel/panelcontainer.tt
  2. +0 −28 assets/plugins/OpenSocial/panel.tt
  3. +2 −2 lib/Moxy.pm
  4. +0 −111 lib/Moxy/Plugin/OpenSocial.pm
  5. +0 −12 moxy.psgi
@@ -50,7 +50,7 @@
moxy_current_tab = i;
}
</script>
-<div id="moxy-control-panel" style="margin-left: 10px;float: left; width: 600px;">
+<div id="moxy-control-panel" style="margin-left: 10px;float: left; width: 500px;">
<ul id="moxy_tab_group">
[% FOR part IN parts %]
<li id="moxytab[% loop.count %]" onclick="moxy_switch_tab([% loop.count %])" class="tab tab_[% IF loop.count == 1 %]open[% ELSE %]close[% END %]">[% part.title %]</li>
@@ -1,28 +0,0 @@
-<form method="post" action="http://opensocial.moxy/[% current_uri | uri %]">
-[%- FOR query IN params.keys %]
-<input type="hidden" name="[% query | html %]" value="[% params.item(query) | html %]" />
-[%- END %]
-
-<p>
- <label for="app_id">app id:</label>
- <input type="text" name="app_id" id="app_id" value="[% app_id | html %]"/>
-</p>
-
-<p>
- <label for="owner_id">owner id:</label>
- <input type="text" name="owner_id" id="owner_id" value="[% owner_id | html %]"/>
-</p>
-
-<p>
- <label for="consumer_key">consumer key:</label>
- <input type="text" name="consumer_key" id="consumer_key" value="[% consumer_key | html %]"/>
-</p>
-
-<p>
- <label for="consumer_secret">consumer secret:</label>
- <input type="text" name="consumer_secret" id="consumer_secret" value="[% consumer_secret | html %]"/>
-</p>
-
-<input type="submit" value="設定" />
-
-</form>
View
@@ -50,8 +50,8 @@ __PACKAGE__->load_components(qw/Plaggerize Autocall::InjectMethod Context/);
__PACKAGE__->load_plugins(qw/
DisplayWidth ControlPanel LocationBar Pictogram
Status::401 Status::500 Status::404
- OpenSocial UserID XMLisHTML UserAgentSwitcher RefererCutter CookieCutter FlashUseImgTag
- DisableTableTag GPS HTTPHeader ShowHTTPHeaders
+ UserID XMLisHTML UserAgentSwitcher RefererCutter CookieCutter FlashUseImgTag
+ DisableTableTag GPS HTTPHeader QRCode ShowHTTPHeaders
/);
__PACKAGE__->mk_accessors(qw/response_time/);
@@ -1,111 +0,0 @@
-package Moxy::Plugin::OpenSocial;
-use strict;
-use warnings;
-use base 'Moxy::Plugin';
-
-use URI::Escape;
-use OAuth::Lite::Consumer;
-use HTML::TreeBuilder;
-
-sub control_panel :Hook {
- my ($self, $context, $args) = @_;
-
- # generate control panel html.
- my %params = URI->new($args->{response}->request->uri)->query_form;
-
- return $self->render_template(
- $context,
- 'panel.tt' => {
- params => \%params,
- current_uri => $args->{response}->request->uri,
- app_id => $args->{session}->get('opensocial_app_id'),
- owner_id => $args->{session}->get('opensocial_owner_id'),
- consumer_key => $args->{session}->get('opensocial_consumer_key'),
- consumer_secret => $args->{session}->get('opensocial_consumer_secret'),
- },
- );
-}
-
-sub url_handle :Hook {
- my ($self, $context, $args) = @_;
-
- if ($args->{request}->uri =~ m!^http://opensocial\.moxy/(.+)!) {
- my $back = uri_unescape($1);
-
- my $r = CGI->new($args->{request}->content);
- $args->{session}->set( opensocial_app_id => $r->param('app_id') );
- $args->{session}->set( opensocial_owner_id => $r->param('owner_id') );
- $args->{session}->set( opensocial_consumer_key => $r->param('consumer_key') );
- $args->{session}->set( opensocial_consumer_secret => $r->param('consumer_secret') );
-
- # back
- my $response = HTTP::Response->new( 302, 'Moxy(UserID)' );
- $response->header(Location => $back);
- return $response;
- }
-}
-
-sub request_filter :Hook {
- my ($self, $context, $args) = @_;
-
- my $req = $args->{request};
-
- my %param = $req->uri->query_form;
- $param{opensocial_app_id} = $args->{session}->get('opensocial_app_id');
- $param{opensocial_owner_id} = $args->{session}->get('opensocial_owner_id');
- $param{opensocial_viewer_id} = $args->{session}->get('opensocial_owner_id');
-
- my $consumer_key = $args->{session}->get('opensocial_consumer_key');
- my $consumer_secret = $args->{session}->get('opensocial_consumer_secret');
-
- return unless $consumer_key && $consumer_secret;
-
- my $consumer = OAuth::Lite::Consumer->new(
- consumer_key => $consumer_key,
- consumer_secret => $consumer_secret,
- );
-
- my $oauth_req = $consumer->gen_oauth_request(
- method => $req->method,
- url => $req->uri->scheme . '://'
- . $req->uri->authority . $req->uri->path,
- headers => [map { $_ => $req->header($_) } $req->header_field_names],
- params => \%param,
- content => $req->content,
- );
-
- $req->uri( $oauth_req->uri );
- $req->header( $_ => $oauth_req->header($_) ) for $oauth_req->header_field_names;
- $req->content($oauth_req->content);
-}
-
-sub response_filter :Hook {
- my ($self, $context, $args) = @_;
-
- my $res = $args->{response};
- if ($res->header('Content-Type') =~ /html/) {
- my $tree = HTML::TreeBuilder->new;
- $tree->parse_content($res->decoded_content);
-
- my @links = $tree->look_down(
- _tag => 'a',
- href => qr/^\?/,
- );
- for my $link (@links) {
- my $u = URI->new( $link->attr('href') );
-
- my %params = $u->query_form;
-
- my $uri = URI->new( delete $params{url} );
- $uri->query_form(%params);
-
- $link->attr('href', $uri);
- }
-
- $res->content( $tree->as_HTML );
- $tree->delete;
- }
-}
-
-1;
-
View
@@ -12,18 +12,6 @@ use Encode::JP::Mobile;
my $moxy = Moxy->new(+{
# configuration here
- log => { level => 'debug' },
- global => {
- log => { level => 'debug' },
- },
- plugins => [
- {
- module => 'QRCode',
- config => {
- engine => 'Google',
- },
- },
- ],
});
print "assets path is: @{[ $moxy->assets_path ]}\n";

0 comments on commit a0aea77

Please sign in to comment.