Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ src/Http/routes.php the route contract (relative to the module group; `
src/Http/Controllers/ thin: request -> one service call -> JSON. Base Controller: respond()/fail()/ok()/presentRun()
src/Services/ Actor, Mounts, Rules, Files, Runs, Syncer, Transfer, Delivery, Serve, ServerConfig, AmountException
src/Queue/ Dispatcher, SystemQueue (CMS task queue), STaskQueue (sTask)
src/Console/ SyncHandler (task handler), TickCommand, ServerCommand, DriversCommand, DemoCommand
src/Console/ SyncHandler, DriverInstallHandler (task handlers), TickCommand, ServerCommand, DriversCommand, DemoCommand
src/Workers/SyncWorker sTask worker (file guarded: only loads when sTask exists)
src/Listeners/ NotFound (OnPageNotFound), Cleanup (OnManagerDeleteUser)
src/Drivers/ one class per Flysystem adapter; Drivers::all()
Expand All @@ -46,6 +46,10 @@ ci/ .github/ builds a full CMS with the plugin inside (Docker),
in `conflict` (SFTP `<3.36` would break host-key pinning). Builds (tests, demo, zip, images)
add `PLUGIN_EXTRAS` from `ci/plugin.env`, so tests may use the S3/SFTP/WebDAV classes; code may
not assume them outside their driver (`Driver::available()`). `PackagesTest` keeps this in sync.
- **Installing a driver** (DESIGN rule 11): `amount:drivers --install=<ids>` from a shell; from the page, only an
administrator, through the CMS task queue (`DriverInstaller` queues `amount.driver_install` via the core's
`createTaskFromStoreRequest()`, `DriverInstallHandler` delegates to `ConsoleInstallFlowService`). Never run Composer
in a request, and never take a package name from a request: packages come from `Driver::packages()`.
- **Where a mount connects** (DESIGN rule 10): `Driver::filesystem()` is fail-closed - without
`_trusted` (set by `Mount::filesystem()` from `Mount::trusted()`) local/zip refuse and every
`destinations()` entry must resolve public. A driver gaining a host/URL field must list it in
Expand Down Expand Up @@ -95,8 +99,8 @@ ci/ .github/ builds a full CMS with the plugin inside (Docker),

`{ok:true, ...}` or `{ok:false, error, message[, errors, candidates]}` with the refusal's HTTP status
(403 forbidden, 404 not found, 409 ambiguous/refused, 422 invalid with `errors` field => message, 502 store failure).
`GET /bootstrap` returns `drivers, mounts, foreign_mounts, rules, presets, runs, queue, server (administrators only, else
null), flags{may_manage,is_admin,use_udperms,serve_enabled}, user_id, groups (administrators only), limits, csrf_token`.
`GET /bootstrap` returns `drivers, driver_installs (unfinished installs by driver id, administrators only), mounts, foreign_mounts, rules, presets, runs, queue, server (administrators only, else
null), flags{may_manage,is_admin,may_install_drivers,use_udperms,serve_enabled}, user_id, groups (administrators only), limits, csrf_token`.
Runs are presented by `Controller::presentRun()`.

## Tests
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ php artisan migrate

The module appears in the manager menu as **aMount**. Only the local folder driver comes with it; every storage
driver is an optional package, so a site carries just the ones it uses (the AWS SDK alone is about 77 MB). Run
`php artisan amount:drivers` to see which drivers are installed; install a missing one with the command it prints,
e.g. for S3, SFTP and WebDAV (the trailing `0` records a package without running Composer, so it runs once):
`php artisan amount:drivers` to see which drivers are installed, and install missing ones by id, e.g. S3, SFTP and
WebDAV (each package goes through the CMS's `package:installrequire`, which undoes a failed install):

```sh
php artisan package:installrequire league/flysystem-aws-s3-v3 "*" 0
php artisan package:installrequire league/flysystem-sftp-v3 "*" 0
php artisan package:installrequire league/flysystem-webdav "*"
php artisan amount:drivers --install=s3,sftp,webdav
```

Administrators can also click **Install** next to a missing driver in the manager. The page doesn't run Composer
itself: it queues a task for the CMS task worker (the same queue the Extras module installs through) and shows its
progress. That needs a running `system:task-worker` (the CMS cron line starts it) and a `core/vendor` directory the
worker can write to. Other managers see the command to pass on.

> **Upgrading from a version that required S3, SFTP and WebDAV:** `composer update` removes those packages if nothing
> else needs them, and mounts using them then report the install command instead of connecting. Install the drivers
> you use as above before or after updating.
Expand Down Expand Up @@ -162,6 +165,8 @@ access, and **this site's code**.
S3 endpoint, FTP/SFTP host or computer gateway only when it resolves to public addresses; the address that was checked
is the one connected to, and WebDAV redirects are not followed. This is checked when the mount is saved or tested and
again on every connection, for whoever last changed its connection settings. Mounts from configuration are trusted.
- **Only an administrator can install a driver from the manager**, since that changes the site's code. Composer runs in
the CMS task worker, never in a web request, and only for the packages the chosen driver lists.
- **SFTP needs a pinned host key** (`ssh-keyscan HOST | ssh-keygen -lf -` prints it as `SHA256:...`); a connection to
a server presenting another key is refused. Several keys may be pinned, so a key can be rotated without downtime.
- **Downloads back are cautious.** The destination must be a folder the user can write to; nothing is overwritten unless
Expand Down
7 changes: 6 additions & 1 deletion docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ is gone); **private** ones are downloadable only by managers who may see the ori
(else owner, else creator) being an administrator *now*. Untrusted connections use the checked address
(`_pinned`: cURL `RESOLVE` for WebDAV/S3, the address itself for FTP/SFTP) and WebDAV follows no redirect.
SFTP refuses to connect without a pinned host key (`host_fingerprint`, several allowed for rotation).
11. Composer never runs in a web request. A missing driver is installed from the manager only by an administrator,
as an `amount.driver_install` system task (`Services\DriverInstaller`, `Console\DriverInstallHandler`): exclusive,
`system_tasks.manage_packages` + super administrator, queued through the core's
`SystemTaskService::createTaskFromStoreRequest()` (its lock and scheduler checks) and run by `system:task-worker`
with the core's `ConsoleInstallFlowService`. Requests name a driver; the packages always come from the driver.

## Already written (do not rewrite; extend only if a contract below says so)

Expand Down Expand Up @@ -207,7 +212,7 @@ heartbeat for too long is healed to `error`, the page polls).
Private files (backups) are never served by the web server; they are denied by the existing rules and downloaded through the
authenticated manager endpoint.
- `Console\ServerCommand` (`amount:server {server?} {--write} {--probe}`), `Console\DriversCommand` (`amount:drivers`: table of
drivers, installed or not, with install command), `Console\DemoCommand` (`amount:demo`: seeds a local-driver demo mount "Demo cloud",
drivers, installed or not, with install command; `--install=<ids>` runs `package:installrequire` once per missing package), `Console\DemoCommand` (`amount:demo`: seeds a local-driver demo mount "Demo cloud",
sample files under `assets/amount-demo/`, one public rule, one backup-like private rule, optionally runs them synchronously
for demo purposes — must be idempotent).
- `Listeners\Cleanup` — remove a deleted user's personal mounts/rules/index rows; remove a deleted user group from
Expand Down
11 changes: 11 additions & 0 deletions lang/az/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
'error_ambiguous_mount' => 'Bir neçə qoşulma uyğun gəlir: :names. Hansını nəzərdə tutursunuz?',
'error_driver_unknown' => 'Bu saxlama növü tanınmır.',
'error_driver_unavailable' => ':driver əlavə paket tələb edir. Onu bu əmrlə quraşdırın: :command',
'error_driver_installed' => ':driver artıq quraşdırılıb.',
'error_driver_not_installable' => ':driver paketlərinə malikdir, lakin yenə də işə düşə bilmir; çox güman ki, PHP genişlənməsi tələb edir. Serveri idarə edən şəxsə müraciət edin.',
'error_driver_install_unavailable' => 'Bu Evolution CMS menecerdən paket quraşdıra bilmir. Onu bu əmrlə quraşdırın: :command',
'error_driver_install_refused' => 'CMS quraşdırmanı növbəyə qoymadı: :reason',
'error_driver_admin_only' => ':driver bu serverin öz diskinə çıxış əldə edir, ona görə də onu yalnız administrator qura bilər.',
'error_destination_private' => ':host bu serverdə və ya daxili şəbəkədədir. Ora qoşulmanı yalnız administrator yarada bilər.',
'error_destination_unresolved' => ':host tapılmadı. Ünvanı yoxlayın.',
Expand Down Expand Up @@ -292,6 +296,13 @@
'ui_driver_choose' => 'Seç: :name',
'ui_driver_choose_short' => 'Seç',
'ui_driver_missing' => 'Əlavə paket tələb edir (:packages). Onu bu əmrlə quraşdırın:',
'ui_driver_install' => 'Quraşdır',
'ui_driver_install_aria' => 'Quraşdır: :name',
'ui_driver_install_help' => 'CMS tapşırıq işçisi onu arxa planda Composer ilə quraşdırır və uğursuz olarsa, hər şeyi geri qaytarır.',
'ui_driver_install_queued' => 'CMS tapşırıq işçisi gözlənilir...',
'ui_driver_installing' => 'Quraşdırılır (:progress%): :message',
'ui_driver_installed' => ':name quraşdırıldı.',
'ui_driver_install_failed' => 'Quraşdırma uğursuz oldu: :message',
'ui_group_object' => 'Obyekt saxlama yerləri',
'ui_group_cloud' => 'Bulud diskləri',
'ui_group_server' => 'Serverlər',
Expand Down
11 changes: 11 additions & 0 deletions lang/be/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
'error_ambiguous_mount' => 'Адпавядае некалькі падключэнняў: :names. Якое вы маеце на ўвазе?',
'error_driver_unknown' => 'Гэты тып сховішча невядомы.',
'error_driver_unavailable' => ':driver патрабуе дадатковы пакет. Усталюйце яго камандай: :command',
'error_driver_installed' => ':driver ужо ўсталяваны.',
'error_driver_not_installable' => 'У :driver ёсць пакеты, але ён усё роўна не можа запусціцца; верагодна, яму патрэбна пашырэнне PHP. Звярніцеся да таго, хто абслугоўвае сервер.',
'error_driver_install_unavailable' => 'Гэты Evolution CMS не можа ўсталёўваць пакеты з менеджара. Усталюйце яго камандай: :command',
'error_driver_install_refused' => 'CMS не паставіла ўсталяванне ў чаргу: :reason',
'error_driver_admin_only' => ':driver звяртаецца да ўласнага дыска гэтага сервера, таму наладзіць яго можа толькі адміністратар.',
'error_destination_private' => ':host знаходзіцца на гэтым серверы або ва ўнутранай сетцы. Падключэнне туды можа стварыць толькі адміністратар.',
'error_destination_unresolved' => 'Не ўдалося знайсці :host. Праверце адрас.',
Expand Down Expand Up @@ -292,6 +296,13 @@
'ui_driver_choose' => 'Выбраць: :name',
'ui_driver_choose_short' => 'Выбраць',
'ui_driver_missing' => 'Патрабуе дадатковы пакет (:packages). Усталюйце яго камандай:',
'ui_driver_install' => 'Усталяваць',
'ui_driver_install_aria' => 'Усталяваць: :name',
'ui_driver_install_help' => 'Выканаўца задач CMS усталёўвае яго праз Composer у фоне і адмяняе ўсе змены, калі нешта пойдзе не так.',
'ui_driver_install_queued' => 'Чакае выканаўцу задач CMS...',
'ui_driver_installing' => 'Усталяванне (:progress%): :message',
'ui_driver_installed' => ':name усталяваны.',
'ui_driver_install_failed' => 'Усталяванне не ўдалося: :message',
'ui_group_object' => 'Аб’ектныя сховішчы',
'ui_group_cloud' => 'Воблачныя дыскі',
'ui_group_server' => 'Серверы',
Expand Down
11 changes: 11 additions & 0 deletions lang/bg/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
'error_ambiguous_mount' => 'Съвпадат няколко връзки: :names. Коя имате предвид?',
'error_driver_unknown' => 'Този тип хранилище не е познат.',
'error_driver_unavailable' => ':driver изисква допълнителен пакет. Инсталирайте го с: :command',
'error_driver_installed' => ':driver вече е инсталиран.',
'error_driver_not_installable' => ':driver има пакетите си, но все още не може да стартира; вероятно изисква PHP разширение. Обърнете се към този, който поддържа сървъра.',
'error_driver_install_unavailable' => 'Тази Evolution CMS не може да инсталира пакети от мениджъра. Инсталирайте го с: :command',
'error_driver_install_refused' => 'CMS не постави инсталацията на опашката: :reason',
'error_driver_admin_only' => ':driver достъпва собствения диск на този сървър, затова само администратор може да го настрои.',
'error_destination_private' => ':host е на този сървър или във вътрешна мрежа. Само администратор може да създаде връзка към него.',
'error_destination_unresolved' => ':host не може да бъде намерен. Проверете адреса.',
Expand Down Expand Up @@ -292,6 +296,13 @@
'ui_driver_choose' => 'Избор: :name',
'ui_driver_choose_short' => 'Избор',
'ui_driver_missing' => 'Изисква допълнителен пакет (:packages). Инсталирайте го с:',
'ui_driver_install' => 'Инсталиране',
'ui_driver_install_aria' => 'Инсталиране: :name',
'ui_driver_install_help' => 'Изпълнителят на задачите на CMS го инсталира с Composer във фонов режим и отменя всичко, ако нещо се провали.',
'ui_driver_install_queued' => 'Изчаква изпълнителя на задачите на CMS...',
'ui_driver_installing' => 'Инсталиране (:progress%): :message',
'ui_driver_installed' => ':name е инсталиран.',
'ui_driver_install_failed' => 'Инсталацията не бе успешна: :message',
'ui_group_object' => 'Обектни хранилища',
'ui_group_cloud' => 'Облачни дискове',
'ui_group_server' => 'Сървъри',
Expand Down
11 changes: 11 additions & 0 deletions lang/cs/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
'error_ambiguous_mount' => 'Odpovídá více připojení: :names. Které máte na mysli?',
'error_driver_unknown' => 'Tento typ úložiště není znám.',
'error_driver_unavailable' => ':driver vyžaduje další balíček. Nainstalujte jej příkazem: :command',
'error_driver_installed' => ':driver je už nainstalován.',
'error_driver_not_installable' => ':driver má své balíčky, ale stále se nemůže spustit; pravděpodobně potřebuje rozšíření PHP. Obraťte se na toho, kdo spravuje server.',
'error_driver_install_unavailable' => 'Tento Evolution CMS nemůže instalovat balíčky ze správce. Nainstalujte jej příkazem: :command',
'error_driver_install_refused' => 'CMS nezařadil instalaci do fronty: :reason',
'error_driver_admin_only' => ':driver přistupuje k vlastnímu disku tohoto serveru, proto ho může nastavit jen administrátor.',
'error_destination_private' => ':host je na tomto serveru nebo ve vnitřní síti. Připojení tam může vytvořit jen administrátor.',
'error_destination_unresolved' => ':host se nepodařilo najít. Zkontrolujte adresu.',
Expand Down Expand Up @@ -292,6 +296,13 @@
'ui_driver_choose' => 'Zvolit: :name',
'ui_driver_choose_short' => 'Zvolit',
'ui_driver_missing' => 'Vyžaduje další balíček (:packages). Nainstalujte jej příkazem:',
'ui_driver_install' => 'Nainstalovat',
'ui_driver_install_aria' => 'Nainstalovat: :name',
'ui_driver_install_help' => 'Správce úloh CMS jej nainstaluje na pozadí pomocí nástroje Composer a při selhání vše vrátí zpět.',
'ui_driver_install_queued' => 'Čeká na správce úloh CMS...',
'ui_driver_installing' => 'Instalace (:progress%): :message',
'ui_driver_installed' => ':name je nainstalován.',
'ui_driver_install_failed' => 'Instalace se nezdařila: :message',
'ui_group_object' => 'Objektová úložiště',
'ui_group_cloud' => 'Cloudové disky',
'ui_group_server' => 'Servery',
Expand Down
11 changes: 11 additions & 0 deletions lang/da/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
'error_ambiguous_mount' => 'Flere monteringer passer: :names. Hvilken mener du?',
'error_driver_unknown' => 'Denne lagertype er ukendt.',
'error_driver_unavailable' => ':driver kræver en ekstra pakke. Installer den med: :command',
'error_driver_installed' => ':driver er allerede installeret.',
'error_driver_not_installable' => ':driver har sine pakker, men kan stadig ikke starte; den kræver sandsynligvis en PHP-udvidelse. Spørg den, der driver serveren.',
'error_driver_install_unavailable' => 'Dette Evolution CMS kan ikke installere pakker fra administrationen. Installer den med: :command',
'error_driver_install_refused' => 'CMS\'et satte ikke installationen i kø: :reason',
'error_driver_admin_only' => ':driver tilgår serverens egen disk, så kun en administrator kan opsætte den.',
'error_destination_private' => ':host ligger på denne server eller et internt netværk. Kun en administrator kan oprette en montering dertil.',
'error_destination_unresolved' => ':host blev ikke fundet. Kontrollér adressen.',
Expand Down Expand Up @@ -292,6 +296,13 @@
'ui_driver_choose' => 'Vælg :name',
'ui_driver_choose_short' => 'Vælg',
'ui_driver_missing' => 'Kræver en ekstra pakke (:packages). Installer den med:',
'ui_driver_install' => 'Installer',
'ui_driver_install_aria' => 'Installer :name',
'ui_driver_install_help' => 'CMS\'ets opgaveworker installerer den med Composer i baggrunden og fortryder alt, hvis det mislykkes.',
'ui_driver_install_queued' => 'Venter på CMS\'ets opgaveworker...',
'ui_driver_installing' => 'Installerer (:progress%): :message',
'ui_driver_installed' => ':name er installeret.',
'ui_driver_install_failed' => 'Installationen mislykkedes: :message',
'ui_group_object' => 'Objektlager',
'ui_group_cloud' => 'Clouddrev',
'ui_group_server' => 'Servere',
Expand Down
Loading
Loading