Webbook
학습자 웹북 뷰어 — � �마 결정 / 진도 계산 / 콘� �츠 모드 결정 (Pure)
상태
| 항목 | 값 |
|---|---|
| Layer | domain |
| Tier | L1 |
| Status | wip |
| Version | 0.9.0 |
| 가격 | Free (free) |
| **카� | |
| �고리** | Content |
개요
개요
Webbook 은 multi-saas-kit 의 Layer 3 Domain Plugin � 니다. 학습자가 � /레슨을 탐색하고 콘� �츠를 보는 viewer 의 핵심 결정 로직 — � �마 / 진도 / 콘� �츠 모드 — 을 모델 의존 없이 Pure 로 제공합니다.
DocumentProcessor (HtmlRenderer) + Annotation (anchor 가시성) 위에 학습자 viewer 레이어를 얹는 도메인 핵심.
핵심 컴포넌트 (3 Pure Service)
ThemeResolver
academy.how WebbookController::resolveEffectiveTheme 추출. 학습자 viewer �
�마 4단계 우선순위:
- URL
?theme=xxx(운영자 미리보기) Book.theme(교재별 분위기)Tenant.settings.academy.default_theme(학원/ 조직 기본)- config default (
'system')
allowed 화이트리스트로 모든 단계에서 검증 — 미허용 값은 다음 단계로 폴백.
$theme = $resolver->resolve(
queryTheme: $request->query('theme'),
bookTheme: $book?->theme,
tenantSettings: $tenant?->settings,
);
ProgressCalculator + LessonProgress DTO
academy.how WebbookController::showLesson 의 진도/이전/다음 계산 추출. lesson id 배열 + 현재 lesson id 만으로 결정.
출력 (LessonProgress):
currentIndex(0-based)totalprogressPercent(0~100)prevId/nextId(없으면 null)toArray()시current_position(1-based) 포함
$progress = $calc->calculate($lessonIds, $currentId);
// → progress_percent, prev_id, next_id
ContentModeResolver
academy.how WebbookController::showLesson 의 image | html 분기 추출.
- �
력:
?content=xxx+hasActiveHtml: bool - 'html' 요청 + activeHtml 미존재 → 'image' 자동 폴백
- 미허용 값 → default ('image')
$mode = $resolver->resolve($request->query('content'), $lesson->activeDocument(...) !== null);
설정 (config/webbook.php)
return [
'enabled' => env('PLG_WEBBOOK_ENABLED', true),
'theme' => [
'allowed' => ['system', 'light', 'dark', 'sepia', 'high_contrast', 'soft', 'ocean', 'forest'],
'default' => 'system',
],
'content_mode' => [
'allowed' => ['image', 'html'],
'default' => 'image',
],
];
사용 예시
use App\Plugins\Webbook\Services\{ThemeResolver, ProgressCalculator, ContentModeResolver};
$theme = ThemeResolver::fromConfig(config('webbook'))->resolve(
$request->query('theme'),
$book->theme,
$tenant?->settings,
);
$progress = (new ProgressCalculator)->calculate(
$allLessons->pluck('id')->all(),
$currentLesson->id,
);
$contentMode = ContentModeResolver::fromConfig(config('webbook'))->resolve(
$request->query('content'),
hasActiveHtml: $activeHtml !== null,
);
return view('webbook.lesson', compact('theme', 'progress', 'contentMode', /*...*/));
출처
academy.how 의 WebbookController 에서 추출. Eloquent Book/Lesson/Page/Asset/LessonModule/ModuleType 의존 부분은 프로젝트에 그대로 남기고, 모델 무관한 결정 로직만 Pure 로 분리.
의존성
- DocumentProcessor — HtmlRenderer / activeDocument 활용 (호출자 � 임)
- Annotation — anchor 별 tip/note 표시 (호출자 � 임)
다른 Plugin 과의 관계
- LessonThread — lesson 페이지에 thread 위젯 임베드 (선택)
다음 단계 (Phase 3+)
- 표준
Book/Lesson/PageModel + Migration (선택 활성) - Filament Resource (관리자 webbook 관리)
- Vue/React viewer SDK
- Phase A pattern composition + tip injection 통합
라이선스
MIT
의존성
데모
- Platform 관리자 패널에서 메타 확인 🔒 로그인 필요
- 사용 예시 (PHP)
🛒 Plugin Store에서 보기: store.codebase.how/plugins/webbook