clearbit logo proxy
This commit is contained in:
parent
0360736af0
commit
a875a1430d
@ -829,6 +829,31 @@ void main() async {
|
||||
},
|
||||
);
|
||||
});
|
||||
app.get('/fbla-api/clearbit/<website>',
|
||||
(Request request, String website) async {
|
||||
print('clearbit logo request received');
|
||||
|
||||
website = Uri.decodeComponent(website);
|
||||
|
||||
var response =
|
||||
await http.get(Uri.parse('https://logo.clearbit.com/$website'));
|
||||
if (response.statusCode == 200) {
|
||||
return Response.ok(
|
||||
response.bodyBytes,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'image/png'
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Response.notFound(
|
||||
'logo not found',
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// get ip address for hosting
|
||||
for (var interface in await NetworkInterface.list()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user