- FastAPI 라우터에서 슬래시 문제로 인한 307 리다이렉트 수정 - Nginx 프록시 설정에서 경로 중복 문제 해결 - 계정 관리 시스템 구현 (로그인, 사용자 관리, 권한 설정) - 노트북 연결 기능 수정 (notebook_id 필드 추가) - 메모 트리 UI 개선 (수평 레이아웃, 드래그 기능 제거) - 헤더 UI 개선 및 고정 위치 설정 - 백업/복원 스크립트 추가 - PDF 미리보기 토큰 인증 지원
369 lines
20 KiB
HTML
369 lines
20 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>시스템 설정 - Document Server</title>
|
|
|
|
<!-- Tailwind CSS -->
|
|
<script src="https://cdn.tailwindcss.com/3.4.17"></script>
|
|
|
|
<!-- Font Awesome -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
|
|
<!-- Alpine.js -->
|
|
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
|
|
|
<!-- 공통 스타일 -->
|
|
<link rel="stylesheet" href="static/css/common.css">
|
|
|
|
<!-- 인증 가드 -->
|
|
<script src="static/js/auth-guard.js"></script>
|
|
|
|
<!-- 헤더 로더 -->
|
|
<script src="static/js/header-loader.js"></script>
|
|
</head>
|
|
<body class="bg-gray-50 min-h-screen">
|
|
<!-- 메인 앱 -->
|
|
<div x-data="systemSettingsApp()" x-init="init()">
|
|
<!-- 헤더 -->
|
|
<div id="header-container"></div>
|
|
|
|
<!-- 메인 컨텐츠 -->
|
|
<main class="container mx-auto px-4 py-8 max-w-6xl">
|
|
<!-- 권한 확인 중 로딩 -->
|
|
<div x-show="!permissionChecked" class="flex items-center justify-center py-20">
|
|
<div class="text-center">
|
|
<i class="fas fa-spinner fa-spin text-4xl text-blue-600 mb-4"></i>
|
|
<p class="text-gray-600">권한을 확인하고 있습니다...</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 권한 없음 -->
|
|
<div x-show="permissionChecked && !hasPermission" class="text-center py-20">
|
|
<div class="bg-red-100 border border-red-200 rounded-lg p-8 max-w-md mx-auto">
|
|
<i class="fas fa-exclamation-triangle text-4xl text-red-600 mb-4"></i>
|
|
<h2 class="text-xl font-semibold text-red-800 mb-2">접근 권한이 없습니다</h2>
|
|
<p class="text-red-600 mb-4">시스템 설정에 접근하려면 관리자 권한이 필요합니다.</p>
|
|
<button onclick="history.back()" class="px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700">
|
|
<i class="fas fa-arrow-left mr-2"></i>이전 페이지로
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 시스템 설정 (권한 있는 경우만 표시) -->
|
|
<div x-show="permissionChecked && hasPermission">
|
|
<!-- 페이지 헤더 -->
|
|
<div class="mb-8">
|
|
<div class="flex items-center space-x-3 mb-2">
|
|
<i class="fas fa-server text-2xl text-blue-600"></i>
|
|
<h1 class="text-3xl font-bold text-gray-900">시스템 설정</h1>
|
|
</div>
|
|
<p class="text-gray-600">시스템 전체 설정을 관리하세요</p>
|
|
</div>
|
|
|
|
<!-- 알림 메시지 -->
|
|
<div x-show="notification.show" x-transition class="mb-6 p-4 rounded-lg" :class="notification.type === 'success' ? 'bg-green-100 text-green-800 border border-green-200' : 'bg-red-100 text-red-800 border border-red-200'">
|
|
<div class="flex items-center">
|
|
<i :class="notification.type === 'success' ? 'fas fa-check-circle text-green-600' : 'fas fa-exclamation-circle text-red-600'" class="mr-2"></i>
|
|
<span x-text="notification.message"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 설정 섹션들 -->
|
|
<div class="space-y-8">
|
|
<!-- 시스템 정보 -->
|
|
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
|
<div class="flex items-center space-x-3 mb-6">
|
|
<i class="fas fa-info-circle text-xl text-blue-600"></i>
|
|
<h2 class="text-xl font-semibold text-gray-900">시스템 정보</h2>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
<div class="bg-gray-50 p-4 rounded-lg">
|
|
<div class="flex items-center space-x-2 mb-2">
|
|
<i class="fas fa-users text-blue-600"></i>
|
|
<span class="font-medium text-gray-700">총 사용자 수</span>
|
|
</div>
|
|
<div class="text-2xl font-bold text-gray-900" x-text="systemInfo.totalUsers">-</div>
|
|
</div>
|
|
|
|
<div class="bg-gray-50 p-4 rounded-lg">
|
|
<div class="flex items-center space-x-2 mb-2">
|
|
<i class="fas fa-user-shield text-green-600"></i>
|
|
<span class="font-medium text-gray-700">활성 사용자</span>
|
|
</div>
|
|
<div class="text-2xl font-bold text-gray-900" x-text="systemInfo.activeUsers">-</div>
|
|
</div>
|
|
|
|
<div class="bg-gray-50 p-4 rounded-lg">
|
|
<div class="flex items-center space-x-2 mb-2">
|
|
<i class="fas fa-crown text-yellow-600"></i>
|
|
<span class="font-medium text-gray-700">관리자 수</span>
|
|
</div>
|
|
<div class="text-2xl font-bold text-gray-900" x-text="systemInfo.adminUsers">-</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 기본 설정 -->
|
|
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
|
<div class="flex items-center space-x-3 mb-6">
|
|
<i class="fas fa-cog text-xl text-blue-600"></i>
|
|
<h2 class="text-xl font-semibold text-gray-900">기본 설정</h2>
|
|
</div>
|
|
|
|
<form @submit.prevent="updateSystemSettings()" class="space-y-4">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">시스템 이름</label>
|
|
<input type="text" x-model="settings.systemName"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
placeholder="Document Server">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">기본 언어</label>
|
|
<select x-model="settings.defaultLanguage"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
<option value="ko">한국어</option>
|
|
<option value="en">English</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">기본 테마</label>
|
|
<select x-model="settings.defaultTheme"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
<option value="light">라이트</option>
|
|
<option value="dark">다크</option>
|
|
<option value="auto">자동</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">기본 세션 타임아웃 (분)</label>
|
|
<select x-model="settings.defaultSessionTimeout"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
<option value="5">5분</option>
|
|
<option value="15">15분</option>
|
|
<option value="30">30분</option>
|
|
<option value="60">1시간</option>
|
|
<option value="0">무제한</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-end">
|
|
<button type="submit" :disabled="loading"
|
|
class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2">
|
|
<i class="fas fa-save"></i>
|
|
<span x-text="loading ? '저장 중...' : '설정 저장'"></span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 사용자 관리 -->
|
|
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
|
<div class="flex items-center justify-between mb-6">
|
|
<div class="flex items-center space-x-3">
|
|
<i class="fas fa-users-cog text-xl text-blue-600"></i>
|
|
<h2 class="text-xl font-semibold text-gray-900">사용자 관리</h2>
|
|
</div>
|
|
<a href="user-management.html" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 flex items-center space-x-2">
|
|
<i class="fas fa-user-plus"></i>
|
|
<span>사용자 관리</span>
|
|
</a>
|
|
</div>
|
|
|
|
<div class="text-gray-600">
|
|
<p class="mb-2">• 새로운 사용자 계정 생성 및 관리</p>
|
|
<p class="mb-2">• 사용자 권한 설정 (서적관리, 노트관리, 소설관리)</p>
|
|
<p class="mb-2">• 개별 사용자 세션 타임아웃 설정</p>
|
|
<p>• 사용자 계정 활성화/비활성화</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 시스템 유지보수 -->
|
|
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
|
<div class="flex items-center space-x-3 mb-6">
|
|
<i class="fas fa-tools text-xl text-orange-600"></i>
|
|
<h2 class="text-xl font-semibold text-gray-900">시스템 유지보수</h2>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div class="border border-gray-200 rounded-lg p-4">
|
|
<h3 class="font-medium text-gray-900 mb-2">캐시 정리</h3>
|
|
<p class="text-sm text-gray-600 mb-3">시스템 캐시를 정리하여 성능을 개선합니다.</p>
|
|
<button @click="clearCache()" :disabled="loading"
|
|
class="w-full px-3 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 disabled:opacity-50">
|
|
<i class="fas fa-broom mr-2"></i>캐시 정리
|
|
</button>
|
|
</div>
|
|
|
|
<div class="border border-gray-200 rounded-lg p-4">
|
|
<h3 class="font-medium text-gray-900 mb-2">시스템 재시작</h3>
|
|
<p class="text-sm text-gray-600 mb-3">시스템을 재시작하여 설정을 적용합니다.</p>
|
|
<button @click="restartSystem()" :disabled="loading"
|
|
class="w-full px-3 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50">
|
|
<i class="fas fa-power-off mr-2"></i>시스템 재시작
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<!-- API 스크립트 -->
|
|
<script src="static/js/api.js"></script>
|
|
|
|
<!-- 시스템 설정 스크립트 -->
|
|
<script>
|
|
function systemSettingsApp() {
|
|
return {
|
|
loading: false,
|
|
permissionChecked: false,
|
|
hasPermission: false,
|
|
currentUser: null,
|
|
systemInfo: {
|
|
totalUsers: 0,
|
|
activeUsers: 0,
|
|
adminUsers: 0
|
|
},
|
|
settings: {
|
|
systemName: 'Document Server',
|
|
defaultLanguage: 'ko',
|
|
defaultTheme: 'light',
|
|
defaultSessionTimeout: 5
|
|
},
|
|
notification: {
|
|
show: false,
|
|
message: '',
|
|
type: 'success'
|
|
},
|
|
|
|
async init() {
|
|
console.log('🔧 시스템 설정 앱 초기화');
|
|
await this.checkPermission();
|
|
if (this.hasPermission) {
|
|
await this.loadSystemInfo();
|
|
await this.loadSettings();
|
|
}
|
|
},
|
|
|
|
async checkPermission() {
|
|
try {
|
|
this.currentUser = await api.getCurrentUser();
|
|
// root, admin 역할이거나 is_admin이 true인 경우 권한 허용
|
|
this.hasPermission = this.currentUser.role === 'root' ||
|
|
this.currentUser.role === 'admin' ||
|
|
this.currentUser.is_admin === true;
|
|
|
|
console.log('👤 현재 사용자:', this.currentUser);
|
|
console.log('🔐 관리자 권한:', this.hasPermission);
|
|
} catch (error) {
|
|
console.error('❌ 권한 확인 실패:', error);
|
|
this.hasPermission = false;
|
|
} finally {
|
|
this.permissionChecked = true;
|
|
}
|
|
},
|
|
|
|
async loadSystemInfo() {
|
|
try {
|
|
const users = await api.get('/users');
|
|
this.systemInfo.totalUsers = users.length;
|
|
this.systemInfo.activeUsers = users.filter(u => u.is_active).length;
|
|
this.systemInfo.adminUsers = users.filter(u => u.role === 'root' || u.role === 'admin' || u.is_admin).length;
|
|
|
|
console.log('📊 시스템 정보 로드 완료:', this.systemInfo);
|
|
} catch (error) {
|
|
console.error('❌ 시스템 정보 로드 실패:', error);
|
|
}
|
|
},
|
|
|
|
async loadSettings() {
|
|
// 실제로는 백엔드에서 시스템 설정을 가져와야 하지만,
|
|
// 현재는 기본값을 사용
|
|
console.log('⚙️ 시스템 설정 로드 (기본값 사용)');
|
|
},
|
|
|
|
async updateSystemSettings() {
|
|
this.loading = true;
|
|
try {
|
|
// 실제로는 백엔드 API를 호출해야 함
|
|
console.log('💾 시스템 설정 저장:', this.settings);
|
|
|
|
// 시뮬레이션을 위한 지연
|
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
|
|
this.showNotification('시스템 설정이 성공적으로 저장되었습니다.', 'success');
|
|
} catch (error) {
|
|
console.error('❌ 시스템 설정 저장 실패:', error);
|
|
this.showNotification('시스템 설정 저장에 실패했습니다.', 'error');
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
|
|
async clearCache() {
|
|
if (!confirm('시스템 캐시를 정리하시겠습니까?')) return;
|
|
|
|
this.loading = true;
|
|
try {
|
|
// 실제로는 백엔드 API를 호출해야 함
|
|
console.log('🧹 캐시 정리 중...');
|
|
|
|
// 시뮬레이션을 위한 지연
|
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
|
|
this.showNotification('캐시가 성공적으로 정리되었습니다.', 'success');
|
|
} catch (error) {
|
|
console.error('❌ 캐시 정리 실패:', error);
|
|
this.showNotification('캐시 정리에 실패했습니다.', 'error');
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
|
|
async restartSystem() {
|
|
if (!confirm('시스템을 재시작하시겠습니까? 모든 사용자의 연결이 끊어집니다.')) return;
|
|
|
|
this.loading = true;
|
|
try {
|
|
// 실제로는 백엔드 API를 호출해야 함
|
|
console.log('🔄 시스템 재시작 중...');
|
|
|
|
this.showNotification('시스템 재시작이 요청되었습니다. 잠시 후 페이지가 새로고침됩니다.', 'success');
|
|
|
|
// 시뮬레이션을 위한 지연 후 페이지 새로고침
|
|
setTimeout(() => {
|
|
window.location.reload();
|
|
}, 3000);
|
|
} catch (error) {
|
|
console.error('❌ 시스템 재시작 실패:', error);
|
|
this.showNotification('시스템 재시작에 실패했습니다.', 'error');
|
|
this.loading = false;
|
|
}
|
|
},
|
|
|
|
showNotification(message, type = 'success') {
|
|
this.notification = {
|
|
show: true,
|
|
message: message,
|
|
type: type
|
|
};
|
|
|
|
setTimeout(() => {
|
|
this.notification.show = false;
|
|
}, 5000);
|
|
}
|
|
};
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|