Exploit databaseDownload repository ZIP
GH-f1ca9c11b8ef6a486ff865162bf281b2
volksrat71/react2shellexploitvisualized
Sources for CVE-2025-55182
257 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files7
volksrat71/react2shellexploitvisualizedRevision e780d6fc4556
- ↑..Parent directory
- animations.svelte.ts
- audioSettings.svelte.ts
- captionSettings.svelte.ts
- comprehension.svelte.ts
- navigation.svelte.ts
- timeline.svelte.ts
- userPreferences.svelte.ts
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/lib/stores/userPreferences.svelte.ts
TypeScript · 4,369 bytes// User preferences with localStorage persistence
// Stores: target audience, volume, muted, captions, caption styling, and visited flag
import { browser } from '$app/environment';
const STORAGE_KEY = 'react2shell-preferences';
export type CaptionColor = 'yellow' | 'white' | 'cyan' | 'green' | 'pink';
export type CaptionSize = 'small' | 'medium' | 'large';
export type CaptionBackground = 'dark' | 'darker' | 'transparent';
interface CaptionStyle {
highlightColor: CaptionColor;
fontSize: CaptionSize;
background: CaptionBackground;
}
interface UserPreferences {
hasVisited: boolean;
audienceLevel: 'expert' | 'practitioner' | 'stakeholder';
volume: number;
muted: boolean;
showCaptions: boolean;
captionStyle: CaptionStyle;
}
const DEFAULT_CAPTION_STYLE: CaptionStyle = {
highlightColor: 'white',
fontSize: 'medium',
background: 'dark'
};
const DEFAULT_PREFERENCES: UserPreferences = {
hasVisited: false,
audienceLevel: 'practitioner',
volume: 1,
muted: false,
showCaptions: true,
captionStyle: DEFAULT_CAPTION_STYLE
};
function loadFromStorage(): UserPreferences {
if (!browser) return DEFAULT_PREFERENCES;
try {
const stored = localStorage.getItem(STORAGE_KEY);
if (stored) {
const parsed = JSON.parse(stored);
// Merge with defaults to handle missing keys from older versions
// Preserve the actual hasVisited value from storage
return { ...DEFAULT_PREFERENCES, ...parsed };
}
} catch (e) {
console.warn('Failed to load preferences from localStorage:', e);
}
return DEFAULT_PREFERENCES;
}
function saveToStorage(prefs: UserPreferences) {
if (!browser) return;
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(prefs));
} catch (e) {
console.warn('Failed to save preferences to localStorage:', e);
}
}
function createUserPreferences() {
const initial = loadFromStorage();
let hasVisited = $state(initial.hasVisited);
let audienceLevel = $state<UserPreferences['audienceLevel']>(initial.audienceLevel);
let volume = $state(initial.volume);
let muted = $state(initial.muted);
let showCaptions = $state(initial.showCaptions);
let captionStyle = $state<CaptionStyle>(initial.captionStyle ?? DEFAULT_CAPTION_STYLE);
// Save to storage whenever any preference changes
function persist() {
saveToStorage({
hasVisited,
audienceLevel,
volume,
muted,
showCaptions,
captionStyle
});
}
return {
// Getters
get hasVisited() {
return hasVisited;
},
get audienceLevel() {
return audienceLevel;
},
get volume() {
return volume;
},
get muted() {
return muted;
},
get showCaptions() {
return showCaptions;
},
// Caption style getters
get captionHighlightColor() {
return captionStyle.highlightColor;
},
get captionFontSize() {
return captionStyle.fontSize;
},
get captionBackground() {
return captionStyle.background;
},
// Setters with persistence
markVisited() {
hasVisited = true;
persist();
},
setAudienceLevel(level: UserPreferences['audienceLevel']) {
audienceLevel = level;
persist();
},
setVolume(v: number) {
volume = Math.max(0, Math.min(1, v));
if (volume > 0) {
muted = false;
}
persist();
},
setMuted(m: boolean) {
muted = m;
persist();
},
toggleMute() {
muted = !muted;
persist();
},
setShowCaptions(show: boolean) {
showCaptions = show;
persist();
},
toggleCaptions() {
showCaptions = !showCaptions;
persist();
},
// Caption style setters
setCaptionHighlightColor(color: CaptionColor) {
captionStyle = { ...captionStyle, highlightColor: color };
persist();
},
setCaptionFontSize(size: CaptionSize) {
captionStyle = { ...captionStyle, fontSize: size };
persist();
},
setCaptionBackground(bg: CaptionBackground) {
captionStyle = { ...captionStyle, background: bg };
persist();
},
resetCaptionStyle() {
captionStyle = { ...DEFAULT_CAPTION_STYLE };
persist();
},
// Reset all preferences
reset() {
hasVisited = DEFAULT_PREFERENCES.hasVisited;
audienceLevel = DEFAULT_PREFERENCES.audienceLevel;
volume = DEFAULT_PREFERENCES.volume;
muted = DEFAULT_PREFERENCES.muted;
showCaptions = DEFAULT_PREFERENCES.showCaptions;
captionStyle = { ...DEFAULT_CAPTION_STYLE };
persist();
}
};
}
export const userPreferences = createUserPreferences();