mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Merge remote-tracking branch 'origin/main' into restore-storage-folder-api
This commit is contained in:
commit
ecfdb83c8a
20 files changed
+830
-194
No files matched your search
+64
-74
@@ -517,7 +517,7 @@ jobs:
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
-e _TESTS_OAUTH2_GITHUB_CLIENT_ID="${{ secrets.TESTS_OAUTH2_GITHUB_CLIENT_ID }}" \
|
||||
-e _TESTS_OAUTH2_GITHUB_CLIENT_SECRET="${{ secrets.TESTS_OAUTH2_GITHUB_CLIENT_SECRET }}" \
|
||||
appwrite vendor/bin/paratest --processes "$PARATEST_PROCESSES" $FUNCTIONAL_FLAG "$SERVICE_PATH" --exclude-group abuseEnabled --exclude-group screenshots --log-junit tests/e2e/Services/${{ matrix.service.name }}/junit.xml
|
||||
appwrite vendor/bin/paratest --processes "$PARATEST_PROCESSES" $FUNCTIONAL_FLAG "$SERVICE_PATH" --exclude-group abuseEnabled --exclude-group screenshots --exclude-group antivirus --log-junit tests/e2e/Services/${{ matrix.service.name }}/junit.xml
|
||||
|
||||
- name: Failure Logs
|
||||
if: failure()
|
||||
@@ -525,10 +525,10 @@ jobs:
|
||||
echo "=== Appwrite Logs ==="
|
||||
docker compose logs --timestamps
|
||||
|
||||
e2e_abuse:
|
||||
name: Tests / E2E / Abuse (${{ matrix.mode }})
|
||||
e2e_grouped:
|
||||
name: Tests / E2E / ${{ matrix.config.label }} (${{ matrix.mode }})
|
||||
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/retry=when-interrupted/extras=otel+ecr-cache
|
||||
timeout-minutes: 15
|
||||
timeout-minutes: 35
|
||||
needs: [build, matrix]
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -537,6 +537,30 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
mode: ${{ fromJSON(needs.matrix.outputs.modes) }}
|
||||
config:
|
||||
- label: Abuse
|
||||
group: abuseEnabled
|
||||
path: /usr/src/code/tests/e2e
|
||||
options_abuse: enabled
|
||||
storage_antivirus: disabled
|
||||
compose_profiles: ''
|
||||
wait: ''
|
||||
- label: Screenshots
|
||||
group: screenshots
|
||||
path: /usr/src/code/tests/e2e/Services/Sites
|
||||
options_abuse: disabled
|
||||
storage_antivirus: disabled
|
||||
compose_profiles: ''
|
||||
wait: executor
|
||||
- label: Antivirus
|
||||
group: antivirus
|
||||
path: /usr/src/code/tests/e2e/Services/Storage
|
||||
options_abuse: disabled
|
||||
storage_antivirus: enabled
|
||||
compose_profiles: antivirus
|
||||
wait: clamav
|
||||
env:
|
||||
COMPOSE_PROFILES: ${{ matrix.config.compose_profiles }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
@@ -574,82 +598,22 @@ jobs:
|
||||
done
|
||||
|
||||
- name: Load and Start Appwrite
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: ${{ matrix.config.wait == 'clamav' && 15 || 5 }}
|
||||
env:
|
||||
_APP_OPTIONS_ABUSE: enabled
|
||||
_APP_OPTIONS_ABUSE: ${{ matrix.config.options_abuse }}
|
||||
_APP_STORAGE_ANTIVIRUS: ${{ matrix.config.storage_antivirus }}
|
||||
_APP_DATABASE_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'documentsdb_db_main' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'vectorsdb_db_main' || '' }}
|
||||
run: docker compose up -d --quiet-pull --wait
|
||||
|
||||
- name: Run tests
|
||||
timeout-minutes: 15
|
||||
run: >-
|
||||
docker compose exec -T
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}"
|
||||
appwrite test /usr/src/code/tests/e2e --group=abuseEnabled
|
||||
|
||||
- name: Failure Logs
|
||||
if: failure()
|
||||
run: |
|
||||
echo "=== Appwrite Logs ==="
|
||||
docker compose logs --timestamps
|
||||
|
||||
e2e_screenshots:
|
||||
name: Tests / E2E / Screenshots (${{ matrix.mode }})
|
||||
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/retry=when-interrupted/extras=otel+ecr-cache
|
||||
timeout-minutes: 15
|
||||
needs: [build, matrix]
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
mode: ${{ fromJSON(needs.matrix.outputs.modes) }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: ${{ env.DOCKERHUB_AUTH_AVAILABLE == 'true' }}
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||
with:
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- parallel:
|
||||
- name: Pull Docker Image
|
||||
run: |
|
||||
docker pull ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }}
|
||||
docker tag ${{ env.RUNS_ON_ECR_CACHE }}:${{ env.IMAGE }}-${{ github.sha }} ${{ env.IMAGE }}
|
||||
|
||||
- name: Pull Docker Compose images
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
# Docker Hub registry timeouts are a common transient CI failure
|
||||
# (e.g. a traefik manifest fetch timing out). Retry the image pull;
|
||||
# keep `up` single-shot so genuine container health failures still surface.
|
||||
for attempt in 1 2 3; do
|
||||
if docker compose pull --quiet --ignore-buildable; then
|
||||
break
|
||||
elif [ "$attempt" -eq 3 ]; then
|
||||
echo "::error::docker compose pull failed after 3 attempts; aborting"
|
||||
exit 1
|
||||
fi
|
||||
echo "::warning::docker compose pull failed (attempt ${attempt}/3); retrying in 15s"
|
||||
sleep 15
|
||||
done
|
||||
|
||||
- name: Load and Start Appwrite
|
||||
timeout-minutes: 5
|
||||
env:
|
||||
_APP_DATABASE_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'database_db_main' || '' }}
|
||||
_APP_DATABASE_DOCUMENTSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'documentsdb_db_main' || '' }}
|
||||
_APP_DATABASE_VECTORSDB_SHARED_TABLES: ${{ matrix.mode != 'dedicated' && 'vectorsdb_db_main' || '' }}
|
||||
run: docker compose up -d --quiet-pull --wait
|
||||
if [ "${{ matrix.config.wait }}" = "clamav" ]; then
|
||||
docker compose up -d --quiet-pull --wait --wait-timeout 780
|
||||
else
|
||||
docker compose up -d --quiet-pull --wait
|
||||
fi
|
||||
|
||||
- name: Wait for Open Runtimes
|
||||
if: matrix.config.wait == 'executor'
|
||||
timeout-minutes: 3
|
||||
run: |
|
||||
while ! docker logs exc1 | grep -q "Executor is ready."; do
|
||||
@@ -657,18 +621,44 @@ jobs:
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- name: Wait for ClamAV
|
||||
if: matrix.config.wait == 'clamav'
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
for attempt in $(seq 1 120); do
|
||||
if docker compose exec -T appwrite php -r '
|
||||
require "/usr/src/code/vendor/autoload.php";
|
||||
$host = getenv("_APP_STORAGE_ANTIVIRUS_HOST") ?: "clamav";
|
||||
$port = (int) (getenv("_APP_STORAGE_ANTIVIRUS_PORT") ?: 3310);
|
||||
$av = new Appwrite\ClamAV\Network($host, $port);
|
||||
exit(@$av->ping() ? 0 : 1);
|
||||
'; then
|
||||
echo "ClamAV is ready"
|
||||
exit 0
|
||||
fi
|
||||
echo "Waiting for ClamAV (attempt ${attempt}/120)"
|
||||
sleep 5
|
||||
done
|
||||
echo "::error::ClamAV did not become ready"
|
||||
docker compose logs --timestamps clamav || true
|
||||
exit 1
|
||||
|
||||
- name: Run tests
|
||||
timeout-minutes: 15
|
||||
run: >-
|
||||
docker compose exec -T
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}"
|
||||
appwrite test /usr/src/code/tests/e2e/Services/Sites --group=screenshots
|
||||
appwrite test ${{ matrix.config.path }} --group=${{ matrix.config.group }}
|
||||
|
||||
- name: Failure Logs
|
||||
if: failure()
|
||||
run: |
|
||||
echo "=== Appwrite Logs ==="
|
||||
docker compose logs --timestamps
|
||||
if [ "${{ matrix.config.wait }}" = "clamav" ]; then
|
||||
echo "=== ClamAV Logs ==="
|
||||
docker compose logs --timestamps clamav || true
|
||||
fi
|
||||
|
||||
benchmark:
|
||||
name: Benchmark
|
||||
|
||||
@@ -1499,7 +1499,7 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||
->inject('domainVerification')
|
||||
->inject('cookieDomain')
|
||||
->inject('authorization')
|
||||
->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Validator $redirectValidator, Document $devKey, User $user, Database $dbForProject, GeoRecord $geoRecord, Database $dbForPlatform, Event $queueForEvents, Store $store, ProofsPassword $proofForPassword, ProofsToken $proofForToken, array $plan, bool $domainVerification, ?string $cookieDomain, Authorization $authorization) use ($oauthDefaultSuccess) {
|
||||
->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Validator $redirectValidator, Document $devKey, User $user, Database $dbForProject, GeoRecord $geoRecord, Database $dbForPlatform, Event $queueForEvents, Store $store, ProofsPassword $proofForPassword, ProofsToken $proofForToken, array $plan, bool $domainVerification, ?string $cookieDomain, Authorization $authorization) use ($oauthDefaultSuccess, $oauthDefaultFailure) {
|
||||
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https';
|
||||
$port = $request->getPort();
|
||||
$callbackBase = $protocol . '://' . $request->getHostname();
|
||||
@@ -1572,7 +1572,7 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||
$failure = URLParser::parse($state['failure']);
|
||||
}
|
||||
|
||||
$failureRedirect = (function (string $type, ?string $message = null, ?int $code = null, ?\Throwable $previous = null, array $params = []) use ($failure, $response) {
|
||||
$failureRedirect = (function (string $type, ?string $message = null, ?int $code = null, ?\Throwable $previous = null, array $params = []) use ($failure, $response, $project, $oauthDefaultFailure) {
|
||||
$exception = new Exception($type, $message, $code, $previous, params: $params);
|
||||
if (!empty($failure)) {
|
||||
$query = URLParser::parseQuery($failure['query']);
|
||||
@@ -1581,6 +1581,11 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||
'type' => $exception->getType(),
|
||||
'code' => !\is_null($code) ? $code : $exception->getCode(),
|
||||
]);
|
||||
// Mirror success path: default OAuth failure relay needs project to deep-link
|
||||
// back into the native app via appwrite-callback-{project}://
|
||||
if (($failure['path'] ?? '') === $oauthDefaultFailure) {
|
||||
$query['project'] = $project->getId();
|
||||
}
|
||||
$failure['query'] = URLParser::unparseQuery($query);
|
||||
$response->redirect(URLParser::unparse($failure), 301);
|
||||
}
|
||||
|
||||
@@ -1130,7 +1130,8 @@ Http::shutdown()
|
||||
->inject('authorization')
|
||||
->inject('apiKey')
|
||||
->inject('mode')
|
||||
->action(function (Route $route, Response $response, Document $project, User $user, Database $dbForPlatform, Authorization $authorization, ?Key $apiKey, string $mode) {
|
||||
->inject('lock')
|
||||
->action(function (Route $route, Response $response, Document $project, User $user, Database $dbForPlatform, Authorization $authorization, ?Key $apiKey, string $mode, Lock $lock) {
|
||||
/**
|
||||
* Persist completed onboarding stage after usage shutdown so a schema/write failure here
|
||||
* cannot suppress RequestCompleted or usage metrics on the same request.
|
||||
@@ -1201,9 +1202,16 @@ Http::shutdown()
|
||||
];
|
||||
|
||||
try {
|
||||
$authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([
|
||||
'onboarding' => $byMethod,
|
||||
])));
|
||||
// last write overwriting the other's stage on multiple request
|
||||
// onboarding is not a native array attribute, it is a string with json filter.
|
||||
// we do not have a query operator for array merge keys
|
||||
$lock->tryWithKey(
|
||||
'lock:platform:' . $project->getSequence() . ':onboarding',
|
||||
fn () => $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([
|
||||
'onboarding' => $byMethod,
|
||||
]))),
|
||||
target: 'projects',
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
// Missing `onboarding` attribute on upgraded installs must not break the request lifecycle.
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ foreach ($vars as $key => $value) {
|
||||
if ($value === null || $value === '') {
|
||||
echo $key . "=\n";
|
||||
} else {
|
||||
echo $key . '="' . addcslashes((string) $value, '"\\$`') . '"' . "\n";
|
||||
// Escape newlines and special chars so multiline secrets (e.g. GitHub App
|
||||
// private keys) survive install/upgrade rewrites as a single .env line.
|
||||
echo $key . '="' . \Appwrite\Docker\Env::encodeValue((string) $value) . '"' . "\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
Generated
+55
-60
@@ -3167,7 +3167,7 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/audit",
|
||||
"version": "2.9.0",
|
||||
"version": "2.9.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/audit.git",
|
||||
@@ -3206,7 +3206,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/audit/issues",
|
||||
"source": "https://github.com/utopia-php/audit/tree/2.9.0"
|
||||
"source": "https://github.com/utopia-php/audit/tree/2.9.1"
|
||||
},
|
||||
"time": "2026-07-15T10:27:51+00:00"
|
||||
},
|
||||
@@ -3635,16 +3635,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "6.4.4",
|
||||
"version": "6.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "a1796fd360d58abcc3bb3e1b615fcebc04ba9100"
|
||||
"reference": "7fd133e99698feb300a689be8767efa975c2cf13"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/a1796fd360d58abcc3bb3e1b615fcebc04ba9100",
|
||||
"reference": "a1796fd360d58abcc3bb3e1b615fcebc04ba9100",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/7fd133e99698feb300a689be8767efa975c2cf13",
|
||||
"reference": "7fd133e99698feb300a689be8767efa975c2cf13",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3689,9 +3689,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/6.4.4"
|
||||
"source": "https://github.com/utopia-php/database/tree/6.5.1"
|
||||
},
|
||||
"time": "2026-07-17T08:21:36+00:00"
|
||||
"time": "2026-07-27T09:40:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/detector",
|
||||
@@ -4055,16 +4055,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/http",
|
||||
"version": "2.0.0-rc18",
|
||||
"version": "2.0.0-rc19",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/http.git",
|
||||
"reference": "3bfc500c6a53ffb87d4dcb95b4712b6a91b24439"
|
||||
"reference": "7a9419858c6c612a8d783024ad46740f857e4430"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/http/zipball/3bfc500c6a53ffb87d4dcb95b4712b6a91b24439",
|
||||
"reference": "3bfc500c6a53ffb87d4dcb95b4712b6a91b24439",
|
||||
"url": "https://api.github.com/repos/utopia-php/http/zipball/7a9419858c6c612a8d783024ad46740f857e4430",
|
||||
"reference": "7a9419858c6c612a8d783024ad46740f857e4430",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4102,22 +4102,22 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/http/issues",
|
||||
"source": "https://github.com/utopia-php/http/tree/2.0.0-rc18"
|
||||
"source": "https://github.com/utopia-php/http/tree/2.0.0-rc19"
|
||||
},
|
||||
"time": "2026-07-13T16:18:22+00:00"
|
||||
"time": "2026-07-27T07:23:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/image",
|
||||
"version": "0.8.7",
|
||||
"version": "0.8.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/image.git",
|
||||
"reference": "ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7"
|
||||
"reference": "6647714267e43bae25c8e8ae7021264eca4a1e84"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/image/zipball/ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7",
|
||||
"reference": "ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7",
|
||||
"url": "https://api.github.com/repos/utopia-php/image/zipball/6647714267e43bae25c8e8ae7021264eca4a1e84",
|
||||
"reference": "6647714267e43bae25c8e8ae7021264eca4a1e84",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4125,11 +4125,6 @@
|
||||
"ext-imagick": "*",
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/pint": "1.24.*",
|
||||
"phpstan/phpstan": "2.1.*",
|
||||
"phpunit/phpunit": "10.5.*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-imagick": "Imagick extension is required for Imagick adapter"
|
||||
},
|
||||
@@ -4153,9 +4148,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/image/issues",
|
||||
"source": "https://github.com/utopia-php/image/tree/0.8.7"
|
||||
"source": "https://github.com/utopia-php/image/tree/0.8.9"
|
||||
},
|
||||
"time": "2026-07-13T12:12:06+00:00"
|
||||
"time": "2026-07-20T18:04:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/locale",
|
||||
@@ -5421,31 +5416,31 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "appwrite/sdk-generator",
|
||||
"version": "2.4.13",
|
||||
"version": "2.4.19",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||
"reference": "7ead3b6ff1746ae950cacca55bc9800708d5beff"
|
||||
"reference": "d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7ead3b6ff1746ae950cacca55bc9800708d5beff",
|
||||
"reference": "7ead3b6ff1746ae950cacca55bc9800708d5beff",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9",
|
||||
"reference": "d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"matthiasmullie/minify": "1.3.*",
|
||||
"matthiasmullie/minify": "^1.3",
|
||||
"php": ">=8.5",
|
||||
"twig/twig": "3.28.*"
|
||||
"twig/twig": "^3.28"
|
||||
},
|
||||
"require-dev": {
|
||||
"brianium/paratest": "7.*",
|
||||
"phpunit/phpunit": "11.*",
|
||||
"brianium/paratest": "^7",
|
||||
"phpunit/phpunit": "^11",
|
||||
"rector/rector": "^2.4",
|
||||
"squizlabs/php_codesniffer": "4.*"
|
||||
"squizlabs/php_codesniffer": "^4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -5467,9 +5462,9 @@
|
||||
"description": "SDK generator for Appwrite APIs across multiple programming languages and platforms",
|
||||
"support": {
|
||||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/2.4.13"
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/2.4.19"
|
||||
},
|
||||
"time": "2026-07-13T07:30:15+00:00"
|
||||
"time": "2026-07-24T06:18:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "brianium/paratest",
|
||||
@@ -6177,11 +6172,11 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "2.2.5",
|
||||
"version": "2.2.6",
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/909c1e5fef7989ac0d0c1c5c42e32a5c4f6198a0",
|
||||
"reference": "909c1e5fef7989ac0d0c1c5c42e32a5c4f6198a0",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/a6e9b5a9420f6109c091e87d82683bd1a80b87ed",
|
||||
"reference": "a6e9b5a9420f6109c091e87d82683bd1a80b87ed",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -6237,7 +6232,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-05T06:31:06+00:00"
|
||||
"time": "2026-07-26T21:22:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@@ -6586,16 +6581,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "12.5.31",
|
||||
"version": "12.5.32",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d"
|
||||
"reference": "c02591dd7840ed124a98d7770753329ad28e9f8f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c02591dd7840ed124a98d7770753329ad28e9f8f",
|
||||
"reference": "c02591dd7840ed124a98d7770753329ad28e9f8f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -6664,7 +6659,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.31"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.32"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -6672,25 +6667,25 @@
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-06T14:54:16+00:00"
|
||||
"time": "2026-07-25T06:54:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rector/rector",
|
||||
"version": "2.5.7",
|
||||
"version": "2.5.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rectorphp/rector.git",
|
||||
"reference": "ba22f8c087848278fed6b4910d4cf1108096d8d3"
|
||||
"reference": "861c77fd2a6d45317a401f4e0b617f947e8b6f96"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/ba22f8c087848278fed6b4910d4cf1108096d8d3",
|
||||
"reference": "ba22f8c087848278fed6b4910d4cf1108096d8d3",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/861c77fd2a6d45317a401f4e0b617f947e8b6f96",
|
||||
"reference": "861c77fd2a6d45317a401f4e0b617f947e8b6f96",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0",
|
||||
"phpstan/phpstan": "^2.2.2"
|
||||
"phpstan/phpstan": "^2.2.6"
|
||||
},
|
||||
"conflict": {
|
||||
"rector/rector-doctrine": "*",
|
||||
@@ -6724,7 +6719,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/rectorphp/rector/issues",
|
||||
"source": "https://github.com/rectorphp/rector/tree/2.5.7"
|
||||
"source": "https://github.com/rectorphp/rector/tree/2.5.8"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -6732,7 +6727,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-13T15:24:18+00:00"
|
||||
"time": "2026-07-27T06:19:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
@@ -7697,16 +7692,16 @@
|
||||
},
|
||||
{
|
||||
"name": "swoole/ide-helper",
|
||||
"version": "6.0.2",
|
||||
"version": "6.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/swoole/ide-helper.git",
|
||||
"reference": "6f12243dce071714c5febe059578d909698f9a52"
|
||||
"reference": "ad91a281e135f498426fb2e5297376581a4e2dca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/swoole/ide-helper/zipball/6f12243dce071714c5febe059578d909698f9a52",
|
||||
"reference": "6f12243dce071714c5febe059578d909698f9a52",
|
||||
"url": "https://api.github.com/repos/swoole/ide-helper/zipball/ad91a281e135f498426fb2e5297376581a4e2dca",
|
||||
"reference": "ad91a281e135f498426fb2e5297376581a4e2dca",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@@ -7723,9 +7718,9 @@
|
||||
"description": "IDE help files for Swoole.",
|
||||
"support": {
|
||||
"issues": "https://github.com/swoole/ide-helper/issues",
|
||||
"source": "https://github.com/swoole/ide-helper/tree/6.0.2"
|
||||
"source": "https://github.com/swoole/ide-helper/tree/6.2.2"
|
||||
},
|
||||
"time": "2025-03-23T07:31:41+00:00"
|
||||
"time": "2026-07-25T08:15:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
@@ -8438,5 +8433,5 @@
|
||||
"platform-dev": {
|
||||
"ext-fileinfo": "*"
|
||||
},
|
||||
"plugin-api-version": "2.9.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
@@ -456,6 +456,14 @@ services:
|
||||
appwrite-embedding:
|
||||
ports:
|
||||
- "9505:3000"
|
||||
clamav:
|
||||
profiles:
|
||||
- antivirus
|
||||
image: clamav/clamav:1.4-debian
|
||||
container_name: appwrite-clamav
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
configs:
|
||||
redisinsight-connections.json:
|
||||
content: |
|
||||
|
||||
+6
-6
@@ -935,7 +935,7 @@ services:
|
||||
- _APP_MIGRATION_HOST
|
||||
appwrite-task-maintenance:
|
||||
entrypoint: maintenance
|
||||
restart: on-failure:3
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
@@ -982,7 +982,7 @@ services:
|
||||
- _APP_DATABASE_SHARED_TABLES
|
||||
appwrite-task-interval:
|
||||
entrypoint: interval
|
||||
restart: on-failure:3
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
@@ -1024,7 +1024,7 @@ services:
|
||||
|
||||
appwrite-task-scheduler-functions:
|
||||
entrypoint: schedule-functions
|
||||
restart: on-failure:3
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
@@ -1063,7 +1063,7 @@ services:
|
||||
- _APP_DATABASE_SHARED_TABLES
|
||||
appwrite-task-scheduler-executions:
|
||||
entrypoint: schedule-executions
|
||||
restart: on-failure:3
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
@@ -1102,7 +1102,7 @@ services:
|
||||
- _APP_DATABASE_SHARED_TABLES
|
||||
appwrite-task-scheduler-messages:
|
||||
entrypoint: schedule-messages
|
||||
restart: on-failure:3
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
@@ -1290,7 +1290,7 @@ services:
|
||||
options:
|
||||
max-file: "5"
|
||||
max-size: 10m
|
||||
restart: on-failure:3
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
volumes:
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
# Multi Architecture Support
|
||||
|
||||
A list of Appwrite CPU architecture support status. We use this list to track the status of all Appwrite related Docker images and which architecture is supported by each image.
|
||||
CPU architecture support for Docker images used by the Appwrite stack. Platforms are taken from the published multi-arch manifests on Docker Hub / GHCR (not from historical claims).
|
||||
|
||||
| | linux/amd64 | linux/arm64 | linux/arm/v6 | linux/arm/v7 | linux/arm64/v8 | linux/ppc64le | linux/s390x |
|
||||
| Image | linux/amd64 | linux/arm64 | linux/arm/v6 | linux/arm/v7 | linux/arm64/v8 | linux/ppc64le | linux/s390x |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| appwrite/appwrite | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 |
|
||||
| appwrite/mariadb | 🟢 | 🟢 | 🔴 | 🔴 | 🔴 | 🟢 | 🔴 |
|
||||
| appwrite/clamav | 🟢 | 🟢 | 🟢 | 🟢 | 🔴 | 🟢 | 🟢 |
|
||||
| traefik | 🟢 | 🔴 | 🟢 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| redis | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 |
|
||||
| **Core** | | | | | | | |
|
||||
| appwrite/appwrite | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| appwrite/base:1.4.4 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| appwrite/assistant:0.8.4 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| appwrite/browser:0.3.3 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| appwrite/embedding:0.1.0 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| appwrite/geo:0.3.0 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| appwrite/postgres:0.1.0 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| openruntimes/executor:0.25.4 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| ghcr.io/open-runtimes/orchestrator/jobs-service:0.13.0 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| traefik:3.6 | 🟢 | 🟢 | 🟢 | 🔴 | 🟢 | 🟢 | 🟢 |
|
||||
| redis:7.4.7-alpine | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 |
|
||||
| mariadb:10.11 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🟢 | 🟢 |
|
||||
| mongo:8.2.5 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| **Optional** | | | | | | | |
|
||||
| clamav/clamav:1.4-debian | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🟢 | 🔴 |
|
||||
| **Dev / test** | | | | | | | |
|
||||
| appwrite/mailcatcher:1.1.1 | 🟢 | 🟢 | 🔴 | 🔴 | 🟢 | 🔴 | 🔴 |
|
||||
| appwrite/requestcatcher:1.1.0 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 | 🟢 |
|
||||
| appwrite/altair:0.3.0 | 🟢 | 🟢 | 🔴 | 🟢 | 🟢 | 🔴 | 🔴 |
|
||||
| coredns/coredns:1.12.4 | 🟢 | 🟢 | 🔴 | 🟢 | 🟢 | 🟢 | 🟢 |
|
||||
|
||||
Notes:
|
||||
|
||||
- `linux/arm64` and `linux/arm64/v8` are treated as the same when the manifest publishes a plain `arm64` platform.
|
||||
+181
-19
@@ -5,31 +5,168 @@ namespace Appwrite\Docker;
|
||||
class Env
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string, string|null>
|
||||
*/
|
||||
protected $vars = [];
|
||||
|
||||
public function __construct(string $data)
|
||||
{
|
||||
$data = explode("\n", $data);
|
||||
$length = \strlen($data);
|
||||
$offset = 0;
|
||||
|
||||
foreach ($data as &$row) {
|
||||
$row = explode('=', $row, 2);
|
||||
$key = trim($row[0]);
|
||||
$value = (isset($row[1])) ? (function (string $v): string {
|
||||
$v = trim($v);
|
||||
if (
|
||||
(\str_starts_with($v, '"') && \str_ends_with($v, '"')) ||
|
||||
(\str_starts_with($v, "'") && \str_ends_with($v, "'"))
|
||||
) {
|
||||
return \substr($v, 1, -1);
|
||||
}
|
||||
return $v;
|
||||
})(trim($row[1])) : null;
|
||||
|
||||
if ($key) {
|
||||
$this->vars[$key] = $value;
|
||||
while ($offset < $length) {
|
||||
$lineEnd = \strpos($data, "\n", $offset);
|
||||
if ($lineEnd === false) {
|
||||
$lineEnd = $length;
|
||||
}
|
||||
|
||||
$line = \substr($data, $offset, $lineEnd - $offset);
|
||||
// Normalize Windows newlines for line-oriented parsing of keys.
|
||||
if (\str_ends_with($line, "\r")) {
|
||||
$line = \substr($line, 0, -1);
|
||||
}
|
||||
|
||||
$trimmed = \ltrim($line, " \t");
|
||||
|
||||
// Skip blank lines and comments (including indented comments).
|
||||
if ($trimmed === '' || $trimmed[0] === '#') {
|
||||
$offset = $lineEnd < $length ? $lineEnd + 1 : $length;
|
||||
continue;
|
||||
}
|
||||
|
||||
$equals = \strpos($line, '=');
|
||||
if ($equals === false) {
|
||||
// Skip malformed lines without an assignment on this line.
|
||||
$offset = $lineEnd < $length ? $lineEnd + 1 : $length;
|
||||
continue;
|
||||
}
|
||||
|
||||
$key = \trim(\substr($line, 0, $equals));
|
||||
if ($key === '') {
|
||||
$offset = $lineEnd < $length ? $lineEnd + 1 : $length;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Value starts after '=' in the full buffer so quoted values may span lines.
|
||||
$valueOffset = $offset + $equals + 1;
|
||||
|
||||
// Consume optional whitespace before the value.
|
||||
while ($valueOffset < $length && ($data[$valueOffset] === ' ' || $data[$valueOffset] === "\t")) {
|
||||
$valueOffset++;
|
||||
}
|
||||
|
||||
if ($valueOffset >= $length || $data[$valueOffset] === "\n" || $data[$valueOffset] === "\r") {
|
||||
$this->vars[$key] = '';
|
||||
$offset = $valueOffset < $length ? (($data[$valueOffset] === "\r" && $valueOffset + 1 < $length && $data[$valueOffset + 1] === "\n") ? $valueOffset + 2 : $valueOffset + 1) : $length;
|
||||
continue;
|
||||
}
|
||||
|
||||
$quote = $data[$valueOffset];
|
||||
if ($quote === '"' || $quote === "'") {
|
||||
$contentStart = $valueOffset + 1;
|
||||
$scanOffset = $contentStart;
|
||||
$value = '';
|
||||
$closed = false;
|
||||
$crossedNewline = false;
|
||||
|
||||
while ($scanOffset < $length) {
|
||||
$char = $data[$scanOffset];
|
||||
|
||||
if ($char === "\n" || $char === "\r") {
|
||||
$crossedNewline = true;
|
||||
}
|
||||
|
||||
if ($char === $quote) {
|
||||
// A later line's opening quote (KEY=") must not close an
|
||||
// earlier unterminated value, or upgrade will drop that key.
|
||||
if ($crossedNewline && self::isAssignmentOpener($data, $scanOffset)) {
|
||||
break;
|
||||
}
|
||||
$scanOffset++;
|
||||
$closed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($quote === '"' && $char === '\\' && $scanOffset + 1 < $length) {
|
||||
$next = $data[$scanOffset + 1];
|
||||
$value .= match ($next) {
|
||||
'n' => "\n",
|
||||
'r' => "\r",
|
||||
't' => "\t",
|
||||
'\\' => '\\',
|
||||
'"' => '"',
|
||||
"'" => "'",
|
||||
'$' => '$',
|
||||
'`' => '`',
|
||||
// Preserve unknown escapes as a literal backslash + next char
|
||||
// (e.g. Windows paths or patterns like `\d`, `\q`).
|
||||
default => '\\' . $next,
|
||||
};
|
||||
$scanOffset += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
$value .= $char;
|
||||
$scanOffset++;
|
||||
}
|
||||
|
||||
if (!$closed) {
|
||||
// Unterminated quote: keep only the remainder of the starting line so
|
||||
// later assignments are not absorbed into this value during upgrade.
|
||||
$end = \strpos($data, "\n", $contentStart);
|
||||
if ($end === false) {
|
||||
$raw = \substr($data, $contentStart);
|
||||
$offset = $length;
|
||||
} else {
|
||||
$raw = \substr($data, $contentStart, $end - $contentStart);
|
||||
$offset = $end + 1;
|
||||
}
|
||||
if (\str_ends_with($raw, "\r")) {
|
||||
$raw = \substr($raw, 0, -1);
|
||||
}
|
||||
$this->vars[$key] = $raw;
|
||||
continue;
|
||||
}
|
||||
|
||||
$valueOffset = $scanOffset;
|
||||
|
||||
// Consume trailing characters until end of line (comments/whitespace).
|
||||
while ($valueOffset < $length && $data[$valueOffset] !== "\n" && $data[$valueOffset] !== "\r") {
|
||||
$valueOffset++;
|
||||
}
|
||||
if ($valueOffset < $length) {
|
||||
if ($data[$valueOffset] === "\r" && $valueOffset + 1 < $length && $data[$valueOffset + 1] === "\n") {
|
||||
$valueOffset += 2;
|
||||
} else {
|
||||
$valueOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->vars[$key] = $value;
|
||||
$offset = $valueOffset;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Unquoted value: read until end of line, trim trailing whitespace.
|
||||
$end = \strpos($data, "\n", $valueOffset);
|
||||
if ($end === false) {
|
||||
$raw = \substr($data, $valueOffset);
|
||||
$offset = $length;
|
||||
} else {
|
||||
$raw = \substr($data, $valueOffset, $end - $valueOffset);
|
||||
$offset = $end + 1;
|
||||
}
|
||||
|
||||
if (\str_ends_with($raw, "\r")) {
|
||||
$raw = \substr($raw, 0, -1);
|
||||
}
|
||||
|
||||
// Strip inline comments preceded by whitespace.
|
||||
if (\preg_match('/\s+#/', $raw, $matches, PREG_OFFSET_CAPTURE) === 1) {
|
||||
$raw = \substr($raw, 0, $matches[0][1]);
|
||||
}
|
||||
|
||||
$this->vars[$key] = \rtrim($raw, " \t");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +203,26 @@ class Env
|
||||
return $this->vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a value for a double-quoted .env assignment.
|
||||
*/
|
||||
public static function encodeValue(string $value): string
|
||||
{
|
||||
return \addcslashes($value, "\"\\\n\r\t\$`");
|
||||
}
|
||||
|
||||
/**
|
||||
* True when $quoteOffset points at a quote that opens a new KEY="..." assignment.
|
||||
*/
|
||||
private static function isAssignmentOpener(string $data, int $quoteOffset): bool
|
||||
{
|
||||
$lineStart = \strrpos(\substr($data, 0, $quoteOffset), "\n");
|
||||
$lineStart = $lineStart === false ? 0 : $lineStart + 1;
|
||||
$before = \substr($data, $lineStart, $quoteOffset - $lineStart);
|
||||
|
||||
return \preg_match('/^\s*[A-Za-z_][A-Za-z0-9_]*\s*=\s*$/', $before) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -74,7 +231,12 @@ class Env
|
||||
$output = '';
|
||||
|
||||
foreach ($this->vars as $key => $value) {
|
||||
$output .= $key . '=' . $value . "\n";
|
||||
if ($value === null || $value === '') {
|
||||
$output .= $key . "=\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$output .= $key . '="' . self::encodeValue((string) $value) . "\"\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -365,7 +365,7 @@ class Create extends Action
|
||||
(int) System::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)
|
||||
);
|
||||
|
||||
if (!$antivirus->fileScan($path)) {
|
||||
if (!$antivirus->fileScanInStream($path)) {
|
||||
$deviceForFiles->delete($path);
|
||||
throw new Exception(Exception::STORAGE_INVALID_FILE);
|
||||
}
|
||||
|
||||
@@ -426,14 +426,8 @@ class Install extends Action
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
if (!is_string($value)) {
|
||||
continue;
|
||||
}
|
||||
if (str_contains($value, "\n") || str_contains($value, "\r")) {
|
||||
throw new \InvalidArgumentException('Invalid value for ' . $key);
|
||||
}
|
||||
}
|
||||
// Multiline values (e.g. GitHub App PEM private keys) are allowed; env.phtml
|
||||
// encodes them as escaped single-line double-quoted assignments.
|
||||
|
||||
// Set database-specific connection details
|
||||
$database = $input['_APP_DB_ADAPTER'] ?? 'postgresql';
|
||||
|
||||
@@ -496,14 +496,14 @@ class Migrations extends Action
|
||||
$transfer = $source = $destination = null;
|
||||
$caughtError = null;
|
||||
|
||||
$host = System::getEnv('_APP_MIGRATION_HOST');
|
||||
if (empty($host)) {
|
||||
throw new \Exception('_APP_MIGRATION_HOST is not set');
|
||||
}
|
||||
|
||||
$endpoint = 'http://' . $host . '/v1';
|
||||
|
||||
try {
|
||||
$host = System::getEnv('_APP_MIGRATION_HOST');
|
||||
if (empty($host)) {
|
||||
throw new \Exception('_APP_MIGRATION_HOST is not set');
|
||||
}
|
||||
|
||||
$endpoint = 'http://' . $host . '/v1';
|
||||
|
||||
$credentials = $migration->getAttribute('credentials', []);
|
||||
|
||||
if ($migration->getAttribute('source') === SourceAppwrite::getName()) {
|
||||
|
||||
@@ -9,6 +9,17 @@ use Utopia\Psr7\Request\Factory;
|
||||
|
||||
class Client
|
||||
{
|
||||
public const VIEWPORT_WIDTH = 1280;
|
||||
|
||||
public const VIEWPORT_HEIGHT = 720;
|
||||
|
||||
/**
|
||||
* Captured pixels per CSS pixel. Above 1 the page is rendered at a higher
|
||||
* resolution than the viewport, so previews stay sharp when the console
|
||||
* displays them on high-density screens or scales them up.
|
||||
*/
|
||||
public const SCALE = 1.5;
|
||||
|
||||
private Factory $factory;
|
||||
|
||||
/**
|
||||
@@ -33,6 +44,11 @@ class Client
|
||||
'theme' => $theme,
|
||||
'headers' => $headers,
|
||||
'sleep' => $sleep,
|
||||
'viewport' => [
|
||||
'width' => self::VIEWPORT_WIDTH,
|
||||
'height' => self::VIEWPORT_HEIGHT,
|
||||
],
|
||||
'deviceScaleFactor' => self::SCALE,
|
||||
]));
|
||||
|
||||
$status = $response->getStatusCode();
|
||||
|
||||
@@ -3068,6 +3068,148 @@ final class AccountCustomClientTest extends Scope
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default OAuth failure relay pages need `project` so native apps can deep-link via
|
||||
* appwrite-callback-{project}://. Without it the UI shows "Missing redirect URL"
|
||||
* instead of the real OAuth error.
|
||||
*/
|
||||
public function testOAuthDefaultFailureRedirectIncludesProject(): void
|
||||
{
|
||||
$provider = 'mock';
|
||||
$projectId = $this->getProject()['$id'];
|
||||
|
||||
$response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $projectId . '/oauth2', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => 'console',
|
||||
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||
]), [
|
||||
'provider' => $provider,
|
||||
'appId' => '1',
|
||||
'secret' => '123456',
|
||||
'enabled' => true,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
|
||||
// Omit failure so Appwrite uses the default relay URL (/auth/oauth2/failure or legacy /console/...)
|
||||
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider, [
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $projectId,
|
||||
], [
|
||||
'success' => 'http://localhost/v1/mock/tests/general/oauth2/success',
|
||||
], followRedirects: false);
|
||||
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
$this->assertStringStartsWith('http://localhost/v1/mock/tests/general/oauth2', $response['headers']['location']);
|
||||
|
||||
$mockQuery = [];
|
||||
\parse_str((string) \parse_url($response['headers']['location'], PHP_URL_QUERY), $mockQuery);
|
||||
$this->assertNotEmpty($mockQuery['state'] ?? null);
|
||||
|
||||
// Simulate provider returning an error (same path as a real OAuth denial)
|
||||
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/callback/' . $provider . '/' . $projectId, [
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $projectId,
|
||||
], [
|
||||
'error' => 'access_denied',
|
||||
'error_description' => 'The user denied the request',
|
||||
'state' => $mockQuery['state'],
|
||||
], followRedirects: false);
|
||||
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
$this->assertStringContainsString('/account/sessions/oauth2/' . $provider . '/redirect?', (string) $response['headers']['location']);
|
||||
|
||||
$oauthClient = new Client();
|
||||
$oauthClient->setEndpoint('');
|
||||
$response = $oauthClient->call(Client::METHOD_GET, $response['headers']['location'], followRedirects: false);
|
||||
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
|
||||
$location = $response['headers']['location'];
|
||||
$path = \parse_url($location, PHP_URL_PATH);
|
||||
$query = [];
|
||||
\parse_str((string) \parse_url($location, PHP_URL_QUERY), $query);
|
||||
|
||||
$this->assertContains($path, ['/auth/oauth2/failure', '/console/auth/oauth2/failure']);
|
||||
$this->assertEquals($projectId, $query['project'] ?? null);
|
||||
$this->assertNotEmpty($query['error'] ?? null);
|
||||
|
||||
$error = \json_decode($query['error'], true);
|
||||
$this->assertIsArray($error);
|
||||
$this->assertArrayHasKey('message', $error);
|
||||
$this->assertArrayHasKey('type', $error);
|
||||
$this->assertStringContainsString('access_denied', (string) $error['message']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom failure URLs must not have `project` forced onto them — only the default
|
||||
* Appwrite failure relay path gets that query param (mirrors success-path gating).
|
||||
*/
|
||||
public function testOAuthCustomFailureRedirectOmitsProject(): void
|
||||
{
|
||||
$provider = 'mock';
|
||||
$projectId = $this->getProject()['$id'];
|
||||
|
||||
$response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $projectId . '/oauth2', array_merge([
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => 'console',
|
||||
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
|
||||
]), [
|
||||
'provider' => $provider,
|
||||
'appId' => '1',
|
||||
'secret' => '123456',
|
||||
'enabled' => true,
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider, [
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $projectId,
|
||||
], [
|
||||
'success' => 'http://localhost/v1/mock/tests/general/oauth2/success',
|
||||
'failure' => 'http://localhost/v1/mock/tests/general/oauth2/failure',
|
||||
], followRedirects: false);
|
||||
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
|
||||
$mockQuery = [];
|
||||
\parse_str((string) \parse_url($response['headers']['location'], PHP_URL_QUERY), $mockQuery);
|
||||
$this->assertNotEmpty($mockQuery['state'] ?? null);
|
||||
|
||||
$response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/callback/' . $provider . '/' . $projectId, [
|
||||
'origin' => 'http://localhost',
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $projectId,
|
||||
], [
|
||||
'error' => 'access_denied',
|
||||
'error_description' => 'The user denied the request',
|
||||
'state' => $mockQuery['state'],
|
||||
], followRedirects: false);
|
||||
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
|
||||
$oauthClient = new Client();
|
||||
$oauthClient->setEndpoint('');
|
||||
$response = $oauthClient->call(Client::METHOD_GET, $response['headers']['location'], followRedirects: false);
|
||||
|
||||
$this->assertEquals(301, $response['headers']['status-code']);
|
||||
|
||||
$location = $response['headers']['location'];
|
||||
$this->assertStringStartsWith('http://localhost/v1/mock/tests/general/oauth2/failure?', $location);
|
||||
|
||||
$query = [];
|
||||
\parse_str((string) \parse_url($location, PHP_URL_QUERY), $query);
|
||||
|
||||
$this->assertArrayNotHasKey('project', $query);
|
||||
$this->assertNotEmpty($query['error'] ?? null);
|
||||
}
|
||||
|
||||
public function testOAuthVerifiedEmailCanLinkToExistingAccount(): void
|
||||
{
|
||||
$provider = 'mock';
|
||||
|
||||
@@ -3732,6 +3732,76 @@ trait DatabasesBase
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetDocumentCacheEmpty(): void
|
||||
{
|
||||
$databaseId = $this->setupDatabase()['databaseId'];
|
||||
|
||||
// Dedicated collection so the inserted document cannot change the
|
||||
// document counts asserted by the shared movies-collection tests.
|
||||
$collection = $this->client->call(Client::METHOD_POST, $this->getContainerUrl($databaseId), [
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], [
|
||||
$this->getContainerIdParam() => ID::unique(),
|
||||
'name' => 'CacheEmpty',
|
||||
$this->getSecurityParam() => true,
|
||||
'permissions' => [
|
||||
Permission::create(Role::user($this->getUser()['$id'])),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $collection['headers']['status-code']);
|
||||
$containerId = $collection['body']['$id'];
|
||||
|
||||
if ($this->getSupportForAttributes()) {
|
||||
$this->createAttribute($databaseId, $containerId, 'string', [
|
||||
'key' => 'title',
|
||||
'size' => 256,
|
||||
'required' => false,
|
||||
]);
|
||||
$this->waitForAttribute($databaseId, $containerId, 'title');
|
||||
}
|
||||
|
||||
$documentId = ID::unique();
|
||||
|
||||
// Read a document that does not exist yet -> negatively caches the miss.
|
||||
$missing = $this->client->call(Client::METHOD_GET, $this->getRecordUrl($databaseId, $containerId, $documentId), array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(404, $missing['headers']['status-code']);
|
||||
|
||||
// Create that same id. This must purge the cached "not found".
|
||||
$created = $this->client->call(Client::METHOD_POST, $this->getRecordUrl($databaseId, $containerId), array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
$this->getRecordIdParam() => $documentId,
|
||||
'data' => [
|
||||
'title' => 'Cached Empty',
|
||||
],
|
||||
'permissions' => [
|
||||
Permission::read(Role::user($this->getUser()['$id'])),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $created['headers']['status-code']);
|
||||
$this->assertEquals($documentId, $created['body']['$id']);
|
||||
|
||||
// The freshly created document must be visible right away. Without cache
|
||||
// invalidation on create this would still return 404 from the marker.
|
||||
$fetched = $this->client->call(Client::METHOD_GET, $this->getRecordUrl($databaseId, $containerId, $documentId), array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $fetched['headers']['status-code']);
|
||||
$this->assertEquals($documentId, $fetched['body']['$id']);
|
||||
$this->assertEquals('Cached Empty', $fetched['body']['title']);
|
||||
}
|
||||
|
||||
public function testGetDocumentWithQueries(): void
|
||||
{
|
||||
$data = $this->getDocumentsList();
|
||||
|
||||
@@ -4,14 +4,19 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\E2E\Services\Storage;
|
||||
|
||||
use CURLFile;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Tests\E2E\Client;
|
||||
use Tests\E2E\Scopes\ProjectCustom;
|
||||
use Tests\E2E\Scopes\Scope;
|
||||
use Tests\E2E\Scopes\SideServer;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Database\Helpers\ID;
|
||||
use Utopia\Database\Helpers\Permission;
|
||||
use Utopia\Database\Helpers\Role;
|
||||
use Utopia\Database\Query;
|
||||
use Utopia\Database\Validator\Datetime as DatetimeValidator;
|
||||
use Utopia\System\System;
|
||||
|
||||
final class StorageCustomServerTest extends Scope
|
||||
{
|
||||
@@ -365,4 +370,91 @@ final class StorageCustomServerTest extends Scope
|
||||
);
|
||||
$this->assertEquals(404, $response['headers']['status-code']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Regression for chunked uploads under the antivirus size limit.
|
||||
*
|
||||
* Requires ClamAV (compose profile `antivirus`) and
|
||||
* `_APP_STORAGE_ANTIVIRUS=enabled`. File must be >5MB (chunked) and
|
||||
* ≤20MB (`APP_LIMIT_ANTIVIRUS`) so the last chunk triggers a scan.
|
||||
*/
|
||||
#[Group('antivirus')]
|
||||
public function testCreateBucketFileChunkedUploadWithAntivirus(): void
|
||||
{
|
||||
if (System::getEnv('_APP_STORAGE_ANTIVIRUS', 'disabled') === 'disabled') {
|
||||
$this->markTestSkipped('Antivirus is disabled.');
|
||||
}
|
||||
|
||||
$health = $this->client->call(Client::METHOD_GET, '/health/anti-virus', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $health['headers']['status-code']);
|
||||
$this->assertEquals('pass', $health['body']['status'], 'ClamAV must be reachable when antivirus is enabled.');
|
||||
|
||||
$bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'bucketId' => ID::unique(),
|
||||
'name' => 'Antivirus Chunked Upload Bucket',
|
||||
'fileSecurity' => true,
|
||||
'antivirus' => true,
|
||||
'permissions' => [
|
||||
Permission::create(Role::any()),
|
||||
Permission::read(Role::any()),
|
||||
],
|
||||
]);
|
||||
$this->assertEquals(201, $bucket['headers']['status-code']);
|
||||
|
||||
$source = __DIR__ . '/../../../resources/functions/large/blue.mp4';
|
||||
$totalSize = \filesize($source);
|
||||
$this->assertGreaterThan(5 * 1024 * 1024, $totalSize, 'Fixture must be large enough to chunk.');
|
||||
$this->assertLessThanOrEqual(20_000_000, $totalSize, 'Fixture must stay under APP_LIMIT_ANTIVIRUS.');
|
||||
|
||||
$chunkSize = 5 * 1024 * 1024;
|
||||
$handle = \fopen($source, 'rb');
|
||||
$this->assertNotFalse($handle);
|
||||
|
||||
$fileId = 'unique()';
|
||||
$mimeType = \mime_content_type($source);
|
||||
$counter = 0;
|
||||
$id = '';
|
||||
$file = null;
|
||||
$headers = [
|
||||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
];
|
||||
|
||||
while (!\feof($handle)) {
|
||||
$curlFile = new CURLFile(
|
||||
'data://' . $mimeType . ';base64,' . \base64_encode(\fread($handle, $chunkSize)),
|
||||
$mimeType,
|
||||
'blue.mp4'
|
||||
);
|
||||
$headers['content-range'] = 'bytes ' . ($counter * $chunkSize) . '-' . \min(((($counter * $chunkSize) + $chunkSize) - 1), $totalSize - 1) . '/' . $totalSize;
|
||||
if (!empty($id)) {
|
||||
$headers['x-appwrite-id'] = $id;
|
||||
}
|
||||
|
||||
$file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucket['body']['$id'] . '/files', \array_merge($headers, $this->getHeaders()), [
|
||||
'fileId' => $fileId,
|
||||
'file' => $curlFile,
|
||||
'permissions' => [
|
||||
Permission::read(Role::any()),
|
||||
],
|
||||
]);
|
||||
$counter++;
|
||||
$id = $file['body']['$id'] ?? $id;
|
||||
}
|
||||
\fclose($handle);
|
||||
|
||||
$this->assertEquals(201, $file['headers']['status-code']);
|
||||
$this->assertNotEmpty($file['body']['$id']);
|
||||
$this->assertEquals('blue.mp4', $file['body']['name']);
|
||||
$this->assertEquals($totalSize, $file['body']['sizeOriginal']);
|
||||
$this->assertEquals($file['body']['chunksTotal'], $file['body']['chunksUploaded']);
|
||||
$this->assertNotEmpty($file['body']['mimeType']);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 25 KiB |
@@ -36,10 +36,110 @@ final class EnvTest extends TestCase
|
||||
|
||||
public function testExport(): void
|
||||
{
|
||||
$this->assertSame("_APP_X=value1
|
||||
_APP_Y=value2
|
||||
_APP_Z=value3
|
||||
_APP_W=value5=
|
||||
", $this->object->export());
|
||||
$this->assertSame(
|
||||
"_APP_X=\"value1\"\n_APP_Y=\"value2\"\n_APP_Z=\"value3\"\n_APP_W=\"value5=\"\n",
|
||||
$this->object->export()
|
||||
);
|
||||
}
|
||||
|
||||
public function testMultilineDoubleQuotedPrivateKey(): void
|
||||
{
|
||||
$pem = "-----BEGIN RSA PRIVATE KEY-----\nABCDEF\n-----END RSA PRIVATE KEY-----";
|
||||
$data = "_APP_VCS_GITHUB_PRIVATE_KEY=\"-----BEGIN RSA PRIVATE KEY-----\nABCDEF\n-----END RSA PRIVATE KEY-----\"\n_APP_OTHER=ok\n";
|
||||
|
||||
$env = new Env($data);
|
||||
|
||||
$this->assertSame($pem, $env->getVar('_APP_VCS_GITHUB_PRIVATE_KEY'));
|
||||
$this->assertSame('ok', $env->getVar('_APP_OTHER'));
|
||||
}
|
||||
|
||||
public function testEscapedNewlineInDoubleQuotedValue(): void
|
||||
{
|
||||
$data = "_APP_VCS_GITHUB_PRIVATE_KEY=\"-----BEGIN RSA PRIVATE KEY-----\\nABCDEF\\n-----END RSA PRIVATE KEY-----\"\n";
|
||||
|
||||
$env = new Env($data);
|
||||
|
||||
$this->assertSame(
|
||||
"-----BEGIN RSA PRIVATE KEY-----\nABCDEF\n-----END RSA PRIVATE KEY-----",
|
||||
$env->getVar('_APP_VCS_GITHUB_PRIVATE_KEY')
|
||||
);
|
||||
}
|
||||
|
||||
public function testRoundTripPreservesMultilineSecret(): void
|
||||
{
|
||||
$pem = "-----BEGIN RSA PRIVATE KEY-----\nLINE1\nLINE2\n-----END RSA PRIVATE KEY-----";
|
||||
$env = new Env('');
|
||||
$env->setVar('_APP_VCS_GITHUB_PRIVATE_KEY', $pem);
|
||||
$env->setVar('_APP_DOMAIN', 'example.com');
|
||||
|
||||
$exported = $env->export();
|
||||
$reloaded = new Env($exported);
|
||||
|
||||
$this->assertSame($pem, $reloaded->getVar('_APP_VCS_GITHUB_PRIVATE_KEY'));
|
||||
$this->assertSame('example.com', $reloaded->getVar('_APP_DOMAIN'));
|
||||
$this->assertStringNotContainsString("\nLINE1\n", $exported);
|
||||
$this->assertStringContainsString('\\nLINE1\\n', $exported);
|
||||
}
|
||||
|
||||
public function testEncodeValueEscapesSpecialCharacters(): void
|
||||
{
|
||||
$this->assertSame(
|
||||
'say\\"hi\\nnext\\$path',
|
||||
Env::encodeValue("say\"hi\nnext\$path")
|
||||
);
|
||||
}
|
||||
|
||||
public function testUnknownEscapesPreserveBackslash(): void
|
||||
{
|
||||
// .env contains unknown escapes \q and \d; both must keep the backslash.
|
||||
$data = "_APP_PATTERN=\"prefix\\q and \\d digits\"\n";
|
||||
|
||||
$env = new Env($data);
|
||||
|
||||
$this->assertSame('prefix\\q and \\d digits', $env->getVar('_APP_PATTERN'));
|
||||
}
|
||||
|
||||
public function testIndentedCommentDoesNotCaptureNextAssignment(): void
|
||||
{
|
||||
$data = " # indented note\n_APP_DOMAIN=example.com\n \n_APP_OPTIONS_FORCE_HTTPS=enabled\n";
|
||||
|
||||
$env = new Env($data);
|
||||
|
||||
$this->assertSame('example.com', $env->getVar('_APP_DOMAIN'));
|
||||
$this->assertSame('enabled', $env->getVar('_APP_OPTIONS_FORCE_HTTPS'));
|
||||
$this->assertArrayNotHasKey(' # indented note', $env->list());
|
||||
$this->assertArrayNotHasKey('# indented note', $env->list());
|
||||
}
|
||||
|
||||
public function testLineWithoutAssignmentIsSkipped(): void
|
||||
{
|
||||
$data = "NOT_AN_ASSIGNMENT\n_APP_DOMAIN=example.com\n";
|
||||
|
||||
$env = new Env($data);
|
||||
|
||||
$this->assertSame('example.com', $env->getVar('_APP_DOMAIN'));
|
||||
$this->assertCount(1, $env->list());
|
||||
}
|
||||
|
||||
public function testUnterminatedQuoteDoesNotAbsorbLaterAssignments(): void
|
||||
{
|
||||
$data = "_APP_BROKEN=\"partial-value\n_APP_DOMAIN=example.com\n_APP_OPTIONS_FORCE_HTTPS=enabled\n";
|
||||
|
||||
$env = new Env($data);
|
||||
|
||||
$this->assertSame('partial-value', $env->getVar('_APP_BROKEN'));
|
||||
$this->assertSame('example.com', $env->getVar('_APP_DOMAIN'));
|
||||
$this->assertSame('enabled', $env->getVar('_APP_OPTIONS_FORCE_HTTPS'));
|
||||
}
|
||||
|
||||
public function testUnterminatedQuoteDoesNotAbsorbLaterQuotedAssignment(): void
|
||||
{
|
||||
$data = "_APP_BROKEN=\"partial-value\n_APP_DOMAIN=\"example.com\"\n_APP_OPTIONS_FORCE_HTTPS=enabled\n";
|
||||
|
||||
$env = new Env($data);
|
||||
|
||||
$this->assertSame('partial-value', $env->getVar('_APP_BROKEN'));
|
||||
$this->assertSame('example.com', $env->getVar('_APP_DOMAIN'));
|
||||
$this->assertSame('enabled', $env->getVar('_APP_OPTIONS_FORCE_HTTPS'));
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,41 @@ final class ClientTest extends TestCase
|
||||
'theme' => 'dark',
|
||||
'headers' => ['x-appwrite-hostname' => 'example.com'],
|
||||
'sleep' => 500,
|
||||
'viewport' => ['width' => 1280, 'height' => 720],
|
||||
'deviceScaleFactor' => 1.5,
|
||||
], \json_decode((string)$this->request->getBody(), true));
|
||||
}
|
||||
|
||||
public function testCreateCapturesAboveViewportResolution(): void
|
||||
{
|
||||
$response = (new Response(200, body: new Stream('png-bytes')))
|
||||
->withHeader('Content-Type', 'image/png');
|
||||
|
||||
$this->client($response)->create('http://appwrite/', 'light');
|
||||
|
||||
$body = \json_decode((string)$this->request->getBody(), true);
|
||||
|
||||
// Left unset, the browser service defaults to a scale factor of 1, which
|
||||
// captures exactly one pixel per CSS pixel and renders soft previews.
|
||||
$this->assertGreaterThan(1, $body['deviceScaleFactor']);
|
||||
$this->assertSame(1280, $body['viewport']['width']);
|
||||
$this->assertSame(720, $body['viewport']['height']);
|
||||
}
|
||||
|
||||
public function testCreateDoesNotBlockOnSubresources(): void
|
||||
{
|
||||
$response = (new Response(200, body: new Stream('png-bytes')))
|
||||
->withHeader('Content-Type', 'image/png');
|
||||
|
||||
$this->client($response)->create('http://appwrite/', 'light');
|
||||
|
||||
// The browser service navigates with `domcontentloaded` unless told
|
||||
// otherwise. Waiting for `load` risks exhausting the request timeout on
|
||||
// sites with slow or hanging subresources, which yields no screenshot at
|
||||
// all rather than an early one.
|
||||
$this->assertArrayNotHasKey('waitUntil', \json_decode((string)$this->request->getBody(), true));
|
||||
}
|
||||
|
||||
public function testCreateError(): void
|
||||
{
|
||||
$response = (new Response(400, body: new Stream('{"error":"Timeout exceeded"}')))
|
||||
|
||||
Reference in new issue
Block a user