-
-
Notifications
You must be signed in to change notification settings - Fork 513
fix(rhwp-chrome): 썸네일 로딩 스피너 정리 + options CSP 호환 #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9edea55
Task #86: 썸네일 로딩 완료 시 스피너 제거
postmelee b10267b
fix(rhwp-chrome): options 페이지 CSP 호환
postmelee 503967f
fix(rhwp-chrome): options.js IIFE + 'use strict' 적용
postmelee bb62838
Merge branch 'devel' into fix/chrome-clean-v2
postmelee 779de81
chore(rhwp-chrome): 버전 표기 및 문서 예시 정합성 보정
postmelee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| (function () { | ||
| 'use strict'; | ||
|
|
||
| // i18n 적용 | ||
| document.getElementById('title').textContent = chrome.i18n.getMessage('optionsTitle'); | ||
| document.getElementById('labelAutoOpen').textContent = chrome.i18n.getMessage('optionsAutoOpen'); | ||
| document.getElementById('labelShowBadges').textContent = chrome.i18n.getMessage('optionsShowBadges'); | ||
| document.getElementById('labelHoverPreview').textContent = chrome.i18n.getMessage('optionsHoverPreview'); | ||
| document.getElementById('saved').textContent = chrome.i18n.getMessage('optionsSaved'); | ||
| document.getElementById('privacy').textContent = chrome.i18n.getMessage('optionsPrivacy'); | ||
| document.getElementById('version').textContent = chrome.runtime.getManifest().version; | ||
|
|
||
| const inputs = ['autoOpen', 'showBadges', 'hoverPreview']; | ||
|
|
||
| // 설정 로드 | ||
| chrome.storage.sync.get( | ||
| { autoOpen: true, showBadges: true, hoverPreview: true }, | ||
| (settings) => { | ||
| for (const id of inputs) { | ||
| document.getElementById(id).checked = settings[id]; | ||
| } | ||
| } | ||
| ); | ||
|
|
||
| // 설정 저장 | ||
| for (const id of inputs) { | ||
| document.getElementById(id).addEventListener('change', () => { | ||
| const settings = {}; | ||
| for (const id2 of inputs) { | ||
| settings[id2] = document.getElementById(id2).checked; | ||
| } | ||
| chrome.storage.sync.set(settings, () => { | ||
| const saved = document.getElementById('saved'); | ||
| saved.classList.add('show'); | ||
| setTimeout(() => saved.classList.remove('show'), 1500); | ||
| }); | ||
| }); | ||
| } | ||
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rhwpDev.help() 출력 예시에서 사용자에게 보여주는 코드:
data-hwp-thumbnail="/thumbs/preview.webp" ← 상대경로
그러나 실제로 이 속성값을 표시하는 로직(content-script.js:60)은:
function isSafeImageUrl(url) {
try {
const parsed = new URL(url); // ← base 인자 없음
return parsed.protocol === 'https:' || parsed.protocol === 'http:';
} catch { return false; }
}
new URL("/thumbs/preview.webp") 는 base 없으면 TypeError를 던집니다 → catch에서 false → 썸네일 거절.
즉 사용자가 help 가이드를 그대로 따라 data-hwp-thumbnail="/thumbs/preview.webp"라고 적으면 썸네일이
표시되지 않습니다. 가이드와 실제 동작이 어긋나는 상태였습니다.