Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c3877b5c1 | |||
| 3eceec64e7 | |||
| 37b59c7ab6 |
11
.dockerignore
Normal file
11
.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
frontend/node_modules
|
||||||
|
frontend/dist
|
||||||
|
backend/node_modules
|
||||||
|
backend/.sessions
|
||||||
|
backend/uploads
|
||||||
|
docker-compose.yml
|
||||||
|
docs
|
||||||
5
.env.production.example
Normal file
5
.env.production.example
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
MARIADB_ROOT_PASSWORD=change-this-root-password
|
||||||
|
MARIADB_DATABASE=tier_cursor
|
||||||
|
MARIADB_USER=tier_cursor
|
||||||
|
MARIADB_PASSWORD=change-this-db-password
|
||||||
|
SESSION_SECRET=change-this-session-secret
|
||||||
12
README.md
12
README.md
@@ -39,6 +39,18 @@ VITE_API_ORIGIN=http://localhost:5179 npm run dev
|
|||||||
|
|
||||||
자세한 내용은 [docs/local-mariadb.md](/Users/bicute/Desktop/zenn.dev/tier-cursor/docs/local-mariadb.md)를 참고하세요.
|
자세한 내용은 [docs/local-mariadb.md](/Users/bicute/Desktop/zenn.dev/tier-cursor/docs/local-mariadb.md)를 참고하세요.
|
||||||
|
|
||||||
|
## UGREEN NAS 운영 배포
|
||||||
|
|
||||||
|
운영용은 `MariaDB + backend + frontend` 3컨테이너 구조를 권장합니다.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.production.example .env.production
|
||||||
|
docker compose --env-file .env.production -f docker-compose.prod.yml up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
- 프로덕션 컴포즈: [docker-compose.prod.yml](/Users/bicute/Desktop/zenn.dev/tier-cursor/docker-compose.prod.yml)
|
||||||
|
- 배포 가이드: [docs/ugreen-nas-deploy.md](/Users/bicute/Desktop/zenn.dev/tier-cursor/docs/ugreen-nas-deploy.md)
|
||||||
|
|
||||||
## 사용 흐름(현재 구현)
|
## 사용 흐름(현재 구현)
|
||||||
|
|
||||||
- **게임 선택**: `/`에서 게임 클릭
|
- **게임 선택**: `/`에서 게임 클릭
|
||||||
|
|||||||
15
backend/Dockerfile
Normal file
15
backend/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY backend/package*.json ./
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
COPY backend/ ./
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV PORT=5179
|
||||||
|
|
||||||
|
EXPOSE 5179
|
||||||
|
|
||||||
|
CMD ["node", "index.js"]
|
||||||
@@ -34,6 +34,18 @@ function buildUploadFilename(file) {
|
|||||||
return `${Date.now()}-${nanoid()}${safeExt}`
|
return `${Date.now()}-${nanoid()}${safeExt}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildItemLabelFromFilename(file) {
|
||||||
|
const originalName = file?.originalname || ''
|
||||||
|
const base = path.basename(originalName, path.extname(originalName))
|
||||||
|
const normalized = base
|
||||||
|
.replace(/[_-]+/g, ' ')
|
||||||
|
.replace(/\s+/g, ' ')
|
||||||
|
.trim()
|
||||||
|
.slice(0, 60)
|
||||||
|
|
||||||
|
return normalized || 'item'
|
||||||
|
}
|
||||||
|
|
||||||
const upload = multer({
|
const upload = multer({
|
||||||
storage: multer.diskStorage({
|
storage: multer.diskStorage({
|
||||||
destination: (req, file, cb) => cb(null, path.join(__dirname, '..', '..', 'uploads', 'games')),
|
destination: (req, file, cb) => cb(null, path.join(__dirname, '..', '..', 'uploads', 'games')),
|
||||||
@@ -74,20 +86,27 @@ router.post('/games/:gameId/thumbnail', requireAdmin, upload.single('thumbnail')
|
|||||||
res.json({ game: updated })
|
res.json({ game: updated })
|
||||||
})
|
})
|
||||||
|
|
||||||
router.post('/games/:gameId/images', requireAdmin, upload.single('image'), async (req, res) => {
|
router.post('/games/:gameId/images', requireAdmin, upload.array('images', 50), async (req, res) => {
|
||||||
if (!req.file) return res.status(400).json({ error: 'file_required' })
|
const files = Array.isArray(req.files) ? req.files : []
|
||||||
const schema = z.object({ label: z.string().min(1).max(60) })
|
if (!files.length) return res.status(400).json({ error: 'file_required' })
|
||||||
const parsed = schema.safeParse(req.body)
|
|
||||||
if (!parsed.success) return res.status(400).json({ error: 'bad_request' })
|
|
||||||
const game = await findGameById(req.params.gameId)
|
const game = await findGameById(req.params.gameId)
|
||||||
if (!game) return res.status(404).json({ error: 'not_found' })
|
if (!game) return res.status(404).json({ error: 'not_found' })
|
||||||
const item = await createGameItem({
|
|
||||||
id: nanoid(),
|
const manualLabel = typeof req.body?.label === 'string' ? req.body.label.trim() : ''
|
||||||
gameId: game.id,
|
if (manualLabel && manualLabel.length > 60) return res.status(400).json({ error: 'bad_request' })
|
||||||
src: `/uploads/games/${req.file.filename}`,
|
|
||||||
label: parsed.data.label,
|
const items = await Promise.all(
|
||||||
})
|
files.map((file, index) =>
|
||||||
res.json({ item })
|
createGameItem({
|
||||||
|
id: nanoid(),
|
||||||
|
gameId: game.id,
|
||||||
|
src: `/uploads/games/${file.filename}`,
|
||||||
|
label: index === 0 && manualLabel ? manualLabel : buildItemLabelFromFilename(file),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
res.json({ item: items[0], items })
|
||||||
})
|
})
|
||||||
|
|
||||||
router.delete('/games/:gameId/items/:itemId', requireAdmin, async (req, res) => {
|
router.delete('/games/:gameId/items/:itemId', requireAdmin, async (req, res) => {
|
||||||
|
|||||||
79
docker-compose.prod.yml
Normal file
79
docker-compose.prod.yml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
services:
|
||||||
|
mariadb:
|
||||||
|
image: mariadb:11.4
|
||||||
|
container_name: tmaker-mariadb
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD}
|
||||||
|
MARIADB_DATABASE: ${MARIADB_DATABASE}
|
||||||
|
MARIADB_USER: ${MARIADB_USER}
|
||||||
|
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
|
||||||
|
command:
|
||||||
|
- --character-set-server=utf8mb4
|
||||||
|
- --collation-server=utf8mb4_unicode_ci
|
||||||
|
volumes:
|
||||||
|
- tmaker_mariadb_data:/var/lib/mysql
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "mariadb-admin ping -h 127.0.0.1 -u$$MARIADB_USER -p$$MARIADB_PASSWORD --silent"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: backend/Dockerfile
|
||||||
|
container_name: tmaker-backend
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
PORT: 5179
|
||||||
|
DB_HOST: mariadb
|
||||||
|
DB_PORT: 3306
|
||||||
|
DB_USER: ${MARIADB_USER}
|
||||||
|
DB_PASSWORD: ${MARIADB_PASSWORD}
|
||||||
|
DB_NAME: ${MARIADB_DATABASE}
|
||||||
|
SESSION_SECRET: ${SESSION_SECRET}
|
||||||
|
SESSION_COOKIE_SECURE: "true"
|
||||||
|
SESSION_COOKIE_SAME_SITE: "lax"
|
||||||
|
CORS_ORIGINS: https://tmaker.sori.studio
|
||||||
|
TRUST_PROXY: 1
|
||||||
|
volumes:
|
||||||
|
- tmaker_uploads:/app/uploads
|
||||||
|
- tmaker_sessions:/app/.sessions
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: frontend/Dockerfile
|
||||||
|
args:
|
||||||
|
VITE_API_ORIGIN: https://tmaker.sori.studio
|
||||||
|
container_name: tmaker-frontend
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
image: phpmyadmin:5.2-apache
|
||||||
|
container_name: tmaker-phpmyadmin
|
||||||
|
restart: unless-stopped
|
||||||
|
profiles: ["admin"]
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
PMA_HOST: mariadb
|
||||||
|
PMA_PORT: 3306
|
||||||
|
PMA_USER: ${MARIADB_USER}
|
||||||
|
PMA_PASSWORD: ${MARIADB_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- "8081:80"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
tmaker_mariadb_data:
|
||||||
|
tmaker_uploads:
|
||||||
|
tmaker_sessions:
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
# 의사결정 이력
|
# 의사결정 이력
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.34
|
||||||
|
- 일부 NAS 환경에서 `favicon.svg` 정적 응답이 `403`으로 차단될 수 있으므로, 운영 안정성을 위해 별도 파일 요청이 필요 없는 인라인 데이터 URL 파비콘으로 전환하기로 결정했다.
|
||||||
|
- 관리자 기본 아이템 등록은 단일 파일 업로드만으로는 운영 부담이 크므로, 다중 선택과 드래그 앤 드롭을 지원하고 라벨은 파일명으로 자동 생성하는 방향을 채택했다.
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.29
|
||||||
|
- NAS에서 HTTPS를 종료한 뒤 내부 컨테이너끼리는 HTTP로 통신하는 구조에서는, 프런트 프록시가 백엔드에 원래 프로토콜을 정확히 전달하지 않으면 `secure` 세션 쿠키가 발급되지 않는다고 판단했다.
|
||||||
|
- 따라서 운영 프런트 Nginx는 백엔드 프록시 요청에 `X-Forwarded-Proto: https`를 명시하고, Express 세션도 프록시 환경을 명시적으로 신뢰하도록 설정하기로 결정했다.
|
||||||
|
|
||||||
## 2026-03-19
|
## 2026-03-19
|
||||||
- 초기 저장소는 빠른 구현을 위해 `lowdb(JSON 파일)`를 채택했다.
|
- 초기 저장소는 빠른 구현을 위해 `lowdb(JSON 파일)`를 채택했다.
|
||||||
- 인증은 JWT 대신 서버 세션(`express-session` + `session-file-store`)을 사용했다.
|
- 인증은 JWT 대신 서버 세션(`express-session` + `session-file-store`)을 사용했다.
|
||||||
@@ -95,3 +103,13 @@
|
|||||||
|
|
||||||
## 2026-03-26 v0.1.25
|
## 2026-03-26 v0.1.25
|
||||||
- 저장 결과물 기준 너비가 여전히 길다고 판단해, export 보드 폭을 추가로 `960px`까지 줄여 최종 PNG 밀도를 더 낮추기로 결정했다.
|
- 저장 결과물 기준 너비가 여전히 길다고 판단해, export 보드 폭을 추가로 `960px`까지 줄여 최종 PNG 밀도를 더 낮추기로 결정했다.
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.26
|
||||||
|
- 아이콘 크기는 사용자 취향 차이가 큰 요소이므로, 고정값 하나보다 기본 `80px`에 단계형 크기 선택을 제공하는 편이 더 낫다고 판단했다.
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.27
|
||||||
|
- NAS 운영은 리버스 프록시 설정을 단순하게 유지하는 편이 좋으므로, 프런트 컨테이너 하나만 외부 공개하고 `/api`, `/uploads`는 내부 프록시로 넘기는 구조를 채택했다.
|
||||||
|
- 운영은 로컬 개발 컴포즈와 분리된 전용 `docker-compose.prod.yml`을 두고, 환경변수는 `.env.production`으로 분리해 관리하기로 결정했다.
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.28
|
||||||
|
- UGREEN NAS에서 MariaDB 초기화가 길게 걸릴 수 있으므로, healthcheck는 앱 계정보다 `root` 기준 ping과 더 긴 유예 시간으로 두는 편이 안전하다고 판단했다.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
## `/admin`
|
## `/admin`
|
||||||
- 화면 파일: `frontend/src/views/AdminView.vue`
|
- 화면 파일: `frontend/src/views/AdminView.vue`
|
||||||
- 역할: `게임 관리 / 아이템 관리 / 회원 관리` 탭 분리, 선택된 게임의 썸네일/기본 아이템 관리, 사용자 커스텀 아이템 검색/페이지네이션/사용 횟수 확인/미사용 이미지 개별·일괄 삭제, 회원 비밀번호 초기화 포함 회원 관리, 파일 입력 초기화, 아이템 삭제, 게임 삭제
|
- 역할: `게임 관리 / 아이템 관리 / 회원 관리` 탭 분리, 선택된 게임의 썸네일 관리, 기본 아이템 다중 드래그 앤 드롭 업로드, 사용자 커스텀 아이템 검색/페이지네이션/사용 횟수 확인/미사용 이미지 개별·일괄 삭제, 회원 비밀번호 초기화 포함 회원 관리, 파일 입력 초기화, 아이템 삭제, 게임 삭제
|
||||||
- 연동 API: `POST /api/admin/games`, `POST /api/admin/games/:gameId/thumbnail`, `POST /api/admin/games/:gameId/images`, `GET /api/admin/custom-items`, `DELETE /api/admin/custom-items/:itemId`, `DELETE /api/admin/custom-items`, `GET /api/admin/users`, `PATCH /api/admin/users/:userId`, `PATCH /api/admin/users/:userId/password`, `DELETE /api/admin/users/:userId`, `DELETE /api/admin/games/:gameId/items/:itemId`, `DELETE /api/admin/games/:gameId`
|
- 연동 API: `POST /api/admin/games`, `POST /api/admin/games/:gameId/thumbnail`, `POST /api/admin/games/:gameId/images`, `GET /api/admin/custom-items`, `DELETE /api/admin/custom-items/:itemId`, `DELETE /api/admin/custom-items`, `GET /api/admin/users`, `PATCH /api/admin/users/:userId`, `PATCH /api/admin/users/:userId/password`, `DELETE /api/admin/users/:userId`, `DELETE /api/admin/games/:gameId/items/:itemId`, `DELETE /api/admin/games/:gameId`
|
||||||
|
|
||||||
## `/profile`
|
## `/profile`
|
||||||
|
|||||||
13
docs/spec.md
13
docs/spec.md
@@ -6,6 +6,9 @@
|
|||||||
- 데이터 저장소: MariaDB(MySQL 호환)
|
- 데이터 저장소: MariaDB(MySQL 호환)
|
||||||
- 세션 저장소: `session-file-store` 기반 파일 세션
|
- 세션 저장소: `session-file-store` 기반 파일 세션
|
||||||
- 업로드 저장소: 로컬 파일 시스템(`backend/uploads/`)
|
- 업로드 저장소: 로컬 파일 시스템(`backend/uploads/`)
|
||||||
|
- 운영 배포: `frontend(Nginx 정적 서빙 + /api,/uploads 프록시) + backend + mariadb` Docker Compose 구조
|
||||||
|
- NAS HTTPS 리버스 프록시 운영 시 프런트 Nginx는 백엔드로 `X-Forwarded-Proto: https`를 전달하고, Express 세션은 프록시 환경에서 `secure` 쿠키를 허용하도록 설정한다.
|
||||||
|
- 프런트 파비콘은 운영 정적 파일 차단 영향을 줄이기 위해 `index.html`의 인라인 데이터 URL로 제공한다.
|
||||||
|
|
||||||
## 데이터 저장 구조
|
## 데이터 저장 구조
|
||||||
- 메인 데이터베이스: MariaDB `tier_cursor` (기본값)
|
- 메인 데이터베이스: MariaDB `tier_cursor` (기본값)
|
||||||
@@ -81,6 +84,7 @@
|
|||||||
- `POST /api/admin/games`
|
- `POST /api/admin/games`
|
||||||
- `POST /api/admin/games/:gameId/thumbnail`
|
- `POST /api/admin/games/:gameId/thumbnail`
|
||||||
- `POST /api/admin/games/:gameId/images`
|
- `POST /api/admin/games/:gameId/images`
|
||||||
|
- 여러 이미지를 한 번에 업로드할 수 있고, 별도 라벨이 없으면 파일명 기준으로 기본 아이템 이름을 만든다.
|
||||||
- `GET /api/admin/custom-items`
|
- `GET /api/admin/custom-items`
|
||||||
- `DELETE /api/admin/custom-items/:itemId`
|
- `DELETE /api/admin/custom-items/:itemId`
|
||||||
- `DELETE /api/admin/custom-items`
|
- `DELETE /api/admin/custom-items`
|
||||||
@@ -93,7 +97,7 @@
|
|||||||
|
|
||||||
## 관리자 화면 메모
|
## 관리자 화면 메모
|
||||||
- 썸네일은 16:9 비율 미리보기 후 `썸네일 적용` 버튼으로 실제 반영한다.
|
- 썸네일은 16:9 비율 미리보기 후 `썸네일 적용` 버튼으로 실제 반영한다.
|
||||||
- 게임 기본 아이템 추가는 이름 입력, 파일 선택, 1:1 미리보기 확인 뒤 저장하는 흐름이다.
|
- 게임 기본 아이템 추가는 드래그 앤 드롭 또는 다중 파일 선택으로 처리하고, 미리보기 카드에서 여러 장을 함께 확인할 수 있다.
|
||||||
- 아이템 미리보기는 반응형 환경에서도 최대 `192px` 크기 안에서 표시한다.
|
- 아이템 미리보기는 반응형 환경에서도 최대 `192px` 크기 안에서 표시한다.
|
||||||
- 게임 전환 또는 업로드 성공 뒤에는 파일 입력값을 초기화해 같은 파일도 다시 선택할 수 있다.
|
- 게임 전환 또는 업로드 성공 뒤에는 파일 입력값을 초기화해 같은 파일도 다시 선택할 수 있다.
|
||||||
- 게임 관리 탭에서는 홈 화면 상단에 먼저 노출할 게임을 최대 50개까지 지정하고, 드래그 또는 위/아래 버튼으로 순서를 저장할 수 있다.
|
- 게임 관리 탭에서는 홈 화면 상단에 먼저 노출할 게임을 최대 50개까지 지정하고, 드래그 또는 위/아래 버튼으로 순서를 저장할 수 있다.
|
||||||
@@ -109,6 +113,7 @@
|
|||||||
- 신규 티어표의 공개 여부 기본값은 `ON`이며, 기존 티어표는 편집 화면과 `내 티어표` 목록에서 직접 삭제할 수 있다.
|
- 신규 티어표의 공개 여부 기본값은 `ON`이며, 기존 티어표는 편집 화면과 `내 티어표` 목록에서 직접 삭제할 수 있다.
|
||||||
- 제목이 비어 있는 상태로 저장하면 내부 제목은 `이름 없음 + 날짜` 형식으로 자동 생성한다.
|
- 제목이 비어 있는 상태로 저장하면 내부 제목은 `이름 없음 + 날짜` 형식으로 자동 생성한다.
|
||||||
- 제목 입력이 비어 있는 동안에는 무분별한 도배 방지를 위한 관리자 임의 삭제 가능성 안내 문구를 표시한다.
|
- 제목 입력이 비어 있는 동안에는 무분별한 도배 방지를 위한 관리자 임의 삭제 가능성 안내 문구를 표시한다.
|
||||||
|
- 티어표 편집기의 아이콘 기본 크기는 `80px`이며, 사용자가 `48 / 60 / 80 / 100 / 120` 단계로 즉시 조절할 수 있다.
|
||||||
- 공개 티어표 목록과 `내 티어표` 목록은 제목 옆에 작성자 아바타와 표시명을 함께 보여준다.
|
- 공개 티어표 목록과 `내 티어표` 목록은 제목 옆에 작성자 아바타와 표시명을 함께 보여준다.
|
||||||
- 작성자 아바타 이미지가 없을 경우 목록 썸네일 fallback은 닉네임이 아니라 계정명 기준 첫 글자를 사용한다.
|
- 작성자 아바타 이미지가 없을 경우 목록 썸네일 fallback은 닉네임이 아니라 계정명 기준 첫 글자를 사용한다.
|
||||||
- 티어표 목록 메타 정보는 최종 업데이트 시각만 간략하게 표시한다.
|
- 티어표 목록 메타 정보는 최종 업데이트 시각만 간략하게 표시한다.
|
||||||
@@ -137,6 +142,12 @@
|
|||||||
- `SESSION_COOKIE_SECURE`: `true`면 HTTPS 전용 쿠키
|
- `SESSION_COOKIE_SECURE`: `true`면 HTTPS 전용 쿠키
|
||||||
- `SESSION_COOKIE_SAME_SITE`: 기본 `lax`
|
- `SESSION_COOKIE_SAME_SITE`: 기본 `lax`
|
||||||
|
|
||||||
|
## 운영 배포 메모
|
||||||
|
- 프로덕션 컴포즈 파일은 [docker-compose.prod.yml](/Users/bicute/Desktop/zenn.dev/tier-cursor/docker-compose.prod.yml)이다.
|
||||||
|
- 외부 도메인 `tmaker.sori.studio`는 `frontend` 컨테이너의 `8080` 포트로 리버스 프록시하고, `/api`, `/uploads`, `/health`는 프런트 Nginx가 내부 `backend:5179`로 전달한다.
|
||||||
|
- 운영 볼륨은 MariaDB 데이터, 업로드 파일, 세션 파일을 각각 분리해 유지한다.
|
||||||
|
- MariaDB healthcheck는 NAS 첫 기동 지연을 고려해 `root` 기준 ping과 긴 `start_period/retries`를 사용한다.
|
||||||
|
|
||||||
## NAS 배포 메모
|
## NAS 배포 메모
|
||||||
- 현재 구조는 MariaDB/MySQL 계열이므로 NAS에 MariaDB를 올리면 phpMyAdmin 또는 Adminer로 직접 데이터 확인이 가능하다.
|
- 현재 구조는 MariaDB/MySQL 계열이므로 NAS에 MariaDB를 올리면 phpMyAdmin 또는 Adminer로 직접 데이터 확인이 가능하다.
|
||||||
- 추천 구성:
|
- 추천 구성:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
- 회원 관리에서 아바타/작성 티어표 수/최근 활동 같은 보조 정보는 아직 표시하지 않는다.
|
- 회원 관리에서 아바타/작성 티어표 수/최근 활동 같은 보조 정보는 아직 표시하지 않는다.
|
||||||
- 미사용 커스텀 이미지 일괄 삭제는 현재 "참조가 없는 항목" 기준이며, 보관 기간 정책 같은 운영 규칙은 아직 없다.
|
- 미사용 커스텀 이미지 일괄 삭제는 현재 "참조가 없는 항목" 기준이며, 보관 기간 정책 같은 운영 규칙은 아직 없다.
|
||||||
- 업로드 이미지는 현재 원본 파일을 그대로 저장하므로, 운영 부담이 커지면 서버 저장 전 리사이즈/압축(예: 긴 변 제한, WebP 변환) 도입이 필요하다.
|
- 업로드 이미지는 현재 원본 파일을 그대로 저장하므로, 운영 부담이 커지면 서버 저장 전 리사이즈/압축(예: 긴 변 제한, WebP 변환) 도입이 필요하다.
|
||||||
|
- 관리자 기본 아이템 다중 업로드는 현재 파일명 기반 자동 라벨만 지원하므로, 필요하면 업로드 후 일괄 라벨 수정/정렬 UX를 추가 검토한다.
|
||||||
|
|
||||||
## 배포 전 작업
|
## 배포 전 작업
|
||||||
- NAS 실제 도메인 기준으로 `VITE_API_ORIGIN`, `CORS_ORIGINS`, `SESSION_SECRET`, `SESSION_COOKIE_SECURE`, `TRUST_PROXY` 값을 설정한다.
|
- NAS 실제 도메인 기준으로 `VITE_API_ORIGIN`, `CORS_ORIGINS`, `SESSION_SECRET`, `SESSION_COOKIE_SECURE`, `TRUST_PROXY` 값을 설정한다.
|
||||||
|
|||||||
78
docs/ugreen-nas-deploy.md
Normal file
78
docs/ugreen-nas-deploy.md
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# UGREEN NAS 배포 가이드
|
||||||
|
|
||||||
|
## 개요
|
||||||
|
- 운영 기본 컨테이너는 `mariadb`, `backend`, `frontend` 3개다.
|
||||||
|
- `phpmyadmin`은 필요할 때만 `admin` 프로필로 추가 실행한다.
|
||||||
|
- 외부 공개는 `frontend` 컨테이너 하나만 하고, `/api`, `/uploads`, `/health`는 내부적으로 `backend`로 프록시한다.
|
||||||
|
- 도메인은 `https://tmaker.sori.studio` 기준으로 설정한다.
|
||||||
|
|
||||||
|
## 파일
|
||||||
|
- 프로덕션 컴포즈: [docker-compose.prod.yml](/Users/bicute/Desktop/zenn.dev/tier-cursor/docker-compose.prod.yml)
|
||||||
|
- 백엔드 이미지: [backend/Dockerfile](/Users/bicute/Desktop/zenn.dev/tier-cursor/backend/Dockerfile)
|
||||||
|
- 프런트 이미지: [frontend/Dockerfile](/Users/bicute/Desktop/zenn.dev/tier-cursor/frontend/Dockerfile)
|
||||||
|
- 프런트 Nginx 프록시: [frontend/nginx.conf](/Users/bicute/Desktop/zenn.dev/tier-cursor/frontend/nginx.conf)
|
||||||
|
- 환경변수 예시: [.env.production.example](/Users/bicute/Desktop/zenn.dev/tier-cursor/.env.production.example)
|
||||||
|
|
||||||
|
## 1. 프로젝트 업로드
|
||||||
|
- NAS 작업 폴더에 현재 프로젝트를 그대로 업로드한다.
|
||||||
|
- 기존 로컬 MariaDB 내용은 무시하고 새 운영 DB로 시작해도 된다.
|
||||||
|
|
||||||
|
## 2. 환경변수 파일 준비
|
||||||
|
- 루트에서 `.env.production.example`를 복사해 `.env.production`으로 만든다.
|
||||||
|
- 최소 변경값:
|
||||||
|
- `MARIADB_ROOT_PASSWORD`
|
||||||
|
- `MARIADB_PASSWORD`
|
||||||
|
- `SESSION_SECRET`
|
||||||
|
|
||||||
|
예시:
|
||||||
|
|
||||||
|
```env
|
||||||
|
MARIADB_ROOT_PASSWORD=very-strong-root-password
|
||||||
|
MARIADB_DATABASE=tier_cursor
|
||||||
|
MARIADB_USER=tier_cursor
|
||||||
|
MARIADB_PASSWORD=very-strong-app-password
|
||||||
|
SESSION_SECRET=very-strong-random-session-secret
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. 컨테이너 실행
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose --env-file .env.production -f docker-compose.prod.yml up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
- phpMyAdmin까지 같이 띄우려면:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose --env-file .env.production -f docker-compose.prod.yml --profile admin up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. NAS 리버스 프록시
|
||||||
|
- 외부 도메인: `tmaker.sori.studio`
|
||||||
|
- 내부 대상 프로토콜: `http`
|
||||||
|
- 내부 대상 호스트: NAS IP 또는 `localhost`
|
||||||
|
- 내부 대상 포트: `8080`
|
||||||
|
|
||||||
|
즉 NAS 리버스 프록시는 `frontend` 컨테이너의 `8080`만 바라보면 된다.
|
||||||
|
|
||||||
|
## 5. HTTPS / 쿠키
|
||||||
|
- 현재 프로덕션 컴포즈는 `SESSION_COOKIE_SECURE=true`를 사용한다.
|
||||||
|
- 따라서 `tmaker.sori.studio`에는 HTTPS 인증서가 연결되어 있어야 한다.
|
||||||
|
- NAS 리버스 프록시가 HTTPS 종료를 하고 내부는 `http://frontend:80` 또는 `localhost:8080`으로 전달하면 된다.
|
||||||
|
|
||||||
|
## 6. 데이터 위치
|
||||||
|
- MariaDB 데이터: Docker volume `tmaker_mariadb_data`
|
||||||
|
- 업로드 파일: Docker volume `tmaker_uploads`
|
||||||
|
- 세션 파일: Docker volume `tmaker_sessions`
|
||||||
|
|
||||||
|
## 7. 점검 포인트
|
||||||
|
- 메인 접속: `https://tmaker.sori.studio`
|
||||||
|
- 헬스체크: `https://tmaker.sori.studio/health`
|
||||||
|
- 관리자 로그인 후:
|
||||||
|
- 게임 생성
|
||||||
|
- 썸네일 업로드
|
||||||
|
- 티어표 저장
|
||||||
|
- 이미지 다운로드
|
||||||
|
|
||||||
|
## 8. 참고
|
||||||
|
- 현재 업로드 이미지는 서버 저장 전에 리사이즈/압축하지 않는다.
|
||||||
|
- 운영 중 원본 이미지가 많이 쌓이면 이후 `sharp` 기반 최적화 단계를 추가하는 것이 좋다.
|
||||||
@@ -1,5 +1,38 @@
|
|||||||
# 업데이트 로그
|
# 업데이트 로그
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.34
|
||||||
|
- **파비콘 정적 요청 제거**: 운영 환경에서 `/favicon.svg`가 `403`으로 막히는 경우를 피하기 위해, 별도 파일 대신 `index.html` 인라인 데이터 URL 파비콘으로 전환
|
||||||
|
- **관리자 기본 아이템 다중 업로드 추가**: 게임 관리 화면에서 기본 아이템을 여러 장 드래그 앤 드롭 또는 다중 파일 선택으로 한 번에 추가할 수 있도록 변경하고, 기본 라벨은 파일명 기준으로 자동 생성
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.29
|
||||||
|
- **NAS 로그인 유지 수정**: 프런트 Nginx가 백엔드에 전달하는 `X-Forwarded-Proto`를 `https`로 고정하고 Express 세션의 프록시 인지를 명시해, NAS HTTPS 리버스 프록시 뒤에서도 `secure` 세션 쿠키가 정상 발급되도록 조정
|
||||||
|
- **운영 템플릿 복구**: 실수로 빠질 수 있는 `.env.production.example`를 다시 포함하고, NAS 재배포 시 최신 프런트 이미지를 다시 빌드하도록 문서 보강
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.30
|
||||||
|
- **[NAS] /api 상대경로 호출**: 운영(`import.meta.env.PROD`)에서는 `http://localhost:...` 같은 다른 origin으로 API를 호출하지 않도록, `frontend/src/lib/runtime.js`에서 `/api` 호출을 상대경로로 고정해 세션 쿠키가 정상 저장되도록 수정
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.31
|
||||||
|
- **[NAS] 세션 쿠키 발급 강제**: 백엔드 인증 라우트에서 `req.session.save()`를 명시 호출해 응답 전에 세션을 저장하고 `Set-Cookie`가 확실히 내려오도록 보강
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.32
|
||||||
|
- **[NAS] 인증 디버그 로그 추가**: `auth/login`에서 `req.session.save` 성공/실패와 `auth/me`에서 세션 존재 여부를 콘솔 로그로 남겨 세션 쿠키 발급 문제를 빠르게 진단
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.33
|
||||||
|
- **[NAS] 요청 프로토콜 디버그**: `auth/login`/`auth/me`에서 `req.secure`, `req.protocol`, `x-forwarded-proto` 값을 로그로 출력해 프록시/HTTPS 판단 문제를 확인
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.28
|
||||||
|
- **MariaDB healthcheck 완화**: UGREEN NAS 첫 초기화 시간이 길어도 `unhealthy`로 오판하지 않도록 프로덕션 컴포즈의 DB healthcheck를 `root` 기준과 더 긴 `start_period/retries`로 조정
|
||||||
|
- **NAS 장애 대응 문서화**: `ready for connections` 이후에도 `unhealthy`가 뜨는 경우의 재기동 절차를 배포 가이드에 추가
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.27
|
||||||
|
- **UGREEN NAS 배포 파일 추가**: `backend`, `frontend`용 Dockerfile과 프런트 Nginx 프록시 설정, 프로덕션 전용 `docker-compose.prod.yml` 추가
|
||||||
|
- **운영 환경 예시 추가**: `.env.production.example`로 MariaDB/세션 시크릿 환경변수 템플릿 제공
|
||||||
|
- **배포 문서화**: `tmaker.sori.studio` 기준 NAS 리버스 프록시, 컨테이너 실행, 볼륨 구성 가이드를 문서에 정리
|
||||||
|
|
||||||
|
## 2026-03-26 v0.1.26
|
||||||
|
- **아이콘 크기 조절 추가**: 티어표 편집기에서 `48 / 60 / 80 / 100 / 120` 단계로 아이콘 크기를 직접 바꿀 수 있도록 추가
|
||||||
|
- **기본 아이콘 크기 상향**: 기본 `.thumb` 크기를 `80px` 기준으로 조정하고, 보드와 우측 아이템 목록에 함께 반영되도록 정리
|
||||||
|
|
||||||
## 2026-03-26 v0.1.25
|
## 2026-03-26 v0.1.25
|
||||||
- **export 폭 추가 축소**: 티어표 PNG export 보드 폭을 `960px`로 더 줄여 최종 저장 이미지가 지나치게 길어지지 않도록 조정
|
- **export 폭 추가 축소**: 티어표 PNG export 보드 폭을 `960px`로 더 줄여 최종 저장 이미지가 지나치게 길어지지 않도록 조정
|
||||||
|
|
||||||
|
|||||||
22
frontend/Dockerfile
Normal file
22
frontend/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY frontend/package*.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
COPY frontend/ ./
|
||||||
|
|
||||||
|
ARG VITE_API_ORIGIN=https://tmaker.sori.studio
|
||||||
|
ENV VITE_API_ORIGIN=${VITE_API_ORIGIN}
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:1.27-alpine
|
||||||
|
|
||||||
|
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
@@ -2,7 +2,10 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link
|
||||||
|
rel="icon"
|
||||||
|
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='16' fill='%230b1220'/%3E%3Cpath d='M18 18h28v8H36v20h-8V26H18z' fill='%23f8fafc'/%3E%3C/svg%3E"
|
||||||
|
/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>frontend</title>
|
<title>frontend</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
38
frontend/nginx.conf
Normal file
38
frontend/nginx.conf
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend:5179/api/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /uploads/ {
|
||||||
|
proxy_pass http://backend:5179/uploads/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /health {
|
||||||
|
proxy_pass http://backend:5179/health;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,10 +31,10 @@ const success = ref('')
|
|||||||
const newGameId = ref('')
|
const newGameId = ref('')
|
||||||
const newGameName = ref('')
|
const newGameName = ref('')
|
||||||
|
|
||||||
const uploadLabel = ref('')
|
const uploadFiles = ref([])
|
||||||
const uploadFile = ref(null)
|
|
||||||
const thumbFile = ref(null)
|
const thumbFile = ref(null)
|
||||||
const itemPreviewUrl = ref('')
|
const itemPreviewUrls = ref([])
|
||||||
|
const isItemDragOver = ref(false)
|
||||||
const thumbPreviewUrl = ref('')
|
const thumbPreviewUrl = ref('')
|
||||||
const itemFileInput = ref(null)
|
const itemFileInput = ref(null)
|
||||||
const thumbFileInput = ref(null)
|
const thumbFileInput = ref(null)
|
||||||
@@ -43,7 +43,7 @@ const featuredSortable = ref(null)
|
|||||||
|
|
||||||
const hasSelectedGame = computed(() => !!selectedGame.value?.game?.id)
|
const hasSelectedGame = computed(() => !!selectedGame.value?.game?.id)
|
||||||
const canApplyThumbnail = computed(() => !!thumbFile.value && !!selectedGameId.value)
|
const canApplyThumbnail = computed(() => !!thumbFile.value && !!selectedGameId.value)
|
||||||
const canAddItem = computed(() => !!uploadFile.value && !!selectedGameId.value)
|
const canAddItem = computed(() => uploadFiles.value.length > 0 && !!selectedGameId.value)
|
||||||
const customItemPageCount = computed(() => Math.max(1, Math.ceil(customItemTotal.value / customItemLimit.value)))
|
const customItemPageCount = computed(() => Math.max(1, Math.ceil(customItemTotal.value / customItemLimit.value)))
|
||||||
const featuredGames = computed(() =>
|
const featuredGames = computed(() =>
|
||||||
featuredGameIds.value
|
featuredGameIds.value
|
||||||
@@ -151,8 +151,7 @@ async function refreshUsers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetUploadState() {
|
function resetUploadState() {
|
||||||
uploadLabel.value = ''
|
uploadFiles.value = []
|
||||||
uploadFile.value = null
|
|
||||||
thumbFile.value = null
|
thumbFile.value = null
|
||||||
resetFileInput('item')
|
resetFileInput('item')
|
||||||
resetFileInput('thumb')
|
resetFileInput('thumb')
|
||||||
@@ -171,9 +170,9 @@ function setGameMode(mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearPreviewUrl(type) {
|
function clearPreviewUrl(type) {
|
||||||
if (type === 'item' && itemPreviewUrl.value) {
|
if (type === 'item' && itemPreviewUrls.value.length) {
|
||||||
URL.revokeObjectURL(itemPreviewUrl.value)
|
itemPreviewUrls.value.forEach((url) => URL.revokeObjectURL(url))
|
||||||
itemPreviewUrl.value = ''
|
itemPreviewUrls.value = []
|
||||||
}
|
}
|
||||||
if (type === 'thumb' && thumbPreviewUrl.value) {
|
if (type === 'thumb' && thumbPreviewUrl.value) {
|
||||||
URL.revokeObjectURL(thumbPreviewUrl.value)
|
URL.revokeObjectURL(thumbPreviewUrl.value)
|
||||||
@@ -232,9 +231,46 @@ function onThumb(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onFile(event) {
|
function onFile(event) {
|
||||||
uploadFile.value = event.target.files && event.target.files[0] ? event.target.files[0] : null
|
handleItemFiles(event.target.files)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleItemFiles(fileList) {
|
||||||
|
const files = Array.from(fileList || []).filter((file) => (file.type || '').startsWith('image/'))
|
||||||
|
uploadFiles.value = files
|
||||||
clearPreviewUrl('item')
|
clearPreviewUrl('item')
|
||||||
if (uploadFile.value) itemPreviewUrl.value = URL.createObjectURL(uploadFile.value)
|
if (!files.length) return
|
||||||
|
itemPreviewUrls.value = files.map((file) => URL.createObjectURL(file))
|
||||||
|
resetFileInput('item')
|
||||||
|
}
|
||||||
|
|
||||||
|
function openItemFilePicker() {
|
||||||
|
itemFileInput.value?.click()
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearItemFiles() {
|
||||||
|
uploadFiles.value = []
|
||||||
|
clearPreviewUrl('item')
|
||||||
|
resetFileInput('item')
|
||||||
|
}
|
||||||
|
|
||||||
|
function onItemDragEnter(event) {
|
||||||
|
event.preventDefault()
|
||||||
|
isItemDragOver.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function onItemDragOver(event) {
|
||||||
|
event.preventDefault()
|
||||||
|
isItemDragOver.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function onItemDragLeave(event) {
|
||||||
|
if (event.currentTarget === event.target) isItemDragOver.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function onItemDrop(event) {
|
||||||
|
event.preventDefault()
|
||||||
|
isItemDragOver.value = false
|
||||||
|
handleItemFiles(event.dataTransfer?.files)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadThumbnail() {
|
async function uploadThumbnail() {
|
||||||
@@ -267,15 +303,15 @@ async function uploadThumbnail() {
|
|||||||
|
|
||||||
async function uploadItem() {
|
async function uploadItem() {
|
||||||
resetMessages()
|
resetMessages()
|
||||||
if (!uploadFile.value || !selectedGameId.value) {
|
if (!uploadFiles.value.length || !selectedGameId.value) {
|
||||||
error.value = '아이템 파일을 선택해주세요.'
|
error.value = '아이템 파일을 선택해주세요.'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
fd.append('label', uploadLabel.value || 'item')
|
uploadFiles.value.forEach((file) => fd.append('images', file))
|
||||||
fd.append('image', uploadFile.value)
|
const uploadCount = uploadFiles.value.length
|
||||||
const res = await fetch(toApiUrl(`/api/admin/games/${encodeURIComponent(selectedGameId.value)}/images`), {
|
const res = await fetch(toApiUrl(`/api/admin/games/${encodeURIComponent(selectedGameId.value)}/images`), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
@@ -285,7 +321,7 @@ async function uploadItem() {
|
|||||||
|
|
||||||
resetUploadState()
|
resetUploadState()
|
||||||
await loadGame()
|
await loadGame()
|
||||||
success.value = '게임 기본 아이템이 추가됐어요.'
|
success.value = `게임 기본 아이템 ${uploadCount}개 추가를 완료했어요.`
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = '아이템 추가 실패(관리자 권한/파일 크기 확인)'
|
error.value = '아이템 추가 실패(관리자 권한/파일 크기 확인)'
|
||||||
}
|
}
|
||||||
@@ -631,16 +667,36 @@ async function saveFeaturedOrder() {
|
|||||||
<div class="section__title">기본 아이템 추가</div>
|
<div class="section__title">기본 아이템 추가</div>
|
||||||
<div class="itemComposer">
|
<div class="itemComposer">
|
||||||
<div class="itemComposer__form">
|
<div class="itemComposer__form">
|
||||||
<input v-model="uploadLabel" class="input input--compact" placeholder="아이템 이름" />
|
<input ref="itemFileInput" type="file" accept="image/*" multiple class="srOnlyInput" @change="onFile" />
|
||||||
<input ref="itemFileInput" type="file" accept="image/*" class="inputFile inputFile--tight" @change="onFile" />
|
<div
|
||||||
<button class="btn" :disabled="!canAddItem" @click="uploadItem">아이템 추가</button>
|
class="dropZone"
|
||||||
|
:class="{ 'dropZone--active': isItemDragOver }"
|
||||||
|
@dragenter="onItemDragEnter"
|
||||||
|
@dragover="onItemDragOver"
|
||||||
|
@dragleave="onItemDragLeave"
|
||||||
|
@drop="onItemDrop"
|
||||||
|
>
|
||||||
|
<div class="dropZone__title">이미지를 드래그해서 기본 아이템으로 추가</div>
|
||||||
|
<div class="dropZone__desc">여러 파일을 한 번에 올릴 수 있고, 저장 라벨은 파일명으로 자동 생성됩니다.</div>
|
||||||
|
<div class="dropZone__actions">
|
||||||
|
<button class="btn btn--ghost btn--small" type="button" @click="openItemFilePicker">파일 선택</button>
|
||||||
|
<button class="btn btn--danger btn--small" type="button" :disabled="!uploadFiles.length" @click="clearItemFiles">선택 비우기</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="btn" :disabled="!canAddItem" @click="uploadItem">
|
||||||
|
아이템 {{ uploadFiles.length || 0 }}개 추가
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="itemPreviewCard">
|
<div class="itemPreviewCard">
|
||||||
<div class="itemPreviewFrame">
|
<div v-if="itemPreviewUrls.length" class="itemPreviewGrid">
|
||||||
<img v-if="itemPreviewUrl" class="itemPreviewImage" :src="itemPreviewUrl" alt="item preview" />
|
<div v-for="(previewUrl, index) in itemPreviewUrls.slice(0, 6)" :key="previewUrl" class="itemPreviewFrame">
|
||||||
<div v-else class="itemPreviewEmpty">이미지를 선택해주세요</div>
|
<img class="itemPreviewImage" :src="previewUrl" :alt="uploadFiles[index]?.name || 'item preview'" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="itemPreviewEmpty">선택한 기본 아이템 미리보기가 여기에 표시됩니다.</div>
|
||||||
|
<div class="thumbLabel thumbLabel--preview">
|
||||||
|
{{ uploadFiles.length ? `선택된 파일 ${uploadFiles.length}개` : '아직 선택된 파일이 없어요.' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="thumbLabel thumbLabel--preview">{{ uploadLabel || '아이템 이름 미리보기' }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -1006,6 +1062,17 @@ async function saveFeaturedOrder() {
|
|||||||
.inputFile--tight {
|
.inputFile--tight {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
.srOnlyInput {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
.btn {
|
.btn {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
@@ -1090,20 +1157,53 @@ async function saveFeaturedOrder() {
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
}
|
}
|
||||||
|
.dropZone {
|
||||||
|
padding: 18px;
|
||||||
|
border-radius: 16px;
|
||||||
|
border: 1px dashed rgba(255, 255, 255, 0.2);
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
transition:
|
||||||
|
border-color 0.16s ease,
|
||||||
|
background 0.16s ease,
|
||||||
|
transform 0.16s ease;
|
||||||
|
}
|
||||||
|
.dropZone--active {
|
||||||
|
border-color: rgba(96, 165, 250, 0.56);
|
||||||
|
background: rgba(96, 165, 250, 0.08);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
.dropZone__title {
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
.dropZone__desc {
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
opacity: 0.74;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
.dropZone__actions {
|
||||||
|
margin-top: 12px;
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
.itemPreviewCard {
|
.itemPreviewCard {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||||
background: rgba(255, 255, 255, 0.04);
|
background: rgba(255, 255, 255, 0.04);
|
||||||
}
|
}
|
||||||
|
.itemPreviewGrid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
.itemPreviewFrame {
|
.itemPreviewFrame {
|
||||||
width: min(100%, 192px);
|
|
||||||
aspect-ratio: 1 / 1;
|
aspect-ratio: 1 / 1;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||||
background: rgba(0, 0, 0, 0.18);
|
background: rgba(0, 0, 0, 0.18);
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
.itemPreviewImage {
|
.itemPreviewImage {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -1111,12 +1211,13 @@ async function saveFeaturedOrder() {
|
|||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
.itemPreviewEmpty {
|
.itemPreviewEmpty {
|
||||||
width: 100%;
|
min-height: 192px;
|
||||||
height: 100%;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
color: rgba(255, 255, 255, 0.62);
|
color: rgba(255, 255, 255, 0.62);
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
.thumbGrid {
|
.thumbGrid {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
@@ -1282,7 +1383,7 @@ async function saveFeaturedOrder() {
|
|||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
.itemPreviewCard {
|
.itemPreviewCard {
|
||||||
max-width: 192px;
|
max-width: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ const authorName = ref('')
|
|||||||
const authorAccountName = ref('')
|
const authorAccountName = ref('')
|
||||||
const updatedAt = ref(0)
|
const updatedAt = ref(0)
|
||||||
const isDragActive = ref(false)
|
const isDragActive = ref(false)
|
||||||
|
const iconSize = ref(80)
|
||||||
|
|
||||||
const boardEl = ref(null)
|
const boardEl = ref(null)
|
||||||
const exportBoardEl = ref(null)
|
const exportBoardEl = ref(null)
|
||||||
@@ -50,6 +51,7 @@ const dropSortables = ref([])
|
|||||||
|
|
||||||
const isNewTierList = computed(() => tierListId.value === 'new')
|
const isNewTierList = computed(() => tierListId.value === 'new')
|
||||||
const canEdit = computed(() => !!auth.user && (!ownerId.value || ownerId.value === auth.user.id))
|
const canEdit = computed(() => !!auth.user && (!ownerId.value || ownerId.value === auth.user.id))
|
||||||
|
const iconSizeOptions = [48, 60, 80, 100, 120]
|
||||||
const hasCustomTitle = computed(() => !!(title.value || '').trim())
|
const hasCustomTitle = computed(() => !!(title.value || '').trim())
|
||||||
const fallbackTimestamp = computed(() => (updatedAt.value ? updatedAt.value : Date.now()))
|
const fallbackTimestamp = computed(() => (updatedAt.value ? updatedAt.value : Date.now()))
|
||||||
const effectiveAuthorName = computed(() => {
|
const effectiveAuthorName = computed(() => {
|
||||||
@@ -92,6 +94,10 @@ function formatExportDate(ts) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setIconSize(nextSize) {
|
||||||
|
iconSize.value = nextSize
|
||||||
|
}
|
||||||
|
|
||||||
function setGroupDropEl(groupId, el) {
|
function setGroupDropEl(groupId, el) {
|
||||||
if (!el) {
|
if (!el) {
|
||||||
delete groupDropEls.value[groupId]
|
delete groupDropEls.value[groupId]
|
||||||
@@ -476,10 +482,26 @@ onUnmounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="layout">
|
<section class="layout" :style="{ '--thumb-size': `${iconSize}px` }">
|
||||||
<div ref="boardEl" class="board">
|
<div ref="boardEl" class="board">
|
||||||
<div v-if="canEdit && !isExporting" class="boardTools">
|
<div v-if="canEdit && !isExporting" class="boardTools">
|
||||||
<button class="btn btn--ghost" @click="addGroup">티어 추가</button>
|
<div class="boardTools__left">
|
||||||
|
<button class="btn btn--ghost" @click="addGroup">티어 추가</button>
|
||||||
|
</div>
|
||||||
|
<div class="boardTools__right">
|
||||||
|
<span class="boardTools__label">아이콘 크기</span>
|
||||||
|
<div class="sizePicker">
|
||||||
|
<button
|
||||||
|
v-for="size in iconSizeOptions"
|
||||||
|
:key="size"
|
||||||
|
class="sizePicker__button"
|
||||||
|
:class="{ 'sizePicker__button--active': iconSize === size }"
|
||||||
|
@click="setIconSize(size)"
|
||||||
|
>
|
||||||
|
{{ size }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ref="exportBoardEl" class="exportBoard" :class="{ 'exportBoard--active': isExporting }">
|
<div ref="exportBoardEl" class="exportBoard" :class="{ 'exportBoard--active': isExporting }">
|
||||||
<div v-if="isExporting" class="exportBoard__title">{{ effectiveTitle }}</div>
|
<div v-if="isExporting" class="exportBoard__title">{{ effectiveTitle }}</div>
|
||||||
@@ -723,8 +745,46 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
.boardTools {
|
.boardTools {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.boardTools__left,
|
||||||
|
.boardTools__right {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.boardTools__left {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.boardTools__label {
|
||||||
|
font-size: 13px;
|
||||||
|
opacity: 0.76;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
.sizePicker {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.sizePicker__button {
|
||||||
|
margin: 0;
|
||||||
|
min-width: 48px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
color: rgba(255, 255, 255, 0.92);
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
.sizePicker__button--active {
|
||||||
|
background: rgba(96, 165, 250, 0.24);
|
||||||
|
border-color: rgba(96, 165, 250, 0.38);
|
||||||
}
|
}
|
||||||
.exportBoard--active {
|
.exportBoard--active {
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -831,7 +891,7 @@ onUnmounted(() => {
|
|||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
background: rgba(0, 0, 0, 0.18);
|
background: rgba(0, 0, 0, 0.18);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.10);
|
border: 1px solid rgba(255, 255, 255, 0.10);
|
||||||
min-height: 74px;
|
min-height: calc(var(--thumb-size, 80px) + 24px);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -854,8 +914,8 @@ onUnmounted(() => {
|
|||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
}
|
}
|
||||||
.thumb {
|
.thumb {
|
||||||
width: 48px;
|
width: var(--thumb-size, 80px);
|
||||||
height: 48px;
|
height: var(--thumb-size, 80px);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.14);
|
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||||
background: rgba(255, 255, 255, 0.06);
|
background: rgba(255, 255, 255, 0.06);
|
||||||
@@ -903,7 +963,7 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
.poolItem {
|
.poolItem {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 52px 1fr;
|
grid-template-columns: var(--thumb-size, 80px) 1fr;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
Reference in New Issue
Block a user