- Add WFS_GalleryFeeder custom node (group_name/index/sort_mode/seed → IMAGE) - Add Feeder tab Gallery mode ([Image Loop]/[Gallery] toggle, node selector, group picker, image grid with click-to-set-index, Run/Stop loop) - Add gallery_feeder_extension.js: After Gen combo + Run/Stop widgets on WFS_GalleryFeeder node in ComfyUI canvas (serialize:false, waitForExecution) - Add Gallery thumbnail F button to toggle __Feeder__ group membership (cyan overlay) - Add __Feeder__ reserved group: rename/delete blocked (403 server + disabled UI); FC toolbar button clears members; ensure_group auto-creates on Feeder init - Security: escapeHtml() applied to tag names, filenames, error messages in gallery-tab.js; single-quote escaping added to util.js escapeHtml - Security: _check_path_allowed() added to save_image_meta, toggle_favorite, add_to_group, remove_from_group in gallery_service.py - Security/bugfix: _init_allowed_root() in gallery_routes.py initializes _allowed_root at module load (settings.json → ComfyUI default); fixes serve_image 404 in Feeder Gallery mode and prevents list_folder_tree from overriding _allowed_root - Bugfix: WFS_GalleryFeeder seed max 0x7FFFFFFF → 0xffffffffffffffff (KSampler parity) - Update README, DEVLOG, pyproject.toml to v0.3.42 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
760 B
JavaScript
29 lines
760 B
JavaScript
/**
|
||
* Shared utilities
|
||
*/
|
||
|
||
// HTMLエスケープ(属性値・テキストコンテンツ両方で安全に使える)
|
||
export function escapeHtml(s) {
|
||
return String(s)
|
||
.replace(/&/g, "&")
|
||
.replace(/</g, "<")
|
||
.replace(/>/g, ">")
|
||
.replace(/"/g, """)
|
||
.replace(/'/g, "'");
|
||
}
|
||
|
||
// localStorage からJSONを安全に読む(不正JSON・未設定時はfallback)
|
||
export function readJsonStorage(key, fallback = {}) {
|
||
try {
|
||
const raw = localStorage.getItem(key);
|
||
return raw ? JSON.parse(raw) : fallback;
|
||
} catch {
|
||
return fallback;
|
||
}
|
||
}
|
||
|
||
// プラグイン共通設定 (wfm_settings)
|
||
export function getSettings() {
|
||
return readJsonStorage("wfm_settings");
|
||
}
|