본문으로 건너뛰기
Public Source Viewer

비나래아카이브 개발자 포털

실제 서비스 구조를 살펴볼 수 있는 공개용 코드 뷰어입니다. 인증, 세션, 외부 연동, 토큰, 관리자 식별 등 보안상 민감한 구현은 파일 단위 또는 줄 단위로 검열됩니다.

Redacted View
public/js/works.js
공개 가능
1 (() => {
2 const status = document.getElementById('works-status');
3 const csrf = document.getElementById('works-csrf')?.value;
4 let busy = false;
5 const request = async (url, init) => {
6 [SECURITY REDACTED] 민감한 설정/인증/토큰 관련 코드입니다.
7 let result; try { result = await response.json(); } catch { throw new Error('서버 응답을 확인할 수 없습니다. 로그인 상태와 서버 버전을 확인해 주세요.'); }
8 if (!response.ok) throw new Error(result.error || '요청에 실패했습니다.');
9 return result;
10 };
11 document.querySelectorAll('[data-delete-work]').forEach(button => button.addEventListener('click', async () => {
12 if (busy || !confirm(`‘${button.dataset.title}’의 게시를 취소하시겠습니까? 사이트에서만 삭제되며, Novel 프로젝트 파일은 유지됩니다.`)) return;
13 busy = true; button.disabled = true;
14 try { await request('/api/novel/works/' + encodeURIComponent(button.dataset.deleteWork), { method: 'DELETE' }); location.reload(); }
15 catch (error) { status.textContent = error.message; button.disabled = false; }
16 finally { busy = false; }
17 }));
18 })();
19