feat(project): PC tray notifier for mentions and assignments

Windows tray app (desktop/notifier, C# .NET Framework 4.8 WinForms,
single exe, no installer/admin) that shows the same big alert popup as
the web even when the browser is in the background: layered topmost
window that does not steal focus, blinking border, open/close actions,
sound, autostart toggle, DPAPI-encrypted token.

Server side (project_db migration 023):
- notifier_links / notifier_tokens (SHA-256 hashes only)
- device link flow: link/start -> browser approve at /project/notifier
  -> link/poll issues token once
- Bearer API for alerts/read/logout reusing _alerts_payload; token
  re-checks current user record and project permission each call
- /project/notifier page (approve, connected PCs, revoke, download)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 10:21:58 +09:00
parent 8f46d6c13a
commit 06af036f86
24 changed files with 2093 additions and 3 deletions
+18
View File
@@ -125,6 +125,24 @@ docker exec postgres-db psql -U postgres -d project_db -c "SELECT to_regclass('g
설정이 없거나 권한이 모자라면 버튼을 눌렀을 때 사유가 안내되고(503), 회의록 다른 기능은 그대로 동작한다.
## PC 알림 프로그램 마이그레이션 (023)
023은 `notifier_links`·`notifier_tokens` 테이블만 추가한다(기존 값 그대로, 다시 실행 가능). 미적용이면 `/project/notifier` 화면은
"마이그레이션 필요" 안내만, PC 알림 API 는 503.
```bash
cd /opt/www/main
docker exec postgres-db pg_dump -U postgres project_db > ~/project_db_before_023_$(date +%Y%m%d%H%M).sql
docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db < scripts/sql/project_db_023_notifier.sql
```
내려받기 파일(선택): 개발 PC 에서 `desktop/notifier/build.ps1` 로 만든 `dist/DBXNotifier.exe` 를 서버로 옮긴 뒤 컨테이너 데이터 볼륨에 둔다.
없으면 화면에 "관리자에게 받으세요"만 나온다(공유 드라이브로 나눠 줘도 된다).
```bash
cd /opt/www/main && docker compose exec web mkdir -p /data/notifier && docker compose cp ~/DBXNotifier.exe web:/data/notifier/DBXNotifier.exe
```
## 주간 회의록 회의 완료 마이그레이션 (022)
022는 `goal_meetings` 에 `completed_at`·`completed_by` 열만 추가한다(기존 값 그대로, 다시 실행 가능). 미적용이면 [회의 완료] 버튼이 나오지 않고
+23
View File
@@ -1041,6 +1041,29 @@ SELECT t.id, t.title FROM tasks t JOIN project_stages s ON s.id = t.stage_id
교정안: 날짜 역전은 담당자와 확인해 한쪽을 고치고, 빈 댓글은 작성자 확인 후 삭제, 완료 섹션 미완료는 완료로 표시하거나 섹션을 옮긴다.
권한을 잃은 사람의 담당자·멘션·협업자 기록은 지우지 않아도 된다(화면·알림은 이미 지금 권한으로 거른다).
## 6-11. PC 알림 프로그램 (마이그레이션 023, 2026-10-08)
웹 큰 팝업(`initTaskAlerts`)은 브라우저 탭이 보일 때만 뜬다. 브라우저가 뒤에 있어도 같은 알림을 PC 화면 위에 크게 띄우는
Windows 트레이 프로그램 **DBX 알림**(`desktop/notifier/`, C# .NET Framework 4.8 WinForms, exe 하나). 빌드·배포·백신 주의는
`desktop/notifier/README.md`.
- **연결(토큰)**: 브라우저 쿠키를 쓸 수 없어 PC마다 토큰. ① 프로그램 `POST /project/api/notifier/link/start {device}`(로그인
없음 → 화면 코드 `XXXX-XXXX` + poll 비밀값, 10분, 대기 200건 상한 429) → ② 브라우저 `/project/notifier?code=`(로그인 필요,
없으면 `/login?next=`)에서 PC 이름·코드 확인 후 [연결] = `POST .../link/approve {code}` → ③ 프로그램 `POST .../link/poll {poll}`
→ `pending`/`expired`/`ok`(토큰 **한 번만**). `notifier_links`·`notifier_tokens` 에는 poll·토큰 **SHA-256 만** 저장.
PC 쪽 토큰은 Windows DPAPI(현재 사용자)로 암호화해 `%APPDATA%\DBXNotifier\settings.json`.
- **알림**: `GET /project/api/notifier/alerts?after=` (`Authorization: Bearer`) — 웹 `/api/notifications/alerts` 와 같은
`_alerts_payload`(태그·배정, 읽지 않은 것, 지금 볼 수 있는 작업만) + `name`. 토큰마다 **지금** 사용자 레코드·`project` 권한을
다시 확인(해제·권한 회수 = 401 → 프로그램이 연결 끊김 안내). `POST .../alerts/{id}/read`, `POST .../logout`(토큰 해제).
- **프로그램 동작**: 20초마다 확인(절전 해제 시 바로). 처음 연결하면 최신 번호를 기준으로(옛 알림 몰아 띄우지 않음),
새 번호가 오면 마우스가 있는 화면 아래 가운데에 웹과 같은 모양의 큰 창(맨 위, 포커스 안 뺏음, 보라↔주황 깜박임, 최대 6줄 +
"외 N건 더") + 알림 소리. [열기] = 기본 브라우저로 작업 + 읽음, [닫기] = 그 번호까지 본 것으로(PC 설정 `last_seen`).
웹에서 읽은 알림은 다음 확인 때 창에서 빠진다. 웹 팝업의 "본 것"(localStorage)과는 따로다.
- **화면** `/project/notifier`(사이드바 "PC 알림"): 연결 승인 카드, 설치 안내, 내 연결된 PC 목록·[연결 해제]
(`POST /project/api/notifier/devices/{id}/revoke`). 내려받기 `GET /project/notifier/download` = 서버
`DATA_DIR/notifier/DBXNotifier.exe`(컨테이너 `/data/notifier/`) — 파일이 없으면 버튼 대신 "관리자에게 받으세요".
- 023 미적용이면 화면은 안내만, notifier API 는 503.
## 7. 추후 단계
작업 라벨(태그 분류) · 반복 작업 · 템플릿 · 작업 의존성 · 하위 작업의 하위 작업(다단계 중첩,