Files
vtube/docs/ARCHITECTURE.md
goboss 981a0ad9b6 Document granular hook policy + ad architecture + 94-site scale
Hook redesign (guard-readonly.sh + guard-bash.sh):
- ALLOW edits: /home/nosfortube/frontend_<port>/ (digits-only, all subdirs)
  + /home/nosfortube/orest/ (user working zone + screenshots)
- DENY: lang variants (frontend_<port>_<lang>/), frontend_core/, .git/,
  system paths (/etc/, /usr/, /boot/, /var/* except /var/log/claude/)
- 19/19 readonly + 18/19 bash tests pass (1 pre-existing sed-i regex gap)
- Backup попередньої версії: .bak.2026-05-02

Doc updates:
- New: PROJECT.md, ARCHITECTURE.md, DEPLOY.md, ADS.md, PERFORMANCE.md,
  INTERLINKING.md, ADMINS.md (topic-split docs/)
- CLAUDE.md: 94-site scale, granular edit zones, doc index
- INFRASTRUCTURE.md: hook table updated
- SITES.md: scope note (14 backup-tracked of 94 total)
- RECOMMENDATIONS.md: W1 (hook conflict) → DONE; W2-W3, D1-D4 added

Site architecture findings (audit 2026-05-02):
- 94 frontend_<port>/ sites, 71 in site-name-routing.csv, 14 backup-tracked
- 3 ad-architectures coexist: 8148 modern bundle (1), modern partials (~23),
  legacy inline surstrom (31)
- 8148 unique: ad-bundle.min.js source files, build-ad-bundle.sh, terser
- Server IP 185.73.222.75 у t1.* allowlist (curl probes work)
- CDN: custom + Cloudflare на 8081 etc; purge-cache при prod deploy

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:26:25 +00:00

64 lines
3.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# tubev — Per-Site Architecture
Що де лежить у `/home/nosfortube/frontend_<port>/` і яка зона безпечна для редагування.
## Folder map
```
/home/nosfortube/frontend_<port>/
├── views/ ← НАША зона
│ ├── *.etlua templates (layout, video page, list, footer, ...)
│ ├── modules/ reusable module includes
│ ├── css/ etlua-rendered CSS chunks (часто critical inline)
│ └── static/ ← public-served assets
│ ├── css/ deferred CSS files
│ ├── js/
│ │ ├── lib/ ← SHARED (НЕ редагувати для one-off!)
│ │ ├── lib2/ ← SHARED (НЕ редагувати для one-off!)
│ │ ├── c2.js, auth.js, comment.js, profile_index.js, main.js, ...
│ │ └── *.min.js
│ └── videojs-v10/ video player
├── lib/
│ └── <port>/
│ └── var.lua ← per-site config змінні (потребує kor reboot!)
└── (інше) ← НЕ чіпаємо
```
## Site name → port
`/home/nosfortube/orest/site-name-routing.csv`:
```csv
site name;id;url-pattern;new-url-pattern
atube.sex;8082;/video/;/video/hold/
hdmmovies.xxx;8083;/video/;/video/offline/
...
```
Лукап: `grep ';8083;' /home/nosfortube/orest/site-name-routing.csv` → site name.
## SHARED vs per-site
**SHARED (зміни → всі сайти):**
- `views/static/js/lib/` — основний shared, активно використовується звичайними скриптами
- `views/static/js/lib2/` — другий shared bucket. Юзер каже: "в цілому сайти що юзають звичайні скрипти то ніби ніколи не бачив що тянуть щось з lib2, тільки lib". **Реальне використання lib2 — рідкісне** (можливо historical / specific subset).
**Правило:** якщо щось правиш у `lib/` або `lib2/` — зміна поширюється на ВСІ сайти. Per-site fix робити НЕ можна тут. Винести у per-site файл або параметризувати через `var.lua`.
**Per-site (editable безпечно):**
- `views/*.etlua` (всі templates)
- `views/modules/`, `views/css/`
- `views/static/css/`, `views/static/js/<non-shared>.js`
## Config — `lib/<port>/var.lua`
- Lua-таблиця змінних доступних у templates через kor runtime
- **Зміни applied тільки після kor reboot** — це блокер для interactive flow
- Додавати нові змінні → пишеш у `var.lua` → просиш Адміна reboot → змінна стає доступна
## Open questions
- [ ] `lib/` vs `lib2/` — функціональна різниця історична / структурна / випадкова? (lib2 рідко вживається — можливо deprecated subset?)
- [ ] Що ще лежить у `frontend_<port>/` поза `views/` + `lib/`? (services/, conf/, scripts/?) — `ls` коли матимем доступ
- [ ] kor reboot — manual через Адміна, нема self-service API