1
0
Fork 0
mirror of synced 2024-05-20 20:52:36 +12:00

Updated env vars

This commit is contained in:
Eldad Fux 2020-03-01 19:05:51 +02:00
parent dcae998d45
commit 27850c660f
5 changed files with 22 additions and 11 deletions

View file

@ -206,7 +206,7 @@ $utopia->get('/v1/avatars/favicon')
->label('sdk.method', 'getFavicon')
->label('sdk.description', '/docs/references/avatars/get-favicon.md')
->action(
function ($url) use ($response, $version) {
function ($url) use ($response, $request, $version) {
$width = 56;
$height = 56;
$quality = 80;
@ -237,7 +237,10 @@ $utopia->get('/v1/avatars/favicon')
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 3,
CURLOPT_URL => $url,
CURLOPT_USERAGENT => sprintf(APP_USERAGENT, $version),
CURLOPT_USERAGENT => sprintf(APP_USERAGENT,
$version,
$request->getServer('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
),
]);
$html = curl_exec($curl);

View file

@ -20,9 +20,9 @@ use PHPMailer\PHPMailer\PHPMailer;
const APP_NAME = 'Appwrite';
const APP_DOMAIN = 'appwrite.io';
const APP_EMAIL_TEAM = 'team@'.APP_DOMAIN;
const APP_EMAIL_SECURITY = 'security@'.APP_DOMAIN;
const APP_USERAGENT = APP_NAME.'-Server/%s Please report abuse at '.APP_EMAIL_SECURITY;
const APP_EMAIL_TEAM = 'team@localhost'; // Default email address
const APP_EMAIL_SECURITY = 'security@localhost'; // Default security email address
const APP_USERAGENT = APP_NAME.'-Server v%s. Please report abuse at %s';
const APP_MODE_ADMIN = 'admin';
const APP_PAGING_LIMIT = 15;
const APP_CACHE_BUSTER = 48;
@ -209,7 +209,9 @@ if (in_array($locale, $locales)) {
stream_context_set_default([ // Set global user agent and http settings
'http' => [
'method' => 'GET',
'user_agent' => sprintf(APP_USERAGENT, $version),
'user_agent' => sprintf(APP_USERAGENT,
$version,
$request->getServer('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)),
'timeout' => 2,
],
]);

View file

@ -23,7 +23,7 @@ class TasksV1
public function perform()
{
global $consoleDB, $version;
global $consoleDB, $version, $request;
/*
* 1. Get Original Task
@ -93,7 +93,10 @@ class TasksV1
curl_setopt($ch, CURLOPT_POSTFIELDS, '');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, sprintf(APP_USERAGENT, $version));
curl_setopt($ch, CURLOPT_USERAGENT, sprintf(APP_USERAGENT,
$version,
$request->getServer('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
));
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,

View file

@ -19,7 +19,7 @@ class WebhooksV1
public function perform()
{
global $consoleDB, $version;
global $consoleDB, $version, $request;
$errors = [];
@ -58,7 +58,10 @@ class WebhooksV1
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, sprintf(APP_USERAGENT, $version));
curl_setopt($ch, CURLOPT_USERAGENT, sprintf(APP_USERAGENT,
$version,
$request->getServer('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS', APP_EMAIL_SECURITY)
));
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,

View file

@ -138,7 +138,7 @@ abstract class OAuth2
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, APP_USERAGENT);
curl_setopt($ch, CURLOPT_USERAGENT, '');
if (!empty($payload)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);