generated from nhcarrigan/template
feat: add streamer mode for privacy during streaming
- Add quick toggle button in InputBar for easy access - Mask API keys in settings when streamer mode active - Optional path masking to hide usernames in file paths - Visual LIVE indicator in both InputBar and StatusBar - Keyboard shortcut Ctrl+Shift+S for quick toggle - Privacy section in settings for additional options Closes #35
This commit is contained in:
@@ -19,6 +19,8 @@ export interface HikariConfig {
|
||||
update_checks_enabled: boolean;
|
||||
character_panel_width: number | null;
|
||||
font_size: number;
|
||||
streamer_mode: boolean;
|
||||
streamer_hide_paths: boolean;
|
||||
}
|
||||
|
||||
const defaultConfig: HikariConfig = {
|
||||
@@ -37,6 +39,8 @@ const defaultConfig: HikariConfig = {
|
||||
update_checks_enabled: true,
|
||||
character_panel_width: null,
|
||||
font_size: 14,
|
||||
streamer_mode: false,
|
||||
streamer_hide_paths: false,
|
||||
};
|
||||
|
||||
function createConfigStore() {
|
||||
@@ -145,6 +149,12 @@ function createConfigStore() {
|
||||
config.subscribe((c) => (currentConfig = c))();
|
||||
return currentConfig;
|
||||
},
|
||||
|
||||
toggleStreamerMode: async () => {
|
||||
let currentConfig: HikariConfig = defaultConfig;
|
||||
config.subscribe((c) => (currentConfig = c))();
|
||||
await updateConfig({ streamer_mode: !currentConfig.streamer_mode });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -174,3 +184,25 @@ export { MIN_FONT_SIZE, MAX_FONT_SIZE, DEFAULT_FONT_SIZE };
|
||||
export const configStore = createConfigStore();
|
||||
|
||||
export const isDarkTheme = derived(configStore.config, ($config) => $config.theme === "dark");
|
||||
|
||||
export const isStreamerMode = derived(configStore.config, ($config) => $config.streamer_mode);
|
||||
export const shouldHidePaths = derived(
|
||||
configStore.config,
|
||||
($config) => $config.streamer_mode && $config.streamer_hide_paths
|
||||
);
|
||||
|
||||
/**
|
||||
* Masks file paths in text when streamer mode with hide paths is enabled.
|
||||
* Replaces username portion of paths with asterisks.
|
||||
*/
|
||||
export function maskPaths(text: string, hidePaths: boolean): string {
|
||||
if (!hidePaths) return text;
|
||||
|
||||
// Match Unix paths like /home/username/... or /Users/username/...
|
||||
// and Windows paths like C:\Users\username\...
|
||||
return text
|
||||
.replace(/\/home\/([^\/\s]+)/g, "/home/****")
|
||||
.replace(/\/Users\/([^\/\s]+)/g, "/Users/****")
|
||||
.replace(/C:\\Users\\([^\\\s]+)/gi, "C:\\Users\\****")
|
||||
.replace(/~\//g, "****/");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user