Public Source Viewer
비나래아카이브 개발자 포털
실제 서비스 구조를 살펴볼 수 있는 공개용 코드 뷰어입니다. 인증, 세션, 외부 연동, 토큰, 관리자 식별 등 보안상 민감한 구현은 파일 단위 또는 줄 단위로 검열됩니다.
public/js/work-reader.js
공개 가능
1
// Store position for the sandboxed reader without granting it the site's origin.
2
(() => {
3
const frame = document.querySelector('.work-reader-frame');
4
if (!frame) return;
5
const key = 'hinana-novel-position:' + frame.dataset.readerKey;
6
const valid = anchor => Number.isFinite(anchor) && anchor >= 0 && anchor <= 1000000000;
7
const restore = () => {
8
try {
9
[SECURITY REDACTED] 민감한 설정/인증/토큰 관련 코드입니다.
10
if (stored && valid(stored.anchor)) frame.contentWindow.postMessage({ type: 'novel:position:restore', anchor: stored.anchor }, '*');
11
} catch { /* Reading is available when storage is disabled. */ }
12
};
13
frame.addEventListener('load', restore);
14
window.addEventListener('message', event => {
15
if (event.source !== frame.contentWindow || !event.data) return;
16
if (event.data.type === 'novel:position:load') restore();
17
if (event.data.type === 'novel:position:save' && valid(event.data.anchor)) {
18
[SECURITY REDACTED] 민감한 설정/인증/토큰 관련 코드입니다.
19
}
20
});
21
})();
22