experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(frontend): add profiles API to preload

- Expose profiles API through contextBridge
- Add functions for list/create/delete/switch operations
- Add sync configuration functions per profile
- Available via window.app.profiles in renderer

+84
+84
preload.js
··· 611 611 } 612 612 }; 613 613 614 + // Profiles API - user profile management 615 + api.profiles = { 616 + /** 617 + * List all profiles 618 + * @returns {Promise<{success: boolean, data?: Profile[], error?: string}>} 619 + */ 620 + list: () => { 621 + return ipcRenderer.invoke('profiles:list'); 622 + }, 623 + 624 + /** 625 + * Create a new profile 626 + * @param {string} name - Profile name (e.g., "Work", "Personal") 627 + * @returns {Promise<{success: boolean, data?: Profile, error?: string}>} 628 + */ 629 + create: (name) => { 630 + return ipcRenderer.invoke('profiles:create', { name }); 631 + }, 632 + 633 + /** 634 + * Get a specific profile by slug 635 + * @param {string} slug - Profile slug (e.g., "work", "personal") 636 + * @returns {Promise<{success: boolean, data?: Profile, error?: string}>} 637 + */ 638 + get: (slug) => { 639 + return ipcRenderer.invoke('profiles:get', { slug }); 640 + }, 641 + 642 + /** 643 + * Delete a profile (cannot delete default or active profile) 644 + * @param {string} id - Profile ID 645 + * @returns {Promise<{success: boolean, error?: string}>} 646 + */ 647 + delete: (id) => { 648 + return ipcRenderer.invoke('profiles:delete', { id }); 649 + }, 650 + 651 + /** 652 + * Get the currently active profile 653 + * @returns {Promise<{success: boolean, data?: Profile, error?: string}>} 654 + */ 655 + getCurrent: () => { 656 + return ipcRenderer.invoke('profiles:getCurrent'); 657 + }, 658 + 659 + /** 660 + * Switch to a different profile (causes app restart) 661 + * @param {string} slug - Profile slug to switch to 662 + * @returns {Promise<{success: boolean, error?: string}>} 663 + */ 664 + switch: (slug) => { 665 + return ipcRenderer.invoke('profiles:switch', { slug }); 666 + }, 667 + 668 + /** 669 + * Enable sync for a profile 670 + * @param {string} profileId - Profile ID 671 + * @param {string} apiKey - Server API key 672 + * @param {string} serverProfileSlug - Server profile slug to sync with 673 + * @returns {Promise<{success: boolean, error?: string}>} 674 + */ 675 + enableSync: (profileId, apiKey, serverProfileSlug) => { 676 + return ipcRenderer.invoke('profiles:enableSync', { profileId, apiKey, serverProfileSlug }); 677 + }, 678 + 679 + /** 680 + * Disable sync for a profile 681 + * @param {string} profileId - Profile ID 682 + * @returns {Promise<{success: boolean, error?: string}>} 683 + */ 684 + disableSync: (profileId) => { 685 + return ipcRenderer.invoke('profiles:disableSync', { profileId }); 686 + }, 687 + 688 + /** 689 + * Get sync configuration for a profile 690 + * @param {string} profileId - Profile ID 691 + * @returns {Promise<{success: boolean, data?: {apiKey: string, serverProfileSlug: string} | null, error?: string}>} 692 + */ 693 + getSyncConfig: (profileId) => { 694 + return ipcRenderer.invoke('profiles:getSyncConfig', { profileId }); 695 + } 696 + }; 697 + 614 698 // Track per-window color scheme override (null = use global) 615 699 let windowColorSchemeOverride = null; 616 700