first commit
This commit is contained in:
21
.dockerignore
Normal file
21
.dockerignore
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Evita di copiare nei build context file pesanti o sensibili.
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
**/.env
|
||||||
|
**/.env.*
|
||||||
|
!**/.env.example
|
||||||
|
**/node_modules
|
||||||
|
**/vendor
|
||||||
|
backend/storage/logs/*
|
||||||
|
backend/storage/framework/cache/*
|
||||||
|
backend/storage/framework/sessions/*
|
||||||
|
backend/storage/framework/views/*
|
||||||
|
backend/coverage.xml
|
||||||
|
backend/coverage
|
||||||
|
frontend/dist
|
||||||
|
frontend/coverage
|
||||||
|
frontend/stats.html
|
||||||
|
db-init/*.sql
|
||||||
|
db-init/*.sql.gz
|
||||||
|
**/.DS_Store
|
||||||
|
*.md
|
||||||
94
.env.example
Normal file
94
.env.example
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# dyncoll.v2 — file di esempio delle variabili d'ambiente
|
||||||
|
# Copia in `.env` e compila i valori (i segreti restano vuoti qui).
|
||||||
|
# cp .env.example .env && (cd backend && php artisan key:generate)
|
||||||
|
# NB: `.env` NON va versionato (vedi .gitignore).
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# --- Applicazione ------------------------------------------------------------
|
||||||
|
APP_NAME="Dynamic Collection"
|
||||||
|
APP_ENV=local # local | staging | production
|
||||||
|
APP_KEY= # generata con: php artisan key:generate
|
||||||
|
APP_DEBUG=true # false in produzione
|
||||||
|
APP_URL=https://dyncoll-dev.local
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_FALLBACK_LOCALE=en
|
||||||
|
APP_TIMEZONE=Europe/Rome
|
||||||
|
|
||||||
|
# Porte pubblicate sull'host (mappate nei compose)
|
||||||
|
APP_BACKEND_PORT=8000
|
||||||
|
APP_FRONTEND_PORT=8080
|
||||||
|
# Porta del dev server Vite (solo sviluppo, override compose; Traefik instrada qui)
|
||||||
|
APP_FRONTEND_DEVPORT=5173
|
||||||
|
|
||||||
|
# --- Logging -----------------------------------------------------------------
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_STACK=single
|
||||||
|
LOG_LEVEL=debug # warning/error in produzione
|
||||||
|
|
||||||
|
# --- Database (v2, MySQL — nomi canonici Laravel) ----------------------------
|
||||||
|
# Usati sia da Laravel sia dal container mysql (mappati nel compose).
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=db # nome del servizio docker
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=dyncoll
|
||||||
|
DB_USERNAME=dyncoll
|
||||||
|
DB_PASSWORD= # segreto: compilare
|
||||||
|
DB_ROOT_PASSWORD= # segreto: solo per il container mysql (root)
|
||||||
|
|
||||||
|
# --- Database legacy (v1) — sorgente per l'ETL `php artisan v1:import` --------
|
||||||
|
# Connessione in SOLA LETTURA verso il MySQL di dyncoll.v1.
|
||||||
|
# Attiva solo durante l'import; richiede rete docker condivisa o tunnel.
|
||||||
|
DB_LEGACY_CONNECTION=mysql
|
||||||
|
DB_LEGACY_HOST=dyncoll_v1_db # container/host del DB v1
|
||||||
|
DB_LEGACY_PORT=3306
|
||||||
|
DB_LEGACY_DATABASE=lund
|
||||||
|
DB_LEGACY_USERNAME=readonly
|
||||||
|
DB_LEGACY_PASSWORD= # segreto: compilare
|
||||||
|
|
||||||
|
# --- Redis (cache, sessioni, code, Horizon) ----------------------------------
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_PASSWORD= # segreto: compilare
|
||||||
|
REDIS_CLUSTER=false
|
||||||
|
|
||||||
|
CACHE_STORE=redis
|
||||||
|
SESSION_DRIVER=redis
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
QUEUE_CONNECTION=redis
|
||||||
|
BROADCAST_CONNECTION=log
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
|
||||||
|
# --- Autenticazione (Sanctum / Fortify) --------------------------------------
|
||||||
|
SANCTUM_STATEFUL_DOMAINS=dyncoll-dev.local,localhost,localhost:8080
|
||||||
|
SESSION_DOMAIN=.dyncoll-dev.local
|
||||||
|
|
||||||
|
# --- Mail (SMTP) -------------------------------------------------------------
|
||||||
|
# DEV: Mailpit (servizio nel docker-compose.override.yml). UI: http://localhost:8025
|
||||||
|
# MAIL_HOST=mailpit MAIL_PORT=1025 (nessuna autenticazione)
|
||||||
|
# PROD: SMTP dell'Ente — esempio (mettere i valori reali nel .env di produzione):
|
||||||
|
# MAIL_HOST=smtps.lu.se MAIL_PORT=587 MAIL_USERNAME=smtps_...@lu.se MAIL_PASSWORD=<segreto>
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=mailpit
|
||||||
|
MAIL_PORT=1025
|
||||||
|
MAIL_USERNAME=
|
||||||
|
MAIL_PASSWORD= # segreto in prod
|
||||||
|
MAIL_SCHEME= # vuoto = STARTTLS (es. porta 587); irrilevante per Mailpit
|
||||||
|
MAIL_FROM_ADDRESS="dynamic_collections@ark.lu.se"
|
||||||
|
MAIL_FROM_NAME="Dynamic Collection Crew"
|
||||||
|
|
||||||
|
# --- Documentazione OpenAPI (Scramble) ---------------------------------------
|
||||||
|
# Generata automaticamente dal codice; UI su /docs/api (proxy frontend: /api-docs).
|
||||||
|
# Config avanzata in backend/config/scramble.php (nessuna env obbligatoria).
|
||||||
|
|
||||||
|
# --- Linked Art / Harvesting KSamsök 2 (RAÄ) ---------------------------------
|
||||||
|
# Base URI per il mapping ontologico (vedi memoria progetto + workfile/.../shm-2b).
|
||||||
|
# provider = ente che pubblica; canonical = id stabile; retrieval = URI dereferenziabile.
|
||||||
|
LOD_PROVIDER_URI=https://kulturarvsdata.se/lund
|
||||||
|
LOD_CANONICAL_BASE=https://kulturarvsdata.se/lund/object
|
||||||
|
LOD_RETRIEVAL_BASE=https://dyncoll-dev.local/linkedart/v1/objects
|
||||||
|
LOD_BATCH_PAGE_SIZE=400 # default protocollo (max 2000)
|
||||||
|
|
||||||
|
# --- SonarQube (analisi qualità via pre-commit) ------------------------------
|
||||||
|
# Il token NON va qui: usare la variabile SONAR_TOKEN o il file .git/sonar.token.
|
||||||
|
# SonarQube locale: http://sonar.local (UI) — container su rete `sonarqube-internal`.
|
||||||
56
.gitignore
vendored
Normal file
56
.gitignore
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# dyncoll.v2 — .gitignore (monorepo: backend Laravel + frontend Vite)
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# --- Segreti / ambiente (MAI versionare) -------------------------------------
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
backend/.env
|
||||||
|
backend/.env.*
|
||||||
|
!backend/.env.example
|
||||||
|
.git/sonar.token
|
||||||
|
**/sonar.token
|
||||||
|
|
||||||
|
# --- Backend: Laravel --------------------------------------------------------
|
||||||
|
backend/vendor/
|
||||||
|
backend/node_modules/
|
||||||
|
backend/public/build/
|
||||||
|
backend/public/hot
|
||||||
|
backend/public/storage
|
||||||
|
backend/storage/*.key
|
||||||
|
backend/storage/app/public/*
|
||||||
|
backend/storage/framework/cache/data/*
|
||||||
|
backend/storage/framework/sessions/*
|
||||||
|
backend/storage/framework/views/*
|
||||||
|
backend/storage/logs/*
|
||||||
|
backend/bootstrap/cache/*.php
|
||||||
|
backend/.phpunit.result.cache
|
||||||
|
backend/.phpunit.cache/
|
||||||
|
backend/coverage.xml
|
||||||
|
backend/coverage/
|
||||||
|
backend/auth.json
|
||||||
|
backend/database/database.sqlite
|
||||||
|
|
||||||
|
# --- Frontend: Vite / Node ---------------------------------------------------
|
||||||
|
frontend/node_modules/
|
||||||
|
frontend/dist/
|
||||||
|
frontend/coverage/
|
||||||
|
frontend/stats.html
|
||||||
|
frontend/.vite/
|
||||||
|
frontend/dev-dist/
|
||||||
|
|
||||||
|
# --- Docker / runtime --------------------------------------------------------
|
||||||
|
db-init/*.sql
|
||||||
|
db-init/*.sql.gz
|
||||||
|
|
||||||
|
# --- Editor / OS -------------------------------------------------------------
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
.idea/
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
!.vscode/settings.json
|
||||||
|
*.log
|
||||||
|
*.swp
|
||||||
|
*~
|
||||||
8
.vscode/settings.json
vendored
Normal file
8
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
// Tailwind v4 introduce at-rule custom (@plugin, @theme, @apply, @custom-variant,
|
||||||
|
// @source) che il linter CSS integrato di VS Code non conosce: senza questo,
|
||||||
|
// segnala falsi positivi "Unknown at-rule". Le elabora @tailwindcss/vite.
|
||||||
|
"css.lint.unknownAtRules": "ignore",
|
||||||
|
"scss.lint.unknownAtRules": "ignore",
|
||||||
|
"less.lint.unknownAtRules": "ignore"
|
||||||
|
}
|
||||||
145
CLAUDE.md
Normal file
145
CLAUDE.md
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
# CLAUDE.md — dyncoll.v2
|
||||||
|
|
||||||
|
Istruzioni per agenti AI (e umani) che lavorano su questo repository.
|
||||||
|
|
||||||
|
## 1. Cos'è
|
||||||
|
|
||||||
|
**dyncoll.v2** è la riscrittura della piattaforma *Dynamic Collections Plus*: catalogo e
|
||||||
|
curatela di collezioni digitali di reperti archeologici. Obiettivo trasversale della v2:
|
||||||
|
esporre i dati secondo lo standard di harvesting **KSamsök 2 Linked Art** del
|
||||||
|
Riksantikvarieämbetet (RAÄ) / SweDigArch, così da essere raccoglibili dall'aggregatore
|
||||||
|
nazionale svedese.
|
||||||
|
|
||||||
|
- v1 (legacy, in produzione): `../dyncoll.v1` — PHP MPA procedurale, MySQL.
|
||||||
|
- Documentazione di mapping (sorgente di verità): `../workfile/K2_tech_doc260430/shm-2b/`.
|
||||||
|
- Contesto e decisioni storiche: file di memoria in `../` (`memory/MEMORY.md` e collegati).
|
||||||
|
|
||||||
|
## 2. Stack
|
||||||
|
|
||||||
|
| Layer | Tecnologia |
|
||||||
|
|---|---|
|
||||||
|
| Backend | Laravel (PHP 8.3+/8.4), API-only |
|
||||||
|
| Auth | Sanctum + Fortify (2FA TOTP via `pragmarx/google2fa`) |
|
||||||
|
| Code/cache | Redis + Horizon |
|
||||||
|
| DB | MySQL 8.4 (schema definito da migration Laravel) |
|
||||||
|
| OpenAPI | **scegliere UNO** tra `darkaonline/l5-swagger` o `dedoc/scramble` (ora ci sono entrambi) |
|
||||||
|
| Linked Art | `ml/json-ld` (serializzazione) + `opis/json-schema` (validazione contro gli schema RAÄ) |
|
||||||
|
| Frontend | Vite + TypeScript, MPA con isole, Tailwind v4 + daisyUI, Leaflet |
|
||||||
|
| Docs | MkDocs Material (`documentation/`) |
|
||||||
|
| Qualità | SonarQube locale (`http://sonar.local`) |
|
||||||
|
|
||||||
|
## 3. Architettura dati (decisione chiave)
|
||||||
|
|
||||||
|
- **v2 ha il proprio DB**, schema da migration Laravel — NON si appoggia in read-only al DB di v1.
|
||||||
|
- I dati arrivano da v1 tramite un **comando ETL idempotente** (`php artisan v1:import`),
|
||||||
|
non via dump/restore manuale (gli schemi divergono volutamente).
|
||||||
|
- Due connessioni in `config/database.php`: `mysql` (v2, scrivibile) e `legacy` (v1, **sola lettura**,
|
||||||
|
variabili `DB_LEGACY_*`). Lo stesso ETL serve sia per i refresh di sviluppo sia per il cutover.
|
||||||
|
- Progettare lo schema v2 **già orientato al Linked Art**: identificatori `canonical`/`uuid` stabili,
|
||||||
|
vocabolari come tabelle con colonna URI, audit `created/modified` puliti.
|
||||||
|
|
||||||
|
## 4. Mapping Linked Art — vincoli da rispettare
|
||||||
|
|
||||||
|
Quando si genera JSON-LD (vedi `mapping-protocol-key-facts` in memoria):
|
||||||
|
|
||||||
|
- Reperto → `HumanMadeObject` (E22). Documento annidato, **non** CRM piatto.
|
||||||
|
- Ogni record porta `RecordProvenance` (license, dateCreated/Modified, `ingestedAt`+`provider` autogenerati).
|
||||||
|
- Distinzione `id` (URI di retrieval dereferenziabile) vs `canonical` (id stabile `kulturarvsdata.se/...`).
|
||||||
|
- **Classi CRM astratte vietate** come tipo concreto: E1,E2,E3,E14–E19,E24,E28,E31,E32,E41,E63,E64,E70,E71,E72,E77,E83,E90,E92,E93,E96,E99.
|
||||||
|
- Ogni record generato DEVE validare contro `LinkedArtRecord-1.0.0.schema.json` (test obbligatorio).
|
||||||
|
- Endpoint Provider da implementare (path sotto `/linkedart/v1`):
|
||||||
|
Tier 1 `/batch` (MUST), Tier 2 `/changes` + `/objects/{id}` (SHOULD), Tier 3 Search (MAY).
|
||||||
|
Gli endpoint devono essere conformi a `protokoll-openapi/raa-linkedart-service-1.0.0.yaml`.
|
||||||
|
|
||||||
|
## 5. Regole di commit e qualità
|
||||||
|
|
||||||
|
Esiste un **pre-commit hook** (`.git/hooks/pre-commit`) che blocca il commit se:
|
||||||
|
|
||||||
|
1. **REUSE / licenze**: ogni file deve avere copyright + licenza SPDX (header o `REUSE.toml`).
|
||||||
|
Licenza codice prevista: **EUPL-1.2**; docs/dati: **CC-BY-4.0**.
|
||||||
|
2. **Test + coverage** (PHP via PHPUnit, frontend via Vitest) sui file staged.
|
||||||
|
3. **SonarQube**: quality gate (`sonar.qualitygate.wait=true`) deve passare.
|
||||||
|
Token letto da `$SONAR_TOKEN` o da `.git/sonar.token` (mai in chiaro nel repo).
|
||||||
|
|
||||||
|
Conseguenze pratiche:
|
||||||
|
- Aggiungere header SPDX a ogni nuovo file, altrimenti il commit fallisce.
|
||||||
|
- Mantenere/aggiornare i test: nuovo codice senza test fa fallire la quality gate.
|
||||||
|
- Backend e frontend devono essere up (`docker compose up`) perché l'hook gira i test nei container.
|
||||||
|
|
||||||
|
## 6. Segreti e ambiente
|
||||||
|
|
||||||
|
- `.env` e `.git/sonar.token` **non si versionano mai** (vedi `.gitignore`).
|
||||||
|
- Le variabili sono documentate in `.env.example`: aggiornarlo quando se ne aggiungono.
|
||||||
|
- Nomi DB canonici (Laravel): `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD`, `DB_ROOT_PASSWORD`.
|
||||||
|
I compose devono mappare le `MYSQL_*` da questi (non introdurre `DB_NAME`/`DB_USER` paralleli).
|
||||||
|
|
||||||
|
## 6bis. Workflow host/container (IMPORTANTE — leggere prima di lanciare comandi)
|
||||||
|
|
||||||
|
Regola d'oro: **chi scrive file lo fa come utente host (`beppe`, UID 1000); mai mischiare
|
||||||
|
`node_modules` musl (container Alpine) e glibc (host).** Usare i target del `Makefile`.
|
||||||
|
|
||||||
|
| Operazione | Dove | Comando |
|
||||||
|
|---|---|---|
|
||||||
|
| Editare `composer.json` / `package.json` / codice | HOST | editor / tool agente (sempre beppe-owned) |
|
||||||
|
| Avviare lo stack di sviluppo (Vite HMR + backend + …) | CONTAINER | `make up` |
|
||||||
|
| `composer install/update/require` | HOST | `make be-install` / `make be-update` / `make composer c="…"` |
|
||||||
|
| Aggiornare deps frontend: edita `package.json` (host) → | HOST + rebuild img | `make fe-install` poi `make fe-rebuild` |
|
||||||
|
| artisan con servizi (`migrate`, `db:*`, `queue`, `tinker`, `v1:import`) | CONTAINER come UID host | `make migrate` / `make import` / `make artisan c="…"` |
|
||||||
|
| Permessi `storage` per php-fpm (www-data) | HOST, una tantum | `make permissions` |
|
||||||
|
|
||||||
|
Motivi e asimmetria backend/frontend:
|
||||||
|
- **Backend**: host PHP 8.4 == container; `vendor/` è codice PHP portabile ed è **bind-montato**
|
||||||
|
(`./backend:/var/www/html`), quindi composer gira sull'host e il container lo vede subito.
|
||||||
|
`config.platform` in `composer.json` copre le estensioni mancanti sull'host (redis, gd, bcmath).
|
||||||
|
- **Frontend**: il dev server di Vite gira **nel container** (`make up`, stage `development`). Il
|
||||||
|
sorgente è bind-montato (`./frontend:/app`) → HMR; i `node_modules` **non** sono bind-montati ma
|
||||||
|
vivono in un **volume anonimo** (`/app/node_modules`), così quelli musl dell'immagine schermano
|
||||||
|
quelli glibc dell'host (mai mischiati). Si installano nella *build dell'immagine*, mai in un
|
||||||
|
container in esecuzione. `npm install` su host serve solo a `package-lock` + type-check IDE; dopo
|
||||||
|
modifiche a `package.json` rigenerare l'immagine con `make fe-rebuild`.
|
||||||
|
- I comandi artisan con servizi girano nel container (dove `db`, `redis`, `mailpit` risolvono) ma con
|
||||||
|
`-u $(id -u):$(id -g)` per non creare file root-owned.
|
||||||
|
|
||||||
|
**Regole per l'agente AI:**
|
||||||
|
- Editare `composer.json`/`package.json`/codice coi propri tool (host, beppe-owned): OK.
|
||||||
|
- NON lanciare `composer install/update` o `npm install` di propria iniziativa (l'ambiente host
|
||||||
|
dell'utente è autoritativo). Se serve, usare i target `make` qui sopra.
|
||||||
|
- Per artisan che tocca i servizi usare **sempre** `make artisan c="…"` (container come UID host).
|
||||||
|
- Non bind-montare mai `node_modules` in un container Alpine.
|
||||||
|
|
||||||
|
> Nota drift: l'IDE/type-check usa il Node dell'host (20.19/npm 9); il dev server di Vite usa il
|
||||||
|
> Node 24 dell'immagine. Conviene comunque allineare l'host a Node 22/24 LTS (Vite 8 richiede ≥ 20.19/22.12).
|
||||||
|
|
||||||
|
## 7. Comandi utili
|
||||||
|
|
||||||
|
Usare i target del `Makefile` (incapsulano la strategia host/container del §6bis):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make up # avvia l'intero stack dev (Vite HMR + backend + db + redis + docs + mailpit)
|
||||||
|
make migrate # artisan migrate (container come UID host)
|
||||||
|
make import # ETL da v1 (quando implementato)
|
||||||
|
make artisan c="test --coverage-clover=coverage.xml" # test backend
|
||||||
|
make be-update # composer update (host)
|
||||||
|
make fe-install # npm install host (package-lock + type-check IDE)
|
||||||
|
make fe-rebuild # ricostruisce l'immagine frontend dopo modifiche a package.json
|
||||||
|
make permissions # fix permessi storage (una tantum, sudo)
|
||||||
|
make help # elenco completo
|
||||||
|
```
|
||||||
|
|
||||||
|
Frontend in dev: `make up` → Vite con HMR su `https://dyncoll-dev.local` (Traefik) o
|
||||||
|
`http://localhost:${APP_FRONTEND_DEVPORT}`. Le modifiche al sorgente si ricaricano da sole; per
|
||||||
|
nuove dipendenze npm: edita `package.json` → `make fe-install` → `make fe-rebuild`.
|
||||||
|
|
||||||
|
## 8. Convenzioni di codice
|
||||||
|
|
||||||
|
- PHP: PSR-12, formattato con **Laravel Pint** (`./vendor/bin/pint`).
|
||||||
|
- TypeScript: `strict` attivo (vedi `frontend/tsconfig.json`); evitare `any`.
|
||||||
|
- Commenti in italiano ammessi (coerenti col resto del repo).
|
||||||
|
- Non reintrodurre pattern v1 non sicuri: **query parametrizzate** sempre, mai interpolazione in SQL.
|
||||||
|
|
||||||
|
## 9. Stato dello scaffolding
|
||||||
|
|
||||||
|
Lo scaffolding iniziale è stato adattato da un altro progetto ("Valdarno Trails"/RMV) e
|
||||||
|
contiene residui da ripulire (riferimenti RMV in `frontend/vite.config.ts`,
|
||||||
|
`frontend/frontend.Dockerfile`, `frontend/nginx.conf`) e alcuni bug nei compose/Dockerfile.
|
||||||
|
Verificare sempre lo stato reale dei file prima di darli per buoni; vedere le note di review.
|
||||||
156
LICENSES/CC-BY-4.0.txt
Normal file
156
LICENSES/CC-BY-4.0.txt
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
Creative Commons Attribution 4.0 International
|
||||||
|
|
||||||
|
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
|
||||||
|
|
||||||
|
Using Creative Commons Public Licenses
|
||||||
|
|
||||||
|
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
|
||||||
|
|
||||||
|
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
|
||||||
|
|
||||||
|
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
|
||||||
|
|
||||||
|
Creative Commons Attribution 4.0 International Public License
|
||||||
|
|
||||||
|
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
||||||
|
|
||||||
|
Section 1 – Definitions.
|
||||||
|
|
||||||
|
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
||||||
|
|
||||||
|
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
||||||
|
|
||||||
|
c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
||||||
|
|
||||||
|
d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
||||||
|
|
||||||
|
e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
||||||
|
|
||||||
|
f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
||||||
|
|
||||||
|
g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
||||||
|
|
||||||
|
h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
|
||||||
|
|
||||||
|
i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
||||||
|
|
||||||
|
j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
||||||
|
|
||||||
|
k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
||||||
|
|
||||||
|
Section 2 – Scope.
|
||||||
|
|
||||||
|
a. License grant.
|
||||||
|
|
||||||
|
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
||||||
|
|
||||||
|
A. reproduce and Share the Licensed Material, in whole or in part; and
|
||||||
|
|
||||||
|
B. produce, reproduce, and Share Adapted Material.
|
||||||
|
|
||||||
|
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
||||||
|
|
||||||
|
3. Term. The term of this Public License is specified in Section 6(a).
|
||||||
|
|
||||||
|
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
||||||
|
|
||||||
|
5. Downstream recipients.
|
||||||
|
|
||||||
|
A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
||||||
|
|
||||||
|
B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
||||||
|
|
||||||
|
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
||||||
|
|
||||||
|
b. Other rights.
|
||||||
|
|
||||||
|
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
||||||
|
|
||||||
|
2. Patent and trademark rights are not licensed under this Public License.
|
||||||
|
|
||||||
|
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
|
||||||
|
|
||||||
|
Section 3 – License Conditions.
|
||||||
|
|
||||||
|
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
||||||
|
|
||||||
|
a. Attribution.
|
||||||
|
|
||||||
|
1. If You Share the Licensed Material (including in modified form), You must:
|
||||||
|
|
||||||
|
A. retain the following if it is supplied by the Licensor with the Licensed Material:
|
||||||
|
|
||||||
|
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
||||||
|
|
||||||
|
ii. a copyright notice;
|
||||||
|
|
||||||
|
iii. a notice that refers to this Public License;
|
||||||
|
|
||||||
|
iv. a notice that refers to the disclaimer of warranties;
|
||||||
|
|
||||||
|
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
||||||
|
|
||||||
|
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
||||||
|
|
||||||
|
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
||||||
|
|
||||||
|
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
||||||
|
|
||||||
|
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
||||||
|
|
||||||
|
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
|
||||||
|
|
||||||
|
Section 4 – Sui Generis Database Rights.
|
||||||
|
|
||||||
|
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
||||||
|
|
||||||
|
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
|
||||||
|
|
||||||
|
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
|
||||||
|
|
||||||
|
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
||||||
|
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
||||||
|
|
||||||
|
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
||||||
|
|
||||||
|
a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
|
||||||
|
|
||||||
|
b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
|
||||||
|
|
||||||
|
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
||||||
|
|
||||||
|
Section 6 – Term and Termination.
|
||||||
|
|
||||||
|
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
||||||
|
|
||||||
|
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
||||||
|
|
||||||
|
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
||||||
|
|
||||||
|
2. upon express reinstatement by the Licensor.
|
||||||
|
|
||||||
|
c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
||||||
|
|
||||||
|
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
||||||
|
|
||||||
|
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
||||||
|
|
||||||
|
Section 7 – Other Terms and Conditions.
|
||||||
|
|
||||||
|
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
||||||
|
|
||||||
|
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
||||||
|
|
||||||
|
Section 8 – Interpretation.
|
||||||
|
|
||||||
|
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
||||||
|
|
||||||
|
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
||||||
|
|
||||||
|
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
||||||
|
|
||||||
|
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
||||||
|
|
||||||
|
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
|
||||||
|
|
||||||
|
Creative Commons may be contacted at creativecommons.org.
|
||||||
190
LICENSES/EUPL-1.2.txt
Normal file
190
LICENSES/EUPL-1.2.txt
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
||||||
|
EUPL © the European Union 2007, 2016
|
||||||
|
|
||||||
|
This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined below) which is provided under the
|
||||||
|
terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such
|
||||||
|
use is covered by a right of the copyright holder of the Work).
|
||||||
|
The Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following
|
||||||
|
notice immediately following the copyright notice for the Work:
|
||||||
|
Licensed under the EUPL
|
||||||
|
or has expressed by any other means his willingness to license under the EUPL.
|
||||||
|
|
||||||
|
1.Definitions
|
||||||
|
In this Licence, the following terms have the following meaning:
|
||||||
|
— ‘The Licence’:this Licence.
|
||||||
|
— ‘The Original Work’:the work or software distributed or communicated by the Licensor under this Licence, available
|
||||||
|
as Source Code and also as Executable Code as the case may be.
|
||||||
|
— ‘Derivative Works’:the works or software that could be created by the Licensee, based upon the Original Work or
|
||||||
|
modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work
|
||||||
|
required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in
|
||||||
|
the country mentioned in Article 15.
|
||||||
|
— ‘The Work’:the Original Work or its Derivative Works.
|
||||||
|
— ‘The Source Code’:the human-readable form of the Work which is the most convenient for people to study and
|
||||||
|
modify.
|
||||||
|
— ‘The Executable Code’:any code which has generally been compiled and which is meant to be interpreted by
|
||||||
|
a computer as a program.
|
||||||
|
— ‘The Licensor’:the natural or legal person that distributes or communicates the Work under the Licence.
|
||||||
|
— ‘Contributor(s)’:any natural or legal person who modifies the Work under the Licence, or otherwise contributes to
|
||||||
|
the creation of a Derivative Work.
|
||||||
|
— ‘The Licensee’ or ‘You’:any natural or legal person who makes any usage of the Work under the terms of the
|
||||||
|
Licence.
|
||||||
|
— ‘Distribution’ or ‘Communication’:any act of selling, giving, lending, renting, distributing, communicating,
|
||||||
|
transmitting, or otherwise making available, online or offline, copies of the Work or providing access to its essential
|
||||||
|
functionalities at the disposal of any other natural or legal person.
|
||||||
|
|
||||||
|
2.Scope of the rights granted by the Licence
|
||||||
|
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive, sublicensable licence to do the following, for
|
||||||
|
the duration of copyright vested in the Original Work:
|
||||||
|
— use the Work in any circumstance and for all usage,
|
||||||
|
— reproduce the Work,
|
||||||
|
— modify the Work, and make Derivative Works based upon the Work,
|
||||||
|
— communicate to the public, including the right to make available or display the Work or copies thereof to the public
|
||||||
|
and perform publicly, as the case may be, the Work,
|
||||||
|
— distribute the Work or copies thereof,
|
||||||
|
— lend and rent the Work or copies thereof,
|
||||||
|
— sublicense rights in the Work or copies thereof.
|
||||||
|
Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the
|
||||||
|
applicable law permits so.
|
||||||
|
In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed
|
||||||
|
by law in order to make effective the licence of the economic rights here above listed.
|
||||||
|
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to any patents held by the Licensor, to the
|
||||||
|
extent necessary to make use of the rights granted on the Work under this Licence.
|
||||||
|
|
||||||
|
3.Communication of the Source Code
|
||||||
|
The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as
|
||||||
|
Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with
|
||||||
|
each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to
|
||||||
|
the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to
|
||||||
|
distribute or communicate the Work.
|
||||||
|
|
||||||
|
4.Limitations on copyright
|
||||||
|
Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the
|
||||||
|
exclusive rights of the rights owners in the Work, of the exhaustion of those rights or of other applicable limitations
|
||||||
|
thereto.
|
||||||
|
|
||||||
|
5.Obligations of the Licensee
|
||||||
|
The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those
|
||||||
|
obligations are the following:
|
||||||
|
|
||||||
|
Attribution right: The Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to
|
||||||
|
the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the
|
||||||
|
Licence with every copy of the Work he/she distributes or communicates. The Licensee must cause any Derivative Work
|
||||||
|
to carry prominent notices stating that the Work has been modified and the date of modification.
|
||||||
|
|
||||||
|
Copyleft clause: If the Licensee distributes or communicates copies of the Original Works or Derivative Works, this
|
||||||
|
Distribution or Communication will be done under the terms of this Licence or of a later version of this Licence unless
|
||||||
|
the Original Work is expressly distributed only under this version of the Licence — for example by communicating
|
||||||
|
‘EUPL v. 1.2 only’. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the
|
||||||
|
Work or Derivative Work that alter or restrict the terms of the Licence.
|
||||||
|
|
||||||
|
Compatibility clause: If the Licensee Distributes or Communicates Derivative Works or copies thereof based upon both
|
||||||
|
the Work and another work licensed under a Compatible Licence, this Distribution or Communication can be done
|
||||||
|
under the terms of this Compatible Licence. For the sake of this clause, ‘Compatible Licence’ refers to the licences listed
|
||||||
|
in the appendix attached to this Licence. Should the Licensee's obligations under the Compatible Licence conflict with
|
||||||
|
his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail.
|
||||||
|
|
||||||
|
Provision of Source Code: When distributing or communicating copies of the Work, the Licensee will provide
|
||||||
|
a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available
|
||||||
|
for as long as the Licensee continues to distribute or communicate the Work.
|
||||||
|
Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names
|
||||||
|
of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and
|
||||||
|
reproducing the content of the copyright notice.
|
||||||
|
|
||||||
|
6.Chain of Authorship
|
||||||
|
The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or
|
||||||
|
licensed to him/her and that he/she has the power and authority to grant the Licence.
|
||||||
|
Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or
|
||||||
|
licensed to him/her and that he/she has the power and authority to grant the Licence.
|
||||||
|
Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions
|
||||||
|
to the Work, under the terms of this Licence.
|
||||||
|
|
||||||
|
7.Disclaimer of Warranty
|
||||||
|
The Work is a work in progress, which is continuously improved by numerous Contributors. It is not a finished work
|
||||||
|
and may therefore contain defects or ‘bugs’ inherent to this type of development.
|
||||||
|
For the above reason, the Work is provided under the Licence on an ‘as is’ basis and without warranties of any kind
|
||||||
|
concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or
|
||||||
|
errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this
|
||||||
|
Licence.
|
||||||
|
This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work.
|
||||||
|
|
||||||
|
8.Disclaimer of Liability
|
||||||
|
Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be
|
||||||
|
liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the
|
||||||
|
Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss
|
||||||
|
of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However,
|
||||||
|
the Licensor will be liable under statutory product liability laws as far such laws apply to the Work.
|
||||||
|
|
||||||
|
9.Additional agreements
|
||||||
|
While distributing the Work, You may choose to conclude an additional agreement, defining obligations or services
|
||||||
|
consistent with this Licence. However, if accepting obligations, You may act only on your own behalf and on your sole
|
||||||
|
responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by
|
||||||
|
the fact You have accepted any warranty or additional liability.
|
||||||
|
|
||||||
|
10.Acceptance of the Licence
|
||||||
|
The provisions of this Licence can be accepted by clicking on an icon ‘I agree’ placed under the bottom of a window
|
||||||
|
displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of
|
||||||
|
applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms
|
||||||
|
and conditions.
|
||||||
|
Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You
|
||||||
|
by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution
|
||||||
|
or Communication by You of the Work or copies thereof.
|
||||||
|
|
||||||
|
11.Information to the public
|
||||||
|
In case of any Distribution or Communication of the Work by means of electronic communication by You (for example,
|
||||||
|
by offering to download the Work from a remote location) the distribution channel or media (for example, a website)
|
||||||
|
must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence
|
||||||
|
and the way it may be accessible, concluded, stored and reproduced by the Licensee.
|
||||||
|
|
||||||
|
12.Termination of the Licence
|
||||||
|
The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms
|
||||||
|
of the Licence.
|
||||||
|
Such a termination will not terminate the licences of any person who has received the Work from the Licensee under
|
||||||
|
the Licence, provided such persons remain in full compliance with the Licence.
|
||||||
|
|
||||||
|
13.Miscellaneous
|
||||||
|
Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the
|
||||||
|
Work.
|
||||||
|
If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or
|
||||||
|
enforceability of the Licence as a whole. Such provision will be construed or reformed so as necessary to make it valid
|
||||||
|
and enforceable.
|
||||||
|
The European Commission may publish other linguistic versions or new versions of this Licence or updated versions of
|
||||||
|
the Appendix, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence.
|
||||||
|
New versions of the Licence will be published with a unique version number.
|
||||||
|
All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take
|
||||||
|
advantage of the linguistic version of their choice.
|
||||||
|
|
||||||
|
14.Jurisdiction
|
||||||
|
Without prejudice to specific agreement between parties,
|
||||||
|
— any litigation resulting from the interpretation of this License, arising between the European Union institutions,
|
||||||
|
bodies, offices or agencies, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice
|
||||||
|
of the European Union, as laid down in article 272 of the Treaty on the Functioning of the European Union,
|
||||||
|
— any litigation arising between other parties and resulting from the interpretation of this License, will be subject to
|
||||||
|
the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business.
|
||||||
|
|
||||||
|
15.Applicable Law
|
||||||
|
Without prejudice to specific agreement between parties,
|
||||||
|
— this Licence shall be governed by the law of the European Union Member State where the Licensor has his seat,
|
||||||
|
resides or has his registered office,
|
||||||
|
— this licence shall be governed by Belgian law if the Licensor has no seat, residence or registered office inside
|
||||||
|
a European Union Member State.
|
||||||
|
|
||||||
|
|
||||||
|
Appendix
|
||||||
|
|
||||||
|
‘Compatible Licences’ according to Article 5 EUPL are:
|
||||||
|
— GNU General Public License (GPL) v. 2, v. 3
|
||||||
|
— GNU Affero General Public License (AGPL) v. 3
|
||||||
|
— Open Software License (OSL) v. 2.1, v. 3.0
|
||||||
|
— Eclipse Public License (EPL) v. 1.0
|
||||||
|
— CeCILL v. 2.0, v. 2.1
|
||||||
|
— Mozilla Public Licence (MPL) v. 2
|
||||||
|
— GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
||||||
|
— Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for works other than software
|
||||||
|
— European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
||||||
|
— Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong Reciprocity (LiLiQ-R+).
|
||||||
|
|
||||||
|
The European Commission may update this Appendix to later versions of the above licences without producing
|
||||||
|
a new version of the EUPL, as long as they provide the rights granted in Article 2 of this Licence and protect the
|
||||||
|
covered Source Code from exclusive appropriation.
|
||||||
|
All other changes or additions to this Appendix require the production of a new EUPL version.
|
||||||
232
LICENSES/GPL-3.0-or-later.txt
Normal file
232
LICENSES/GPL-3.0-or-later.txt
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
“This License” refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||||
|
|
||||||
|
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||||
|
|
||||||
|
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||||
|
|
||||||
|
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||||
|
|
||||||
|
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||||
|
|
||||||
|
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||||
|
|
||||||
|
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||||
|
|
||||||
|
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||||
|
|
||||||
|
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
63
Makefile
Normal file
63
Makefile
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# Makefile — workflow host/container condiviso (vedi CLAUDE.md §Workflow).
|
||||||
|
# Regola d'oro: chi scrive file lo fa come utente host (beppe). Mai mischiare
|
||||||
|
# node_modules musl(container) e glibc(host).
|
||||||
|
# - composer / npm -> HOST
|
||||||
|
# - artisan con servizi -> container MA come UID host (file beppe-owned)
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
UID := $(shell id -u)
|
||||||
|
GID := $(shell id -g)
|
||||||
|
DC := docker compose
|
||||||
|
EXEC := $(DC) exec -u $(UID):$(GID) backend
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := help
|
||||||
|
.PHONY: help up down build logs composer be-install be-update artisan migrate import tinker fe-install fe-rebuild fe-dev fe-build permissions
|
||||||
|
|
||||||
|
help: ## Mostra questo aiuto
|
||||||
|
@grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-14s\033[0m %s\n",$$1,$$2}'
|
||||||
|
|
||||||
|
## --- Stack ---
|
||||||
|
up: ## Avvia l'intero stack dev: Vite HMR + backend(serve) + db + redis + docs + mailpit
|
||||||
|
$(DC) up -d
|
||||||
|
down: ## Ferma lo stack
|
||||||
|
$(DC) down
|
||||||
|
build: ## Ricostruisce le immagini (con --pull per base aggiornate)
|
||||||
|
$(DC) build --pull
|
||||||
|
logs: ## Segue i log del backend
|
||||||
|
$(DC) logs -f backend
|
||||||
|
|
||||||
|
## --- Backend / PHP (composer sull'HOST) ---
|
||||||
|
composer: ## composer host (es: make composer c="require foo/bar")
|
||||||
|
composer -d backend $(c)
|
||||||
|
be-install: ## composer install (host)
|
||||||
|
composer -d backend install
|
||||||
|
be-update: ## composer update (host)
|
||||||
|
composer -d backend update
|
||||||
|
artisan: ## artisan nel container come utente host (es: make artisan c="migrate --seed")
|
||||||
|
$(EXEC) php artisan $(c)
|
||||||
|
migrate: ## php artisan migrate (container)
|
||||||
|
$(EXEC) php artisan migrate
|
||||||
|
import: ## ETL da v1 (container)
|
||||||
|
$(EXEC) php artisan v1:import
|
||||||
|
tinker: ## REPL artisan (container)
|
||||||
|
$(EXEC) php artisan tinker
|
||||||
|
|
||||||
|
## --- Frontend / Node ---
|
||||||
|
# In dev Vite gira NEL container (make up): HMR via bind-mount, node_modules musl
|
||||||
|
# nel volume anonimo. Su host npm serve solo a tenere package-lock + node_modules
|
||||||
|
# host sincronizzati per il type-check dell'IDE; dopo ogni modifica a package.json
|
||||||
|
# rigenerare l'immagine frontend con `make fe-rebuild`.
|
||||||
|
fe-install: ## npm install host (aggiorna package-lock + node_modules host per l'IDE)
|
||||||
|
cd frontend && npm install
|
||||||
|
fe-rebuild: ## Ricostruisce l'immagine frontend dopo modifiche a package.json (aggiorna node_modules del container)
|
||||||
|
$(DC) up -d --build frontend
|
||||||
|
fe-dev: ## ALTERNATIVA: vite dev server su host senza Docker (conflitto porta 5173 se lo stack è su)
|
||||||
|
cd frontend && npm run dev
|
||||||
|
fe-build: ## build di produzione su host (smoke test locale)
|
||||||
|
cd frontend && npm run build
|
||||||
|
|
||||||
|
## --- Manutenzione ---
|
||||||
|
permissions: ## Permessi storage scrivibili da php-fpm (www-data) — richiede sudo, una tantum
|
||||||
|
sudo chgrp -R www-data backend/storage backend/bootstrap/cache
|
||||||
|
sudo chmod -R g+ws backend/storage backend/bootstrap/cache
|
||||||
29
REUSE.toml
Normal file
29
REUSE.toml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
version = 1
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Annotazioni REUSE (https://reuse.software) per dyncoll.v2.
|
||||||
|
# Evita header SPDX in ogni singolo file: la licenza è dichiarata qui in blocco.
|
||||||
|
# Titolare del copyright: cambiare se deve essere l'istituzione/università.
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# Default per tutto il repository (codice e configurazioni): EUPL-1.2.
|
||||||
|
[[annotations]]
|
||||||
|
path = "**"
|
||||||
|
precedence = "aggregate"
|
||||||
|
SPDX-FileCopyrightText = "2026 Giuseppe Naponiello"
|
||||||
|
SPDX-License-Identifier = "EUPL-1.2"
|
||||||
|
|
||||||
|
# Documentazione utente (sito MkDocs): CC-BY-4.0.
|
||||||
|
[[annotations]]
|
||||||
|
path = "documentation/**"
|
||||||
|
precedence = "override"
|
||||||
|
SPDX-FileCopyrightText = "2026 Giuseppe Naponiello"
|
||||||
|
SPDX-License-Identifier = "CC-BY-4.0"
|
||||||
|
|
||||||
|
# Libreria di terzi 3DHOP (vendored come asset statici, non modificata).
|
||||||
|
# 3D Heritage Online Presenter — Visual Computing Lab, ISTI - CNR — GPL-3.0-or-later.
|
||||||
|
[[annotations]]
|
||||||
|
path = "frontend/public/vendor/3dhop/**"
|
||||||
|
precedence = "override"
|
||||||
|
SPDX-FileCopyrightText = "2014-2020 Visual Computing Lab, ISTI - CNR"
|
||||||
|
SPDX-License-Identifier = "GPL-3.0-or-later"
|
||||||
29
backend/.dockerignore
Normal file
29
backend/.dockerignore
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Build context = ./backend (vedi docker-compose.yml). Il .dockerignore di root
|
||||||
|
# NON si applica qui: serve questo file dedicato.
|
||||||
|
|
||||||
|
# Segreti: MAI nell'immagine (il .env reale è montato a runtime via compose).
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Dipendenze: l'immagine fa il proprio `composer install` (no-dev in prod).
|
||||||
|
# La vendor host conterrebbe le dev-deps e sporcherebbe il layer.
|
||||||
|
vendor
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# VCS / tooling locale
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.gitattributes
|
||||||
|
.editorconfig
|
||||||
|
|
||||||
|
# Artefatti runtime/test che non vanno nel layer
|
||||||
|
storage/logs/*
|
||||||
|
storage/framework/cache/data/*
|
||||||
|
storage/framework/sessions/*
|
||||||
|
storage/framework/views/*
|
||||||
|
coverage
|
||||||
|
coverage.xml
|
||||||
|
.phpunit.result.cache
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
18
backend/.editorconfig
Normal file
18
backend/.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[{compose,docker-compose}.{yml,yaml}]
|
||||||
|
indent_size = 4
|
||||||
65
backend/.env.example
Normal file
65
backend/.env.example
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_FALLBACK_LOCALE=en
|
||||||
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|
||||||
|
APP_MAINTENANCE_DRIVER=file
|
||||||
|
# APP_MAINTENANCE_STORE=database
|
||||||
|
|
||||||
|
# PHP_CLI_SERVER_WORKERS=4
|
||||||
|
|
||||||
|
BCRYPT_ROUNDS=12
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_STACK=single
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=sqlite
|
||||||
|
# DB_HOST=127.0.0.1
|
||||||
|
# DB_PORT=3306
|
||||||
|
# DB_DATABASE=laravel
|
||||||
|
# DB_USERNAME=root
|
||||||
|
# DB_PASSWORD=
|
||||||
|
|
||||||
|
SESSION_DRIVER=database
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
SESSION_ENCRYPT=false
|
||||||
|
SESSION_PATH=/
|
||||||
|
SESSION_DOMAIN=null
|
||||||
|
|
||||||
|
BROADCAST_CONNECTION=log
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=database
|
||||||
|
|
||||||
|
CACHE_STORE=database
|
||||||
|
# CACHE_PREFIX=
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_CLIENT=phpredis
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=log
|
||||||
|
MAIL_SCHEME=null
|
||||||
|
MAIL_HOST=127.0.0.1
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_FROM_ADDRESS="hello@example.com"
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
VITE_APP_NAME="${APP_NAME}"
|
||||||
11
backend/.gitattributes
vendored
Normal file
11
backend/.gitattributes
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
*.blade.php diff=html
|
||||||
|
*.css diff=css
|
||||||
|
*.html diff=html
|
||||||
|
*.md diff=markdown
|
||||||
|
*.php diff=php
|
||||||
|
|
||||||
|
/.github export-ignore
|
||||||
|
CHANGELOG.md export-ignore
|
||||||
|
.styleci.yml export-ignore
|
||||||
27
backend/.gitignore
vendored
Normal file
27
backend/.gitignore
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
*.log
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.env.production
|
||||||
|
.phpactor.json
|
||||||
|
.phpunit.result.cache
|
||||||
|
/.codex
|
||||||
|
/.cursor/
|
||||||
|
/.idea
|
||||||
|
/.nova
|
||||||
|
/.phpunit.cache
|
||||||
|
/.vscode
|
||||||
|
/.zed
|
||||||
|
/auth.json
|
||||||
|
/node_modules
|
||||||
|
/public/build
|
||||||
|
/public/fonts-manifest.dev.json
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/storage/pail
|
||||||
|
/vendor
|
||||||
|
_ide_helper.php
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
Thumbs.db
|
||||||
2
backend/.npmrc
Normal file
2
backend/.npmrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ignore-scripts=true
|
||||||
|
audit=true
|
||||||
58
backend/README.md
Normal file
58
backend/README.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||||
|
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||||
|
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||||
|
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## About Laravel
|
||||||
|
|
||||||
|
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||||
|
|
||||||
|
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||||
|
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||||
|
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||||
|
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||||
|
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||||
|
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||||
|
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||||
|
|
||||||
|
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||||
|
|
||||||
|
## Learning Laravel
|
||||||
|
|
||||||
|
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||||
|
|
||||||
|
In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||||
|
|
||||||
|
You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals.
|
||||||
|
|
||||||
|
## Agentic Development
|
||||||
|
|
||||||
|
Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer require laravel/boost --dev
|
||||||
|
|
||||||
|
php artisan boost:install
|
||||||
|
```
|
||||||
|
|
||||||
|
Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
|
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||||
|
|
||||||
|
## Security Vulnerabilities
|
||||||
|
|
||||||
|
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||||
8
backend/app/Http/Controllers/Controller.php
Normal file
8
backend/app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
abstract class Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
32
backend/app/Models/User.php
Normal file
32
backend/app/Models/User.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use Database\Factories\UserFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||||
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
|
#[Fillable(['name', 'email', 'password'])]
|
||||||
|
#[Hidden(['password', 'remember_token'])]
|
||||||
|
class User extends Authenticatable
|
||||||
|
{
|
||||||
|
/** @use HasFactory<UserFactory> */
|
||||||
|
use HasFactory, Notifiable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email_verified_at' => 'datetime',
|
||||||
|
'password' => 'hashed',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/app/Providers/AppServiceProvider.php
Normal file
24
backend/app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
18
backend/artisan
Executable file
18
backend/artisan
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
// Register the Composer autoloader...
|
||||||
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
|
// Bootstrap Laravel and handle the command...
|
||||||
|
/** @var Application $app */
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
$status = $app->handleCommand(new ArgvInput);
|
||||||
|
|
||||||
|
exit($status);
|
||||||
79
backend/backend.Dockerfile
Normal file
79
backend/backend.Dockerfile
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
FROM php:8.4-fpm-alpine AS base
|
||||||
|
|
||||||
|
LABEL maintainer="Giuseppe Naponiello"
|
||||||
|
LABEL version="3.0.0"
|
||||||
|
LABEL description="Dynamic Collections Plus is a web platform for building and curating digital collections of archaeological artefacts. Backend container."
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
mysql-dev mysql-client \
|
||||||
|
libpq libpng-dev libzip-dev \
|
||||||
|
zip unzip \
|
||||||
|
git \
|
||||||
|
oniguruma-dev \
|
||||||
|
icu-dev \
|
||||||
|
linux-headers \
|
||||||
|
nginx supervisor \
|
||||||
|
$PHPIZE_DEPS && \
|
||||||
|
docker-php-ext-install pdo_mysql gd zip intl bcmath pcntl && \
|
||||||
|
pecl install redis pcov && \
|
||||||
|
docker-php-ext-enable redis pcov && \
|
||||||
|
apk del $PHPIZE_DEPS
|
||||||
|
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
# composer.lock è opzionale finché non viene generato (il glob `*` non fallisce se assente)
|
||||||
|
COPY composer.json composer.lock* ./
|
||||||
|
|
||||||
|
ARG APP_ENV=production
|
||||||
|
RUN if [ "$APP_ENV" = "production" ]; then \
|
||||||
|
composer install --no-dev --no-scripts --no-autoloader; \
|
||||||
|
else \
|
||||||
|
composer install --no-scripts --no-autoloader; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copie esplicite (no `COPY . .` — docker:S6470): solo l'app Laravel, così non
|
||||||
|
# finiscono nell'immagine .env (segreti), vendor host (dev-deps) o file locali.
|
||||||
|
# Il .dockerignore è una rete di sicurezza ulteriore.
|
||||||
|
COPY app/ ./app/
|
||||||
|
COPY bootstrap/ ./bootstrap/
|
||||||
|
COPY config/ ./config/
|
||||||
|
COPY database/ ./database/
|
||||||
|
COPY public/ ./public/
|
||||||
|
COPY resources/ ./resources/
|
||||||
|
COPY routes/ ./routes/
|
||||||
|
COPY storage/ ./storage/
|
||||||
|
COPY artisan ./
|
||||||
|
|
||||||
|
# Ottimizzazione autoloader + permessi storage
|
||||||
|
RUN composer dump-autoload --optimize && \
|
||||||
|
chown -R www-data:www-data storage bootstrap/cache && \
|
||||||
|
chmod -R 775 storage bootstrap/cache
|
||||||
|
|
||||||
|
# Entrypoint per migrations e bootstrap
|
||||||
|
COPY entrypoint.sh /usr/local/bin/
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# STAGE: development
|
||||||
|
# Override del CMD tramite docker-compose.override.yml:
|
||||||
|
# command: ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
||||||
|
# ----------------------------
|
||||||
|
FROM base AS development
|
||||||
|
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# STAGE: production
|
||||||
|
# Nginx + php-fpm gestiti da supervisord
|
||||||
|
# ----------------------------
|
||||||
|
FROM base AS production
|
||||||
|
|
||||||
|
COPY docker/nginx-backend.conf /etc/nginx/http.d/default.conf
|
||||||
|
COPY docker/supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||||
21
backend/bootstrap/app.php
Normal file
21
backend/bootstrap/app.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
|
->withRouting(
|
||||||
|
web: __DIR__.'/../routes/web.php',
|
||||||
|
commands: __DIR__.'/../routes/console.php',
|
||||||
|
health: '/up',
|
||||||
|
)
|
||||||
|
->withMiddleware(function (Middleware $middleware): void {
|
||||||
|
//
|
||||||
|
})
|
||||||
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
|
$exceptions->shouldRenderJsonWhen(
|
||||||
|
fn (Request $request) => $request->is('api/*'),
|
||||||
|
);
|
||||||
|
})->create();
|
||||||
2
backend/bootstrap/cache/.gitignore
vendored
Normal file
2
backend/bootstrap/cache/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
7
backend/bootstrap/providers.php
Normal file
7
backend/bootstrap/providers.php
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Providers\AppServiceProvider;
|
||||||
|
|
||||||
|
return [
|
||||||
|
AppServiceProvider::class,
|
||||||
|
];
|
||||||
102
backend/composer.json
Normal file
102
backend/composer.json
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://getcomposer.org/schema.json",
|
||||||
|
"name": "laravel/laravel",
|
||||||
|
"type": "project",
|
||||||
|
"description": "The skeleton application for the Laravel framework.",
|
||||||
|
"keywords": ["laravel", "framework"],
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^8.3",
|
||||||
|
"bacon/bacon-qr-code": "^3.1",
|
||||||
|
"barryvdh/laravel-dompdf": "^3.1",
|
||||||
|
"dedoc/scramble": "^0.13.27",
|
||||||
|
"laravel/fortify": "^1.37",
|
||||||
|
"laravel/framework": "^13.8",
|
||||||
|
"laravel/horizon": "^5.47",
|
||||||
|
"laravel/sanctum": "^4.0",
|
||||||
|
"laravel/tinker": "^3.0",
|
||||||
|
"matanyadaev/laravel-eloquent-spatial": "^4.8",
|
||||||
|
"ml/json-ld": "^1.2",
|
||||||
|
"opis/json-schema": "^2.6",
|
||||||
|
"owen-it/laravel-auditing": "^14.0",
|
||||||
|
"pragmarx/google2fa": "^9.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "^1.23",
|
||||||
|
"laravel/pail": "^1.2.5",
|
||||||
|
"laravel/pint": "^1.27",
|
||||||
|
"mockery/mockery": "^1.6",
|
||||||
|
"nunomaduro/collision": "^8.6",
|
||||||
|
"phpunit/phpunit": "^12.5.12"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"setup": [
|
||||||
|
"composer install",
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||||
|
"@php artisan key:generate",
|
||||||
|
"@php artisan migrate --force",
|
||||||
|
"npm install --ignore-scripts",
|
||||||
|
"npm run build"
|
||||||
|
],
|
||||||
|
"dev": [
|
||||||
|
"Composer\\Config::disableProcessTimeout",
|
||||||
|
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
|
||||||
|
],
|
||||||
|
"test": [
|
||||||
|
"@php artisan config:clear --ansi",
|
||||||
|
"@php artisan test"
|
||||||
|
],
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi",
|
||||||
|
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||||
|
"@php artisan migrate --graceful --ansi"
|
||||||
|
],
|
||||||
|
"pre-package-uninstall": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true,
|
||||||
|
"platform": {
|
||||||
|
"php": "8.4",
|
||||||
|
"ext-redis": "6.1.0",
|
||||||
|
"ext-gd": "8.4",
|
||||||
|
"ext-bcmath": "8.4"
|
||||||
|
},
|
||||||
|
"allow-plugins": {
|
||||||
|
"pestphp/pest-plugin": true,
|
||||||
|
"php-http/discovery": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
||||||
10970
backend/composer.lock
generated
Normal file
10970
backend/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
126
backend/config/app.php
Normal file
126
backend/config/app.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value is the name of your application, which will be used when the
|
||||||
|
| framework needs to place the application's name in a notification or
|
||||||
|
| other UI elements where an application name needs to be displayed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'name' => env('APP_NAME', 'Laravel'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Environment
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value determines the "environment" your application is currently
|
||||||
|
| running in. This may determine how you prefer to configure various
|
||||||
|
| services the application utilizes. Set this in your ".env" file.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'env' => env('APP_ENV', 'production'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Debug Mode
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When your application is in debug mode, detailed error messages with
|
||||||
|
| stack traces will be shown on every error that occurs within your
|
||||||
|
| application. If disabled, a simple generic error page is shown.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'debug' => (bool) env('APP_DEBUG', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application URL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This URL is used by the console to properly generate URLs when using
|
||||||
|
| the Artisan command line tool. You should set this to the root of
|
||||||
|
| the application so that it's available within Artisan commands.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Timezone
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default timezone for your application, which
|
||||||
|
| will be used by the PHP date and date-time functions. The timezone
|
||||||
|
| is set to "UTC" by default as it is suitable for most use cases.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Locale Configuration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The application locale determines the default locale that will be used
|
||||||
|
| by Laravel's translation / localization methods. This option can be
|
||||||
|
| set to any locale for which you plan to have translation strings.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'locale' => env('APP_LOCALE', 'en'),
|
||||||
|
|
||||||
|
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||||
|
|
||||||
|
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Encryption Key
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This key is utilized by Laravel's encryption services and should be set
|
||||||
|
| to a random, 32 character string to ensure that all encrypted values
|
||||||
|
| are secure. You should do this prior to deploying the application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
|
'key' => env('APP_KEY'),
|
||||||
|
|
||||||
|
'previous_keys' => [
|
||||||
|
...array_filter(
|
||||||
|
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Maintenance Mode Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These configuration options determine the driver used to determine and
|
||||||
|
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||||
|
| allow maintenance mode to be controlled across multiple machines.
|
||||||
|
|
|
||||||
|
| Supported drivers: "file", "cache"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'maintenance' => [
|
||||||
|
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||||
|
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
117
backend/config/auth.php
Normal file
117
backend/config/auth.php
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Defaults
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option defines the default authentication "guard" and password
|
||||||
|
| reset "broker" for your application. You may change these values
|
||||||
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => env('AUTH_GUARD', 'web'),
|
||||||
|
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, you may define every authentication guard for your application.
|
||||||
|
| Of course, a great default configuration has been defined for you
|
||||||
|
| which utilizes session storage plus the Eloquent user provider.
|
||||||
|
|
|
||||||
|
| All authentication guards have a user provider, which defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| system used by the application. Typically, Eloquent is utilized.
|
||||||
|
|
|
||||||
|
| Supported: "session"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| User Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| All authentication guards have a user provider, which defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| system used by the application. Typically, Eloquent is utilized.
|
||||||
|
|
|
||||||
|
| If you have multiple user tables or models you may configure multiple
|
||||||
|
| providers to represent the model / table. These providers may then
|
||||||
|
| be assigned to any extra authentication guards you have defined.
|
||||||
|
|
|
||||||
|
| Supported: "database", "eloquent"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
'users' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => env('AUTH_MODEL', User::class),
|
||||||
|
],
|
||||||
|
|
||||||
|
// 'users' => [
|
||||||
|
// 'driver' => 'database',
|
||||||
|
// 'table' => 'users',
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Resetting Passwords
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These configuration options specify the behavior of Laravel's password
|
||||||
|
| reset functionality, including the table utilized for token storage
|
||||||
|
| and the user provider that is invoked to actually retrieve users.
|
||||||
|
|
|
||||||
|
| The expiry time is the number of minutes that each reset token will be
|
||||||
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
||||||
|
| The throttle setting is the number of seconds a user must wait before
|
||||||
|
| generating more password reset tokens. This prevents the user from
|
||||||
|
| quickly generating a very large amount of password reset tokens.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'passwords' => [
|
||||||
|
'users' => [
|
||||||
|
'provider' => 'users',
|
||||||
|
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||||
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Confirmation Timeout
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define the number of seconds before a password confirmation
|
||||||
|
| window expires and users are asked to re-enter their password via the
|
||||||
|
| confirmation screen. By default, the timeout lasts for three hours.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||||
|
|
||||||
|
];
|
||||||
136
backend/config/cache.php
Normal file
136
backend/config/cache.php
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default cache store that will be used by the
|
||||||
|
| framework. This connection is utilized if another isn't explicitly
|
||||||
|
| specified when running a cache operation inside the application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('CACHE_STORE', 'database'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Stores
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the cache "stores" for your application as
|
||||||
|
| well as their drivers. You may even define multiple stores for the
|
||||||
|
| same cache driver to group types of items stored in your caches.
|
||||||
|
|
|
||||||
|
| Supported drivers: "array", "database", "file", "memcached",
|
||||||
|
| "redis", "dynamodb", "storage", "octane",
|
||||||
|
| "session", "failover", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stores' => [
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'driver' => 'array',
|
||||||
|
'serialize' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'connection' => env('DB_CACHE_CONNECTION'),
|
||||||
|
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||||
|
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||||
|
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'file' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
'path' => storage_path('framework/cache/data'),
|
||||||
|
'lock_path' => storage_path('framework/cache/data'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'storage' => [
|
||||||
|
'driver' => 'storage',
|
||||||
|
'disk' => env('CACHE_STORAGE_DISK'),
|
||||||
|
'path' => env('CACHE_STORAGE_PATH', 'framework/cache/data'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'memcached' => [
|
||||||
|
'driver' => 'memcached',
|
||||||
|
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||||
|
'sasl' => [
|
||||||
|
env('MEMCACHED_USERNAME'),
|
||||||
|
env('MEMCACHED_PASSWORD'),
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||||
|
],
|
||||||
|
'servers' => [
|
||||||
|
[
|
||||||
|
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('MEMCACHED_PORT', 11211),
|
||||||
|
'weight' => 100,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||||
|
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'dynamodb' => [
|
||||||
|
'driver' => 'dynamodb',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||||
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'octane' => [
|
||||||
|
'driver' => 'octane',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'driver' => 'failover',
|
||||||
|
'stores' => [
|
||||||
|
'database',
|
||||||
|
'array',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Key Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||||
|
| stores, there might be other applications using the same cache. For
|
||||||
|
| that reason, you may prefix every cache key to avoid collisions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Serializable Classes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value determines the classes that can be unserialized from cache
|
||||||
|
| storage. By default, no PHP classes will be unserialized from your
|
||||||
|
| cache to prevent gadget chain attacks if your APP_KEY is leaked.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'serializable_classes' => false,
|
||||||
|
|
||||||
|
];
|
||||||
184
backend/config/database.php
Normal file
184
backend/config/database.php
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Pdo\Mysql;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Database Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify which of the database connections below you wish
|
||||||
|
| to use as your default connection for database operations. This is
|
||||||
|
| the connection which will be utilized unless another connection
|
||||||
|
| is explicitly specified when you execute a query / statement.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Database Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Below are all of the database connections defined for your application.
|
||||||
|
| An example configuration is provided for each database system which
|
||||||
|
| is supported by Laravel. You're free to add / remove connections.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sqlite' => [
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||||
|
'prefix' => '',
|
||||||
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
|
'busy_timeout' => null,
|
||||||
|
'journal_mode' => null,
|
||||||
|
'synchronous' => null,
|
||||||
|
'transaction_mode' => 'DEFERRED',
|
||||||
|
],
|
||||||
|
|
||||||
|
'mysql' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||||
|
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'mariadb' => [
|
||||||
|
'driver' => 'mariadb',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||||
|
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'pgsql' => [
|
||||||
|
'driver' => 'pgsql',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '5432'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'search_path' => 'public',
|
||||||
|
'sslmode' => env('DB_SSLMODE', 'prefer'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqlsrv' => [
|
||||||
|
'driver' => 'sqlsrv',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', 'localhost'),
|
||||||
|
'port' => env('DB_PORT', '1433'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||||
|
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Migration Repository Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This table keeps track of all the migrations that have already run for
|
||||||
|
| your application. Using this information, we can determine which of
|
||||||
|
| the migrations on disk haven't actually been run on the database.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'migrations' => [
|
||||||
|
'table' => 'migrations',
|
||||||
|
'update_date_on_publish' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Redis Databases
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Redis is an open source, fast, and advanced key-value store that also
|
||||||
|
| provides a richer body of commands than a typical key-value system
|
||||||
|
| such as Memcached. You may define your connection settings here.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
|
||||||
|
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||||
|
|
||||||
|
'options' => [
|
||||||
|
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||||
|
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
|
||||||
|
'persistent' => env('REDIS_PERSISTENT', false),
|
||||||
|
],
|
||||||
|
|
||||||
|
'default' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_DB', '0'),
|
||||||
|
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||||
|
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||||
|
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||||
|
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||||
|
],
|
||||||
|
|
||||||
|
'cache' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_CACHE_DB', '1'),
|
||||||
|
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||||
|
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||||
|
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||||
|
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
80
backend/config/filesystems.php
Normal file
80
backend/config/filesystems.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Filesystem Disk
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default filesystem disk that should be used
|
||||||
|
| by the framework. The "local" disk, as well as a variety of cloud
|
||||||
|
| based disks are available to your application for file storage.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Filesystem Disks
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Below you may configure as many filesystem disks as necessary, and you
|
||||||
|
| may even configure multiple disks for the same driver. Examples for
|
||||||
|
| most supported storage drivers are configured here for reference.
|
||||||
|
|
|
||||||
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'disks' => [
|
||||||
|
|
||||||
|
'local' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/private'),
|
||||||
|
'serve' => true,
|
||||||
|
'throw' => false,
|
||||||
|
'report' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'public' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/public'),
|
||||||
|
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
|
||||||
|
'visibility' => 'public',
|
||||||
|
'throw' => false,
|
||||||
|
'report' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
's3' => [
|
||||||
|
'driver' => 's3',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
|
'bucket' => env('AWS_BUCKET'),
|
||||||
|
'url' => env('AWS_URL'),
|
||||||
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
|
'throw' => false,
|
||||||
|
'report' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Symbolic Links
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the symbolic links that will be created when the
|
||||||
|
| `storage:link` Artisan command is executed. The array keys should be
|
||||||
|
| the locations of the links and the values should be their targets.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
132
backend/config/logging.php
Normal file
132
backend/config/logging.php
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Monolog\Handler\NullHandler;
|
||||||
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option defines the default log channel that is utilized to write
|
||||||
|
| messages to your logs. The value provided here should match one of
|
||||||
|
| the channels present in the list of "channels" configured below.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('LOG_CHANNEL', 'stack'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Deprecations Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the log channel that should be used to log warnings
|
||||||
|
| regarding deprecated PHP and library features. This allows you to get
|
||||||
|
| your application ready for upcoming major versions of dependencies.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'deprecations' => [
|
||||||
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||||
|
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Log Channels
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the log channels for your application. Laravel
|
||||||
|
| utilizes the Monolog PHP logging library, which includes a variety
|
||||||
|
| of powerful log handlers and formatters that you're free to use.
|
||||||
|
|
|
||||||
|
| Available drivers: "single", "daily", "slack", "syslog",
|
||||||
|
| "errorlog", "monolog", "custom", "stack"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'channels' => [
|
||||||
|
|
||||||
|
'stack' => [
|
||||||
|
'driver' => 'stack',
|
||||||
|
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
|
||||||
|
'ignore_exceptions' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'single' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'daily' => [
|
||||||
|
'driver' => 'daily',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'days' => env('LOG_DAILY_DAYS', 14),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'driver' => 'slack',
|
||||||
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
|
'username' => env('LOG_SLACK_USERNAME', env('APP_NAME', 'Laravel')),
|
||||||
|
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||||
|
'level' => env('LOG_LEVEL', 'critical'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'papertrail' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||||
|
'handler_with' => [
|
||||||
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
|
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'stderr' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => StreamHandler::class,
|
||||||
|
'handler_with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'syslog' => [
|
||||||
|
'driver' => 'syslog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'errorlog' => [
|
||||||
|
'driver' => 'errorlog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'handler' => NullHandler::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'emergency' => [
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
118
backend/config/mail.php
Normal file
118
backend/config/mail.php
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Mailer
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default mailer that is used to send all email
|
||||||
|
| messages unless another mailer is explicitly specified when sending
|
||||||
|
| the message. All additional mailers can be configured within the
|
||||||
|
| "mailers" array. Examples of each type of mailer are provided.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('MAIL_MAILER', 'log'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mailer Configurations
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure all of the mailers used by your application plus
|
||||||
|
| their respective settings. Several examples have been configured for
|
||||||
|
| you and you are free to add your own as your application requires.
|
||||||
|
|
|
||||||
|
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||||
|
| when delivering an email. You may specify which one you're using for
|
||||||
|
| your mailers below. You may also add additional mailers if needed.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||||
|
| "postmark", "resend", "log", "array",
|
||||||
|
| "failover", "roundrobin"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailers' => [
|
||||||
|
|
||||||
|
'smtp' => [
|
||||||
|
'transport' => 'smtp',
|
||||||
|
'scheme' => env('MAIL_SCHEME'),
|
||||||
|
'url' => env('MAIL_URL'),
|
||||||
|
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('MAIL_PORT', 2525),
|
||||||
|
'username' => env('MAIL_USERNAME'),
|
||||||
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
'timeout' => null,
|
||||||
|
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'transport' => 'ses',
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'transport' => 'postmark',
|
||||||
|
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'resend' => [
|
||||||
|
'transport' => 'resend',
|
||||||
|
],
|
||||||
|
|
||||||
|
'sendmail' => [
|
||||||
|
'transport' => 'sendmail',
|
||||||
|
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'transport' => 'log',
|
||||||
|
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'transport' => 'array',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'transport' => 'failover',
|
||||||
|
'mailers' => [
|
||||||
|
'smtp',
|
||||||
|
'log',
|
||||||
|
],
|
||||||
|
'retry_after' => 60,
|
||||||
|
],
|
||||||
|
|
||||||
|
'roundrobin' => [
|
||||||
|
'transport' => 'roundrobin',
|
||||||
|
'mailers' => [
|
||||||
|
'ses',
|
||||||
|
'postmark',
|
||||||
|
],
|
||||||
|
'retry_after' => 60,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global "From" Address
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may wish for all emails sent by your application to be sent from
|
||||||
|
| the same address. Here you may specify a name and address that is
|
||||||
|
| used globally for all emails that are sent by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'from' => [
|
||||||
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||||
|
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
129
backend/config/queue.php
Normal file
129
backend/config/queue.php
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Queue Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Laravel's queue supports a variety of backends via a single, unified
|
||||||
|
| API, giving you convenient access to each backend using identical
|
||||||
|
| syntax for each. The default queue connection is defined below.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Queue Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the connection options for every queue backend
|
||||||
|
| used by your application. An example configuration is provided for
|
||||||
|
| each backend supported by Laravel. You're also free to add more.
|
||||||
|
|
|
||||||
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
|
||||||
|
| "deferred", "background", "failover", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sync' => [
|
||||||
|
'driver' => 'sync',
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||||
|
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||||
|
'queue' => env('DB_QUEUE', 'default'),
|
||||||
|
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'beanstalkd' => [
|
||||||
|
'driver' => 'beanstalkd',
|
||||||
|
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||||
|
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||||
|
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||||
|
'block_for' => 0,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqs' => [
|
||||||
|
'driver' => 'sqs',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||||
|
'queue' => env('SQS_QUEUE', 'default'),
|
||||||
|
'suffix' => env('SQS_SUFFIX'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||||
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
|
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||||
|
'block_for' => null,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'deferred' => [
|
||||||
|
'driver' => 'deferred',
|
||||||
|
],
|
||||||
|
|
||||||
|
'background' => [
|
||||||
|
'driver' => 'background',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'driver' => 'failover',
|
||||||
|
'connections' => [
|
||||||
|
'database',
|
||||||
|
'deferred',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Job Batching
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following options configure the database and table that store job
|
||||||
|
| batching information. These options can be updated to any database
|
||||||
|
| connection and table which has been defined by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'batching' => [
|
||||||
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Failed Queue Jobs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These options configure the behavior of failed queue job logging so you
|
||||||
|
| can control how and where failed jobs are stored. Laravel ships with
|
||||||
|
| support for storing failed jobs in a simple file or in a database.
|
||||||
|
|
|
||||||
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => [
|
||||||
|
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||||
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
'table' => 'failed_jobs',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
38
backend/config/services.php
Normal file
38
backend/config/services.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Third Party Services
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is for storing the credentials for third party services such
|
||||||
|
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||||
|
| location for this type of information, allowing packages to have
|
||||||
|
| a conventional file to locate the various service credentials.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'key' => env('POSTMARK_API_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'resend' => [
|
||||||
|
'key' => env('RESEND_API_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'notifications' => [
|
||||||
|
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||||
|
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
233
backend/config/session.php
Normal file
233
backend/config/session.php
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Session Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines the default session driver that is utilized for
|
||||||
|
| incoming requests. Laravel supports a variety of storage options to
|
||||||
|
| persist session data. Database storage is a great default choice.
|
||||||
|
|
|
||||||
|
| Supported: "file", "cookie", "database", "memcached",
|
||||||
|
| "redis", "dynamodb", "array"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => env('SESSION_DRIVER', 'database'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Lifetime
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the number of minutes that you wish the session
|
||||||
|
| to be allowed to remain idle before it expires. If you want them
|
||||||
|
| to expire immediately when the browser is closed then you may
|
||||||
|
| indicate that via the expire_on_close configuration option.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||||
|
|
||||||
|
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Encryption
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option allows you to easily specify that all of your session data
|
||||||
|
| should be encrypted before it's stored. All encryption is performed
|
||||||
|
| automatically by Laravel and you may use the session like normal.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session File Location
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing the "file" session driver, the session files are placed
|
||||||
|
| on disk. The default storage location is defined here; however, you
|
||||||
|
| are free to provide another location where they should be stored.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'files' => storage_path('framework/sessions'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Connection
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" or "redis" session drivers, you may specify a
|
||||||
|
| connection that should be used to manage these sessions. This should
|
||||||
|
| correspond to a connection in your database configuration options.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connection' => env('SESSION_CONNECTION'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" session driver, you may specify the table to
|
||||||
|
| be used to store sessions. Of course, a sensible default is defined
|
||||||
|
| for you; however, you're welcome to change this to another table.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'table' => env('SESSION_TABLE', 'sessions'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using one of the framework's cache driven session backends, you may
|
||||||
|
| define the cache store which should be used to store the session data
|
||||||
|
| between requests. This must match one of your defined cache stores.
|
||||||
|
|
|
||||||
|
| Affects: "dynamodb", "memcached", "redis"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'store' => env('SESSION_STORE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Sweeping Lottery
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Some session drivers must manually sweep their storage location to get
|
||||||
|
| rid of old sessions from storage. Here are the chances that it will
|
||||||
|
| happen on a given request. By default, the odds are 2 out of 100.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lottery' => [2, 100],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may change the name of the session cookie that is created by
|
||||||
|
| the framework. Typically, you should not need to change this value
|
||||||
|
| since doing so does not grant a meaningful security improvement.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cookie' => env(
|
||||||
|
'SESSION_COOKIE',
|
||||||
|
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
|
||||||
|
),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The session cookie path determines the path for which the cookie will
|
||||||
|
| be regarded as available. Typically, this will be the root path of
|
||||||
|
| your application, but you're free to change this when necessary.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'path' => env('SESSION_PATH', '/'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Domain
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value determines the domain and subdomains the session cookie is
|
||||||
|
| available to. By default, the cookie will be available to the root
|
||||||
|
| domain without subdomains. Typically, this shouldn't be changed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'domain' => env('SESSION_DOMAIN'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTPS Only Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By setting this option to true, session cookies will only be sent back
|
||||||
|
| to the server if the browser has a HTTPS connection. This will keep
|
||||||
|
| the cookie from being sent to you when it can't be done securely.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTP Access Only
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Setting this value to true will prevent JavaScript from accessing the
|
||||||
|
| value of the cookie and the cookie will only be accessible through
|
||||||
|
| the HTTP protocol. It's unlikely you should disable this option.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Same-Site Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines how your cookies behave when cross-site requests
|
||||||
|
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||||
|
| will set this value to "lax" to permit secure cross-site requests.
|
||||||
|
|
|
||||||
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||||
|
|
|
||||||
|
| Supported: "lax", "strict", "none", null
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Partitioned Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Setting this value to true will tie the cookie to the top-level site for
|
||||||
|
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||||
|
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Serialization
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value controls the serialization strategy for session data, which
|
||||||
|
| is JSON by default. Setting this to "php" allows the storage of PHP
|
||||||
|
| objects in the session but can make an application vulnerable to
|
||||||
|
| "gadget chain" serialization attacks if the APP_KEY is leaked.
|
||||||
|
|
|
||||||
|
| Supported: "json", "php"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'serialization' => 'json',
|
||||||
|
|
||||||
|
];
|
||||||
1
backend/database/.gitignore
vendored
Normal file
1
backend/database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.sqlite*
|
||||||
45
backend/database/factories/UserFactory.php
Normal file
45
backend/database/factories/UserFactory.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends Factory<User>
|
||||||
|
*/
|
||||||
|
class UserFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The current password being used by the factory.
|
||||||
|
*/
|
||||||
|
protected static ?string $password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => fake()->name(),
|
||||||
|
'email' => fake()->unique()->safeEmail(),
|
||||||
|
'email_verified_at' => now(),
|
||||||
|
'password' => static::$password ??= Hash::make('password'),
|
||||||
|
'remember_token' => Str::random(10),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate that the model's email address should be unverified.
|
||||||
|
*/
|
||||||
|
public function unverified(): static
|
||||||
|
{
|
||||||
|
return $this->state(fn (array $attributes) => [
|
||||||
|
'email_verified_at' => null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('users', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('email')->unique();
|
||||||
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
|
$table->string('password');
|
||||||
|
$table->rememberToken();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||||
|
$table->string('email')->primary();
|
||||||
|
$table->string('token');
|
||||||
|
$table->timestamp('created_at')->nullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('sessions', function (Blueprint $table) {
|
||||||
|
$table->string('id')->primary();
|
||||||
|
$table->foreignId('user_id')->nullable()->index();
|
||||||
|
$table->string('ip_address', 45)->nullable();
|
||||||
|
$table->text('user_agent')->nullable();
|
||||||
|
$table->longText('payload');
|
||||||
|
$table->integer('last_activity')->index();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('users');
|
||||||
|
Schema::dropIfExists('password_reset_tokens');
|
||||||
|
Schema::dropIfExists('sessions');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('cache', function (Blueprint $table) {
|
||||||
|
$table->string('key')->primary();
|
||||||
|
$table->mediumText('value');
|
||||||
|
$table->bigInteger('expiration')->index();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('cache_locks', function (Blueprint $table) {
|
||||||
|
$table->string('key')->primary();
|
||||||
|
$table->string('owner');
|
||||||
|
$table->bigInteger('expiration')->index();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('cache');
|
||||||
|
Schema::dropIfExists('cache_locks');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('jobs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('queue')->index();
|
||||||
|
$table->longText('payload');
|
||||||
|
$table->unsignedSmallInteger('attempts');
|
||||||
|
$table->unsignedInteger('reserved_at')->nullable();
|
||||||
|
$table->unsignedInteger('available_at');
|
||||||
|
$table->unsignedInteger('created_at');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('job_batches', function (Blueprint $table) {
|
||||||
|
$table->string('id')->primary();
|
||||||
|
$table->string('name');
|
||||||
|
$table->integer('total_jobs');
|
||||||
|
$table->integer('pending_jobs');
|
||||||
|
$table->integer('failed_jobs');
|
||||||
|
$table->longText('failed_job_ids');
|
||||||
|
$table->mediumText('options')->nullable();
|
||||||
|
$table->integer('cancelled_at')->nullable();
|
||||||
|
$table->integer('created_at');
|
||||||
|
$table->integer('finished_at')->nullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('uuid')->unique();
|
||||||
|
$table->string('connection');
|
||||||
|
$table->string('queue');
|
||||||
|
$table->longText('payload');
|
||||||
|
$table->longText('exception');
|
||||||
|
$table->timestamp('failed_at')->useCurrent();
|
||||||
|
|
||||||
|
$table->index(['connection', 'queue', 'failed_at']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('jobs');
|
||||||
|
Schema::dropIfExists('job_batches');
|
||||||
|
Schema::dropIfExists('failed_jobs');
|
||||||
|
}
|
||||||
|
};
|
||||||
25
backend/database/seeders/DatabaseSeeder.php
Normal file
25
backend/database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
use WithoutModelEvents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seed the application's database.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
// User::factory(10)->create();
|
||||||
|
|
||||||
|
User::factory()->create([
|
||||||
|
'name' => 'Test User',
|
||||||
|
'email' => 'test@example.com',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
44
backend/docker/nginx-backend.conf
Normal file
44
backend/docker/nginx-backend.conf
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
server {
|
||||||
|
listen 8000;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /var/www/html/public;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
# Gestione SPA/Laravel: tutto passa per index.php
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Passa le richieste PHP a php-fpm locale
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
|
||||||
|
# Timeout generosi per operazioni Laravel pesanti (es. import, export)
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_connect_timeout 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Blocca accesso a file sensibili
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.env {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache statica per asset compilati
|
||||||
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff2)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Log
|
||||||
|
access_log /dev/stdout;
|
||||||
|
error_log /dev/stderr warn;
|
||||||
|
}
|
||||||
26
backend/docker/supervisord.conf
Normal file
26
backend/docker/supervisord.conf
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
logfile=/dev/null
|
||||||
|
logfile_maxbytes=0
|
||||||
|
pidfile=/run/supervisord.pid
|
||||||
|
|
||||||
|
[program:php-fpm]
|
||||||
|
command=php-fpm -F
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
priority=10
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=nginx -g "daemon off;"
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
priority=20
|
||||||
|
depends_on=php-fpm
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
27
backend/entrypoint.sh
Normal file
27
backend/entrypoint.sh
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Immagine php:8.4-fpm-alpine: niente bash, solo /bin/sh (busybox ash).
|
||||||
|
# set -eu basta (nessuna pipe nello script → pipefail non serve e non è POSIX).
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
echo "Waiting for database connection..."
|
||||||
|
|
||||||
|
# Riprova la connessione finché MySQL non risponde (max ~60s)
|
||||||
|
ATTEMPTS=0
|
||||||
|
until php artisan db:show >/dev/null 2>&1; do
|
||||||
|
ATTEMPTS=$((ATTEMPTS + 1))
|
||||||
|
if [ "$ATTEMPTS" -ge 30 ]; then
|
||||||
|
echo "MySQL not reachable after 60s, exiting." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "MySQL ready. Executing pending migrations (idempotent)..."
|
||||||
|
|
||||||
|
# --force: niente prompt interattivo
|
||||||
|
# migrate normale: applica SOLO le migration non ancora eseguite, non tocca i dati esistenti
|
||||||
|
php artisan migrate --force
|
||||||
|
|
||||||
|
# Avvia il processo principale passato come CMD (php-fpm, artisan serve, ecc.)
|
||||||
|
echo "Starting application..."
|
||||||
|
exec "$@"
|
||||||
16
backend/package.json
Normal file
16
backend/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://www.schemastore.org/package.json",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "vite build",
|
||||||
|
"dev": "vite"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tailwindcss/vite": "^4.0.0",
|
||||||
|
"concurrently": "^9.0.1",
|
||||||
|
"laravel-vite-plugin": "^3.1",
|
||||||
|
"tailwindcss": "^4.0.0",
|
||||||
|
"vite": "^8.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
36
backend/phpunit.xml
Normal file
36
backend/phpunit.xml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
colors="true"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Unit">
|
||||||
|
<directory>tests/Unit</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="Feature">
|
||||||
|
<directory>tests/Feature</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory>app</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
|
<php>
|
||||||
|
<env name="APP_ENV" value="testing"/>
|
||||||
|
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||||
|
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||||
|
<env name="BROADCAST_CONNECTION" value="null"/>
|
||||||
|
<env name="CACHE_STORE" value="array"/>
|
||||||
|
<env name="DB_CONNECTION" value="sqlite"/>
|
||||||
|
<env name="DB_DATABASE" value=":memory:"/>
|
||||||
|
<env name="DB_URL" value=""/>
|
||||||
|
<env name="MAIL_MAILER" value="array"/>
|
||||||
|
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||||
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
|
<env name="PULSE_ENABLED" value="false"/>
|
||||||
|
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||||
|
<env name="NIGHTWATCH_ENABLED" value="false"/>
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
||||||
25
backend/public/.htaccess
Normal file
25
backend/public/.htaccess
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
<IfModule mod_negotiation.c>
|
||||||
|
Options -MultiViews -Indexes
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Handle Authorization Header
|
||||||
|
RewriteCond %{HTTP:Authorization} .
|
||||||
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
|
||||||
|
# Handle X-XSRF-Token Header
|
||||||
|
RewriteCond %{HTTP:x-xsrf-token} .
|
||||||
|
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
|
||||||
|
|
||||||
|
# Redirect Trailing Slashes If Not A Folder...
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_URI} (.+)/$
|
||||||
|
RewriteRule ^ %1 [L,R=301]
|
||||||
|
|
||||||
|
# Send Requests To Front Controller...
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^ index.php [L]
|
||||||
|
</IfModule>
|
||||||
0
backend/public/favicon.ico
Normal file
0
backend/public/favicon.ico
Normal file
20
backend/public/index.php
Normal file
20
backend/public/index.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
// Determine if the application is in maintenance mode...
|
||||||
|
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||||
|
require $maintenance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register the Composer autoloader...
|
||||||
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
|
|
||||||
|
// Bootstrap Laravel and handle the request...
|
||||||
|
/** @var Application $app */
|
||||||
|
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
|
$app->handleRequest(Request::capture());
|
||||||
2
backend/public/robots.txt
Normal file
2
backend/public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
9
backend/resources/css/app.css
Normal file
9
backend/resources/css/app.css
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
@import 'tailwindcss';
|
||||||
|
|
||||||
|
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
||||||
|
@source '../../storage/framework/views/*.php';
|
||||||
|
|
||||||
|
@theme {
|
||||||
|
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||||
|
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||||
|
}
|
||||||
1
backend/resources/js/app.js
Normal file
1
backend/resources/js/app.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//
|
||||||
223
backend/resources/views/welcome.blade.php
Normal file
223
backend/resources/views/welcome.blade.php
Normal file
File diff suppressed because one or more lines are too long
8
backend/routes/console.php
Normal file
8
backend/routes/console.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Inspiring;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
Artisan::command('inspire', function () {
|
||||||
|
$this->comment(Inspiring::quote());
|
||||||
|
})->purpose('Display an inspiring quote');
|
||||||
7
backend/routes/web.php
Normal file
7
backend/routes/web.php
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
Route::get('/', function () {
|
||||||
|
return view('welcome');
|
||||||
|
});
|
||||||
4
backend/storage/app/.gitignore
vendored
Normal file
4
backend/storage/app/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
*
|
||||||
|
!private/
|
||||||
|
!public/
|
||||||
|
!.gitignore
|
||||||
2
backend/storage/app/private/.gitignore
vendored
Normal file
2
backend/storage/app/private/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
backend/storage/app/public/.gitignore
vendored
Normal file
2
backend/storage/app/public/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
9
backend/storage/framework/.gitignore
vendored
Normal file
9
backend/storage/framework/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
compiled.php
|
||||||
|
config.php
|
||||||
|
down
|
||||||
|
events.scanned.php
|
||||||
|
maintenance.php
|
||||||
|
routes.php
|
||||||
|
routes.scanned.php
|
||||||
|
schedule-*
|
||||||
|
services.json
|
||||||
3
backend/storage/framework/cache/.gitignore
vendored
Normal file
3
backend/storage/framework/cache/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!data/
|
||||||
|
!.gitignore
|
||||||
2
backend/storage/framework/cache/data/.gitignore
vendored
Normal file
2
backend/storage/framework/cache/data/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
backend/storage/framework/sessions/.gitignore
vendored
Normal file
2
backend/storage/framework/sessions/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
backend/storage/framework/testing/.gitignore
vendored
Normal file
2
backend/storage/framework/testing/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
backend/storage/framework/views/.gitignore
vendored
Normal file
2
backend/storage/framework/views/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
backend/storage/logs/.gitignore
vendored
Normal file
2
backend/storage/logs/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
19
backend/tests/Feature/ExampleTest.php
Normal file
19
backend/tests/Feature/ExampleTest.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
// use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ExampleTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic test example.
|
||||||
|
*/
|
||||||
|
public function test_the_application_returns_a_successful_response(): void
|
||||||
|
{
|
||||||
|
$response = $this->get('/');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
backend/tests/TestCase.php
Normal file
10
backend/tests/TestCase.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||||
|
|
||||||
|
abstract class TestCase extends BaseTestCase
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
16
backend/tests/Unit/ExampleTest.php
Normal file
16
backend/tests/Unit/ExampleTest.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Unit;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ExampleTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic test example.
|
||||||
|
*/
|
||||||
|
public function test_that_true_is_true(): void
|
||||||
|
{
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/vite.config.js
Normal file
24
backend/vite.config.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import laravel from 'laravel-vite-plugin';
|
||||||
|
import { bunny } from 'laravel-vite-plugin/fonts';
|
||||||
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
laravel({
|
||||||
|
input: ['resources/css/app.css', 'resources/js/app.js'],
|
||||||
|
refresh: true,
|
||||||
|
fonts: [
|
||||||
|
bunny('Instrument Sans', {
|
||||||
|
weights: [400, 500, 600],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
tailwindcss(),
|
||||||
|
],
|
||||||
|
server: {
|
||||||
|
watch: {
|
||||||
|
ignored: ['**/storage/framework/views/**'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
61
docker-compose.override.yml
Normal file
61
docker-compose.override.yml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# ==============================================================================
|
||||||
|
# docker-compose.override.yml — Sviluppo locale
|
||||||
|
# Attivo automaticamente con: docker compose up -d
|
||||||
|
# → avvia l'intero stack di sviluppo: Vite dev server (HMR) + backend
|
||||||
|
# (artisan serve) + db + redis + docs + mailpit, dietro Traefik.
|
||||||
|
#
|
||||||
|
# In produzione si usa SOLO il compose base (niente override, niente Traefik):
|
||||||
|
# docker compose -f docker-compose.yml up -d
|
||||||
|
#
|
||||||
|
# Prerequisiti dev:
|
||||||
|
# - rete traefik: docker network create traefik-network
|
||||||
|
# - dyncoll-dev.local in /etc/hosts
|
||||||
|
#
|
||||||
|
# NB router/service Traefik = `dyncoll-dev` per non collidere con la v1 (`dyncoll`).
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
# Frontend: in dev gira il dev server di Vite (HMR), non l'nginx statico.
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
target: development # stage Vite, non lo stage nginx di produzione
|
||||||
|
ports:
|
||||||
|
- "${APP_FRONTEND_DEVPORT}:5173"
|
||||||
|
volumes:
|
||||||
|
- ./frontend:/app # sorgente live → HMR su ogni modifica
|
||||||
|
- /app/node_modules # volume anonimo: i node_modules musl dell'immagine
|
||||||
|
# schermano quelli glibc dell'host (mai bind-montati)
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
- traefik-network
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.dyncoll-dev.rule=Host(`dyncoll-dev.local`)"
|
||||||
|
- "traefik.http.routers.dyncoll-dev.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.dyncoll-dev.tls=true"
|
||||||
|
- "traefik.http.services.dyncoll-dev.loadbalancer.server.port=5173"
|
||||||
|
- "traefik.docker.network=traefik-network"
|
||||||
|
|
||||||
|
# Backend: in dev usa `artisan serve` (errori leggibili, niente supervisord/nginx).
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
target: development
|
||||||
|
command: ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
||||||
|
|
||||||
|
# Mailpit: SMTP sink di sviluppo. Cattura tutte le mail (nessuna spedizione reale).
|
||||||
|
# SMTP su 1025 (raggiungibile dal backend come host `mailpit`), Web UI su 8025.
|
||||||
|
mailpit:
|
||||||
|
image: axllent/mailpit:latest
|
||||||
|
container_name: dyncoll_mailpit
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:8025:8025" # Web UI: http://localhost:8025
|
||||||
|
labels:
|
||||||
|
- "com.docker.compose.project=dyncoll-project"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik-network:
|
||||||
|
external: true
|
||||||
201
docker-compose.yml
Normal file
201
docker-compose.yml
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
services:
|
||||||
|
redis:
|
||||||
|
image: redis:8.8-alpine
|
||||||
|
container_name: dyncoll_redis
|
||||||
|
restart: always
|
||||||
|
# Forma lista (NON stringa): evita lo shell-split di compose, così la password
|
||||||
|
# può contenere caratteri speciali — es. '(' — senza rompere il parsing.
|
||||||
|
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}", "--maxmemory", "256mb", "--maxmemory-policy", "allkeys-lru"]
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
labels:
|
||||||
|
- "com.docker.compose.project=dyncoll-project"
|
||||||
|
|
||||||
|
queue-worker:
|
||||||
|
image: dyncoll:3.0
|
||||||
|
container_name: dyncoll_queue
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
APP_NAME: ${APP_NAME}
|
||||||
|
APP_KEY: ${APP_KEY}
|
||||||
|
APP_DEBUG: ${APP_DEBUG}
|
||||||
|
APP_ENV: ${APP_ENV}
|
||||||
|
DB_CONNECTION: mysql
|
||||||
|
DB_HOST: db
|
||||||
|
DB_PORT: ${DB_PORT}
|
||||||
|
DB_DATABASE: ${DB_DATABASE}
|
||||||
|
DB_USERNAME: ${DB_USERNAME}
|
||||||
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
REDIS_HOST: redis
|
||||||
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||||
|
REDIS_PORT: 6379
|
||||||
|
REDIS_CLUSTER: false
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
entrypoint: []
|
||||||
|
command: ["php", "artisan", "horizon"]
|
||||||
|
|
||||||
|
scheduler:
|
||||||
|
image: dyncoll:3.0
|
||||||
|
container_name: dyncoll_scheduler
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
APP_NAME: ${APP_NAME}
|
||||||
|
APP_KEY: ${APP_KEY}
|
||||||
|
APP_DEBUG: ${APP_DEBUG}
|
||||||
|
APP_ENV: ${APP_ENV}
|
||||||
|
DB_CONNECTION: mysql
|
||||||
|
DB_HOST: db
|
||||||
|
DB_PORT: ${DB_PORT}
|
||||||
|
DB_DATABASE: ${DB_DATABASE}
|
||||||
|
DB_USERNAME: ${DB_USERNAME}
|
||||||
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
REDIS_HOST: redis
|
||||||
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||||
|
REDIS_PORT: 6379
|
||||||
|
REDIS_CLUSTER: false
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
entrypoint: []
|
||||||
|
command: ["php", "artisan", "schedule:work"]
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mysql:8.4
|
||||||
|
container_name: dyncoll_db
|
||||||
|
restart: always
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||||
|
MYSQL_DATABASE: ${DB_DATABASE}
|
||||||
|
MYSQL_USER: ${DB_USERNAME}
|
||||||
|
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:${DB_PORT}:3306"
|
||||||
|
volumes:
|
||||||
|
- mysql_data:/var/lib/mysql
|
||||||
|
# Nessun import di dump qui: i dati v2 arrivano da migration Laravel + ETL
|
||||||
|
# (`php artisan v1:import`), non da un dump SQL del DB di v1.
|
||||||
|
# - ./db-init:/docker-entrypoint-initdb.d
|
||||||
|
healthcheck:
|
||||||
|
# Usa le env del container ($$ = $ letterale → espanso a runtime dalla shell, NON da compose)
|
||||||
|
# e QUOTA la password: caratteri speciali (qui '{' e '(') non rompono lo shell, e la password
|
||||||
|
# non finisce in chiaro nel `docker inspect`.
|
||||||
|
test: ["CMD-SHELL", "mysqladmin ping -h localhost -P 3306 -u \"$$MYSQL_USER\" -p\"$$MYSQL_PASSWORD\""]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
labels:
|
||||||
|
- "io.portainer.accesscontrol.public=true"
|
||||||
|
- "com.docker.compose.project=dyncoll-project"
|
||||||
|
- "com.docker.compose.stack=dyncoll-project"
|
||||||
|
|
||||||
|
backend:
|
||||||
|
image: dyncoll:3.0
|
||||||
|
container_name: dyncoll-backend
|
||||||
|
build:
|
||||||
|
context: ./backend
|
||||||
|
dockerfile: backend.Dockerfile
|
||||||
|
args:
|
||||||
|
APP_ENV: ${APP_ENV}
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
ports:
|
||||||
|
- ${APP_BACKEND_PORT}:8000
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
volumes:
|
||||||
|
- ./backend:/var/www/html
|
||||||
|
- ./backend/storage/app/public:/var/www/html/storage/app/public
|
||||||
|
- ./.env:/var/www/html/.env
|
||||||
|
environment:
|
||||||
|
APP_NAME: ${APP_NAME}
|
||||||
|
APP_KEY: ${APP_KEY}
|
||||||
|
APP_DEBUG: ${APP_DEBUG}
|
||||||
|
APP_ENV: ${APP_ENV}
|
||||||
|
DB_CONNECTION: mysql
|
||||||
|
DB_HOST: db
|
||||||
|
DB_PORT: ${DB_PORT}
|
||||||
|
DB_DATABASE: ${DB_DATABASE}
|
||||||
|
DB_USERNAME: ${DB_USERNAME}
|
||||||
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
MAIL_MAILER: ${MAIL_MAILER}
|
||||||
|
MAIL_FROM_NAME: ${MAIL_FROM_NAME}
|
||||||
|
MAIL_FROM_ADDRESS: "${MAIL_FROM_ADDRESS}"
|
||||||
|
REDIS_HOST: redis
|
||||||
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||||
|
REDIS_PORT: 6379
|
||||||
|
REDIS_CLUSTER: ${REDIS_CLUSTER}
|
||||||
|
CACHE_STORE: redis
|
||||||
|
SESSION_DRIVER: redis
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
labels:
|
||||||
|
- "io.portainer.accesscontrol.public=true"
|
||||||
|
- "com.docker.compose.project=dyncoll-project"
|
||||||
|
- "com.docker.compose.stack=dyncoll-project"
|
||||||
|
|
||||||
|
docs:
|
||||||
|
image: squidfunk/mkdocs-material
|
||||||
|
container_name: dyncoll_docs
|
||||||
|
restart: always
|
||||||
|
# L'immagine ha ENTRYPOINT ["mkdocs"]: serviamo il sito in ascolto su 8000.
|
||||||
|
command: ["serve", "--dev-addr=0.0.0.0:8000"]
|
||||||
|
volumes:
|
||||||
|
# mkdocs si aspetta mkdocs.yml in /docs e i contenuti in /docs/docs
|
||||||
|
- ./documentation:/docs:ro
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
labels:
|
||||||
|
- "com.docker.compose.project=dyncoll-project"
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: dyncoll-frontend:3.0
|
||||||
|
container_name: dyncoll-frontend
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: frontend.Dockerfile
|
||||||
|
target: production
|
||||||
|
ports:
|
||||||
|
- ${APP_FRONTEND_PORT}:80
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
volumes:
|
||||||
|
# Il frontend "vede" gli upload di Laravel nella sua cartella storage
|
||||||
|
- ./backend/storage/app/public:/usr/share/nginx/html/storage:ro
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
labels:
|
||||||
|
- "io.portainer.accesscontrol.public=true"
|
||||||
|
- "com.docker.compose.project=dyncoll-project"
|
||||||
|
- "com.docker.compose.stack=dyncoll-project"
|
||||||
|
networks:
|
||||||
|
internal:
|
||||||
|
driver: bridge
|
||||||
|
volumes:
|
||||||
|
mysql_data:
|
||||||
|
redis_data:
|
||||||
16
documentation/docs/index.md
Normal file
16
documentation/docs/index.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Dynamic Collection v2
|
||||||
|
|
||||||
|
Documentazione utente e tecnica della piattaforma **Dynamic Collection** (versione 2).
|
||||||
|
|
||||||
|
Piattaforma per la catalogazione e curatela di collezioni digitali di reperti
|
||||||
|
archeologici, con esposizione dei dati secondo lo standard di harvesting
|
||||||
|
**KSamsök 2 Linked Art** del Riksantikvarieämbetet (RAÄ).
|
||||||
|
|
||||||
|
!!! note "Lavori in corso"
|
||||||
|
Questa documentazione è in fase di stesura insieme alla riscrittura della piattaforma.
|
||||||
|
|
||||||
|
## Sezioni
|
||||||
|
|
||||||
|
- Guida utente — *in arrivo*
|
||||||
|
- Guida sviluppatore — *in arrivo*
|
||||||
|
- Endpoint LOD / Linked Art — *in arrivo*
|
||||||
22
documentation/mkdocs.yml
Normal file
22
documentation/mkdocs.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
site_name: Dynamic Collection v2
|
||||||
|
site_description: Documentazione della piattaforma Dynamic Collection (v2)
|
||||||
|
repo_url: https://github.com/LundDarkLab/adc
|
||||||
|
|
||||||
|
docs_dir: docs
|
||||||
|
|
||||||
|
theme:
|
||||||
|
name: material
|
||||||
|
palette:
|
||||||
|
primary: indigo
|
||||||
|
features:
|
||||||
|
- navigation.tabs
|
||||||
|
- navigation.sections
|
||||||
|
- content.code.copy
|
||||||
|
|
||||||
|
markdown_extensions:
|
||||||
|
- admonition
|
||||||
|
- pymdownx.highlight
|
||||||
|
- pymdownx.superfences
|
||||||
|
|
||||||
|
nav:
|
||||||
|
- Home: index.md
|
||||||
18
frontend/.dockerignore
Normal file
18
frontend/.dockerignore
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Build context = ./frontend (vedi docker-compose.yml). Il .dockerignore di root
|
||||||
|
# NON si applica qui: serve questo file dedicato.
|
||||||
|
# Evita di copiare nell'immagine artefatti pesanti, locali o incompatibili.
|
||||||
|
|
||||||
|
# node_modules host = glibc, immagine = Alpine/musl: MAI copiarli nel container.
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
coverage
|
||||||
|
stats.html
|
||||||
|
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
*.log
|
||||||
|
.DS_Store
|
||||||
45
frontend/frontend.Dockerfile
Normal file
45
frontend/frontend.Dockerfile
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# --- STAGE 1: Sviluppo (Node LTS) ---
|
||||||
|
FROM node:lts-alpine3.24 AS development
|
||||||
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# In sviluppo il sorgente arriva dal bind-mount (./frontend:/app) e i node_modules
|
||||||
|
# dall'immagine via volume anonimo (/app/node_modules): NON si copia il sorgente qui.
|
||||||
|
# Vantaggi: niente build fragile su index.html/src mancanti, nessun COPY ricorsivo
|
||||||
|
# (docker:S6470) e i node_modules musl dell'immagine schermano quelli glibc dell'host.
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
EXPOSE 5173
|
||||||
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
||||||
|
|
||||||
|
# --- STAGE 2: Build (Node LTS) ---
|
||||||
|
FROM node:lts-alpine3.24 AS build
|
||||||
|
|
||||||
|
LABEL maintainer="Giuseppe Naponiello"
|
||||||
|
LABEL version="3.0"
|
||||||
|
LABEL description="Dynamic Collections Plus, frontend container (build stage)."
|
||||||
|
|
||||||
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# npm ci richiede package-lock.json (deterministico). Fallback a install se assente.
|
||||||
|
# Servono le devDependencies (Vite, TypeScript) per compilare: NON usare --omit=dev.
|
||||||
|
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
||||||
|
|
||||||
|
# Copie esplicite (no `COPY . .` — docker:S6470): non sovrascrivere i node_modules
|
||||||
|
# musl appena installati con quelli glibc dell'host, né copiare segreti/file locali.
|
||||||
|
COPY vite.config.ts tsconfig.json index.html ./
|
||||||
|
COPY src/ ./src/
|
||||||
|
COPY public/ ./public/
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# --- STAGE 3: Produzione (Nginx stable, patchato) ---
|
||||||
|
FROM nginx:1.30-alpine AS production
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
11
frontend/index.html
Normal file
11
frontend/index.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0">
|
||||||
|
<title>Dynamic Collection - Index</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="module" src="./src/pages/index/index.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
70
frontend/nginx.conf
Normal file
70
frontend/nginx.conf
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# URL puliti — /mappa trova mappa.html
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri.html $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Pagine "scheda" con slug nel path: /<page>/<slug> -> <page>.html
|
||||||
|
# Lo slug resta leggibile lato client da location.pathname.
|
||||||
|
# Elencare qui le pagine path-style reali quando esistono (deve esistere il relativo .html).
|
||||||
|
# Esempio:
|
||||||
|
# location ~ ^/(?<page>artifact|institution)/[^/]+/?$ {
|
||||||
|
# try_files /$page.html =404;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Proxy per API: inoltra /api/* al backend
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend:8000/api/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Documentazione utente (MkDocs)
|
||||||
|
location /documentation/ {
|
||||||
|
proxy_pass http://docs:8000/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Documentazione OpenAPI (Scramble) — /api-docs/* → backend /docs/*
|
||||||
|
location /api-docs/ {
|
||||||
|
rewrite ^/api-docs/(.*)$ /docs/$1 break;
|
||||||
|
proxy_pass http://backend:8000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache aggressiva per asset con hash (Vite li genera con hash nel nome)
|
||||||
|
location ~* \.(js|css|woff2|png|jpg|ico|svg)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Blocca file sensibili
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Storage per file statici
|
||||||
|
location /storage/ {
|
||||||
|
alias /usr/share/nginx/html/storage/;
|
||||||
|
access_log off;
|
||||||
|
expires 30d;
|
||||||
|
}
|
||||||
|
|
||||||
|
access_log /dev/stdout;
|
||||||
|
error_log /dev/stderr warn;
|
||||||
|
}
|
||||||
2481
frontend/package-lock.json
generated
Normal file
2481
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
frontend/package.json
Normal file
30
frontend/package.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "dyncoll-frontend",
|
||||||
|
"private": true,
|
||||||
|
"version": "3.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"type-check": "tsc --noEmit",
|
||||||
|
"test": "vitest run --coverage",
|
||||||
|
"test:watch": "vitest"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tailwindcss/vite": "^4.3.1",
|
||||||
|
"@types/leaflet": "^1.9.21",
|
||||||
|
"@types/node": "^25.9.3",
|
||||||
|
"@vitest/coverage-v8": "^4.1.8",
|
||||||
|
"daisyui": "^5.5.23",
|
||||||
|
"rollup-plugin-visualizer": "^7.0.1",
|
||||||
|
"tailwindcss": "^4.3.1",
|
||||||
|
"typescript": "^6.0.3",
|
||||||
|
"vite": "^8.0.16",
|
||||||
|
"vitest": "^4.1.8"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.17.0",
|
||||||
|
"leaflet": "^1.9.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
216
frontend/public/vendor/3dhop/corto.em.js
vendored
Normal file
216
frontend/public/vendor/3dhop/corto.em.js
vendored
Normal file
File diff suppressed because one or more lines are too long
961
frontend/public/vendor/3dhop/meco.js
vendored
Normal file
961
frontend/public/vendor/3dhop/meco.js
vendored
Normal file
@@ -0,0 +1,961 @@
|
|||||||
|
/*
|
||||||
|
Nexus
|
||||||
|
Copyright (c) 2012-2020, Visual Computing Lab, ISTI - CNR
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
onmessage = function(job) {
|
||||||
|
if(typeof(job.data) == "string") return;
|
||||||
|
var node = job.data.node;
|
||||||
|
var signature = job.data.signature;
|
||||||
|
var patches = job.data.patches;
|
||||||
|
// var now =new Date().getTime();
|
||||||
|
|
||||||
|
var size;
|
||||||
|
if(!node.buffer) return;
|
||||||
|
else size = node.buffer.byteLength;
|
||||||
|
var buffer;
|
||||||
|
for(var i =0 ; i < 1; i++) {
|
||||||
|
var coder = new MeshCoder(signature, node, patches);
|
||||||
|
buffer = coder.decode(node.buffer);
|
||||||
|
}
|
||||||
|
node.buffer = buffer;
|
||||||
|
node.owner = job.owner;
|
||||||
|
// var elapsed = new Date().getTime() - now;
|
||||||
|
// var t = node.nface;
|
||||||
|
// console.log("Z Time: " + elapsed + " Size: " + size + " KT/s " + (t/(elapsed)) + " Mbps " + (8*1000*node.buffer.byteLength/elapsed)/(1<<20));
|
||||||
|
postMessage(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
// actually bitstreams expects a little endian uin64 type. convert it to 2 uint32
|
||||||
|
|
||||||
|
BitStream = function(array) {
|
||||||
|
this.a = array;
|
||||||
|
for(var i = 0; i < array.length; i += 2) {
|
||||||
|
var s = array[i];
|
||||||
|
array[i] = array[i+1];
|
||||||
|
array[i+1] = s;
|
||||||
|
}
|
||||||
|
this.position = 0;
|
||||||
|
this.bitsPending = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
BitStream.prototype = {
|
||||||
|
read: function(bits) {
|
||||||
|
var bitBuffer = 0;
|
||||||
|
while(bits > 0) {
|
||||||
|
var partial;
|
||||||
|
var bitsConsumed;
|
||||||
|
if (this.bitsPending > 0) {
|
||||||
|
var byte = (this.a[this.position - 1] & (0xffffffff >>> (32 - this.bitsPending)))>>>0;
|
||||||
|
bitsConsumed = Math.min(this.bitsPending, bits);
|
||||||
|
this.bitsPending -= bitsConsumed;
|
||||||
|
partial = byte >>> this.bitsPending;
|
||||||
|
} else {
|
||||||
|
bitsConsumed = Math.min(32, bits);
|
||||||
|
this.bitsPending = 32 - bitsConsumed;
|
||||||
|
partial = this.a[this.position++] >>> this.bitsPending;
|
||||||
|
}
|
||||||
|
bits -= bitsConsumed;
|
||||||
|
bitBuffer = ((bitBuffer << bitsConsumed) | partial)>>>0;
|
||||||
|
}
|
||||||
|
return bitBuffer;
|
||||||
|
},
|
||||||
|
replace: function(bits, value) {
|
||||||
|
//zero last part
|
||||||
|
value = (value & (0xffffffff >>> 32 - bits)) >>> 0;
|
||||||
|
value = (value | read(bits)) >>> 0;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Stream = function(buffer) {
|
||||||
|
this.data = buffer;
|
||||||
|
this.buffer = new Uint8Array(buffer);
|
||||||
|
this.pos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Stream.prototype = {
|
||||||
|
readChar: function() {
|
||||||
|
var c = this.buffer[this.pos++];
|
||||||
|
if(c > 127) c -= 256;
|
||||||
|
return c;
|
||||||
|
},
|
||||||
|
readUChar: function() {
|
||||||
|
return this.buffer[this.pos++];
|
||||||
|
},
|
||||||
|
readInt: function() {
|
||||||
|
var c = this.buffer[this.pos + 3]
|
||||||
|
c <<= 8;
|
||||||
|
c |= this.buffer[this.pos + 2];
|
||||||
|
c <<= 8;
|
||||||
|
c |= this.buffer[this.pos + 1];
|
||||||
|
c <<= 8;
|
||||||
|
c |= this.buffer[this.pos + 0];
|
||||||
|
this.pos += 4;
|
||||||
|
return c;
|
||||||
|
},
|
||||||
|
readArray: function(n) {
|
||||||
|
var a = this.buffer.subarray(this.pos, this.pos+n);
|
||||||
|
this.pos += n;
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
readBitStream:function() {
|
||||||
|
var n = this.readInt();
|
||||||
|
var pad = this.pos & 0x3;
|
||||||
|
if(pad != 0)
|
||||||
|
this.pos += 4 - pad;
|
||||||
|
var b = new BitStream(new Uint32Array(this.data, this.pos, n*2));
|
||||||
|
this.pos += n*8;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function Tunstall(wordsize, lookup_size) {
|
||||||
|
this.wordsize = wordsize? wordsize : 8;
|
||||||
|
this.lookup_size = lookup_size? lookup_size : 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tunstall.prototype = {
|
||||||
|
decompress: function(stream) {
|
||||||
|
var nsymbols = stream.readUChar();
|
||||||
|
this.probabilities = stream.readArray(nsymbols*2);
|
||||||
|
this.createDecodingTables();
|
||||||
|
var size = stream.readInt();
|
||||||
|
var data = new Uint8Array(size);
|
||||||
|
var compressed_size = stream.readInt();
|
||||||
|
var compressed_data = stream.readArray(compressed_size);
|
||||||
|
if(size)
|
||||||
|
this._decompress(compressed_data, compressed_size, data, size);
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
|
createDecodingTables: function() {
|
||||||
|
//read symbol,prob,symbol,prob as uchar.
|
||||||
|
//Here probabilities will range from 0 to 0xffff for better precision
|
||||||
|
|
||||||
|
var n_symbols = this.probabilities.length/2;
|
||||||
|
if(n_symbols <= 1) return;
|
||||||
|
|
||||||
|
var queues = []; //array of arrays
|
||||||
|
var buffer = [];
|
||||||
|
|
||||||
|
//initialize adding all symbols to queues
|
||||||
|
for(var i = 0; i < n_symbols; i++) {
|
||||||
|
var symbol = this.probabilities[i*2];
|
||||||
|
var s = [(this.probabilities[i*2+1])<<8, buffer.length, 1]; //probability, position in the buffer, length
|
||||||
|
queues[i] = [s];
|
||||||
|
buffer.push(this.probabilities[i*2]); //symbol
|
||||||
|
}
|
||||||
|
var dictionary_size = 1<<this.wordsize;
|
||||||
|
var n_words = n_symbols;
|
||||||
|
var table_length = n_symbols;
|
||||||
|
|
||||||
|
//at each step we grow all queues using the most probable sequence
|
||||||
|
while(n_words < dictionary_size - n_symbols +1) {
|
||||||
|
//Should use a stack or something to be faster, but we have few symbols
|
||||||
|
//find highest probability word
|
||||||
|
var best = 0;
|
||||||
|
var max_prob = 0;
|
||||||
|
for(var i = 0; i < n_symbols; i++) {
|
||||||
|
var p = queues[i][0][0]; //front of queue probability.
|
||||||
|
if(p > max_prob) {
|
||||||
|
best = i;
|
||||||
|
max_prob = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var symbol = queues[best][0];
|
||||||
|
var pos = buffer.length;
|
||||||
|
|
||||||
|
for(var i = 0; i < n_symbols; i++) {
|
||||||
|
var sym = this.probabilities[i*2];
|
||||||
|
var prob = this.probabilities[i*2+1]<<8;
|
||||||
|
var s = [((prob*symbol[0])>>>16), pos, symbol[2]+1]; //combine probabilities, keep track of buffer, keep length of queue
|
||||||
|
|
||||||
|
for(var k = 0; k < symbol[2]; k++)
|
||||||
|
buffer[pos+k] = buffer[symbol[1] + k]; //copy sequence of symbols
|
||||||
|
|
||||||
|
pos += symbol[2];
|
||||||
|
buffer[pos++] = sym; //append symbol
|
||||||
|
queues[i].push(s);
|
||||||
|
}
|
||||||
|
table_length += (n_symbols-1)*(symbol[2] + 1) +1;
|
||||||
|
n_words += n_symbols -1;
|
||||||
|
queues[best].shift(); //remove first thing
|
||||||
|
}
|
||||||
|
|
||||||
|
this.index = new Uint32Array(n_words);
|
||||||
|
this.lengths = new Uint32Array(n_words);
|
||||||
|
this.table = new Uint8Array(table_length);
|
||||||
|
var word = 0;
|
||||||
|
var pos = 0;
|
||||||
|
for(i = 0; i < queues.length; i++) {
|
||||||
|
var queue = queues[i];
|
||||||
|
for(var k = 0; k < queue.length; k++) {
|
||||||
|
var s = queue[k];
|
||||||
|
this.index[word] = pos;
|
||||||
|
this.lengths[word] = s[2]; //length
|
||||||
|
word++;
|
||||||
|
|
||||||
|
for(var j = 0; j < s[2]; j++)
|
||||||
|
this.table[pos + j] = buffer[s[1] + j]; //buffer of offset
|
||||||
|
pos += s[2]; //length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_decompress: function(input, input_size, output, output_size) {
|
||||||
|
var input_pos = 0;
|
||||||
|
var output_pos = 0;
|
||||||
|
if(this.probabilities.length == 2) {
|
||||||
|
var symbol = this.probabilities[0];
|
||||||
|
for(var i = 0; i < output_size; i++)
|
||||||
|
output[i] = symbol;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(input_pos < input_size-1) {
|
||||||
|
var symbol = input[input_pos++];
|
||||||
|
var start = this.index[symbol];
|
||||||
|
var end = start + this.lengths[symbol];
|
||||||
|
for(var i = start; i < end; i++)
|
||||||
|
output[output_pos++] = this.table[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//last symbol might override so we check.
|
||||||
|
var symbol = input[input_pos];
|
||||||
|
var start = this.index[symbol];
|
||||||
|
var end = start + output_size - output_pos;
|
||||||
|
var length = output_size - output_pos;
|
||||||
|
for(var i = start; i < end; i++)
|
||||||
|
output[output_pos++] = this.table[i];
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ZPoint = function(h, l) {
|
||||||
|
this.lo = l;
|
||||||
|
this.hi = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZPoint.prototype = {
|
||||||
|
copy: function(z) {
|
||||||
|
this.lo = z.lo;
|
||||||
|
this.hi = z.hi;
|
||||||
|
},
|
||||||
|
setBit: function(d) {
|
||||||
|
if(d < 32)
|
||||||
|
this.lo = (this.lo | (1<<d))>>>0;
|
||||||
|
else
|
||||||
|
this.hi = (this.hi | (1<<(d-32)))>>>0;
|
||||||
|
},
|
||||||
|
toPoint: function(min, step, buffer, pos) {
|
||||||
|
var x = this.morton3(this.lo, this.hi>>>1);
|
||||||
|
var y = this.morton3(this.lo>>>1, this.hi>>>2);
|
||||||
|
var z = this.morton3((this.lo>>>2 | (this.hi & 0x1)<<30 )>>>0, this.hi>>>3); //first hi bit needs to go into low.
|
||||||
|
|
||||||
|
buffer[pos+0] = (x + min[0])*step;
|
||||||
|
buffer[pos+1] = (y + min[1])*step;
|
||||||
|
buffer[pos+2] = (z + min[2])*step;
|
||||||
|
},
|
||||||
|
morton3: function(lo, hi) {
|
||||||
|
lo = ( lo & 0x49249249)>>>0;
|
||||||
|
lo = ((lo | (lo >>> 2 )) & 0xc30c30c3)>>>0;
|
||||||
|
lo = ((lo | (lo >>> 4 )) & 0x0f00f00f)>>>0;
|
||||||
|
lo = ((lo | (lo >>> 8 )) & 0xff0000ff)>>>0;
|
||||||
|
lo = ((lo | (lo >>> 16)) & 0x0000ffff)>>>0;
|
||||||
|
|
||||||
|
hi = ( hi & 0x49249249)>>>0;
|
||||||
|
hi = ((hi | (hi >> 2 )) & 0xc30c30c3)>>>0;
|
||||||
|
hi = ((hi | (hi >> 4 )) & 0x0f00f00f)>>>0;
|
||||||
|
hi = ((hi | (hi >> 8 )) & 0xff0000ff)>>>0;
|
||||||
|
hi = ((hi | (hi >> 16)) & 0x0000ffff)>>>0;
|
||||||
|
|
||||||
|
return ((hi<<11) | lo)>>>0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//node is an object with nvert, nface
|
||||||
|
//patches is an array of offsets in the index, triangle are grouped by those offsets
|
||||||
|
//signature tells wether mesh has indices, normals, colors, etc. {'colors': true, 'normals':true, 'indices': true }
|
||||||
|
|
||||||
|
function MeshCoder(signature, node, patches) {
|
||||||
|
this.sig = signature;
|
||||||
|
this.node = node;
|
||||||
|
this.patches = patches;
|
||||||
|
|
||||||
|
this.last = new Int32Array(this.node.nvert);
|
||||||
|
this.last_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
MeshCoder.prototype = {
|
||||||
|
//assumes input is an ArrayBuffer
|
||||||
|
decode: function(input) {
|
||||||
|
var t = this;
|
||||||
|
|
||||||
|
t.buffer = new ArrayBuffer(t.node.nvert*(12 + t.sig.texcoords*8 + t.sig.normals*6 + t.sig.colors*4) + t.node.nface*t.sig.indices*6);
|
||||||
|
|
||||||
|
var size = t.node.nvert*12; //float
|
||||||
|
t.coords = new Float32Array(t.buffer, 0, t.node.nvert*3);
|
||||||
|
|
||||||
|
if(t.sig.texcoords) {
|
||||||
|
t.texcoords = new Float32Array(t.buffer, size, t.node.nvert*2);
|
||||||
|
size += t.node.nvert*8; //float
|
||||||
|
}
|
||||||
|
if(t.sig.normals) {
|
||||||
|
t.normals = new Int16Array(t.buffer, size, t.node.nvert*3);
|
||||||
|
size += t.node.nvert*6; //short
|
||||||
|
}
|
||||||
|
if(t.sig.colors) {
|
||||||
|
t.colors = new Uint8ClampedArray(t.buffer, size, t.node.nvert*4);
|
||||||
|
size += t.node.nvert*4; //chars
|
||||||
|
}
|
||||||
|
if(t.sig.indices) {
|
||||||
|
t.faces = new Uint16Array(t.buffer, size, t.node.nface*3);
|
||||||
|
size += t.node.nface*6; //short
|
||||||
|
}
|
||||||
|
|
||||||
|
t.stream = new Stream(input);
|
||||||
|
|
||||||
|
t.stack = new Float32Array(12); //min0, min1, min2, step, tmin0, tmin1, tstep
|
||||||
|
|
||||||
|
t.stack[3] = t.stream.readInt();
|
||||||
|
t.stack[4] = t.stream.readInt();
|
||||||
|
t.stack[5] = t.stream.readInt();
|
||||||
|
|
||||||
|
t.coord_q = t.stream.readChar();
|
||||||
|
t.coord_bits = t.stream.readChar()*3;
|
||||||
|
|
||||||
|
t.stack[6] = Math.pow(2.0, t.coord_q);
|
||||||
|
|
||||||
|
if(t.sig.texcoords) {
|
||||||
|
t.stack[9] = t.stream.readInt();
|
||||||
|
t.stack[10] = t.stream.readInt();
|
||||||
|
|
||||||
|
t.texcoord_q = t.stream.readChar();
|
||||||
|
t.texcoord_bits = t.stream.readChar()*2;
|
||||||
|
t.stack[11] = Math.pow(2.0, t.texcoord_q);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(t.sig.indices) {
|
||||||
|
t.decodeFaces();
|
||||||
|
|
||||||
|
// var faces = window.performance.now() - start;
|
||||||
|
// start += faces;
|
||||||
|
} else {
|
||||||
|
t.decodeCoordinates();
|
||||||
|
|
||||||
|
// var coords = window.performance.now() - start;
|
||||||
|
// start += coords;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(t.sig.normals)
|
||||||
|
t.decodeNormals();
|
||||||
|
// var normals = window.performance.now() - start;
|
||||||
|
// start += normals;
|
||||||
|
if(t.sig.colors)
|
||||||
|
t.decodeColors();
|
||||||
|
// var colors = window.performance.now() - start;
|
||||||
|
// start += colors;
|
||||||
|
// console.log("Decode " + (faces + coords + normals + colors) + "ms. C: " + coords + " F: " + faces + " N: " + normals + " C: " + colors);
|
||||||
|
|
||||||
|
return t.buffer;
|
||||||
|
},
|
||||||
|
|
||||||
|
decodeCoordinates: function() {
|
||||||
|
var t = this;
|
||||||
|
t.min = [t.stack[3], t.stack[4], t.stack[5]];
|
||||||
|
|
||||||
|
var step = Math.pow(2.0, t.coord_q);
|
||||||
|
|
||||||
|
var hi_bits = Math.max(t.coord_bits - 32, 0);
|
||||||
|
var lo_bits = Math.min(t.coord_bits, 32);
|
||||||
|
|
||||||
|
var bitstream = t.stream.readBitStream();
|
||||||
|
|
||||||
|
var tunstall = new Tunstall;
|
||||||
|
var diffs = tunstall.decompress(t.stream);
|
||||||
|
|
||||||
|
var hi = bitstream.read(hi_bits);
|
||||||
|
var lo = bitstream.read(lo_bits);
|
||||||
|
var p = new ZPoint(hi, lo);
|
||||||
|
var count = 0;
|
||||||
|
p.toPoint(t.min, step, t.coords, count);
|
||||||
|
count += 3;
|
||||||
|
for(var i = 1; i < t.node.nvert; i++) {
|
||||||
|
var d = diffs[i-1];
|
||||||
|
p.setBit(d, 1);
|
||||||
|
if(d > 32) {
|
||||||
|
p.hi = (p.hi & ~((1<<(d-32))-1))>>>0;
|
||||||
|
var e = bitstream.read(d - 32);
|
||||||
|
p.hi = (p.hi | e)>>>0;
|
||||||
|
p.lo = bitstream.read(32);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(d == 32) {
|
||||||
|
p.lo = bitstream.read(d);
|
||||||
|
} else {
|
||||||
|
var e = bitstream.read(d);
|
||||||
|
p.lo = (p.lo & ~((1<<d) -1))>>>0;
|
||||||
|
p.lo = (p.lo | e)>>>0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.toPoint(t.min, step, t.coords, count);
|
||||||
|
count += 3;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
decodeFaces: function() {
|
||||||
|
if(!this.node.nface) return;
|
||||||
|
|
||||||
|
this.vertex_count = 0;
|
||||||
|
var start = 0;
|
||||||
|
for(var p = 0; p < this.patches.length; p++) {
|
||||||
|
var end = this.patches[p];
|
||||||
|
this.decodeConnectivity(end - start, start*3);
|
||||||
|
start = end;
|
||||||
|
}
|
||||||
|
//dequantize positions
|
||||||
|
var tot = this.node.nvert*3;
|
||||||
|
var coords = this.coords;
|
||||||
|
var stack = this.stack;
|
||||||
|
for(var i = 0; i < tot; ) {
|
||||||
|
coords[i] = (coords[i] + stack[3])*stack[6]; i++;
|
||||||
|
coords[i] = (coords[i] + stack[4])*stack[6]; i++;
|
||||||
|
coords[i] = (coords[i] + stack[5])*stack[6]; i++;
|
||||||
|
}
|
||||||
|
if(this.sig.texcoords) {
|
||||||
|
var t_tot = this.node.nvert*2;
|
||||||
|
var t_coords = this.texcoords;
|
||||||
|
for(var i = 0; i < tot; ) {
|
||||||
|
t_coords[i] = (t_coords[i] + stack[9])*stack[11]; i++;
|
||||||
|
t_coords[i] = (t_coords[i] + stack[10])*stack[11]; i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
decodeNormals: function() {
|
||||||
|
var norm_q = this.stream.readChar();
|
||||||
|
|
||||||
|
var dtunstall = new Tunstall;
|
||||||
|
var diffs = dtunstall.decompress(this.stream);
|
||||||
|
|
||||||
|
var stunstall = new Tunstall;
|
||||||
|
var signs = stunstall.decompress(this.stream);
|
||||||
|
var bitstream = this.stream.readBitStream();
|
||||||
|
|
||||||
|
var side = (1<<(16 - norm_q))>>>0;
|
||||||
|
var diffcount = 0;
|
||||||
|
var signcount = 0;
|
||||||
|
|
||||||
|
if(!this.sig.indices) {
|
||||||
|
for(var k = 0; k < 2; k++) {
|
||||||
|
var on = 0;
|
||||||
|
for(var i = 0; i < this.node.nvert; i++) {
|
||||||
|
var d = this.decodeDiff(diffs[diffcount++], bitstream);
|
||||||
|
on = on + d;
|
||||||
|
this.normals[3*i + k] = on*side;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(var i = 0; i < this.node.nvert; i++) {
|
||||||
|
var offset = i*3;
|
||||||
|
var x = this.normals[offset + 0];
|
||||||
|
var y = this.normals[offset + 1];
|
||||||
|
var z = 32767.0*32767.0 - x*x - y*y;
|
||||||
|
|
||||||
|
if(z < 0) z = 0;
|
||||||
|
z = Math.sqrt(z);
|
||||||
|
if(z > 32767) z = 32767;
|
||||||
|
if(signs[i] == 0)
|
||||||
|
z = -z;
|
||||||
|
this.normals[offset + 2] = z;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var boundary = this.markBoundary();
|
||||||
|
this.computeNormals();
|
||||||
|
|
||||||
|
if(this.sig.texcoords) //hack, fixing normals makes it worse actually
|
||||||
|
return;
|
||||||
|
|
||||||
|
var stat = 0;
|
||||||
|
//get difference between original and predicted
|
||||||
|
for(var i = 0; i < this.node.nvert; i++) {
|
||||||
|
if(!boundary[i]) continue;
|
||||||
|
var offset = i*3;
|
||||||
|
var x = (this.normals[offset + 0]/side);
|
||||||
|
var y = (this.normals[offset + 1]/side);
|
||||||
|
var dx = this.decodeDiff(diffs[diffcount++], bitstream);
|
||||||
|
var dy = this.decodeDiff(diffs[diffcount++], bitstream);
|
||||||
|
x = (x + dx)*side;
|
||||||
|
y = (y + dy)*side;
|
||||||
|
|
||||||
|
var z = 32767.0*32767.0 - x*x - y*y;
|
||||||
|
|
||||||
|
if(z < 0) z = 0;
|
||||||
|
z = Math.sqrt(z);
|
||||||
|
//sign
|
||||||
|
if(z > 32767.0) z = 32767.0;
|
||||||
|
var signbit = signs[signcount++];
|
||||||
|
// if(this.normals[offset+2] < 0 != signbit)
|
||||||
|
if((this.normals[offset+2] < 0 && signbit == 0) || (this.normals[offset+2] > 0 && signbit == 1))
|
||||||
|
z = -z;
|
||||||
|
this.normals[offset + 0] = x;
|
||||||
|
this.normals[offset + 1] = y;
|
||||||
|
this.normals[offset + 2] = z;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
decodeColors: function() {
|
||||||
|
var color_q = [];
|
||||||
|
for(var k = 0; k < 4; k++)
|
||||||
|
color_q[k] = this.stream.readChar();
|
||||||
|
|
||||||
|
var diffs = [];
|
||||||
|
for(var k = 0; k < 4; k++) {
|
||||||
|
var tunstall = new Tunstall;;
|
||||||
|
diffs[k] = tunstall.decompress(this.stream);
|
||||||
|
}
|
||||||
|
var bitstream = this.stream.readBitStream();
|
||||||
|
|
||||||
|
var count = 0;
|
||||||
|
if(this.sig.indices) {
|
||||||
|
for(var i = 0; i < this.node.nvert; i++) {
|
||||||
|
var last = this.last[i]*4;
|
||||||
|
var offset = i*4;
|
||||||
|
|
||||||
|
for(var k = 0; k < 4; k++) {
|
||||||
|
var c = this.decodeDiff(diffs[k][count], bitstream);
|
||||||
|
|
||||||
|
if(last >= 0)
|
||||||
|
c += this.colors[last + k];
|
||||||
|
this.colors[offset] = c;
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(var k = 0; k < 4; k++)
|
||||||
|
this.colors[k] = this.decodeDiff(diffs[k][count], bitstream);
|
||||||
|
count++;
|
||||||
|
|
||||||
|
var offset = 4;
|
||||||
|
for(var i = 1; i < this.node.nvert; i++) {
|
||||||
|
for(var k = 0; k < 4; k++) {
|
||||||
|
var d = this.decodeDiff(diffs[k][count], bitstream);
|
||||||
|
this.colors[offset] = this.colors[offset-4] + d;
|
||||||
|
offset ++;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var steps = [];
|
||||||
|
for(var k = 0; k < 4; k++)
|
||||||
|
steps[k] = (1<<(8 - color_q[k]));
|
||||||
|
|
||||||
|
//convert to rgb
|
||||||
|
for(var i = 0; i < this.node.nvert; i++) {
|
||||||
|
var offset = i*4;
|
||||||
|
|
||||||
|
var e0 = this.colors[offset + 0] * steps[0];
|
||||||
|
var e1 = this.colors[offset + 1] * steps[1];
|
||||||
|
var e2 = this.colors[offset + 2] * steps[2];
|
||||||
|
var e3 = this.colors[offset + 3] * steps[3];
|
||||||
|
|
||||||
|
this.colors[offset + 0] = (e2 + e0)&0xff;
|
||||||
|
this.colors[offset + 1] = e0;
|
||||||
|
this.colors[offset + 2] = (e1 + e0)&0xff;
|
||||||
|
this.colors[offset + 3] = e3;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//how to determine if a vertex is a boundary without topology:
|
||||||
|
//for each edge a vertex is in, add or subtract the id of the other vertex depending on order
|
||||||
|
//for internal vertices sum is zero.
|
||||||
|
//unless we have strange configurations and a lot of sfiga, zero wont happen. //TODO think about this
|
||||||
|
markBoundary: function() {
|
||||||
|
// var boundary = new Uint8Array(this.node.nvert);
|
||||||
|
var count = new Uint32Array(this.node.nvert);
|
||||||
|
|
||||||
|
var offset = 0;
|
||||||
|
for(var i = 0; i < this.node.nface; i++) {
|
||||||
|
count[this.faces[offset + 0]] += this.faces[offset + 1] - this.faces[offset + 2];
|
||||||
|
count[this.faces[offset + 1]] += this.faces[offset + 2] - this.faces[offset + 0];
|
||||||
|
count[this.faces[offset + 2]] += this.faces[offset + 0] - this.faces[offset + 1];
|
||||||
|
offset += 3;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
// for(var i = 0; i < this.node.nvert; i++)
|
||||||
|
// if(count[i] != 0)
|
||||||
|
// boundary[i] = true;
|
||||||
|
// return boundary;
|
||||||
|
},
|
||||||
|
|
||||||
|
norm: function(buffer, a, b, c) { //a b c offsets in the buffer
|
||||||
|
var ba0 = buffer[b+0] - buffer[a+0];
|
||||||
|
var ba1 = buffer[b+1] - buffer[a+1];
|
||||||
|
var ba2 = buffer[b+2] - buffer[a+2];
|
||||||
|
|
||||||
|
var ca0 = buffer[c+0] - buffer[a+0];
|
||||||
|
var ca1 = buffer[c+1] - buffer[a+1];
|
||||||
|
var ca2 = buffer[c+2] - buffer[a+2];
|
||||||
|
|
||||||
|
var p = [];
|
||||||
|
p[0] = ba1*ca2 - ba2*ca1;
|
||||||
|
p[1] = ba2*ca0 - ba0*ca2;
|
||||||
|
p[2] = ba0*ca1 - ba1*ca0;
|
||||||
|
return p;
|
||||||
|
},
|
||||||
|
|
||||||
|
normalize: function(buffer, offset) {
|
||||||
|
var x = buffer[offset + 0];
|
||||||
|
var y = buffer[offset + 1];
|
||||||
|
var z = buffer[offset + 2];
|
||||||
|
var n = Math.sqrt(x*x + y*y + z*z);
|
||||||
|
if(n > 0) {
|
||||||
|
buffer[offset + 0] = x/n;
|
||||||
|
buffer[offset + 1] = y/n;
|
||||||
|
buffer[offset + 2] = z/n;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computeNormals:function() {
|
||||||
|
var tmp_normals = new Float32Array(this.node.nvert*3);
|
||||||
|
|
||||||
|
var offset = 0;
|
||||||
|
for(var i = 0; i < this.node.nface; i++) {
|
||||||
|
var a = 3*this.faces[offset + 0];
|
||||||
|
var b = 3*this.faces[offset + 1];
|
||||||
|
var c = 3*this.faces[offset + 2];
|
||||||
|
|
||||||
|
var buffer = this.coords;
|
||||||
|
var ba0 = buffer[b+0] - buffer[a+0];
|
||||||
|
var ba1 = buffer[b+1] - buffer[a+1];
|
||||||
|
var ba2 = buffer[b+2] - buffer[a+2];
|
||||||
|
|
||||||
|
var ca0 = buffer[c+0] - buffer[a+0];
|
||||||
|
var ca1 = buffer[c+1] - buffer[a+1];
|
||||||
|
var ca2 = buffer[c+2] - buffer[a+2];
|
||||||
|
|
||||||
|
var n0 = ba1*ca2 - ba2*ca1;
|
||||||
|
var n1 = ba2*ca0 - ba0*ca2;
|
||||||
|
var n2 = ba0*ca1 - ba1*ca0;
|
||||||
|
|
||||||
|
tmp_normals[a + 0] += n0;
|
||||||
|
tmp_normals[a + 1] += n1;
|
||||||
|
tmp_normals[a + 2] += n2;
|
||||||
|
tmp_normals[b + 0] += n0;
|
||||||
|
tmp_normals[b + 1] += n1;
|
||||||
|
tmp_normals[b + 2] += n2;
|
||||||
|
tmp_normals[c + 0] += n0;
|
||||||
|
tmp_normals[c + 1] += n1;
|
||||||
|
tmp_normals[c + 2] += n2;
|
||||||
|
offset += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
//normalize
|
||||||
|
var offset = 0;
|
||||||
|
for(var i = 0; i < this.node.nvert; i++) {
|
||||||
|
var x = tmp_normals[offset + 0];
|
||||||
|
var y = tmp_normals[offset + 1];
|
||||||
|
var z = tmp_normals[offset + 2];
|
||||||
|
var n = Math.sqrt(x*x + y*y + z*z);
|
||||||
|
if(n > 0) {
|
||||||
|
tmp_normals[offset + 0] = x/n;
|
||||||
|
tmp_normals[offset + 1] = y/n;
|
||||||
|
tmp_normals[offset + 2] = z/n;
|
||||||
|
}
|
||||||
|
this.normals[offset + 0] = tmp_normals[offset + 0]*32767;
|
||||||
|
this.normals[offset + 1] = tmp_normals[offset + 1]*32767;
|
||||||
|
this.normals[offset + 2] = tmp_normals[offset + 2]*32767;
|
||||||
|
offset += 3;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
decodeDiff: function(diff, bitstream) {
|
||||||
|
var val;
|
||||||
|
if(diff == 0) {
|
||||||
|
val = 1;
|
||||||
|
} else {
|
||||||
|
val = 1<<(diff);
|
||||||
|
val |= bitstream.read(diff);
|
||||||
|
};
|
||||||
|
val--; //vall is always >= 1
|
||||||
|
if(val & 0x1)
|
||||||
|
val = -((val+1)>>1);
|
||||||
|
else
|
||||||
|
val = val>>1;
|
||||||
|
return val;
|
||||||
|
},
|
||||||
|
|
||||||
|
/* an edge is: uint16_t face, uint16_t side, uint32_t prev, next, bool deleted
|
||||||
|
I do not want to create millions of small objects, I will use aUint32Array.
|
||||||
|
Problem is how long, sqrt(nface) we will over blow using nface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
decodeConnectivity: function(length, start) {
|
||||||
|
|
||||||
|
var t = this;
|
||||||
|
var ctunstall = new Tunstall;
|
||||||
|
var clers = ctunstall.decompress(this.stream);
|
||||||
|
var cler_count = 0;
|
||||||
|
|
||||||
|
var dtunstall = new Tunstall;
|
||||||
|
var diffs = dtunstall.decompress(this.stream);
|
||||||
|
var diff_count = 0;
|
||||||
|
|
||||||
|
var tdiffs;
|
||||||
|
var tdiff_count = 0;
|
||||||
|
if(t.sig.texcoords) {
|
||||||
|
var ttunstall = new Tunstall;
|
||||||
|
tdiffs = ttunstall.decompress(this.stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bitstream = this.stream.readBitStream(bitstream);
|
||||||
|
|
||||||
|
var current_face = 0; //keep track of connected component start
|
||||||
|
//t.vertex_count = 0;
|
||||||
|
var front = new Uint32Array(this.node.nface*18);
|
||||||
|
var front_count = 0; //count each integer so it's front_back*5
|
||||||
|
function addFront(_v0, _v1, _v2, _prev, _next) {
|
||||||
|
front[front_count++] = _v0;
|
||||||
|
front[front_count++] = _v1;
|
||||||
|
front[front_count++] = _v2;
|
||||||
|
front[front_count++] = _prev;
|
||||||
|
front[front_count++] = _next;
|
||||||
|
front[front_count++] = 0; //deleted
|
||||||
|
}
|
||||||
|
function _next(t) {
|
||||||
|
t++;
|
||||||
|
if(t == 3) t = 0;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
function _prev(t) {
|
||||||
|
t--;
|
||||||
|
if(t == -1) t = 2;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
var delayed = [];
|
||||||
|
var faceorder = [];
|
||||||
|
|
||||||
|
var faces_count = start; //count indices in this.faces array
|
||||||
|
var totfaces = length;
|
||||||
|
// var estimated = [0, 0, 0]; //no! use stack.
|
||||||
|
var stack = this.stack;
|
||||||
|
var coords = this.coords;
|
||||||
|
var texcoords = this.texcoords;
|
||||||
|
var hasTexCoords = t.sig.texcoords;
|
||||||
|
|
||||||
|
while(totfaces > 0) {
|
||||||
|
if(!faceorder.length && !delayed.length) {
|
||||||
|
if(current_face == this.node.nface) break; //no more faces to encode exiting
|
||||||
|
|
||||||
|
stack[0] = stack[1] = stack[2] = 0;
|
||||||
|
stack[7] = stack[8] = 0; //texcoords
|
||||||
|
var last_index = -1;
|
||||||
|
var index = [];
|
||||||
|
for(var k = 0; k < 3; k++) {
|
||||||
|
this.last[this.last_count++] = last_index;
|
||||||
|
var diff = diffs[diff_count++];
|
||||||
|
var tdiff = diff && hasTexCoords? tdiffs[tdiff_count++] : 0;
|
||||||
|
var v = this.decodeVertex(bitstream, diff, tdiff);
|
||||||
|
index[k] = v;
|
||||||
|
this.faces[faces_count++] = v;
|
||||||
|
stack[0] = coords[v*3];
|
||||||
|
stack[1] = coords[v*3+1];
|
||||||
|
stack[2] = coords[v*3+2];
|
||||||
|
if(t.sig.texcoords) {
|
||||||
|
stack[7] = texcoords[v*2];
|
||||||
|
stack[8] = texcoords[v*2+1];
|
||||||
|
}
|
||||||
|
last_index = v;
|
||||||
|
}
|
||||||
|
var current_edge = front_count;
|
||||||
|
for(var k = 0; k < 3; k++) {
|
||||||
|
faceorder.push(front_count);
|
||||||
|
front[front_count++] = index[_next(k)];
|
||||||
|
front[front_count++] = index[_prev(k)];
|
||||||
|
front[front_count++] = index[k];
|
||||||
|
front[front_count++] = current_edge + _prev(k)*6;
|
||||||
|
front[front_count++] = current_edge + _next(k)*6;
|
||||||
|
front_count++;
|
||||||
|
// addFront(index[_next(k)], index[_prev(k)], index[k], current_edge + _prev(k)*6, current_edge + _next(k)*6);
|
||||||
|
}
|
||||||
|
current_face++;
|
||||||
|
totfaces--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var f;
|
||||||
|
if(faceorder.length)
|
||||||
|
f = faceorder.shift();
|
||||||
|
else
|
||||||
|
f = delayed.pop();
|
||||||
|
|
||||||
|
var edge_start = f;
|
||||||
|
|
||||||
|
if(front[edge_start + 5]) continue; //deleted
|
||||||
|
front[edge_start + 5] = 1; //set edge as deleted anyway
|
||||||
|
|
||||||
|
var c = clers[cler_count++];
|
||||||
|
if(c == 4) continue; //BOUNDARY
|
||||||
|
|
||||||
|
var v0 = front[edge_start + 0];
|
||||||
|
var v1 = front[edge_start + 1];
|
||||||
|
var v2 = front[edge_start + 2];
|
||||||
|
var prev = front[edge_start + 3];
|
||||||
|
var next = front[edge_start + 4];
|
||||||
|
|
||||||
|
var first_edge = front_count; //points to new edge to be inserted
|
||||||
|
var opposite = -1;
|
||||||
|
if(c == 0) { //VERTEX
|
||||||
|
//predict position based on v0, v1 and v2
|
||||||
|
for(var k = 0; k < 3; k++)
|
||||||
|
stack[k] = coords[v0*3 + k] + coords[v1*3 + k] - coords[v2*3 + k];
|
||||||
|
|
||||||
|
if(hasTexCoords)
|
||||||
|
for(var k = 0; k < 2; k++)
|
||||||
|
stack[7+k] = texcoords[v0*2 + k] + texcoords[v1*2 + k] - texcoords[v2*2 + k];
|
||||||
|
|
||||||
|
var diff = diffs[diff_count++];
|
||||||
|
var tdiff = diff && hasTexCoords? tdiffs[tdiff_count++] : 0;
|
||||||
|
opposite = this.decodeVertex(bitstream, diff, tdiff);
|
||||||
|
if(diff != 0)
|
||||||
|
this.last[this.last_count++] = v1;
|
||||||
|
|
||||||
|
front[prev + 4] = first_edge;
|
||||||
|
front[next + 3] = first_edge + 6;
|
||||||
|
faceorder.unshift(front_count);
|
||||||
|
|
||||||
|
front[front_count++] = v0;
|
||||||
|
front[front_count++] = opposite;
|
||||||
|
front[front_count++] = v1;
|
||||||
|
front[front_count++] = prev;
|
||||||
|
front[front_count++] = first_edge+6;
|
||||||
|
front_count++;
|
||||||
|
// addFront(v0, opposite, v1, prev, first_edge + 6);
|
||||||
|
|
||||||
|
faceorder.push(front_count);
|
||||||
|
|
||||||
|
front[front_count++] = opposite;
|
||||||
|
front[front_count++] = v1;
|
||||||
|
front[front_count++] = v0;
|
||||||
|
front[front_count++] = first_edge;
|
||||||
|
front[front_count++] = next;
|
||||||
|
front_count++;
|
||||||
|
// addFront(opposite, v1, v0, first_edge, next);
|
||||||
|
|
||||||
|
} else if(c == 3) { //END
|
||||||
|
front[prev + 5] = 1;
|
||||||
|
front[next + 5] = 1;
|
||||||
|
front[front[prev + 3] + 4] = front[next + 4];
|
||||||
|
front[front[next + 4] + 3] = front[prev + 3];
|
||||||
|
opposite = front[prev + 0];
|
||||||
|
|
||||||
|
} else if(c == 1) { //LEFT
|
||||||
|
front[prev + 5] = 1; //deleted
|
||||||
|
front[front[prev + 3] + 4] = first_edge;
|
||||||
|
front[next + 3] = first_edge;
|
||||||
|
opposite = front[prev + 0];
|
||||||
|
|
||||||
|
faceorder.unshift(front_count);
|
||||||
|
|
||||||
|
front[front_count++] = opposite;
|
||||||
|
front[front_count++] = v1;
|
||||||
|
front[front_count++] = v0;
|
||||||
|
front[front_count++] = front[prev +3];
|
||||||
|
front[front_count++] = next;
|
||||||
|
front_count++;
|
||||||
|
// addFront(opposite, v1, v0, front[prev + 3], next);
|
||||||
|
|
||||||
|
} else if(c == 2) { //RIGHT
|
||||||
|
front[next + 5] = 1;
|
||||||
|
front[front[next + 4] + 3] = first_edge;
|
||||||
|
front[prev + 4] = first_edge;
|
||||||
|
opposite = front[next + 1];
|
||||||
|
|
||||||
|
|
||||||
|
faceorder.unshift(front_count);
|
||||||
|
|
||||||
|
front[front_count++] = v0;
|
||||||
|
front[front_count++] = opposite;
|
||||||
|
front[front_count++] = v1;
|
||||||
|
front[front_count++] = prev;
|
||||||
|
front[front_count++] = front[next+4];
|
||||||
|
front_count++;
|
||||||
|
// addFront(v0, opposite, v1, prev, front[next + 4]);
|
||||||
|
|
||||||
|
} else if(c == 5) { //DELAY
|
||||||
|
front[edge_start + 5] = 0;
|
||||||
|
delayed.push(edge_start);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
this.faces[faces_count++] = v1;
|
||||||
|
this.faces[faces_count++] = v0;
|
||||||
|
this.faces[faces_count++] = opposite;
|
||||||
|
totfaces--;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
decodeVertex: function(bitstream, diff, tdiff) {
|
||||||
|
if(diff == 0)
|
||||||
|
return bitstream.read(16);
|
||||||
|
|
||||||
|
var v = this.vertex_count++;
|
||||||
|
|
||||||
|
var max = 1<<(diff-1);
|
||||||
|
|
||||||
|
for(var k = 0; k < 3; k++) {
|
||||||
|
var d = bitstream.read(diff) - max;
|
||||||
|
this.coords[v*3+k] = this.stack[k] + d; //stack 0-3 is used as extimated
|
||||||
|
}
|
||||||
|
if(this.sig.texcoords) {
|
||||||
|
var tmax = 1<<(tdiff-1);
|
||||||
|
for(var k = 0; k < 2; k++) {
|
||||||
|
var d = bitstream.read(tdiff) - tmax;
|
||||||
|
this.texcoords[v*2+k] = this.stack[7+k] + d; //stack 7-9 is used as extimated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
},
|
||||||
|
|
||||||
|
decodeDiff: function(diff, bitstream) {
|
||||||
|
var val;
|
||||||
|
if(diff == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
val = 1<<diff;
|
||||||
|
val += bitstream.read(diff);
|
||||||
|
|
||||||
|
|
||||||
|
if(val & 0x1)
|
||||||
|
val >>>= 1;
|
||||||
|
else
|
||||||
|
val = -(val>>>1);
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var tot = 0;
|
||||||
1323
frontend/public/vendor/3dhop/nexus.js
vendored
Normal file
1323
frontend/public/vendor/3dhop/nexus.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1042
frontend/public/vendor/3dhop/ply.js
vendored
Normal file
1042
frontend/public/vendor/3dhop/ply.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4232
frontend/public/vendor/3dhop/presenter.js
vendored
Executable file
4232
frontend/public/vendor/3dhop/presenter.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
29
frontend/public/vendor/3dhop/spidergl.js
vendored
Normal file
29
frontend/public/vendor/3dhop/spidergl.js
vendored
Normal file
File diff suppressed because one or more lines are too long
383
frontend/public/vendor/3dhop/trackball_pantilt.js
vendored
Executable file
383
frontend/public/vendor/3dhop/trackball_pantilt.js
vendored
Executable file
@@ -0,0 +1,383 @@
|
|||||||
|
/*
|
||||||
|
3DHOP - 3D Heritage Online Presenter
|
||||||
|
Copyright (c) 2014-2023, Visual Computing Lab, ISTI - CNR
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a PanTiltTrackball object.
|
||||||
|
* @class Interactor which implements a pan-tilt trackball controller with bounds.
|
||||||
|
*/
|
||||||
|
function PanTiltTrackball() {
|
||||||
|
}
|
||||||
|
|
||||||
|
PanTiltTrackball.prototype = {
|
||||||
|
|
||||||
|
setup : function (options,myPresenter) {
|
||||||
|
options = options || {};
|
||||||
|
var opt = sglGetDefaultObject({
|
||||||
|
startCenter : [ 0.0, 0.0, 0.0 ],
|
||||||
|
startPanX : 0.0,
|
||||||
|
startPanY : 0.0,
|
||||||
|
startAngleX : 0.0,
|
||||||
|
startAngleY : 0.0,
|
||||||
|
startDistance : 2.0,
|
||||||
|
minMaxDist : [0.2, 4.0],
|
||||||
|
minMaxPanX : [-0.7, 0.7],
|
||||||
|
minMaxPanY : [-0.7, 0.7],
|
||||||
|
minMaxAngleX : [-70.0, 70.0],
|
||||||
|
minMaxAngleY : [-70.0, 70.0],
|
||||||
|
pathStates : [ ], // path points array
|
||||||
|
animationLocked : false,// if true disable trackball interactions during animation
|
||||||
|
animationTime : null // when single position navigation, each to point navigation is # seconds (if null, automatically computed)
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
|
||||||
|
this.myPresenter = myPresenter;// parent presenter
|
||||||
|
|
||||||
|
// path
|
||||||
|
this._pathStates = opt.pathStates;
|
||||||
|
this._animationLocked = opt.animationLocked;
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
|
||||||
|
// trackball center
|
||||||
|
this._center = opt.startCenter;
|
||||||
|
|
||||||
|
// starting/default parameters
|
||||||
|
this._startPanX = opt.startPanX; //pan X
|
||||||
|
this._startPanY = opt.startPanY; //pan Y
|
||||||
|
this._startAngleX = sglDegToRad(opt.startAngleX); //angle X
|
||||||
|
this._startAngleY = sglDegToRad(opt.startAngleY); //angle Y
|
||||||
|
this._startDistance = opt.startDistance; //distance
|
||||||
|
|
||||||
|
// current parameters
|
||||||
|
this._panX = this._startPanX;
|
||||||
|
this._panY = this._startPanY;
|
||||||
|
this._angleX = this._startAngleX;
|
||||||
|
this._angleY = this._startAngleY;
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
|
||||||
|
// target paramenters
|
||||||
|
this._targetPanX = this._startPanX;
|
||||||
|
this._targetPanY = this._startPanY;
|
||||||
|
this._targetAngleX = this._startAngleX;
|
||||||
|
this._targetAngleY = this._startAngleY;
|
||||||
|
this._targetDistance = this._startDistance;
|
||||||
|
|
||||||
|
//animation data
|
||||||
|
this._isAnimating = false;
|
||||||
|
this._speedPanX = 0.0;
|
||||||
|
this._speedPanY = 0.0;
|
||||||
|
this._speedAngleX = 0.0;
|
||||||
|
this._speedAngleY = 0.0;
|
||||||
|
this._speedDistance = 0.0;
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._animationTime = opt.animationTime;
|
||||||
|
|
||||||
|
//limits
|
||||||
|
this._minMaxDist = opt.minMaxDist;
|
||||||
|
this._minMaxPanX = opt.minMaxPanX;
|
||||||
|
this._minMaxPanY = opt.minMaxPanY;
|
||||||
|
this._minMaxAngleX = opt.minMaxAngleX;
|
||||||
|
this._minMaxAngleX[0] = sglDegToRad(this._minMaxAngleX[0]);
|
||||||
|
this._minMaxAngleX[1] = sglDegToRad(this._minMaxAngleX[1]);
|
||||||
|
this._minMaxAngleY = opt.minMaxAngleY;
|
||||||
|
this._minMaxAngleY[0] = sglDegToRad(this._minMaxAngleY[0]);
|
||||||
|
this._minMaxAngleY[1] = sglDegToRad(this._minMaxAngleY[1]);
|
||||||
|
|
||||||
|
this._start = [0.0, 0.0];
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
_clamp : function(value, low, high) {
|
||||||
|
if(value < low) return low;
|
||||||
|
if(value > high) return high;
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
|
||||||
|
_computeMatrix: function() {
|
||||||
|
var m = SglMat4.identity();
|
||||||
|
|
||||||
|
// centering
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([-this._center[0], -this._center[1], -this._center[2]]));
|
||||||
|
// zoom
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([0.0, 0.0, -this._distance]));
|
||||||
|
// tilt
|
||||||
|
m = SglMat4.mul(m, SglMat4.rotationAngleAxis(this._angleY, [1.0, 0.0, 0.0]));
|
||||||
|
m = SglMat4.mul(m, SglMat4.rotationAngleAxis(this._angleX, [0.0, -1.0, 0.0]));
|
||||||
|
// pan
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([this._panX, this._panY, 0.0]));
|
||||||
|
|
||||||
|
this._matrix = m;
|
||||||
|
|
||||||
|
if(typeof onTrackballUpdate != "undefined")
|
||||||
|
onTrackballUpdate(this.getState());
|
||||||
|
},
|
||||||
|
|
||||||
|
getState : function () {
|
||||||
|
return [this._panX, this._panY, sglRadToDeg(this._angleX), sglRadToDeg(this._angleY), this._distance];
|
||||||
|
},
|
||||||
|
|
||||||
|
setState : function (newstate) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = this._isAutoWalking = false;
|
||||||
|
|
||||||
|
this._panX = newstate[0];
|
||||||
|
this._panY = newstate[1];
|
||||||
|
this._angleX = sglDegToRad(newstate[2]);
|
||||||
|
this._angleY = sglDegToRad(newstate[3]);
|
||||||
|
this._distance = newstate[4];
|
||||||
|
|
||||||
|
//check limits
|
||||||
|
this._panX = this._clamp(this._panX, this._minMaxPanX[0], this._minMaxPanX[1]);
|
||||||
|
this._panY = this._clamp(this._panY, this._minMaxPanY[0], this._minMaxPanY[1]);
|
||||||
|
this._angleX = this._clamp(this._angleX, this._minMaxAngleX[0], this._minMaxAngleX[1]);
|
||||||
|
this._angleY = this._clamp(this._angleY, this._minMaxAngleY[0], this._minMaxAngleY[1]);
|
||||||
|
this._distance = this._clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
animateToState : function (newstate, newtime) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = false;
|
||||||
|
|
||||||
|
if(newstate)
|
||||||
|
{
|
||||||
|
// stop autoWalking
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
|
||||||
|
// setting targets
|
||||||
|
this._targetPanX = newstate[0];
|
||||||
|
this._targetPanY = newstate[1];
|
||||||
|
this._targetAngleX = sglDegToRad(newstate[2]);
|
||||||
|
this._targetAngleY = sglDegToRad(newstate[3]);
|
||||||
|
this._targetDistance = newstate[4];
|
||||||
|
|
||||||
|
//check limits
|
||||||
|
this._targetPanX = this._clamp(this._targetPanX, this._minMaxPanX[0], this._minMaxPanX[1]);
|
||||||
|
this._targetPanY = this._clamp(this._targetPanY, this._minMaxPanY[0], this._minMaxPanY[1]);
|
||||||
|
this._targetAngleX = this._clamp(this._targetAngleX, this._minMaxAngleX[0], this._minMaxAngleX[1]);
|
||||||
|
this._targetAngleY = this._clamp(this._targetAngleY, this._minMaxAngleY[0], this._minMaxAngleY[1]);
|
||||||
|
this._targetDistance = this._clamp(this._targetDistance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
|
||||||
|
// setting base velocities
|
||||||
|
this._speedPanX = 2.0;
|
||||||
|
this._speedPanY = 2.0;
|
||||||
|
this._speedAngleX = Math.PI;
|
||||||
|
this._speedAngleY = Math.PI;
|
||||||
|
this._speedDistance = 2.0;
|
||||||
|
|
||||||
|
// find max animation time to set a time limit and then synchronize all movements
|
||||||
|
var timePanX = Math.abs((this._targetPanX - this._panX) / this._speedPanX);
|
||||||
|
var timePanY = Math.abs((this._targetPanY - this._panY) / this._speedPanY);
|
||||||
|
var timeAngleX = Math.abs((this._targetAngleX - this._angleX) / this._speedAngleX);
|
||||||
|
var timeAngleY = Math.abs((this._targetAngleY - this._angleY) / this._speedAngleY);
|
||||||
|
var timeDistance = Math.abs((this._targetDistance - this._distance) / this._speedDistance);
|
||||||
|
|
||||||
|
var maxtime = Math.max( timePanX, Math.max( timePanY, Math.max( timeAngleX, Math.max( timeAngleY, timeDistance ) ) ));
|
||||||
|
var animationtime = this._clamp(maxtime, 0.5, 2.0);
|
||||||
|
|
||||||
|
if(newtime) animationtime = newtime;
|
||||||
|
else if (this._animationTime) animationtime = this._animationTime;
|
||||||
|
|
||||||
|
this._speedPanX *= timePanX / animationtime;
|
||||||
|
this._speedPanY *= timePanY / animationtime;
|
||||||
|
this._speedAngleX *= timeAngleX / animationtime;
|
||||||
|
this._speedAngleY *= timeAngleY / animationtime;
|
||||||
|
this._speedDistance *= timeDistance / animationtime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(this._pathPosNum == this._pathStates.length){
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var state = this._pathStates[this._pathPosNum][0];
|
||||||
|
var time = this._animationTime;
|
||||||
|
if(!Array.isArray(state)) state = this._pathStates[this._pathPosNum];
|
||||||
|
else if (this._pathStates[this._pathPosNum][1]) time = this._pathStates[this._pathPosNum][1];
|
||||||
|
if(!this._isAutoWalking) this.animateToState(state, time);
|
||||||
|
this._isAutoWalking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// start animation
|
||||||
|
this._isAnimating = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
recenter : function (newpoint) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = this._isAutoWalking = false;
|
||||||
|
|
||||||
|
var newpanX = -(newpoint[0]-this.myPresenter.sceneCenter[0]) * this.myPresenter.sceneRadiusInv;
|
||||||
|
var newpanY = -(newpoint[1]-this.myPresenter.sceneCenter[1]) * this.myPresenter.sceneRadiusInv;
|
||||||
|
|
||||||
|
this.animateToState([newpanX, newpanY, sglRadToDeg(this._angleX), sglRadToDeg(this._angleY), (this._distance * 0.6)]);
|
||||||
|
},
|
||||||
|
|
||||||
|
tick : function (dt) {
|
||||||
|
if(!this._isAnimating) return false;
|
||||||
|
|
||||||
|
var deltaPanX = this._speedPanX * dt;
|
||||||
|
var deltaPanY = this._speedPanY * dt;
|
||||||
|
var deltaAngleX = this._speedAngleX * dt;
|
||||||
|
var deltaAngleY = this._speedAngleY * dt;
|
||||||
|
var deltaDistance = this._speedDistance * dt;
|
||||||
|
|
||||||
|
var diffPanX = this._targetPanX - this._panX;
|
||||||
|
var diffPanY = this._targetPanY - this._panY;
|
||||||
|
var diffAngleX = this._targetAngleX - this._angleX;
|
||||||
|
var diffAngleY = this._targetAngleY - this._angleY;
|
||||||
|
var diffDistance = this._targetDistance - this._distance;
|
||||||
|
|
||||||
|
if (diffPanX > deltaPanX)
|
||||||
|
this._panX += deltaPanX;
|
||||||
|
else if (diffPanX < -deltaPanX)
|
||||||
|
this._panX -= deltaPanX;
|
||||||
|
else
|
||||||
|
this._panX = this._targetPanX;
|
||||||
|
|
||||||
|
if (diffPanY > deltaPanY)
|
||||||
|
this._panY += deltaPanY;
|
||||||
|
else if (diffPanY < -deltaPanY)
|
||||||
|
this._panY -= deltaPanY;
|
||||||
|
else
|
||||||
|
this._panY = this._targetPanY;
|
||||||
|
|
||||||
|
if (diffAngleX > deltaAngleX)
|
||||||
|
this._angleX += deltaAngleX;
|
||||||
|
else if (diffAngleX < -deltaAngleX)
|
||||||
|
this._angleX -= deltaAngleX;
|
||||||
|
else
|
||||||
|
this._angleX = this._targetAngleX;
|
||||||
|
|
||||||
|
if (diffAngleY > deltaAngleY)
|
||||||
|
this._angleY += deltaAngleY;
|
||||||
|
else if (diffAngleY < -deltaAngleY)
|
||||||
|
this._angleY -= deltaAngleY;
|
||||||
|
else
|
||||||
|
this._angleY = this._targetAngleY;
|
||||||
|
|
||||||
|
if (diffDistance > deltaDistance)
|
||||||
|
this._distance += deltaDistance;
|
||||||
|
else if (diffDistance < -deltaDistance)
|
||||||
|
this._distance -= deltaDistance;
|
||||||
|
else
|
||||||
|
this._distance = this._targetDistance;
|
||||||
|
|
||||||
|
if(this._panX == this._targetPanX)
|
||||||
|
if(this._panY == this._targetPanY)
|
||||||
|
if(this._angleX == this._targetAngleX)
|
||||||
|
if(this._angleY == this._targetAngleY)
|
||||||
|
if(this._distance == this._targetDistance){
|
||||||
|
this._isAnimating = false;
|
||||||
|
if(typeof onTrackballArrived != "undefined")
|
||||||
|
onTrackballArrived(this.getState());
|
||||||
|
if(this._isAutoWalking) { this._pathPosNum++; this._isAutoWalking = false; this.animateToState(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
set action(a) { if(this._action != a) { this._new_action = true; this._action = a; } },
|
||||||
|
|
||||||
|
get action() { return this._action; },
|
||||||
|
|
||||||
|
get matrix() { this._computeMatrix(); return this._matrix; },
|
||||||
|
|
||||||
|
get distance() { return this._distance; },
|
||||||
|
|
||||||
|
reset : function () {
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
|
||||||
|
this._panX = this._startPanX;
|
||||||
|
this._panY = this._startPanY;
|
||||||
|
this._angleX = this._startAngleX;
|
||||||
|
this._angleY = this._startAngleY;
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._isAnimating = false;
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
track : function(m, x, y, z) {
|
||||||
|
if(this._animationLocked && this._isAnimating) this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
if(this._new_action) {
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
this._new_action = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dx = this._start[0] - x;
|
||||||
|
var dy = this._start[1] - y;
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
|
||||||
|
switch (this._action) {
|
||||||
|
case SGL_TRACKBALL_ROTATE:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.rotate(m, dx, dy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_PAN:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.pan(m, dx, dy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_SCALE:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.scale(m, z);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
rotate: function(m, dx, dy) {
|
||||||
|
this._angleX += dx;
|
||||||
|
this._angleY += dy;
|
||||||
|
this._angleX = this._clamp(this._angleX, this._minMaxAngleX[0], this._minMaxAngleX[1]);
|
||||||
|
this._angleY = this._clamp(this._angleY, this._minMaxAngleY[0], this._minMaxAngleY[1]);
|
||||||
|
},
|
||||||
|
|
||||||
|
pan: function(m, dx, dy) {
|
||||||
|
var panSpeed = Math.max(Math.min(1.5, this._distance),0.05);
|
||||||
|
this._panX -= dx/2.0 * panSpeed;
|
||||||
|
this._panY -= dy/2.0 * panSpeed;
|
||||||
|
this._panX = this._clamp(this._panX, this._minMaxPanX[0], this._minMaxPanX[1]);
|
||||||
|
this._panY = this._clamp(this._panY, this._minMaxPanY[0], this._minMaxPanY[1]);
|
||||||
|
},
|
||||||
|
|
||||||
|
scale : function(m, s) {
|
||||||
|
this._distance *= s;
|
||||||
|
this._distance = this._clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/***********************************************************************/
|
||||||
241
frontend/public/vendor/3dhop/trackball_sphere.js
vendored
Normal file
241
frontend/public/vendor/3dhop/trackball_sphere.js
vendored
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/*
|
||||||
|
3DHOP - 3D Heritage Online Presenter
|
||||||
|
Copyright (c) 2014-2020, Visual Computing Lab, ISTI - CNR
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a SphereTrackball object.
|
||||||
|
* @class Interactor which implements a full spherical trackball controller.
|
||||||
|
*/
|
||||||
|
function SphereTrackball() {
|
||||||
|
}
|
||||||
|
|
||||||
|
SphereTrackball.prototype = {
|
||||||
|
|
||||||
|
setup : function (options) {
|
||||||
|
options = options || {};
|
||||||
|
var opt = sglGetDefaultObject({
|
||||||
|
startCenter : [ 0.0, 0.0, 0.0 ],
|
||||||
|
startDistance : 2.0,
|
||||||
|
minMaxDist : [0.2, 4.0],
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
this._sphereMatrix = SglMat4.identity();
|
||||||
|
|
||||||
|
// starting/default parameters
|
||||||
|
this._startDistance = opt.startDistance; //distance
|
||||||
|
|
||||||
|
// current parameters
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
|
||||||
|
//limits
|
||||||
|
this._minMaxDist = opt.minMaxDist;
|
||||||
|
|
||||||
|
this._pts = [ [0.0, 0.0], [0.0, 0.0] ];
|
||||||
|
this._start = [0.0, 0.0];
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
clamp : function(value, low, high) {
|
||||||
|
if(value < low) return low;
|
||||||
|
if(value > high) return high;
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
|
||||||
|
_computeMatrix: function() {
|
||||||
|
var m = SglMat4.identity();
|
||||||
|
|
||||||
|
// zoom
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([0.0, 0.0, -this._distance]));
|
||||||
|
// spheretrack
|
||||||
|
m = SglMat4.mul(m, this._sphereMatrix);
|
||||||
|
|
||||||
|
this._matrix = m;
|
||||||
|
|
||||||
|
if(typeof onTrackballUpdate != "undefined")
|
||||||
|
onTrackballUpdate(this.getState());
|
||||||
|
},
|
||||||
|
|
||||||
|
_projectOnSphere : function(x, y) {
|
||||||
|
var r = 1.0;
|
||||||
|
|
||||||
|
var z = 0.0;
|
||||||
|
var d = sglSqrt(x*x + y*y);
|
||||||
|
if (d < (r * 0.70710678118654752440)) {
|
||||||
|
/* Inside sphere */
|
||||||
|
z = sglSqrt(r*r - d*d);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* On hyperbola */
|
||||||
|
t = r / 1.41421356237309504880;
|
||||||
|
z = t*t / d;
|
||||||
|
}
|
||||||
|
return z;
|
||||||
|
},
|
||||||
|
|
||||||
|
_transform : function(m, x, y, z) {
|
||||||
|
return SglMat4.mul4(m, [x, y, z, 0.0]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_transformOnSphere : function(m, x, y) {
|
||||||
|
var z = this._projectOnSphere(x, y); //get z value
|
||||||
|
return this._transform(m, x, y, z);
|
||||||
|
},
|
||||||
|
|
||||||
|
_translate : function(offset, f) {
|
||||||
|
var invMat = SglMat4.inverse(this._sphereMatrix);
|
||||||
|
var t = SglVec3.to4(offset, 0.0);
|
||||||
|
t = SglMat4.mul4(invMat, t);
|
||||||
|
t = SglVec4.muls(t, f);
|
||||||
|
var trMat = SglMat4.translation(t);
|
||||||
|
this._sphereMatrix = SglMat4.mul(this._sphereMatrix, trMat);
|
||||||
|
},
|
||||||
|
|
||||||
|
getState : function () {
|
||||||
|
return this._sphereMatrix;
|
||||||
|
},
|
||||||
|
|
||||||
|
setState : function (newstate) {
|
||||||
|
this._sphereMatrix = newstate;
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
animateToState : function (newstate) {
|
||||||
|
this._sphereMatrix = newstate;
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
recenter : function (newpoint) {
|
||||||
|
var newpanX = (newpoint[0]-presenter.sceneCenter[0]) * presenter.sceneRadiusInv;
|
||||||
|
var newpanY = (newpoint[1]-presenter.sceneCenter[1]) * presenter.sceneRadiusInv;
|
||||||
|
var newpanZ = (newpoint[2]-presenter.sceneCenter[2]) * presenter.sceneRadiusInv;
|
||||||
|
|
||||||
|
this._sphereMatrix[12] = -newpanX;
|
||||||
|
this._sphereMatrix[13] = -newpanY;
|
||||||
|
this._sphereMatrix[14] = -newpanZ;
|
||||||
|
this._distance *= 0.6;
|
||||||
|
this._distance = this.clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
tick : function (dt) {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
set action(a) { if(this._action != a) this._new_action = true; this._action = a; },
|
||||||
|
|
||||||
|
get action() { return this._action; },
|
||||||
|
|
||||||
|
get matrix() { this._computeMatrix(); return this._matrix; },
|
||||||
|
|
||||||
|
get distance() { return this._distance; },
|
||||||
|
|
||||||
|
reset : function () {
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
this._sphereMatrix = SglMat4.identity();
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
|
||||||
|
this._pts = [ [0.0, 0.0], [0.0, 0.0] ];
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
track : function(m, x, y, z) {
|
||||||
|
|
||||||
|
if(this._new_action) {
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
this._new_action = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dx = this._start[0] - x;
|
||||||
|
var dy = this._start[1] - y;
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
|
||||||
|
this._pts[0][0] = this._pts[1][0] + dx;
|
||||||
|
this._pts[0][1] = this._pts[1][1] + dy;
|
||||||
|
this._pts[1][0] = dx;
|
||||||
|
this._pts[1][1] = dy;
|
||||||
|
|
||||||
|
switch (this._action) {
|
||||||
|
case SGL_TRACKBALL_ROTATE:
|
||||||
|
this.rotate(m);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_PAN:
|
||||||
|
this.pan(m);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_DOLLY:
|
||||||
|
this.dolly(m, z);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_SCALE:
|
||||||
|
this.scale(m, z);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
rotate : function(m) {
|
||||||
|
if ((this._pts[0][0] == this._pts[1][0]) && (this._pts[0][1] == this._pts[1][1])) return; //if Xold == Xnew && Yold ==Ynew return
|
||||||
|
|
||||||
|
var mInv = SglMat4.inverse(m);
|
||||||
|
|
||||||
|
var v0 = this._transformOnSphere(mInv, this._pts[0][0], this._pts[0][1]); //project on sphere (Xold, Yold)
|
||||||
|
var v1 = this._transformOnSphere(mInv, this._pts[1][0], this._pts[1][1]); //project on sphere (Xnew, Ynew)
|
||||||
|
|
||||||
|
var axis = SglVec3.cross(v0, v1); //axis of rotation
|
||||||
|
var angle = SglVec3.length(axis); //angle of rotation
|
||||||
|
var rotMat = SglMat4.rotationAngleAxis(angle, axis);
|
||||||
|
|
||||||
|
this._sphereMatrix = SglMat4.mul(rotMat, this._sphereMatrix);
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
pan : function(m) {
|
||||||
|
var mInv = SglMat4.inverse(m);
|
||||||
|
var v0 = this._transform(mInv, this._pts[0][0], this._pts[0][1], -1.0);
|
||||||
|
var v1 = this._transform(mInv, this._pts[1][0], this._pts[1][1], -1.0);
|
||||||
|
var offset = SglVec3.sub(v1, v0);
|
||||||
|
this._translate(offset, 2.0);
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
dolly : function(m, dz) {
|
||||||
|
var mInv = SglMat4.inverse(m);
|
||||||
|
var offset = this._transform(mInv, 0.0, 0.0, dz);
|
||||||
|
this._translate(offset, 1.0);
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
scale : function(m, s) {
|
||||||
|
this._distance *= s;
|
||||||
|
this._distance = this.clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
this._computeMatrix();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/***********************************************************************/
|
||||||
354
frontend/public/vendor/3dhop/trackball_turntable.js
vendored
Normal file
354
frontend/public/vendor/3dhop/trackball_turntable.js
vendored
Normal file
@@ -0,0 +1,354 @@
|
|||||||
|
/*
|
||||||
|
3DHOP - 3D Heritage Online Presenter
|
||||||
|
Copyright (c) 2014-2020, Visual Computing Lab, ISTI - CNR
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a TurntableTrackball object.
|
||||||
|
* @class Interactor which implements a Turntable controller with bounds.
|
||||||
|
*/
|
||||||
|
function TurnTableTrackball() {
|
||||||
|
}
|
||||||
|
|
||||||
|
TurnTableTrackball.prototype = {
|
||||||
|
|
||||||
|
setup : function (options) {
|
||||||
|
options = options || {};
|
||||||
|
var opt = sglGetDefaultObject({
|
||||||
|
startCenter : [ 0.0, 0.0, 0.0 ],
|
||||||
|
startPhi : 0.0,
|
||||||
|
startTheta : 0.0,
|
||||||
|
startDistance : 2.0,
|
||||||
|
minMaxDist : [0.2, 4.0],
|
||||||
|
minMaxPhi : [-180, 180],
|
||||||
|
minMaxTheta : [-80.0, 80.0],
|
||||||
|
pathStates : [ ], // path points array
|
||||||
|
animationLocked : false,// if true disable trackball interactions during animation
|
||||||
|
animationTime : null // when single position navigation, each to point navigation is # seconds (if null, automatically computed)
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
|
||||||
|
// path
|
||||||
|
this._pathStates = opt.pathStates;
|
||||||
|
this._animationLocked = opt.animationLocked;
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
|
||||||
|
// trackball center
|
||||||
|
this._center = opt.startCenter;
|
||||||
|
|
||||||
|
// starting/default parameters
|
||||||
|
this._startPhi = sglDegToRad(opt.startPhi); //phi (horizontal rotation)
|
||||||
|
this._startTheta = sglDegToRad(opt.startTheta); //theta (vertical rotation)
|
||||||
|
this._startDistance = opt.startDistance; //distance
|
||||||
|
|
||||||
|
// current parameters
|
||||||
|
this._phi = this._startPhi;
|
||||||
|
this._theta = this._startTheta;
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
|
||||||
|
// target paramenters
|
||||||
|
this._targetPhi = this._startPhi;
|
||||||
|
this._targetTheta = this._startTheta;
|
||||||
|
this._targetDistance = this._startDistance;
|
||||||
|
|
||||||
|
//animation data
|
||||||
|
this._isAnimating = false;
|
||||||
|
this._speedPhi = 0.0;
|
||||||
|
this._speedTheta = 0.0;
|
||||||
|
this._speedDistance = 0.0;
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._animationTime = opt.animationTime;
|
||||||
|
|
||||||
|
// limits
|
||||||
|
this._minMaxDist = opt.minMaxDist;
|
||||||
|
if((opt.minMaxPhi[0] == -180)&&(opt.minMaxPhi[1] == 180))
|
||||||
|
this._limitPhi = false;
|
||||||
|
else
|
||||||
|
this._limitPhi = true;
|
||||||
|
this._minMaxPhi = opt.minMaxPhi;
|
||||||
|
this._minMaxPhi[0] = sglDegToRad(this._minMaxPhi[0]);
|
||||||
|
this._minMaxPhi[1] = sglDegToRad(this._minMaxPhi[1]);
|
||||||
|
this._minMaxTheta = opt.minMaxTheta;
|
||||||
|
this._minMaxTheta[0] = sglDegToRad(this._minMaxTheta[0]);
|
||||||
|
this._minMaxTheta[1] = sglDegToRad(this._minMaxTheta[1]);
|
||||||
|
|
||||||
|
this._start = [0.0, 0.0];
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
_clamp : function(value, low, high) {
|
||||||
|
if(value < low) return low;
|
||||||
|
if(value > high) return high;
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
|
||||||
|
_computeMatrix: function() {
|
||||||
|
var m = SglMat4.identity();
|
||||||
|
|
||||||
|
// centering
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([-this._center[0], -this._center[1], -this._center[2]]));
|
||||||
|
// zoom
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([0.0, 0.0, -this._distance]));
|
||||||
|
// rotation
|
||||||
|
m = SglMat4.mul(m, SglMat4.rotationAngleAxis(this._theta, [1.0, 0.0, 0.0]));
|
||||||
|
// tilt
|
||||||
|
m = SglMat4.mul(m, SglMat4.rotationAngleAxis(this._phi, [0.0, -1.0, 0.0]));
|
||||||
|
|
||||||
|
this._matrix = m;
|
||||||
|
|
||||||
|
if(typeof onTrackballUpdate != "undefined")
|
||||||
|
onTrackballUpdate(this.getState());
|
||||||
|
},
|
||||||
|
|
||||||
|
getState : function () {
|
||||||
|
return [sglRadToDeg(this._phi), sglRadToDeg(this._theta), this._distance];
|
||||||
|
},
|
||||||
|
|
||||||
|
setState : function (newstate) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = this._isAutoWalking = false;
|
||||||
|
|
||||||
|
this._phi = sglDegToRad(newstate[0]);
|
||||||
|
this._theta = sglDegToRad(newstate[1]);
|
||||||
|
this._distance = newstate[2];
|
||||||
|
|
||||||
|
//check limits
|
||||||
|
if(this._limitPhi)
|
||||||
|
this._phi = this._clamp(this._phi, this._minMaxPhi[0], this._minMaxPhi[1]);
|
||||||
|
this._theta = this._clamp(this._theta, this._minMaxTheta[0], this._minMaxTheta[1]);
|
||||||
|
this._distance = this._clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
animateToState : function (newstate, newtime) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = false;
|
||||||
|
|
||||||
|
if(newstate)
|
||||||
|
{
|
||||||
|
// stop autoWalking
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
|
||||||
|
// setting targets
|
||||||
|
this._targetPhi = sglDegToRad(newstate[0]);
|
||||||
|
this._targetTheta = sglDegToRad(newstate[1]);
|
||||||
|
this._targetDistance = newstate[2];
|
||||||
|
|
||||||
|
//check limits
|
||||||
|
if(this._limitPhi)
|
||||||
|
this._targetPhi = this._clamp(this._targetPhi, this._minMaxPhi[0], this._minMaxPhi[1]);
|
||||||
|
this._targetPhi = this._targetPhi % (2*Math.PI);
|
||||||
|
this._targetTheta = this._clamp(this._targetTheta, this._minMaxTheta[0], this._minMaxTheta[1]);
|
||||||
|
this._targetDistance = this._clamp(this._targetDistance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
|
||||||
|
// setting base velocities
|
||||||
|
this._speedPhi = Math.PI;
|
||||||
|
this._speedTheta = Math.PI;
|
||||||
|
this._speedDistance = 2.0;
|
||||||
|
|
||||||
|
//if phi unconstrained rotation, it is necessary to find a good rotation direction
|
||||||
|
if(!this._limitPhi){
|
||||||
|
// normalize (-2pi 2pi) current phi angle, to prevent endless unwinding
|
||||||
|
this._phi = this._phi % (2*Math.PI);
|
||||||
|
|
||||||
|
// determine minimal, normalized target phi angle, to prevent endless unwinding
|
||||||
|
var clampedangle = this._targetPhi;
|
||||||
|
clampedangle = clampedangle % (2*Math.PI);
|
||||||
|
|
||||||
|
if(Math.abs(clampedangle - this._phi) < Math.PI) { // standard rotation
|
||||||
|
if(clampedangle > this._phi){
|
||||||
|
this.speedphi = Math.PI;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.speedphi = -Math.PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(clampedangle > this._phi){
|
||||||
|
clampedangle = (clampedangle - 2*Math.PI)
|
||||||
|
this.speedphi = -Math.PI;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
clampedangle = (clampedangle + 2*Math.PI)
|
||||||
|
this.speedphi = Math.PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._targetPhi = clampedangle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find max animation time to set a time limit and then synchronize all movements
|
||||||
|
var timePhi = Math.abs((this._targetPhi - this._phi) / this._speedPhi);
|
||||||
|
var timeTheta = Math.abs((this._targetTheta - this._theta) / this._speedTheta);
|
||||||
|
var timeDistance = Math.abs((this._targetDistance - this._distance) / this._speedDistance);
|
||||||
|
|
||||||
|
var maxtime = Math.max( timePhi, Math.max( timeTheta, timeDistance ));
|
||||||
|
var animationtime = this._clamp(maxtime, 0.5, 2.0);
|
||||||
|
|
||||||
|
if(newtime) animationtime = newtime;
|
||||||
|
else if (this._animationTime) animationtime = this._animationTime;
|
||||||
|
|
||||||
|
this._speedPhi *= timePhi / animationtime;
|
||||||
|
this._speedTheta *= timeTheta / animationtime;
|
||||||
|
this._speedDistance *= timeDistance / animationtime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(this._pathPosNum == this._pathStates.length){
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var state = this._pathStates[this._pathPosNum][0];
|
||||||
|
var time = this._animationTime;
|
||||||
|
if(!Array.isArray(state)) state = this._pathStates[this._pathPosNum];
|
||||||
|
else if (this._pathStates[this._pathPosNum][1]) time = this._pathStates[this._pathPosNum][1];
|
||||||
|
if(!this._isAutoWalking) this.animateToState(state, time);
|
||||||
|
this._isAutoWalking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// start animation
|
||||||
|
this._isAnimating = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
tick : function (dt) {
|
||||||
|
if(!this._isAnimating) return false;
|
||||||
|
|
||||||
|
var deltaPhi = this._speedPhi * dt;
|
||||||
|
var deltaTheta = this._speedTheta * dt;
|
||||||
|
var deltaDistance = this._speedDistance * dt;
|
||||||
|
|
||||||
|
var diffPhi = this._targetPhi - this._phi;
|
||||||
|
var diffTheta = this._targetTheta - this._theta;
|
||||||
|
var diffDistance = this._targetDistance - this._distance;
|
||||||
|
|
||||||
|
if (diffPhi > deltaPhi)
|
||||||
|
this._phi += deltaPhi;
|
||||||
|
else if (diffPhi < -deltaPhi)
|
||||||
|
this._phi -= deltaPhi;
|
||||||
|
else
|
||||||
|
this._phi = this._targetPhi;
|
||||||
|
|
||||||
|
if (diffTheta > deltaTheta)
|
||||||
|
this._theta += deltaTheta;
|
||||||
|
else if (diffTheta < -deltaTheta)
|
||||||
|
this._theta -= deltaTheta;
|
||||||
|
else
|
||||||
|
this._theta = this._targetTheta;
|
||||||
|
|
||||||
|
if (diffDistance > deltaDistance)
|
||||||
|
this._distance += deltaDistance;
|
||||||
|
else if (diffDistance < -deltaDistance)
|
||||||
|
this._distance -= deltaDistance;
|
||||||
|
else
|
||||||
|
this._distance = this._targetDistance;
|
||||||
|
|
||||||
|
if(this._phi == this._targetPhi)
|
||||||
|
if(this._theta == this._targetTheta)
|
||||||
|
if(this._distance == this._targetDistance){
|
||||||
|
this._isAnimating = false;
|
||||||
|
if(typeof onTrackballArrived != "undefined")
|
||||||
|
onTrackballArrived(this.getState());
|
||||||
|
if(this._isAutoWalking) { this._pathPosNum++; this._isAutoWalking = false; this.animateToState(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
set action(a) { if(this._action != a) { this._new_action = true; this._action = a; } },
|
||||||
|
|
||||||
|
get action() { return this._action; },
|
||||||
|
|
||||||
|
get matrix() { this._computeMatrix(); return this._matrix; },
|
||||||
|
|
||||||
|
get distance() { return this._distance; },
|
||||||
|
|
||||||
|
reset : function () {
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
|
||||||
|
this._phi = this._startPhi;
|
||||||
|
this._theta = this._startTheta;
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._isAnimating = false;
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
track : function(m, x, y, z) {
|
||||||
|
if(this._animationLocked && this._isAnimating) this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
if(this._new_action) {
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
this._new_action = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dx = this._start[0] - x;
|
||||||
|
var dy = this._start[1] - y;
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
|
||||||
|
switch (this._action) {
|
||||||
|
case SGL_TRACKBALL_ROTATE:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.rotate(m, dx, dy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_PAN:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_SCALE:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.scale(m, z);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
rotate: function(m, dx, dy) {
|
||||||
|
this._phi += dx;
|
||||||
|
if(this._limitPhi)
|
||||||
|
this._phi = this._clamp(this._phi, this._minMaxPhi[0], this._minMaxPhi[1]);
|
||||||
|
|
||||||
|
// avoid eternal accumulation of rotation, just for the sake of cleanliness
|
||||||
|
if (this._phi > 10.0) this._phi = this._phi - 10.0;
|
||||||
|
if (this._phi < -10.0) this._phi = this._phi + 10.0;
|
||||||
|
|
||||||
|
this._theta += dy;
|
||||||
|
this._theta = this._clamp(this._theta, this._minMaxTheta[0], this._minMaxTheta[1]);
|
||||||
|
},
|
||||||
|
|
||||||
|
scale : function(m, s) {
|
||||||
|
this._distance *= s;
|
||||||
|
this._distance = this._clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/***********************************************************************/
|
||||||
467
frontend/public/vendor/3dhop/trackball_turntable_pan.js
vendored
Normal file
467
frontend/public/vendor/3dhop/trackball_turntable_pan.js
vendored
Normal file
@@ -0,0 +1,467 @@
|
|||||||
|
/*
|
||||||
|
3DHOP - 3D Heritage Online Presenter
|
||||||
|
Copyright (c) 2014-2020, Visual Computing Lab, ISTI - CNR
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a TurntableCylTrackball object.
|
||||||
|
* @class Interactor which implements a Turntable controller + cylindrical pan with bounds.
|
||||||
|
*/
|
||||||
|
function TurntablePanTrackball() {
|
||||||
|
}
|
||||||
|
|
||||||
|
TurntablePanTrackball.prototype = {
|
||||||
|
|
||||||
|
setup : function (options) {
|
||||||
|
options = options || {};
|
||||||
|
var opt = sglGetDefaultObject({
|
||||||
|
startCenter : [ 0.0, 0.0, 0.0 ],
|
||||||
|
startPhi : 0.0,
|
||||||
|
startTheta : 0.0,
|
||||||
|
startDistance : 2.0,
|
||||||
|
startPanX : 0.0,
|
||||||
|
startPanY : 0.0,
|
||||||
|
startPanZ : 0.0,
|
||||||
|
minMaxDist : [0.2, 4.0],
|
||||||
|
minMaxPhi : [-180, 180],
|
||||||
|
minMaxTheta : [-80.0, 80.0],
|
||||||
|
minMaxPanX : [-1.0, 1.0],
|
||||||
|
minMaxPanY : [-1.0, 1.0],
|
||||||
|
minMaxPanZ : [-1.0, 1.0],
|
||||||
|
pathStates : [ ], // path points array
|
||||||
|
animationLocked : false,// if true disable trackball interactions during animation
|
||||||
|
animationTime : null // when single position navigation, each to point navigation is # seconds (if null, automatically computed)
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
|
||||||
|
// path
|
||||||
|
this._pathStates = opt.pathStates;
|
||||||
|
this._animationLocked = opt.animationLocked;
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
|
||||||
|
// trackball center
|
||||||
|
this._center = opt.startCenter;
|
||||||
|
|
||||||
|
// starting/default parameters
|
||||||
|
this._startPhi = sglDegToRad(opt.startPhi); //phi (horizontal rotation)
|
||||||
|
this._startTheta = sglDegToRad(opt.startTheta); //theta (vertical rotation)
|
||||||
|
this._startPanX = opt.startPanX; //panX
|
||||||
|
this._startPanY = opt.startPanY; //panY
|
||||||
|
this._startPanZ = opt.startPanZ; //panZ
|
||||||
|
this._startDistance = opt.startDistance; //distance
|
||||||
|
|
||||||
|
// current parameters
|
||||||
|
this._phi = this._startPhi;
|
||||||
|
this._theta = this._startTheta;
|
||||||
|
this._panX = this._startPanX;
|
||||||
|
this._panY = this._startPanY;
|
||||||
|
this._panZ = this._startPanZ;
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
|
||||||
|
// target paramenters
|
||||||
|
this._targetPhi = this._startPhi;
|
||||||
|
this._targetTheta = this._startTheta;
|
||||||
|
this._targetPanX = this._startPanX;
|
||||||
|
this._targetPanY = this._startPanY;
|
||||||
|
this._targetPanZ = this._startPanZ;
|
||||||
|
this._targetDistance = this._startDistance;
|
||||||
|
|
||||||
|
//animation data
|
||||||
|
this._isAnimating = false;
|
||||||
|
this._speedPhi = 0.0;
|
||||||
|
this._speedTheta = 0.0;
|
||||||
|
this._speedPanX = 0.0;
|
||||||
|
this._speedPanY = 0.0;
|
||||||
|
this._speedPanZ = 0.0;
|
||||||
|
this._speedDistance = 0.0;
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._animationTime = opt.animationTime;
|
||||||
|
|
||||||
|
// limits
|
||||||
|
this._minMaxDist = opt.minMaxDist;
|
||||||
|
if((opt.minMaxPhi[0] == -180)&&(opt.minMaxPhi[1] == 180))
|
||||||
|
this._limitPhi = false;
|
||||||
|
else
|
||||||
|
this._limitPhi = true;
|
||||||
|
this._minMaxPhi = opt.minMaxPhi;
|
||||||
|
this._minMaxPhi[0] = sglDegToRad(this._minMaxPhi[0]);
|
||||||
|
this._minMaxPhi[1] = sglDegToRad(this._minMaxPhi[1]);
|
||||||
|
this._minMaxTheta = opt.minMaxTheta;
|
||||||
|
this._minMaxTheta[0] = sglDegToRad(this._minMaxTheta[0]);
|
||||||
|
this._minMaxTheta[1] = sglDegToRad(this._minMaxTheta[1]);
|
||||||
|
this._minMaxPanX = opt.minMaxPanX;
|
||||||
|
this._minMaxPanY = opt.minMaxPanY;
|
||||||
|
this._minMaxPanZ = opt.minMaxPanZ;
|
||||||
|
|
||||||
|
this._start = [0.0, 0.0];
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
_clamp : function(value, low, high) {
|
||||||
|
if(value < low) return low;
|
||||||
|
if(value > high) return high;
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
|
||||||
|
_computeMatrix: function() {
|
||||||
|
var m = SglMat4.identity();
|
||||||
|
|
||||||
|
// centering
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([-this._center[0], -this._center[1], -this._center[2]]));
|
||||||
|
// zoom
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([0.0, 0.0, -this._distance]));
|
||||||
|
// rotation
|
||||||
|
m = SglMat4.mul(m, SglMat4.rotationAngleAxis(this._theta, [1.0, 0.0, 0.0]));
|
||||||
|
// tilt
|
||||||
|
m = SglMat4.mul(m, SglMat4.rotationAngleAxis(this._phi, [0.0, -1.0, 0.0]));
|
||||||
|
// panning
|
||||||
|
m = SglMat4.mul(m, SglMat4.translation([-this._panX, -this._panY, -this._panZ]));
|
||||||
|
|
||||||
|
this._matrix = m;
|
||||||
|
|
||||||
|
if(typeof onTrackballUpdate != "undefined")
|
||||||
|
onTrackballUpdate(this.getState());
|
||||||
|
},
|
||||||
|
|
||||||
|
getState : function () {
|
||||||
|
return [sglRadToDeg(this._phi), sglRadToDeg(this._theta), this._panX, this._panY, this._panZ, this._distance];
|
||||||
|
},
|
||||||
|
|
||||||
|
setState : function (newstate) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = this._isAutoWalking = false;
|
||||||
|
|
||||||
|
this._phi = sglDegToRad(newstate[0]);
|
||||||
|
this._theta = sglDegToRad(newstate[1]);
|
||||||
|
this._panX = newstate[2];
|
||||||
|
this._panY = newstate[3];
|
||||||
|
this._panZ = newstate[4];
|
||||||
|
this._distance = newstate[5];
|
||||||
|
|
||||||
|
//check limits
|
||||||
|
if(this._limitPhi)
|
||||||
|
this._phi = this._clamp(this._phi, this._minMaxPhi[0], this._minMaxPhi[1]);
|
||||||
|
this._theta = this._clamp(this._theta, this._minMaxTheta[0], this._minMaxTheta[1]);
|
||||||
|
this._distance = this._clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
this._panX = this._clamp(this._panX, this._minMaxPanX[0], this._minMaxPanX[1]);
|
||||||
|
this._panY = this._clamp(this._panY, this._minMaxPanY[0], this._minMaxPanY[1]);
|
||||||
|
this._panZ = this._clamp(this._panZ, this._minMaxPanZ[0], this._minMaxPanZ[1]);
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
animateToState : function (newstate, newtime) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = false;
|
||||||
|
|
||||||
|
if(newstate)
|
||||||
|
{
|
||||||
|
// stop autoWalking
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
|
||||||
|
// setting targets
|
||||||
|
this._targetPhi = sglDegToRad(newstate[0]);
|
||||||
|
this._targetTheta = sglDegToRad(newstate[1]);
|
||||||
|
this._targetPanX = newstate[2];
|
||||||
|
this._targetPanY = newstate[3];
|
||||||
|
this._targetPanZ = newstate[4];
|
||||||
|
this._targetDistance = newstate[5];
|
||||||
|
|
||||||
|
//check limits
|
||||||
|
if(this._limitPhi)
|
||||||
|
this._targetPhi = this._clamp(this._targetPhi, this._minMaxPhi[0], this._minMaxPhi[1]);
|
||||||
|
this._targetPhi = this._targetPhi % (2*Math.PI);
|
||||||
|
this._targetTheta = this._clamp(this._targetTheta, this._minMaxTheta[0], this._minMaxTheta[1]);
|
||||||
|
this._targetPanX = this._clamp(this._targetPanX, this._minMaxPanX[0], this._minMaxPanX[1]);
|
||||||
|
this._targetPanY = this._clamp(this._targetPanY, this._minMaxPanY[0], this._minMaxPanY[1]);
|
||||||
|
this._targetPanZ = this._clamp(this._targetPanZ, this._minMaxPanZ[0], this._minMaxPanZ[1]);
|
||||||
|
this._targetDistance = this._clamp(this._targetDistance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
|
||||||
|
// setting base velocities
|
||||||
|
this._speedPhi = Math.PI;
|
||||||
|
this._speedTheta = Math.PI;
|
||||||
|
this._speedPanX = 1.0;
|
||||||
|
this._speedPanY = 1.0;
|
||||||
|
this._speedPanZ = 1.0;
|
||||||
|
this._speedDistance = 2.0;
|
||||||
|
|
||||||
|
//if phi unconstrained rotation, it is necessary to find a good rotation direction
|
||||||
|
if(!this._limitPhi){
|
||||||
|
// normalize (-2pi 2pi) current phi angle, to prevent endless unwinding
|
||||||
|
this._phi = this._phi % (2*Math.PI);
|
||||||
|
|
||||||
|
// determine minimal, normalized target phi angle, to prevent endless unwinding
|
||||||
|
var clampedangle = this._targetPhi;
|
||||||
|
clampedangle = clampedangle % (2*Math.PI);
|
||||||
|
|
||||||
|
if(Math.abs(clampedangle - this._phi) < Math.PI) { // standard rotation
|
||||||
|
if(clampedangle > this._phi){
|
||||||
|
this.speedphi = Math.PI;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.speedphi = -Math.PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(clampedangle > this._phi){
|
||||||
|
clampedangle = (clampedangle - 2*Math.PI)
|
||||||
|
this.speedphi = -Math.PI;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
clampedangle = (clampedangle + 2*Math.PI)
|
||||||
|
this.speedphi = Math.PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._targetPhi = clampedangle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find max animation time to set a time limit and then synchronize all movements
|
||||||
|
var timePhi = Math.abs((this._targetPhi - this._phi) / this._speedPhi);
|
||||||
|
var timeTheta = Math.abs((this._targetTheta - this._theta) / this._speedTheta);
|
||||||
|
var timeDistance = Math.abs((this._targetDistance - this._distance) / this._speedDistance);
|
||||||
|
var timePanX = Math.abs((this._targetPanX - this._panX) / this._speedPanX);
|
||||||
|
var timePanY = Math.abs((this._targetPanY - this._panY) / this._speedPanY);
|
||||||
|
var timePanZ = Math.abs((this._targetPanZ - this._panZ) / this._speedPanZ);
|
||||||
|
|
||||||
|
var maxtime = Math.max( timePhi, Math.max( timeTheta, Math.max( timeDistance, Math.max( timePanX, Math.max( timePanY, timePanZ )))));
|
||||||
|
var animationtime = this._clamp(maxtime, 0.5, 2.0);
|
||||||
|
|
||||||
|
if(newtime) animationtime = newtime;
|
||||||
|
else if (this._animationTime) animationtime = this._animationTime;
|
||||||
|
|
||||||
|
this._speedPhi *= timePhi / animationtime;
|
||||||
|
this._speedTheta *= timeTheta / animationtime;
|
||||||
|
this._speedDistance *= timeDistance / animationtime;
|
||||||
|
this._speedPanX *= timePanX / animationtime;
|
||||||
|
this._speedPanY *= timePanY / animationtime;
|
||||||
|
this._speedPanZ *= timePanZ / animationtime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(this._pathPosNum == this._pathStates.length){
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var state = this._pathStates[this._pathPosNum][0];
|
||||||
|
var time = this._animationTime;
|
||||||
|
if(!Array.isArray(state)) state = this._pathStates[this._pathPosNum];
|
||||||
|
else if (this._pathStates[this._pathPosNum][1]) time = this._pathStates[this._pathPosNum][1];
|
||||||
|
if(!this._isAutoWalking) this.animateToState(state, time);
|
||||||
|
this._isAutoWalking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// start animation
|
||||||
|
this._isAnimating = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
recenter : function (newpoint) {
|
||||||
|
// stop animation
|
||||||
|
this._isAnimating = this._isAutoWalking = false;
|
||||||
|
|
||||||
|
var newpanX = (newpoint[0]-presenter.sceneCenter[0]) * presenter.sceneRadiusInv;
|
||||||
|
var newpanY = (newpoint[1]-presenter.sceneCenter[1]) * presenter.sceneRadiusInv;
|
||||||
|
var newpanZ = (newpoint[2]-presenter.sceneCenter[2]) * presenter.sceneRadiusInv;
|
||||||
|
|
||||||
|
this.animateToState([sglRadToDeg(this._phi), sglRadToDeg(this._theta), newpanX, newpanY, newpanZ, (this._distance * 0.6)]);
|
||||||
|
},
|
||||||
|
|
||||||
|
tick : function (dt) {
|
||||||
|
if(!this._isAnimating) return false;
|
||||||
|
|
||||||
|
var deltaPhi = this._speedPhi * dt;
|
||||||
|
var deltaTheta = this._speedTheta * dt;
|
||||||
|
var deltaDistance = this._speedDistance * dt;
|
||||||
|
var deltaPanX = this._speedPanX * dt;
|
||||||
|
var deltaPanY = this._speedPanY * dt;
|
||||||
|
var deltaPanZ = this._speedPanZ * dt;
|
||||||
|
|
||||||
|
var diffPhi = this._targetPhi - this._phi;
|
||||||
|
var diffTheta = this._targetTheta - this._theta;
|
||||||
|
var diffDistance = this._targetDistance - this._distance;
|
||||||
|
var diffPanX = this._targetPanX - this._panX;
|
||||||
|
var diffPanY = this._targetPanY - this._panY;
|
||||||
|
var diffPanZ = this._targetPanZ - this._panZ;
|
||||||
|
|
||||||
|
if (diffPhi > deltaPhi)
|
||||||
|
this._phi += deltaPhi;
|
||||||
|
else if (diffPhi < -deltaPhi)
|
||||||
|
this._phi -= deltaPhi;
|
||||||
|
else
|
||||||
|
this._phi = this._targetPhi;
|
||||||
|
|
||||||
|
if (diffTheta > deltaTheta)
|
||||||
|
this._theta += deltaTheta;
|
||||||
|
else if (diffTheta < -deltaTheta)
|
||||||
|
this._theta -= deltaTheta;
|
||||||
|
else
|
||||||
|
this._theta = this._targetTheta;
|
||||||
|
|
||||||
|
if (diffDistance > deltaDistance)
|
||||||
|
this._distance += deltaDistance;
|
||||||
|
else if (diffDistance < -deltaDistance)
|
||||||
|
this._distance -= deltaDistance;
|
||||||
|
else
|
||||||
|
this._distance = this._targetDistance;
|
||||||
|
|
||||||
|
if (diffPanX > deltaPanX)
|
||||||
|
this._panX += deltaPanX;
|
||||||
|
else if (diffPanX < -deltaPanX)
|
||||||
|
this._panX -= deltaPanX;
|
||||||
|
else
|
||||||
|
this._panX = this._targetPanX;
|
||||||
|
|
||||||
|
if (diffPanY > deltaPanY)
|
||||||
|
this._panY += deltaPanY;
|
||||||
|
else if (diffPanY < -deltaPanY)
|
||||||
|
this._panY -= deltaPanY;
|
||||||
|
else
|
||||||
|
this._panY = this._targetPanY;
|
||||||
|
|
||||||
|
if (diffPanZ > deltaPanZ)
|
||||||
|
this._panZ += deltaPanZ;
|
||||||
|
else if (diffPanZ < -deltaPanZ)
|
||||||
|
this._panZ -= deltaPanZ;
|
||||||
|
else
|
||||||
|
this._panZ = this._targetPanZ;
|
||||||
|
|
||||||
|
if(this._phi == this._targetPhi)
|
||||||
|
if(this._theta == this._targetTheta)
|
||||||
|
if(this._distance == this._targetDistance)
|
||||||
|
if(this._panX == this._targetPanX)
|
||||||
|
if(this._panY == this._targetPanY)
|
||||||
|
if(this._panZ == this._targetPanZ){
|
||||||
|
this._isAnimating = false;
|
||||||
|
if(typeof onTrackballArrived != "undefined")
|
||||||
|
onTrackballArrived(this.getState());
|
||||||
|
if(this._isAutoWalking) { this._pathPosNum++; this._isAutoWalking = false; this.animateToState(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
set action(a) { if(this._action != a) { this._new_action = true; this._action = a; } },
|
||||||
|
|
||||||
|
get action() { return this._action; },
|
||||||
|
|
||||||
|
get matrix() { this._computeMatrix(); return this._matrix; },
|
||||||
|
|
||||||
|
get distance() { return this._distance; },
|
||||||
|
|
||||||
|
reset : function () {
|
||||||
|
this._matrix = SglMat4.identity();
|
||||||
|
this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
this._new_action = true;
|
||||||
|
|
||||||
|
this._phi = this._startPhi;
|
||||||
|
this._theta = this._startTheta;
|
||||||
|
this._distance = this._startDistance;
|
||||||
|
this._panX = this._startPanX;
|
||||||
|
this._panY = this._startPanY;
|
||||||
|
this._panZ = this._startPanZ;
|
||||||
|
|
||||||
|
this._pathPosNum = 0;
|
||||||
|
|
||||||
|
this._isAutoWalking = false;
|
||||||
|
this._isAnimating = false;
|
||||||
|
|
||||||
|
this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
track : function(m, x, y, z) {
|
||||||
|
if(this._animationLocked && this._isAnimating) this._action = SGL_TRACKBALL_NO_ACTION;
|
||||||
|
if(this._new_action) {
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
this._new_action = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dx = this._start[0] - x;
|
||||||
|
var dy = this._start[1] - y;
|
||||||
|
this._start[0] = x;
|
||||||
|
this._start[1] = y;
|
||||||
|
|
||||||
|
switch (this._action) {
|
||||||
|
case SGL_TRACKBALL_ROTATE:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.rotate(m, dx, dy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_PAN:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.pan(m, dx, dy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SGL_TRACKBALL_SCALE:
|
||||||
|
this._isAnimating = this._isAutoWalking = false; //stopping animation
|
||||||
|
this.scale(m, z);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this._computeMatrix();
|
||||||
|
},
|
||||||
|
|
||||||
|
pan: function(m, dx, dy) {
|
||||||
|
//determining current X, Y and Z axis
|
||||||
|
var Xvec = [1.0, 0.0, 0.0, 1.0];
|
||||||
|
var Yvec = [0.0, 1.0, 0.0, 1.0];
|
||||||
|
var Zvec = [0.0, 0.0, 1.0, 1.0];
|
||||||
|
Xvec = SglMat4.mul4(SglMat4.rotationAngleAxis(this._phi, [0.0, -1.0, 0.0]), Xvec);
|
||||||
|
Yvec = SglMat4.mul4(SglMat4.rotationAngleAxis(this._phi, [0.0, -1.0, 0.0]), Yvec);
|
||||||
|
Zvec = SglMat4.mul4(SglMat4.rotationAngleAxis(this._phi, [0.0, -1.0, 0.0]), Zvec);
|
||||||
|
Xvec = SglMat4.mul4(SglMat4.rotationAngleAxis(this._theta, [1.0, 0.0, 0.0]), Xvec);
|
||||||
|
Yvec = SglMat4.mul4(SglMat4.rotationAngleAxis(this._theta, [1.0, 0.0, 0.0]), Yvec);
|
||||||
|
Zvec = SglMat4.mul4(SglMat4.rotationAngleAxis(this._theta, [1.0, 0.0, 0.0]), Zvec);
|
||||||
|
|
||||||
|
var panSpeed = Math.max(Math.min(1.5, this._distance),0.05);
|
||||||
|
this._panX += ((dx * Xvec[0]) + (dy * Xvec[1])) * panSpeed;
|
||||||
|
this._panY += ((dx * Yvec[0]) + (dy * Yvec[1])) * panSpeed;
|
||||||
|
this._panZ += ((dx * Zvec[0]) + (dy * Zvec[1])) * panSpeed;
|
||||||
|
|
||||||
|
//clamping
|
||||||
|
this._panX = this._clamp(this._panX, this._minMaxPanX[0], this._minMaxPanX[1]);
|
||||||
|
this._panY = this._clamp(this._panY, this._minMaxPanY[0], this._minMaxPanY[1]);
|
||||||
|
this._panZ = this._clamp(this._panZ, this._minMaxPanZ[0], this._minMaxPanZ[1]);
|
||||||
|
},
|
||||||
|
|
||||||
|
rotate: function(m, dx, dy) {
|
||||||
|
this._phi += dx;
|
||||||
|
if(this._limitPhi)
|
||||||
|
this._phi = this._clamp(this._phi, this._minMaxPhi[0], this._minMaxPhi[1]);
|
||||||
|
|
||||||
|
// avoid eternal accumulation of rotation, just for the sake of cleanliness
|
||||||
|
if (this._phi > 10.0) this._phi = this._phi - 10.0;
|
||||||
|
if (this._phi < -10.0) this._phi = this._phi + 10.0;
|
||||||
|
|
||||||
|
this._theta += dy;
|
||||||
|
this._theta = this._clamp(this._theta, this._minMaxTheta[0], this._minMaxTheta[1]);
|
||||||
|
},
|
||||||
|
|
||||||
|
scale : function(m, s) {
|
||||||
|
this._distance *= s;
|
||||||
|
this._distance = this._clamp(this._distance, this._minMaxDist[0], this._minMaxDist[1]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/***********************************************************************/
|
||||||
23
frontend/src/config/bootstrap.ts
Normal file
23
frontend/src/config/bootstrap.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import "@/styles/main.css"
|
||||||
|
|
||||||
|
|
||||||
|
type BootstrapOptions = {
|
||||||
|
activeLink?: string | null;
|
||||||
|
onReady?: () => void | Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function bootstrap(options: BootstrapOptions = {}): Promise<void> {
|
||||||
|
const {
|
||||||
|
activeLink = null,
|
||||||
|
onReady,
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
if(activeLink !== null){setActiveLink(activeLink);}
|
||||||
|
|
||||||
|
await onReady?.();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setActiveLink(activeLink:string): void{
|
||||||
|
const link = document.getElementById(activeLink);
|
||||||
|
link?.classList.add('active');
|
||||||
|
}
|
||||||
0
frontend/src/config/ui.ts
Normal file
0
frontend/src/config/ui.ts
Normal file
9
frontend/src/pages/index/index.ts
Normal file
9
frontend/src/pages/index/index.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { bootstrap } from "@/config/bootstrap"
|
||||||
|
|
||||||
|
bootstrap({
|
||||||
|
onReady:() => init()
|
||||||
|
})
|
||||||
|
|
||||||
|
export function init(){
|
||||||
|
console.log('index')
|
||||||
|
}
|
||||||
8
frontend/src/styles/main.css
Normal file
8
frontend/src/styles/main.css
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
@plugin "daisyui"; /* NOSONAR */
|
||||||
|
|
||||||
|
:root{
|
||||||
|
--dc-primary: rgb(34, 69, 138);
|
||||||
|
--dc-dark-blue: rgb(0, 15, 46);
|
||||||
|
--dc-white: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
31
frontend/tsconfig.json
Normal file
31
frontend/tsconfig.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||||
|
"types": ["vite/client", "node", "leaflet"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true,
|
||||||
|
|
||||||
|
/* Path Aliases - Molto utile per evitare ../../../ */
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
106
frontend/vite.config.ts
Normal file
106
frontend/vite.config.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import { defineConfig } from 'vitest/config'
|
||||||
|
import type { Plugin } from 'vite'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
import { readdirSync } from 'node:fs'
|
||||||
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
import { visualizer } from 'rollup-plugin-visualizer'
|
||||||
|
|
||||||
|
// MPA: raccoglie automaticamente ogni *.html nella root di frontend/ come entry di build.
|
||||||
|
// { 'index': '/app/index.html', 'scheda': '/app/scheda.html', ... }
|
||||||
|
const frontendRoot = fileURLToPath(new URL('.', import.meta.url))
|
||||||
|
const htmlEntries = Object.fromEntries(
|
||||||
|
readdirSync(frontendRoot)
|
||||||
|
.filter((file) => file.endsWith('.html'))
|
||||||
|
.map((file) => [file.slice(0, -'.html'.length), fileURLToPath(new URL(file, import.meta.url))])
|
||||||
|
)
|
||||||
|
|
||||||
|
function mpaRewritePlugin(): Plugin {
|
||||||
|
return {
|
||||||
|
name: 'mpa-rewrite',
|
||||||
|
configureServer(server: any) {
|
||||||
|
server.middlewares.use((req: any, _res: any, next: any) => {
|
||||||
|
if (
|
||||||
|
req.url &&
|
||||||
|
!req.url.includes('.') &&
|
||||||
|
!req.url.startsWith('/@') &&
|
||||||
|
!req.url.startsWith('/api') &&
|
||||||
|
!req.url.startsWith('/sanctum') &&
|
||||||
|
!req.url.startsWith('/storage') &&
|
||||||
|
!req.url.startsWith('/documentation') &&
|
||||||
|
!req.url.startsWith('/api-docs') &&
|
||||||
|
req.url !== '/'
|
||||||
|
) {
|
||||||
|
// Mappa il primo segmento del path sul relativo .html.
|
||||||
|
// Es: /scheda/uno-slug -> /scheda.html (lo slug resta leggibile da location.pathname)
|
||||||
|
const firstSegment = req.url.split('?')[0].split('/')[1]
|
||||||
|
req.url = `/${firstSegment}.html`
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
tailwindcss(),
|
||||||
|
visualizer(),
|
||||||
|
mpaRewritePlugin()
|
||||||
|
],
|
||||||
|
resolve: {
|
||||||
|
// Alias lato Vite/bundler: tsconfig `paths` vale solo per il type-check, Vite
|
||||||
|
// ha bisogno del proprio alias per risolvere `@/...` a runtime e in build.
|
||||||
|
alias: {
|
||||||
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
// MPA: auto-detect delle pagine. Ogni *.html nella root di frontend/ è un entry
|
||||||
|
// (nome = file senza estensione). Aggiungere una pagina = creare il suo .html,
|
||||||
|
// nessuna modifica qui. Vedi htmlEntries sotto.
|
||||||
|
input: htmlEntries,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
host: '0.0.0.0',
|
||||||
|
allowedHosts: ['dyncoll-dev.local'],
|
||||||
|
port: 5173,
|
||||||
|
proxy: {
|
||||||
|
'/api-docs': {
|
||||||
|
target: 'http://backend:8000',
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
rewrite: (path: string) => path.replace(/^\/api-docs/, '/docs')
|
||||||
|
},
|
||||||
|
'/api': {
|
||||||
|
target: 'http://backend:8000',
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false // accetta certificati self-signed
|
||||||
|
},
|
||||||
|
'/sanctum': {
|
||||||
|
target: 'http://backend:8000',
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
'/storage': {
|
||||||
|
target: 'http://backend:8000',
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false // accetta certificati self-signed
|
||||||
|
},
|
||||||
|
// Documentazione utente (MkDocs) — servizio docker `docs`
|
||||||
|
'/documentation': {
|
||||||
|
target: 'http://docs:8000',
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
rewrite: (path: string) => path.replace(/^\/documentation/, '') || '/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
coverage: {
|
||||||
|
provider: 'v8',
|
||||||
|
reporter: ['text', 'html', 'lcov'],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
39
sonar-project.properties
Normal file
39
sonar-project.properties
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Identità del progetto
|
||||||
|
sonar.projectKey=dyncoll
|
||||||
|
sonar.projectName=Dynamic Collection
|
||||||
|
sonar.projectVersion=3.0
|
||||||
|
sonar.projectBaseDir=.
|
||||||
|
|
||||||
|
# Sorgenti da analizzare
|
||||||
|
sonar.sources=backend/app, backend/resources/, backend/routes, frontend/src
|
||||||
|
|
||||||
|
# Esclusioni per non appesantire l'analisi e ignorare file inutili
|
||||||
|
sonar.exclusions=**/*.spec.ts,frontend/node_modules/**,frontend/dist/**,backend/vendor/**,backend/storage/**,backend/database/migrations/**,backend/database/seeders/**,backend/tests/**,backend/config/**,backend/app/Actions/**,backend/app/Providers/**,backend/routes/**,backend/app/Http/Traits/**
|
||||||
|
|
||||||
|
# Esclusioni dalla COPERTURA (i file restano analizzati per gli issue, ma non
|
||||||
|
# contano nella coverage): codice UI/DOM e wiring non coperto da unit test
|
||||||
|
# (pages = entry/wiring, config = bootstrap/ui, viewer = integrazione 3DHOP WebGL,
|
||||||
|
# types = solo dichiarazioni .d.ts). La logica testabile (shared/**: utils, api, …)
|
||||||
|
# resta misurata.
|
||||||
|
sonar.coverage.exclusions=frontend/src/pages/**,frontend/src/config/**,frontend/src/viewer/**,frontend/src/types/**
|
||||||
|
|
||||||
|
# Configurazione specifica per Lingue
|
||||||
|
# sonar.language=php
|
||||||
|
sonar.php.exclusions=**/vendor/**
|
||||||
|
sonar.typescript.tsconfigPath=frontend/tsconfig.json
|
||||||
|
sonar.javascript.lcov.reportPaths=frontend/coverage/lcov.info
|
||||||
|
sonar.typescript.lcov.reportPaths=frontend/coverage/lcov.info
|
||||||
|
|
||||||
|
# Codifica file
|
||||||
|
sonar.sourceEncoding=UTF-8
|
||||||
|
|
||||||
|
# Qualità: Forza lo scanner ad aspettare l'esito della Quality Gate
|
||||||
|
sonar.qualitygate.wait=true
|
||||||
|
|
||||||
|
sonar.php.coverage.reportPaths=backend/coverage.xml
|
||||||
|
|
||||||
|
# Escludi le at-rule custom di Tailwind v4 dall'analisi CSS
|
||||||
|
sonar.css.stylelint.reportPaths=
|
||||||
|
sonar.issue.ignore.multicriteria=e1
|
||||||
|
sonar.issue.ignore.multicriteria.e1.ruleKey=css:S4662
|
||||||
|
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.css
|
||||||
Reference in New Issue
Block a user