summaryrefslogtreecommitdiff
path: root/layouts/recordings/recordings-plain.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/recordings/recordings-plain.html')
-rw-r--r--layouts/recordings/recordings-plain.html38
1 files changed, 31 insertions, 7 deletions
diff --git a/layouts/recordings/recordings-plain.html b/layouts/recordings/recordings-plain.html
index 9ba34f8..6849f5b 100644
--- a/layouts/recordings/recordings-plain.html
+++ b/layouts/recordings/recordings-plain.html
@@ -101,27 +101,51 @@
<script>
// 즉시 실행: 제한된 폴더 숨기기 (FOUC 방지)
(function() {
+ let isSiUser = false;
+
// 쿠키에서 사용자 확인
const cookies = document.cookie.split(';').reduce((acc, cookie) => {
const [key, value] = cookie.trim().split('=');
acc[key] = value;
return acc;
}, {});
- const isSiUser = cookies.user === 'si' || cookies.authUser === 'si';
+ isSiUser = cookies.user === 'si' || cookies.authUser === 'si';
// DOM이 준비되면 즉시 처리
+ function applyRestrictions() {
+ const restrictedFolders = document.querySelectorAll('li.folder-section[data-restricted="true"]');
+ console.log('Restricted folders found:', restrictedFolders.length);
+ console.log('isSiUser:', isSiUser);
+ if (isSiUser) {
+ restrictedFolders.forEach(folder => {
+ folder.classList.add('allowed');
+ console.log('Added allowed class to:', folder);
+ });
+ }
+ }
+
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', applyRestrictions);
} else {
applyRestrictions();
}
- function applyRestrictions() {
- const restrictedFolders = document.querySelectorAll('li.folder-section[data-restricted="true"]');
- if (isSiUser) {
- restrictedFolders.forEach(folder => folder.classList.add('allowed'));
- }
- }
+ // API로 재확인 (비동기)
+ fetch('/api/whoami', { credentials: 'include' })
+ .then(r => r.ok ? r.json() : null)
+ .then(data => {
+ console.log('API response:', data);
+ if (data && data.user === 'si') {
+ isSiUser = true;
+ applyRestrictions();
+ } else {
+ console.log('Not si user. API user:', data ? data.user : 'no data');
+ console.log('Cookies:', cookies);
+ }
+ })
+ .catch(e => {
+ console.log('API error:', e);
+ });
})();
</script>
</head>