-
Notifications
You must be signed in to change notification settings - Fork 90
/
mk-sponsors.pl
executable file
·100 lines (88 loc) · 3.25 KB
/
mk-sponsors.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/perl
use strict;
my $SSURL = "https://rest.opencollective.com/v2/curl/tier/silver-sponsor/orders/active";
## Silver sponsors
# URLs must match exactly the one retrieved from opencollective.com or if null the "slug"
my %silver = (
"https://ipinfo.io/" => 'ipinfo.svg',
"https://www.airbnb.com/" => 'airbnb.svg',
"https://www.premium-minds.com" => 'premium-minds.svg',
"https://www.partitionwizard.com" => 'partitionwizard-2.svg',
"https://www.crosswordsolver.com" => 'CrosswordSolver.svg',
"https://www.minitool.com" => 'minitool-2.svg',
"https://icons8.com/" => 'icons8.svg',
"https://serpapi.com" => 'serpapi.svg',
"https://proxy-hub.com/" => 'proxyhub.svg',
'https://cryptotracker.com' => 'crypto-tracker.svg',
'https://iboysoft.com' => 'iBoysoft.svg',
"flutter-enterprises" => 'fineproxy.jpg',
'https://www.hityah.com/' => 'testarna.png',
'https://onelessthing.co.uk/' => 'onelessthing.svg',
'guest-b727d782' => 'zynk.svg',
'babiel-gmbh' => 'babiel.svg',
# Sponsors that don't get images
'thebestsolution' => '[none]', # link denied 16 May 2024 due to social media manipulation
);
# URLs that are changed from the one in the profile
my %modurl = (
'flutter-enterprises' => 'https://fineproxy.org/',
'https://www.hityah.com/' => 'https://www.testarna.se/casino/utan-svensk-licens',
'guest-b727d782' => 'https://zynk.it',
'babiel-gmbh' => 'https://www.babiel.com/',
);
# Get the list of Silver Sponsor URLs
# Some users don't have web sites configured, in which case use the username
# instead and map it to a URL with %modurl
open(S, "curl -sRL --compressed --proto -all,+https --max-redirs 3 --max-time 10 $SSURL | jq '.nodes[] | if (.fromAccount.website == null) then .fromAccount.slug else .fromAccount.website end'|");
my @urls=<S>;
close(S);
my %found;
my $images;
my $count;
for my $u (reverse @urls) {
{
my $url = $u;
$url =~ s/[\"\n]//g;
my $img = $silver{$url};
if(!$img) {
print STDERR "\n*** Missing image: for $url ($img)\n";
}
$found{$url}=1;
if($img ne '[none]') {
my $alt = $img;
my $href = $url;
$alt =~ s/(.*)\....$/$1/; # strip the extension
$alt =~ s/^([-a-z0-9]*)$/\u$1/; # capitalize only if all lowercase
if($modurl{$url}) {
$href=$modurl{$url};
$found{$href}=1;
}
print <<SPONSOR
<div class="silver"><p> <a class="x" href="$href" rel="sponsored"><img src="pix/silver/$img" alt="$alt"></a></div>
SPONSOR
;
if(! -f "pix/silver/$img") {
print STDERR "Missing image file: pix/silver/$img\n";
exit 1;
}
$images++;
}
$count++;
}
}
my $sec;
open(SP, "<_sponsors.html");
while(<SP>) {
if($_ =~ /^<div class="silver"><p> <a class=\"x\" href="([^"]*)/) {
my $exist=$1;
if(!$found{$exist}) {
print STDERR "$exist is not a sponsor anymore\n";
}
$sec++;
}
}
close(SP);
if($sec != $images) {
print STDERR "_sponsors.html count ($sec) does not match online count: $count ($images with images)\n";
}
print STDERR "$count sponsors, $images images\n";