Add kofi userheads; update FFN userheads (#3119)

* Add kofi userhead stuff

* Issue with hyphen?

* Adjust module casing in case that helps

* Also update fanfiction.net userhead while i'm at it

* Add ffnet user icon to repository
This commit is contained in:
Carly Ho 2023-06-16 22:43:17 -05:00 committed by GitHub
parent d02ce7509b
commit 1f9a45335e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 1 deletions

View File

@ -109,6 +109,8 @@ $domaintosite{"furaffinity.com"} =
DW::External::Site->new( "33", "www.furaffinity.com", "furaffinity.com", "FurAffinity", "fa" );
$domaintosite{"artstation.com"} =
DW::External::Site->new( "33", "www.artstation.com", "artstation.com", "ArtStation", "artstation" );
$domaintosite{"ko-fi.com"} =
DW::External::Site->new( "34", "www.ko-fi.com", "ko-fi.com", "Kofi", "kofi" );
@all_sites_without_alias = values %domaintosite;
@ -159,6 +161,7 @@ $domaintosite{"fa"} = $domaintosite{"furaffinity.com"};
$domaintosite{"artstation"} = $domaintosite{"artstation.com"};
$domaintosite{"substack"} = $domaintosite{"substack.com"};
$domaintosite{"itch"} = $domaintosite{"itch.io"};
$domaintosite{"kofi"} = $domaintosite{"ko-fi.com"};
foreach my $value (@all_sites_without_alias) {
$idtosite{ $value->{siteid} } = $value;

View File

@ -63,7 +63,7 @@ sub badge_image {
# for lack of anything better, let's use the favicon
return {
url => "https://www.fanfiction.net/static/images/favicon_2010_site.png",
url => "/img/userheads/ff-icon-192.png",
width => 16,
height => 16,
};

71
cgi-bin/DW/External/Site/KoFi.pm vendored Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/perl
#
# DW::External::Site::KoFi
#
# Class to support KoFi linking.
#
# Authors:
# Carly Ho <carlymho@fastmail.com>
#
# Copyright (c) 2011/2023 by Dreamwidth Studios, LLC.
#
# This program is free software; you may redistribute it and/or modify it under
# the same terms as Perl itself. For a copy of the license, please reference
# 'perldoc perlartistic' or 'perldoc perlgpl'.
#
package DW::External::Site::Kofi;
use strict;
use base 'DW::External::Site';
use Carp qw/ croak /;
# new does nothing for these classes
sub new { croak 'cannot build with new'; }
# returns an object if we allow this domain; else undef
sub accepts {
my ( $class, $parts ) = @_;
# let's just assume the last two parts are good if we have them
return undef unless scalar(@$parts) >= 2;
return bless { hostname => "$parts->[-2].$parts->[-1]" }, $class;
}
# argument: DW::External::User
# returns URL to this account's archive
sub journal_url {
my ( $self, $u ) = @_;
croak 'need a DW::External::User'
unless $u && ref $u eq 'DW::External::User';
return 'http://' . $self->{hostname} . '/' . $u->user;
}
# argument: DW::External::User
# there's no separate about page so just return the same thing
sub profile_url {
my ( $self, $u ) = @_;
croak 'need a DW::External::User'
unless $u && ref $u eq 'DW::External::User';
return 'http://' . $self->{hostname} . '/' . $u->user;
}
# argument: DW::External::User
# returns info for the badge image (userhead icon) for this user
sub badge_image {
my ( $self, $u ) = @_;
croak 'need a DW::External::User'
unless $u && ref $u eq 'DW::External::User';
# for lack of anything better, let's use the favicon
return {
url => "https://ko-fi.com/favicon.png",
width => 16,
height => 16,
};
}
1;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB