rename Tweetodon to RSSTootalizer
parent
5ed67744a2
commit
edaac60953
|
@ -1,11 +1,11 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::Account;
|
||||
@Tweetodon::Account::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::Account;
|
||||
@RSSTootalizer::Account::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Tweetodon::Application;
|
||||
use RSSTootalizer::Application;
|
||||
use Data::Dumper;
|
||||
|
||||
sub dbTable :lvalue { "accounts"; }
|
||||
|
@ -15,7 +15,7 @@ sub orderBy :lvalue { "username ASC"; }
|
|||
# Object methods
|
||||
sub application {
|
||||
my $self = shift;
|
||||
my $retVal = Tweetodon::Application->get_by("id", $self->{"data"}->{"application_id"});
|
||||
my $retVal = RSSTootalizer::Application->get_by("id", $self->{"data"}->{"application_id"});
|
||||
return $retVal;
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::App;
|
||||
@Tweetodon::App::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::App;
|
||||
@RSSTootalizer::App::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
|
||||
|
@ -15,7 +15,7 @@ sub get_or_create_by_instance {
|
|||
my $class = shift;
|
||||
my $instance = shift;
|
||||
|
||||
my $app = Tweetodon::DB->doSELECT("SELECT * FROM apps WHERE instance = ?", $instance);
|
||||
my $app = RSSTootalizer::DB->doSELECT("SELECT * FROM apps WHERE instance = ?", $instance);
|
||||
$app = $$app[0];
|
||||
unless (defined($app)){
|
||||
open(DATA, "./register_app.bash '$main::config->{app}->{client_name}' '$main::config->{app}->{redirect_uris}' '$main::config->{app}->{website}' '$instance'|");
|
||||
|
@ -27,9 +27,9 @@ sub get_or_create_by_instance {
|
|||
close DATA;
|
||||
|
||||
$reply = decode_json($reply);
|
||||
Tweetodon::DB->doINSERT("INSERT INTO apps (instance, instance_id, instance_client_id, instance_client_secret) VALUES (?, ?, ?, ?)", $instance, $reply->{id}, $reply->{client_id}, $reply->{client_secret});
|
||||
RSSTootalizer::DB->doINSERT("INSERT INTO apps (instance, instance_id, instance_client_id, instance_client_secret) VALUES (?, ?, ?, ?)", $instance, $reply->{id}, $reply->{client_id}, $reply->{client_secret});
|
||||
|
||||
$app = Tweetodon::DB->doSELECT("SELECT * FROM apps WHERE instance = ?", $instance);
|
||||
$app = RSSTootalizer::DB->doSELECT("SELECT * FROM apps WHERE instance = ?", $instance);
|
||||
$app = $$app[0];
|
||||
}
|
||||
$class->new($app)
|
||||
|
@ -39,7 +39,7 @@ sub get_or_create_by_instance {
|
|||
|
||||
sub app {
|
||||
my $self = shift;
|
||||
my $retVal = Tweetodon::Application->get_by("id", $self->{"data"}->{"app_id"});
|
||||
my $retVal = RSSTootalizer::Application->get_by("id", $self->{"data"}->{"app_id"});
|
||||
return $retVal;
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
|
||||
package Tweetodon::Base;
|
||||
package RSSTootalizer::Base;
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use Tweetodon::DB;
|
||||
use RSSTootalizer::DB;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
# Class functions
|
||||
sub all {
|
||||
my $class = shift;
|
||||
|
||||
my $all = Tweetodon::DB->doSELECT("SELECT * FROM ".$class->dbTable." ORDER BY ".$class->orderBy);
|
||||
my $all = RSSTootalizer::DB->doSELECT("SELECT * FROM ".$class->dbTable." ORDER BY ".$class->orderBy);
|
||||
my @retVal;
|
||||
foreach my $object (@$all){
|
||||
$object = $class->new($object);
|
||||
|
@ -24,7 +24,7 @@ sub get_by {
|
|||
|
||||
my $key = shift;
|
||||
my $value = shift;
|
||||
my $retVal = Tweetodon::DB->doSELECT("SELECT * FROM ".$class->dbTable." WHERE ".$key." ".($value =~ /%/ ? "LIKE" : "=")." ?", $value);
|
||||
my $retVal = RSSTootalizer::DB->doSELECT("SELECT * FROM ".$class->dbTable." WHERE ".$key." ".($value =~ /%/ ? "LIKE" : "=")." ?", $value);
|
||||
$retVal = $$retVal[0];
|
||||
|
||||
return 0 unless defined($retVal);
|
||||
|
@ -34,8 +34,8 @@ sub create {
|
|||
my $class = shift;
|
||||
my %data = @_;
|
||||
|
||||
Tweetodon::DB->doINSERThash($class->dbTable, %data);
|
||||
my $data = Tweetodon::DB->doSELECT("SELECT * FROM ".$class->dbTable." WHERE ID = LAST_INSERT_ID()");
|
||||
RSSTootalizer::DB->doINSERThash($class->dbTable, %data);
|
||||
my $data = RSSTootalizer::DB->doSELECT("SELECT * FROM ".$class->dbTable." WHERE ID = LAST_INSERT_ID()");
|
||||
$data = $$data[0];
|
||||
return $class->get_by("ID", $$data{ID});
|
||||
}
|
||||
|
@ -59,11 +59,11 @@ sub save {
|
|||
} else {
|
||||
delete $self->{"data"}->{"password"};
|
||||
}
|
||||
return Tweetodon::DB->doUPDATEhash($self->dbTable, "ID = ".$self->{"data"}->{"ID"}, %{$self->{"data"}});
|
||||
return RSSTootalizer::DB->doUPDATEhash($self->dbTable, "ID = ".$self->{"data"}->{"ID"}, %{$self->{"data"}});
|
||||
}
|
||||
sub delete {
|
||||
my $self = shift;
|
||||
|
||||
return Tweetodon::DB->doDELETE("DELETE FROM ".$self->dbTable." WHERE ID = ?", $self->{data}->{ID});
|
||||
return RSSTootalizer::DB->doDELETE("DELETE FROM ".$self->dbTable." WHERE ID = ?", $self->{data}->{ID});
|
||||
}
|
||||
1;
|
|
@ -1,7 +1,7 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
|
||||
package Tweetodon::DB;
|
||||
package RSSTootalizer::DB;
|
||||
use DBI;
|
||||
use Data::Dumper;
|
||||
use JSON;
|
|
@ -1,9 +1,9 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::Entry;
|
||||
@Tweetodon::Entry::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::Entry;
|
||||
@RSSTootalizer::Entry::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::Feed;
|
||||
@Tweetodon::Feed::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::Feed;
|
||||
@RSSTootalizer::Feed::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use Tweetodon::Filter;
|
||||
use Tweetodon::Entry;
|
||||
use RSSTootalizer::Filter;
|
||||
use RSSTootalizer::Entry;
|
||||
use XML::Feed;
|
||||
use URI;
|
||||
|
||||
|
@ -20,7 +20,7 @@ sub get_by_user_instance {
|
|||
|
||||
my $user = shift;
|
||||
my $instance = shift;
|
||||
my $retVal = Tweetodon::DB->doSELECT("SELECT * FROM ".$class->dbTable." WHERE username = ? AND instance = ? ORDER BY ".$class->orderBy, $user, $instance);
|
||||
my $retVal = RSSTootalizer::DB->doSELECT("SELECT * FROM ".$class->dbTable." WHERE username = ? AND instance = ? ORDER BY ".$class->orderBy, $user, $instance);
|
||||
|
||||
my @retVal;
|
||||
foreach my $r (@$retVal){
|
||||
|
@ -39,18 +39,18 @@ sub create_and_fetch {
|
|||
my %ne;
|
||||
$ne{feed_id} = $self->{data}->{ID};
|
||||
$ne{entry_link} = $entry->link();
|
||||
Tweetodon::Entry->create(%ne);
|
||||
RSSTootalizer::Entry->create(%ne);
|
||||
}
|
||||
}
|
||||
|
||||
# Object methods
|
||||
sub filters {
|
||||
my $self = shift;
|
||||
my $filters = Tweetodon::DB->doSELECT("SELECT * FROM filters WHERE feed_id = ? ORDER BY ID ASC", $self->{data}->{ID});
|
||||
my $filters = RSSTootalizer::DB->doSELECT("SELECT * FROM filters WHERE feed_id = ? ORDER BY ID ASC", $self->{data}->{ID});
|
||||
|
||||
my @retVal;
|
||||
foreach my $r (@$filters){
|
||||
push @retVal, Tweetodon::Filter->new($r);
|
||||
push @retVal, RSSTootalizer::Filter->new($r);
|
||||
}
|
||||
return @retVal;
|
||||
}
|
||||
|
@ -65,18 +65,18 @@ sub entry_by {
|
|||
my $key = shift;
|
||||
my $value = shift;
|
||||
|
||||
my $sth = Tweetodon::DB->doSELECT("SELECT * FROM entries WHERE feed_id = ? AND $key = ?", $self->{data}->{ID}, $value);
|
||||
my $sth = RSSTootalizer::DB->doSELECT("SELECT * FROM entries WHERE feed_id = ? AND $key = ?", $self->{data}->{ID}, $value);
|
||||
my @retVal;
|
||||
foreach my $r (@$sth){
|
||||
push @retVal, Tweetodon::Entry->new($r);
|
||||
push @retVal, RSSTootalizer::Entry->new($r);
|
||||
}
|
||||
return @retVal;
|
||||
}
|
||||
sub user {
|
||||
my $self = shift;
|
||||
my $sth = Tweetodon::DB->doSELECT("SELECT * FROM users WHERE username = ? and instance = ?", $self->{data}->{username}, $self->{data}->{instance});
|
||||
my $sth = RSSTootalizer::DB->doSELECT("SELECT * FROM users WHERE username = ? and instance = ?", $self->{data}->{username}, $self->{data}->{instance});
|
||||
$sth = $$sth[0];
|
||||
return Tweetodon::User->new($sth);
|
||||
return RSSTootalizer::User->new($sth);
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,9 +1,9 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::Filter;
|
||||
@Tweetodon::Filter::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::Filter;
|
||||
@RSSTootalizer::Filter::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
use URI::Escape;
|
|
@ -1,9 +1,9 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::Migration;
|
||||
@Tweetodon::Migration::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::Migration;
|
||||
@RSSTootalizer::Migration::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::Token;
|
||||
@Tweetodon::Token::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::Token;
|
||||
@RSSTootalizer::Token::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Data::Dumper;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
# vim: set foldmarker={,}:
|
||||
use strict;
|
||||
use Tweetodon::Base;
|
||||
use RSSTootalizer::Base;
|
||||
|
||||
package Tweetodon::User;
|
||||
@Tweetodon::User::ISA = qw(Tweetodon::Base);
|
||||
package RSSTootalizer::User;
|
||||
@RSSTootalizer::User::ISA = qw(RSSTootalizer::Base);
|
||||
use JSON;
|
||||
use Tweetodon::Token;
|
||||
use RSSTootalizer::Token;
|
||||
use Data::Dumper;
|
||||
|
||||
sub dbTable :lvalue { "users"; }
|
|
@ -4,7 +4,7 @@
|
|||
use strict;
|
||||
use HTML::Template;
|
||||
|
||||
package Tweetodon::Website;
|
||||
package RSSTootalizer::Website;
|
||||
use Data::Dumper;
|
||||
|
||||
sub requires_authentication {
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
use strict;
|
||||
use HTML::Template;
|
||||
use Tweetodon::Website;
|
||||
use Tweetodon::App;
|
||||
use Tweetodon::Token;
|
||||
use RSSTootalizer::Website;
|
||||
use RSSTootalizer::App;
|
||||
use RSSTootalizer::Token;
|
||||
|
||||
package Tweetodon::Website::Callback;
|
||||
@Tweetodon::Website::Callback::ISA = qw(Tweetodon::Website);
|
||||
package RSSTootalizer::Website::Callback;
|
||||
@RSSTootalizer::Website::Callback::ISA = qw(RSSTootalizer::Website);
|
||||
use Data::Dumper;
|
||||
use UUID::Tiny;
|
||||
use Digest::SHA qw(sha256_base64);
|
||||
use JSON;
|
||||
use Tweetodon::DB;
|
||||
use RSSTootalizer::DB;
|
||||
|
||||
sub requires_authentication {
|
||||
return 0;
|
||||
|
@ -29,7 +29,7 @@ sub prerender {
|
|||
$self->{"params"}->{"currentmode"} = "Callback";
|
||||
|
||||
my $instance = $main::FORM{instance};
|
||||
my $app = Tweetodon::App->get_or_create_by_instance($instance);
|
||||
my $app = RSSTootalizer::App->get_or_create_by_instance($instance);
|
||||
|
||||
open(DATA, "./process_code.bash '$app->{data}->{instance_client_id}' '$app->{data}->{instance_client_secret}' '$main::FORM{code}' '$main::config->{app}->{redirect_uris}' '$instance'|");
|
||||
my $reply;
|
||||
|
@ -59,7 +59,7 @@ sub prerender {
|
|||
|
||||
my $session_id = UUID::Tiny::create_UUID_as_string(UUID_V5, time().$$reply{acct});
|
||||
|
||||
Tweetodon::DB->doINSERT("INSERT INTO users (username, username_sha256, instance, instance_sha256, access_token, session_id) VALUES (?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE access_token=?, session_id=?", $$reply{acct}, sha256_base64($$reply{acct}), $instance, sha256_base64($instance), $token, $session_id, $token, $session_id);
|
||||
RSSTootalizer::DB->doINSERT("INSERT INTO users (username, username_sha256, instance, instance_sha256, access_token, session_id) VALUES (?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE access_token=?, session_id=?", $$reply{acct}, sha256_base64($$reply{acct}), $instance, sha256_base64($instance), $token, $session_id, $token, $session_id);
|
||||
|
||||
$self->{"set_cookie"} = ("session_id=".$session_id);
|
||||
}
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
use strict;
|
||||
use HTML::Template;
|
||||
use Tweetodon::DB;
|
||||
use Tweetodon::Feed;
|
||||
use Tweetodon::Website;
|
||||
use RSSTootalizer::DB;
|
||||
use RSSTootalizer::Feed;
|
||||
use RSSTootalizer::Website;
|
||||
|
||||
package Tweetodon::Website::Dashboard;
|
||||
package RSSTootalizer::Website::Dashboard;
|
||||
use Data::Dumper;
|
||||
@Tweetodon::Website::Dashboard::ISA = qw(Tweetodon::Website);
|
||||
@RSSTootalizer::Website::Dashboard::ISA = qw(RSSTootalizer::Website);
|
||||
|
||||
sub requires_authentication {
|
||||
return 1;
|
||||
|
@ -25,10 +25,10 @@ sub fill_content {
|
|||
$nf{username} = $main::CURRENTUSER->{data}->{acct};
|
||||
$nf{instance} = $main::FORM{instance};
|
||||
$nf{enabled} = "n";
|
||||
my $feed = Tweetodon::Feed->create_and_fetch(%nf);
|
||||
my $feed = RSSTootalizer::Feed->create_and_fetch(%nf);
|
||||
}
|
||||
|
||||
my @feeds = Tweetodon::Feed->get_by_user_instance($main::CURRENTUSER->{data}->{acct}, $main::FORM{instance});
|
||||
my @feeds = RSSTootalizer::Feed->get_by_user_instance($main::CURRENTUSER->{data}->{acct}, $main::FORM{instance});
|
||||
my @param_feeds;
|
||||
my $count = 0;
|
||||
FEED: foreach my $feed (@feeds){
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
use strict;
|
||||
use HTML::Template;
|
||||
use Tweetodon::DB;
|
||||
use Tweetodon::Feed;
|
||||
use Tweetodon::Filter;
|
||||
use Tweetodon::Website;
|
||||
use RSSTootalizer::DB;
|
||||
use RSSTootalizer::Feed;
|
||||
use RSSTootalizer::Filter;
|
||||
use RSSTootalizer::Website;
|
||||
|
||||
package Tweetodon::Website::EditFeed;
|
||||
package RSSTootalizer::Website::EditFeed;
|
||||
use Data::Dumper;
|
||||
@Tweetodon::Website::EditFeed::ISA = qw(Tweetodon::Website);
|
||||
@RSSTootalizer::Website::EditFeed::ISA = qw(RSSTootalizer::Website);
|
||||
|
||||
sub requires_authentication {
|
||||
return 1;
|
||||
|
@ -19,7 +19,7 @@ sub requires_authentication {
|
|||
sub fill_content {
|
||||
my $class = shift;
|
||||
my $output = shift;
|
||||
my $feed = Tweetodon::Feed->get_by("ID", $main::FORM{id});
|
||||
my $feed = RSSTootalizer::Feed->get_by("ID", $main::FORM{id});
|
||||
unless ($feed){
|
||||
main::Error("Unknown feed", "This feed id is not known");
|
||||
return 1;
|
||||
|
@ -54,7 +54,7 @@ sub fill_content {
|
|||
$newfilter{regex} = $main::FORM{"regex_new".$id};
|
||||
$newfilter{type} = $main::FORM{"type_new".$id};
|
||||
$newfilter{match} = $main::FORM{"match_new".$id};
|
||||
my $nf = Tweetodon::Filter->create(%newfilter);
|
||||
my $nf = RSSTootalizer::Filter->create(%newfilter);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
# vim: set foldmarker={,}:
|
||||
|
||||
use strict;
|
||||
use Tweetodon::DB;
|
||||
use Tweetodon::Account;
|
||||
use Tweetodon::Identity;
|
||||
use Tweetodon::Website;
|
||||
use RSSTootalizer::DB;
|
||||
use RSSTootalizer::Account;
|
||||
use RSSTootalizer::Identity;
|
||||
use RSSTootalizer::Website;
|
||||
|
||||
package Tweetodon::Website::JSON;
|
||||
@Tweetodon::Website::JSON::ISA = qw(Website);
|
||||
package RSSTootalizer::Website::JSON;
|
||||
@RSSTootalizer::Website::JSON::ISA = qw(Website);
|
||||
use Data::Dumper;
|
||||
use JSON;
|
||||
use MIME::Base64 qw(encode_base64);
|
||||
|
@ -61,7 +61,7 @@ sub identity_accounts {
|
|||
$self->{"params"}->{"msg"} = "";
|
||||
|
||||
my @accounts;
|
||||
my $i = Tweetodon::Identity->get_by("id", $main::FORM{"id"});
|
||||
my $i = RSSTootalizer::Identity->get_by("id", $main::FORM{"id"});
|
||||
foreach my $a ($i->accounts()){
|
||||
my %account;
|
||||
foreach my $k (keys %{$a->{"data"}}){
|
||||
|
@ -84,7 +84,7 @@ sub applications_all {
|
|||
$self->{"params"}->{"msg"} = "";
|
||||
|
||||
my @applications;
|
||||
foreach my $a (Tweetodon::Application->all()){
|
||||
foreach my $a (RSSTootalizer::Application->all()){
|
||||
my %application;
|
||||
foreach my $k (keys %{$a->{"data"}}){
|
||||
$application{$k} = $a->{"data"}->{$k};
|
||||
|
@ -105,7 +105,7 @@ sub application_by_id {
|
|||
$self->{"params"}->{"status"} = "OK";
|
||||
$self->{"params"}->{"msg"} = "";
|
||||
|
||||
my $a = Tweetodon::Application->get_by("id", $main::FORM{"id"});
|
||||
my $a = RSSTootalizer::Application->get_by("id", $main::FORM{"id"});
|
||||
foreach my $k (keys %{$a->{"data"}}){
|
||||
$self->{"params"}->{$k} = $a->{"data"}->{$k};
|
||||
}
|
||||
|
@ -128,9 +128,9 @@ sub application_save {
|
|||
# TODO
|
||||
# my %data;
|
||||
# $data{"login"} = $main::FORM{"login"};
|
||||
# $u = Tweetodon::Application->create(%data);
|
||||
# $u = RSSTootalizer::Application->create(%data);
|
||||
} else {
|
||||
$a = Tweetodon::Application->get_by("id", $main::FORM{"id"});
|
||||
$a = RSSTootalizer::Application->get_by("id", $main::FORM{"id"});
|
||||
}
|
||||
|
||||
foreach my $k (keys %{$a->{"data"}}){
|
||||
|
@ -151,7 +151,7 @@ sub application_import_accounts {
|
|||
$self->{"params"}->{"status"} = "OK";
|
||||
$self->{"params"}->{"msg"} = "";
|
||||
|
||||
my $a = Tweetodon::Application->get_by("id", $main::FORM{"id"});
|
||||
my $a = RSSTootalizer::Application->get_by("id", $main::FORM{"id"});
|
||||
my @accounts;
|
||||
foreach my $acc ($a->get_handler()->import_accounts_from_application()){
|
||||
my %account;
|
||||
|
@ -175,7 +175,7 @@ sub users_all {
|
|||
|
||||
my @users;
|
||||
my $count = 0;
|
||||
foreach my $u (Tweetodon::User->all()){
|
||||
foreach my $u (RSSTootalizer::User->all()){
|
||||
my %user;
|
||||
foreach my $k (keys %{$u->{"data"}}){
|
||||
next if $k eq "password";
|
||||
|
@ -198,7 +198,7 @@ sub user_by_id {
|
|||
$self->{"params"}->{"status"} = "OK";
|
||||
$self->{"params"}->{"msg"} = "";
|
||||
|
||||
my $u = Tweetodon::User->get_by("id", $main::FORM{"id"});
|
||||
my $u = RSSTootalizer::User->get_by("id", $main::FORM{"id"});
|
||||
foreach my $k (keys %{$u->{"data"}}){
|
||||
next if $k eq "password";
|
||||
$self->{"params"}->{$k} = $u->{"data"}->{$k};
|
||||
|
@ -219,9 +219,9 @@ sub user_save {
|
|||
if ($main::FORM{"id"} eq "new"){
|
||||
my %data;
|
||||
$data{"login"} = $main::FORM{"login"};
|
||||
$u = Tweetodon::User->create(%data);
|
||||
$u = RSSTootalizer::User->create(%data);
|
||||
} else {
|
||||
$u = Tweetodon::User->get_by("id", $main::FORM{"id"});
|
||||
$u = RSSTootalizer::User->get_by("id", $main::FORM{"id"});
|
||||
}
|
||||
delete $main::FORM{"id"};
|
||||
foreach my $k (keys %{$u->{"data"}}){
|
||||
|
@ -243,7 +243,7 @@ sub user_identities {
|
|||
$self->{"params"}->{"msg"} = "";
|
||||
|
||||
my @identities;
|
||||
my $u = Tweetodon::User->get_by("id", $main::FORM{"id"});
|
||||
my $u = RSSTootalizer::User->get_by("id", $main::FORM{"id"});
|
||||
foreach my $id ($u->identities()){
|
||||
my %identity;
|
||||
foreach my $k (keys %{$id->{"data"}}){
|
||||
|
@ -265,7 +265,7 @@ sub identities_save {
|
|||
$self->{"params"}->{"status"} = "OK";
|
||||
$self->{"params"}->{"msg"} = "";
|
||||
|
||||
my $user = Tweetodon::User->get_by("id", $main::FORM{"id"});
|
||||
my $user = RSSTootalizer::User->get_by("id", $main::FORM{"id"});
|
||||
foreach my $id ($user->identities()){
|
||||
if (exists($main::FORM{$id->{"data"}->{"id"}})){
|
||||
$id->{"data"}->{"description"} = $main::FORM{$id->{"data"}->{"id"}};
|
||||
|
@ -276,7 +276,7 @@ sub identities_save {
|
|||
my %data;
|
||||
$data{user_id} = $user->{"data"}->{"id"};
|
||||
$data{description} = $main::FORM{"new"};
|
||||
Tweetodon::Identity->create(%data);
|
||||
RSSTootalizer::Identity->create(%data);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
use strict;
|
||||
use HTML::Template;
|
||||
use Tweetodon::Website;
|
||||
use RSSTootalizer::Website;
|
||||
|
||||
package Tweetodon::Website::Login;
|
||||
@Tweetodon::Website::Login::ISA = qw(Tweetodon::Website);
|
||||
package RSSTootalizer::Website::Login;
|
||||
@RSSTootalizer::Website::Login::ISA = qw(RSSTootalizer::Website);
|
||||
|
||||
sub requires_authentication {
|
||||
return 0;
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
use strict;
|
||||
use HTML::Template;
|
||||
use Tweetodon::Website;
|
||||
use RSSTootalizer::Website;
|
||||
|
||||
package Tweetodon::Website::Logout;
|
||||
@Tweetodon::Website::Logout::ISA = qw(Tweetodon::Website);
|
||||
package RSSTootalizer::Website::Logout;
|
||||
@RSSTootalizer::Website::Logout::ISA = qw(RSSTootalizer::Website);
|
||||
|
||||
sub requires_authentication {
|
||||
return 0;
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
use strict;
|
||||
use HTML::Template;
|
||||
use Tweetodon::Website;
|
||||
use Tweetodon::App;
|
||||
use Tweetodon::Token;
|
||||
use Tweetodon::User;
|
||||
use RSSTootalizer::Website;
|
||||
use RSSTootalizer::App;
|
||||
use RSSTootalizer::Token;
|
||||
use RSSTootalizer::User;
|
||||
|
||||
package Tweetodon::Website::OAuthLogin;
|
||||
@Tweetodon::Website::OAuthLogin::ISA = qw(Tweetodon::Website);
|
||||
package RSSTootalizer::Website::OAuthLogin;
|
||||
@RSSTootalizer::Website::OAuthLogin::ISA = qw(RSSTootalizer::Website);
|
||||
use Data::Dumper;
|
||||
use JSON;
|
||||
|
||||
|
@ -30,14 +30,14 @@ sub prerender {
|
|||
$self->{"set_cookie"} = ("instance=".$instance);
|
||||
$self->{"params"}->{"currentmode"} = "OAuthLogin";
|
||||
|
||||
my $app = Tweetodon::App->get_or_create_by_instance($instance);
|
||||
my $app = RSSTootalizer::App->get_or_create_by_instance($instance);
|
||||
$self->{params}->{instance_redirect_uri} = $main::config->{app}->{redirect_uris};
|
||||
$self->{params}->{instance_client_id} = $app->{data}->{instance_client_id};
|
||||
$self->{params}->{instance} = $instance;
|
||||
$self->{params}->{token_is_valid} = "false";
|
||||
|
||||
if (defined($main::FORM{session_id})){
|
||||
my $user = Tweetodon::User->authenticate();
|
||||
my $user = RSSTootalizer::User->authenticate();
|
||||
if ($user){
|
||||
$self->{params}->{token_is_valid} = "true";
|
||||
}
|
|
@ -8,11 +8,11 @@ Content-Type: text/html
|
|||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
||||
<script src="static/js/jquery.min.js"></script>
|
||||
<script src="static/js/Tweetodon.js"></script>
|
||||
<script src="static/js/RSSTootalizer.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
function TweetodonOnReady(){
|
||||
function RSSTootalizerOnReady(){
|
||||
var l = "index.pl?mode=Callback&code="+_GET.code;
|
||||
document.location.href=l;
|
||||
}
|
||||
|
|
12
cronjob.pl
12
cronjob.pl
|
@ -4,12 +4,12 @@ use strict;
|
|||
use Data::Dumper;
|
||||
use URI::Escape;
|
||||
use JSON;
|
||||
use Tweetodon::Feed;
|
||||
use Tweetodon::User;
|
||||
use Tweetodon::Entry;
|
||||
use RSSTootalizer::Feed;
|
||||
use RSSTootalizer::User;
|
||||
use RSSTootalizer::Entry;
|
||||
|
||||
our $config = "";
|
||||
open CONFIG, "tweetodon.conf.json" or die "Cannot open tweetodon.conf.json";
|
||||
open CONFIG, "rsstootalizer.conf.json" or die "Cannot open rsstootalizer.conf.json";
|
||||
{
|
||||
$/ = undef;
|
||||
$config = <CONFIG>;
|
||||
|
@ -33,7 +33,7 @@ sub Error {{{
|
|||
binmode STDERR, ":utf8";
|
||||
binmode STDOUT, ":utf8";
|
||||
|
||||
my @feeds = Tweetodon::Feed->all();
|
||||
my @feeds = RSSTootalizer::Feed->all();
|
||||
FEED: foreach my $feed (@feeds){
|
||||
next FEED unless $feed->{data}->{enabled};
|
||||
my $entries = $feed->fetch_entries();
|
||||
|
@ -74,6 +74,6 @@ FEED: foreach my $feed (@feeds){
|
|||
my %ne;
|
||||
$ne{feed_id} = $feed->{data}->{ID};
|
||||
$ne{entry_link} = $entry{link};
|
||||
Tweetodon::Entry->create(%ne);
|
||||
RSSTootalizer::Entry->create(%ne);
|
||||
}
|
||||
}
|
||||
|
|
10
index.pl
10
index.pl
|
@ -5,13 +5,13 @@ use Data::Dumper;
|
|||
use HTML::Template;
|
||||
use URI::Escape;
|
||||
use JSON;
|
||||
use Tweetodon::User;
|
||||
use RSSTootalizer::User;
|
||||
|
||||
our %FORM;
|
||||
our $CURRENTUSER;
|
||||
|
||||
our $config = "";
|
||||
open CONFIG, "tweetodon.conf.json" or die "Cannot open tweetodon.conf.json";
|
||||
open CONFIG, "rsstootalizer.conf.json" or die "Cannot open rsstootalizer.conf.json";
|
||||
{
|
||||
$/ = undef;
|
||||
$config = <CONFIG>;
|
||||
|
@ -98,7 +98,7 @@ sub populateCookieFields {{{
|
|||
}
|
||||
}}}
|
||||
sub CheckCredentials {
|
||||
$CURRENTUSER = Tweetodon::User->authenticate();
|
||||
$CURRENTUSER = RSSTootalizer::User->authenticate();
|
||||
if ($CURRENTUSER){
|
||||
return 1;
|
||||
}
|
||||
|
@ -126,12 +126,12 @@ if (! grep {$_ eq $FORM{mode}} @modules) {
|
|||
Error("Validation Error", "$FORM{mode} is not a valid module");
|
||||
}
|
||||
|
||||
my $x = "Tweetodon::Website::$FORM{mode}";
|
||||
my $x = "RSSTootalizer::Website::$FORM{mode}";
|
||||
eval "use $x; 1" || Error("Parse Error", "Could not include $x: $@");
|
||||
eval { $object=$x->new(); } || Error("Functional Error", "This function is not implemented yet ('".$FORM{mode}."').");
|
||||
if ($object->requires_authentication()) { # Mode requires user to be logged in?
|
||||
unless (CheckCredentials()) {
|
||||
$x = "Tweetodon::Website::Login";
|
||||
$x = "RSSTootalizer::Website::Login";
|
||||
eval "use $x; 1" || Error("Parse Error", "Could not include $x: $@");
|
||||
eval { $object=$x->new(); } || Error("Functional Error", "This function is not implemented yet ('".$FORM{mode}."').");
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ CREATE TABLE `feeds` (
|
|||
`username` text CHARACTER SET utf8mb4 COLLATE utf8_unicode_ci NOT NULL,
|
||||
`instance` text CHARACTER SET utf8mb4 COLLATE utf8_unicode_ci NOT NULL,
|
||||
`url` text CHARACTER SET utf8mb4 COLLATE utf8_unicode_ci NOT NULL,
|
||||
`format` varchar(500) NOT NULL DEFAULT '{Title} - {Link} by {Author} -- posted at {Issued} with #Tweetodon',
|
||||
`format` varchar(500) NOT NULL DEFAULT '{Title} - {Link} by {Author} -- posted at {Issued} with #RSSTootalizer',
|
||||
`enabled` enum('0','1') NOT NULL DEFAULT '0'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"pass": "secret123"
|
||||
},
|
||||
"app": {
|
||||
"client_name": "Tweetodon privatehosted",
|
||||
"client_name": "RSSTootalizer privatehosted",
|
||||
"redirect_uris": "https://www.example.com/cgi-bin/tweetodon/callback.pl",
|
||||
"website": "https://www.example.com/cgi-bin/tweetodon/index.pl?mode=About"
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"mysql": {
|
||||
"host": "mysql.anderdonau.de",
|
||||
"database": "tweetodon_development",
|
||||
"user": "tweetodon",
|
||||
"pass": "oncdebscrgkok"
|
||||
},
|
||||
"app": {
|
||||
"client_name": "RSSTootalizer official",
|
||||
"redirect_uris": "https://www.benjamin-schieder.de/cgi-bin/tweetodon/callback.pl",
|
||||
"website": "https://www.benjamin-schieder.de/cgi-bin/tweetodon/index.pl?mode=About"
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
function TweetodonOnReady(){
|
||||
function RSSTootalizerOnReady(){
|
||||
$("form#addFeed").hide();
|
||||
$("a.deleteFeed").on("click", function(){
|
||||
var btn = $(this);
|
||||
|
|
|
@ -50,7 +50,7 @@ function appendFilter(id, field, regex, type, match){
|
|||
t.find("#match_"+id).val(match);
|
||||
}
|
||||
}
|
||||
function TweetodonOnReady(){
|
||||
function RSSTootalizerOnReady(){
|
||||
$("#rawentries").hide();
|
||||
$("a#togglerawentries").on("click", function(){
|
||||
$("#rawentries").toggle();
|
||||
|
|
|
@ -57,7 +57,7 @@ function jAlert(title, message){
|
|||
$(document).ready(function($){
|
||||
$(".sidebar").find("#"+$("#currentmode").val()).addClass("active");
|
||||
_GET = populateGet();
|
||||
if (typeof TweetodonOnReady == "function"){
|
||||
TweetodonOnReady();
|
||||
if (typeof RSSTootalizerOnReady == "function"){
|
||||
RSSTootalizerOnReady();
|
||||
}
|
||||
});
|
|
@ -44,7 +44,7 @@
|
|||
<h3>Format</h3>
|
||||
<div id="format">
|
||||
Enter the format for the toot. You can use the placeholders <code>{ID}</code>, <code>{Title}</code>, <code>{Link}</code>, <code>{Content}</code>, <code>{Author}</code>, <code>{Issued}</code>, <code>{Modified}</code> and <code>{Tags}</code> to substitute the respective values. <br />
|
||||
<input type="text" placeholder="{Title} - {Link} by {Author} -- posted at {Issued} with #Tweetodon" maxlength=500 value="<TMPL_VAR NAME="format">" class="btn-block"><br />
|
||||
<input type="text" placeholder="{Title} - {Link} by {Author} -- posted at {Issued} with #RSSTootalizer" maxlength=500 value="<TMPL_VAR NAME="format">" class="btn-block"><br />
|
||||
<input type="Submit" value="Save format" class="btn btn-primary btn-block">
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<hr>
|
||||
<div class='center'><small>Tweetodon</small></div>
|
||||
<div class='center'><small>RSSTootalizer</small></div>
|
||||
<hr>
|
||||
<div id="shadow"></div>
|
||||
</body>
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
<link href="static/css/jquery-ui.theme.min.css" rel="stylesheet">
|
||||
<link href="static/css/bootstrap-theme.min.css" rel="stylesheet">
|
||||
<link href="static/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="static/css/Tweetodon.css" rel="stylesheet">
|
||||
<link href="static/css/RSSTootalizer.css" rel="stylesheet">
|
||||
<link href="static/css/<TMPL_VAR NAME='currentmode'>.css" rel="stylesheet">
|
||||
|
||||
<script src="static/js/jquery.min.js"></script>
|
||||
<script src="static/js/jquery-ui.min.js"></script>
|
||||
<script src="static/js/bootstrap-notify.min.js"></script>
|
||||
<script src="static/js/bootstrap.min.js"></script>
|
||||
<script src="static/js/Tweetodon.js"></script>
|
||||
<script src="static/js/RSSTootalizer.js"></script>
|
||||
<script src="static/js/<TMPL_VAR NAME='currentmode'>.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">Tweetodon</a>
|
||||
<a class="navbar-brand" href="#">RSSTootalizer</a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
|
10
update_db.pl
10
update_db.pl
|
@ -2,10 +2,10 @@
|
|||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use Tweetodon::Migration;
|
||||
use RSSTootalizer::Migration;
|
||||
|
||||
our $config = "";
|
||||
open CONFIG, "tweetodon.conf.json" or die "Cannot open tweetodon.conf.json";
|
||||
open CONFIG, "rsstootalizer.conf.json" or die "Cannot open rsstootalizer.conf.json";
|
||||
{
|
||||
$/ = undef;
|
||||
$config = <CONFIG>;
|
||||
|
@ -20,7 +20,7 @@ binmode STDOUT, ":utf8";
|
|||
my @migrations = glob ("migrations/*sql");
|
||||
foreach my $migration (@migrations){
|
||||
print "Running migration $migration\n";
|
||||
if (!Tweetodon::Migration->get_by("name", $migration)){
|
||||
if (!RSSTootalizer::Migration->get_by("name", $migration)){
|
||||
open (M, $migration);
|
||||
my $sql;
|
||||
{
|
||||
|
@ -28,9 +28,9 @@ foreach my $migration (@migrations){
|
|||
$sql = <M>;
|
||||
}
|
||||
close M;
|
||||
Tweetodon::DB->doINSERT($sql);
|
||||
RSSTootalizer::DB->doINSERT($sql);
|
||||
my %migdata;
|
||||
$migdata{name} = $migration;
|
||||
Tweetodon::Migration->create(%migdata);
|
||||
RSSTootalizer::Migration->create(%migdata);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue