Merge branch 'main' into fix-zindex

This commit is contained in:
Darshan 2025-05-23 22:20:57 +05:30 committed by GitHub
commit 598165c0e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 6 deletions

View file

@ -1352,6 +1352,12 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string
if ($encrypt && !empty($plan) && !($plan['databasesAllowEncrypt'] ?? false)) {
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Encrypted string attributes are not available on your plan. Please upgrade to create encrypted string attributes.');
}
if ($encrypt && $size < APP_DATABASE_ENCRYPT_SIZE_MIN) {
throw new Exception(
Exception::GENERAL_BAD_REQUEST,
"Size too small. Encrypted strings require a minimum size of " . APP_DATABASE_ENCRYPT_SIZE_MIN . " characters."
);
}
// Ensure attribute default is within required size
$validator = new Text($size, 0);
if (!is_null($default) && !$validator->isValid($default)) {

View file

@ -51,6 +51,7 @@ const APP_DATABASE_TIMEOUT_MILLISECONDS_API = 15 * 1000; // 15 seconds
const APP_DATABASE_TIMEOUT_MILLISECONDS_WORKER = 300 * 1000; // 5 minutes
const APP_DATABASE_TIMEOUT_MILLISECONDS_TASK = 300 * 1000; // 5 minutes
const APP_DATABASE_QUERY_MAX_VALUES = 500;
const APP_DATABASE_ENCRYPT_SIZE_MIN = 150;
const APP_STORAGE_UPLOADS = '/storage/uploads';
const APP_STORAGE_SITES = '/storage/sites';
const APP_STORAGE_FUNCTIONS = '/storage/functions';

View file

@ -36,6 +36,7 @@ class Comment
$this->builds[$id] = [
'projectName' => $project->getAttribute('name'),
'projectId' => $project->getId(),
'region' => $project->getAttribute('region', 'default'),
'resourceName' => $resource->getAttribute('name'),
'resourceId' => $resource->getId(),
'resourceType' => $resourceType,
@ -66,6 +67,7 @@ class Comment
if ($build['resourceType'] === 'site') {
$projects[$build['projectId']]['site'][$build['resourceId']] = [
'name' => $build['resourceName'],
'region' => $build['region'],
'status' => $build['buildStatus'],
'deploymentId' => $build['deploymentId'],
'action' => $build['action'],
@ -74,6 +76,7 @@ class Comment
} elseif ($build['resourceType'] === 'function') {
$projects[$build['projectId']]['function'][$build['resourceId']] = [
'name' => $build['resourceName'],
'region' => $build['region'],
'status' => $build['buildStatus'],
'deploymentId' => $build['deploymentId'],
'action' => $build['action'],
@ -114,7 +117,7 @@ class Comment
};
if ($site['action']['type'] === 'logs') {
$action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $projectId . '/sites/site-' . $siteId . '/deployments/deployment-' . $site['deploymentId'] . ')';
$action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $site['region'] . '-' . $projectId . '/sites/site-' . $siteId . '/deployments/deployment-' . $site['deploymentId'] . ')';
} else {
$action = '[Authorize](' . $site['action']['url'] . ')';
}
@ -146,12 +149,12 @@ class Comment
$text .= "| :- | :- | :- | :- |\n";
foreach ($project['function'] as $functionId => $function) {
$extension = $site['status'] === 'building' ? 'gif' : 'png';
$extension = $function['status'] === 'building' ? 'gif' : 'png';
$pathLight = '/images/vcs/status-' . $site['status'] . '-light.' . $extension;
$pathDark = '/images/vcs/status-' . $site['status'] . '-dark.' . $extension;
$pathLight = '/images/vcs/status-' . $function['status'] . '-light.' . $extension;
$pathDark = '/images/vcs/status-' . $function['status'] . '-dark.' . $extension;
$status = match ($site['status']) {
$status = match ($function['status']) {
'waiting' => $this->generatImage($pathLight, $pathDark, 'Queued', 85) . ' _Queued_',
'processing' => $this->generatImage($pathLight, $pathDark, 'Processing', 85) . ' _Processing_',
'building' => $this->generatImage($pathLight, $pathDark, 'Building', 85) . ' _Building_',
@ -160,7 +163,7 @@ class Comment
};
if ($function['action']['type'] === 'logs') {
$action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $projectId . '/functions/function-' . $functionId . '/deployment-' . $function['deploymentId'] . ')';
$action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $function['region'] . '-' . $projectId . '/functions/function-' . $functionId . '/deployment-' . $function['deploymentId'] . ')';
} else {
$action = '[Authorize](' . $function['action']['url'] . ')';
}

View file

@ -686,6 +686,18 @@ class DatabasesCustomServerTest extends Scope
'size' => 256,
'required' => true,
]);
// checking size test
$lastName = $this->client->call(Client::METHOD_POST, $attributesPath . '/string', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
]), [
'key' => 'lastName',
'size' => 149,
'required' => true,
'encrypt' => true
]);
$this->assertEquals("Size too small. Encrypted strings require a minimum size of " . APP_DATABASE_ENCRYPT_SIZE_MIN . " characters.", $lastName['body']['message']);
$lastName = $this->client->call(Client::METHOD_POST, $attributesPath . '/string', array_merge([
'content-type' => 'application/json',