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.html32
1 files changed, 19 insertions, 13 deletions
diff --git a/layouts/recordings/recordings-plain.html b/layouts/recordings/recordings-plain.html
index 6849f5b..a36964d 100644
--- a/layouts/recordings/recordings-plain.html
+++ b/layouts/recordings/recordings-plain.html
@@ -114,12 +114,9 @@
// 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);
});
}
}
@@ -130,22 +127,31 @@
applyRestrictions();
}
- // API로 재확인 (비동기)
- fetch('/api/whoami', { credentials: 'include' })
+ // 쿠키가 없으면 재확인 (쿠키는 nginx에서 설정됨)
+ if (!isSiUser) {
+ setTimeout(() => {
+ const cookies2 = document.cookie.split(';').reduce((acc, cookie) => {
+ const [key, value] = cookie.trim().split('=');
+ acc[key] = value;
+ return acc;
+ }, {});
+ if (cookies2.user === 'si' || cookies2.authUser === 'si') {
+ isSiUser = true;
+ applyRestrictions();
+ }
+ }, 100);
+ }
+
+ // API로 최종 확인
+ fetch('/api/whoami.php', { 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);
- });
+ .catch(() => {});
})();
</script>
</head>
@@ -375,7 +381,7 @@
// API로 사용자 정보 확인 (nginx에서 헤더 읽기)
let isSiUser = false;
try {
- const response = await fetch('/api/whoami', {
+ const response = await fetch('/api/whoami.php', {
credentials: 'include'
});
if (response.ok) {