security: 보안 강제 시스템 구축 + 하드코딩 비밀번호 제거
보안 감사 결과 CRITICAL 2건, HIGH 5건 발견 → 수정 완료 + 자동화 구축. [보안 수정] - issue-view.js: 하드코딩 비밀번호 → crypto.getRandomValues() 랜덤 생성 - pushSubscriptionController.js: ntfy 비밀번호 → process.env.NTFY_SUB_PASSWORD - DEPLOY-GUIDE.md/PROGRESS.md/migration SQL: 평문 비밀번호 → placeholder - docker-compose.yml/.env.example: NTFY_SUB_PASSWORD 환경변수 추가 [보안 강제 시스템 - 신규] - scripts/security-scan.sh: 8개 규칙 (CRITICAL 2, HIGH 4, MEDIUM 2) 3모드(staged/all/diff), severity, .securityignore, MEDIUM 임계값 - .githooks/pre-commit: 로컬 빠른 피드백 - .githooks/pre-receive-server.sh: Gitea 서버 최종 차단 bypass 거버넌스([SECURITY-BYPASS: 사유] + 사용자 제한 + 로그) - SECURITY-CHECKLIST.md: 10개 카테고리 자동/수동 구분 - docs/SECURITY-GUIDE.md: 운영자 가이드 (워크플로우, bypass, FAQ) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
99
system1-factory/web/public/js/workplace-management/utils.js
Normal file
99
system1-factory/web/public/js/workplace-management/utils.js
Normal file
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Workplace Management - Utilities
|
||||
* 작업장 관리 관련 유틸리티 함수들
|
||||
*/
|
||||
|
||||
class WorkplaceUtils {
|
||||
constructor() {
|
||||
console.log('[WorkplaceUtils] 초기화 완료');
|
||||
}
|
||||
|
||||
/**
|
||||
* 날짜 포맷팅
|
||||
*/
|
||||
formatDate(dateString) {
|
||||
if (!dateString) return '';
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('ko-KR', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API URL 생성
|
||||
*/
|
||||
getApiBaseUrl() {
|
||||
return window.API_BASE_URL || 'http://localhost:30005/api';
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 URL 생성
|
||||
*/
|
||||
getFullImageUrl(imagePath) {
|
||||
if (!imagePath) return null;
|
||||
if (imagePath.startsWith('http')) return imagePath;
|
||||
return `${this.getApiBaseUrl()}${imagePath}`.replace('/api/', '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* 작업장 용도 아이콘 반환
|
||||
*/
|
||||
getPurposeIcon(purpose) {
|
||||
const icons = {
|
||||
'작업구역': '🔧',
|
||||
'설비': '⚙️',
|
||||
'휴게시설': '☕',
|
||||
'회의실': '💼',
|
||||
'창고': '📦',
|
||||
'기타': '📍'
|
||||
};
|
||||
return purpose ? (icons[purpose] || '📍') : '🏗️';
|
||||
}
|
||||
|
||||
/**
|
||||
* 퍼센트를 픽셀로 변환
|
||||
*/
|
||||
percentToPixel(percent, canvasSize) {
|
||||
return (percent / 100) * canvasSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 픽셀을 퍼센트로 변환
|
||||
*/
|
||||
pixelToPercent(pixel, canvasSize) {
|
||||
return (pixel / canvasSize) * 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* 영역 좌표 정규화 (음수 처리)
|
||||
*/
|
||||
normalizeRect(rect, canvasWidth, canvasHeight) {
|
||||
const xPercent = this.pixelToPercent(
|
||||
Math.min(rect.x, rect.x + rect.width),
|
||||
canvasWidth
|
||||
);
|
||||
const yPercent = this.pixelToPercent(
|
||||
Math.min(rect.y, rect.y + rect.height),
|
||||
canvasHeight
|
||||
);
|
||||
const widthPercent = this.pixelToPercent(
|
||||
Math.abs(rect.width),
|
||||
canvasWidth
|
||||
);
|
||||
const heightPercent = this.pixelToPercent(
|
||||
Math.abs(rect.height),
|
||||
canvasHeight
|
||||
);
|
||||
|
||||
return { xPercent, yPercent, widthPercent, heightPercent };
|
||||
}
|
||||
}
|
||||
|
||||
// 전역 인스턴스 생성
|
||||
window.WorkplaceUtils = new WorkplaceUtils();
|
||||
|
||||
// showToast, formatDate → api-base.js 전역 사용
|
||||
|
||||
console.log('[Module] workplace-management/utils.js 로드 완료');
|
||||
Reference in New Issue
Block a user