-
-
Notifications
You must be signed in to change notification settings - Fork 970
Live Folders #8888
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
base: dev
Are you sure you want to change the base?
Live Folders #8888
Conversation
…t's new: This update introduces "Live Folders," starting with support for GitHub Pull Requests. Here's what it does: 1. **Core Logic & Storage:** * I've added components to manage live folder operations, including fetching and parsing RSS feeds. * I've also set up a system to store live folder data and items in an SQLite database. * The GitHub PR RSS feed URL is used to get public pull requests for a specified user. 2. **UI Integration:** * You'll find a new context menu item "Enable GitHub PR Live Folder" (currently accessible via main toolbar/tab context menus). * Selecting this option will open a page where you can input a GitHub username. * Once you submit a username, a new "Live Folder" (e.g., "Pull Requests (username)") will be created. * Live Folders appear as pinned tabs and display a content page that dynamically shows the fetched pull requests with status indicators (open, merged, closed) and links to the PRs. * The display page listens for updates and refreshes content automatically. 3. **Configuration & Error Handling:** * You can configure the polling interval for checking RSS feed updates (default is 15 minutes, minimum 1 minute). * You can update this polling interval dynamically without a browser restart. * I've included basic error handling for feed fetching and parsing, with logs for diagnostics. 4. **Unit Tests:** * I've added unit tests for the new live folder management and storage components. * These tests cover data persistence, feed parsing logic, folder creation, polling configuration, and error handling, using mocks for external dependencies. This feature allows you to create dynamic folders that stay updated with information from external sources, beginning with GitHub Pull Requests.
if (contextMenu && !document.getElementById('zen-toolbar-context-enable-github-live-folder')) { | ||
const menuItem = document.createXULElement('menuitem'); | ||
menuItem.setAttribute('id', 'zen-toolbar-context-enable-github-live-folder'); | ||
// TODO: Replace with data-lazy-l10n-id for localization if this were a production feature. |
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.
Is this PR in draft?
There's a lot to still be implemented.
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.
Apologies for opening not in draft
// Fallback if goDoCommand is not the mechanism, add a command event listener. | ||
// This is a simplified approach. A more robust solution might involve <command> elements in XUL | ||
// and ensuring this listener is correctly scoped and cleaned up. |
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.
- _____
// Simplified check | ||
// Listen on gBrowser.tabContainer for events that might bubble from tabs |
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.
- _____
// descriptionId: 'zen-livefolder-github-enabled-toast-description', // Example for a more specific message | ||
// For now, using the main messageId as the primary display string. | ||
// In a real scenario, 'zen-livefolder-github-enabled-toast' would be a generic title | ||
// and descriptionId would point to "GitHub PR Live Folder for '{username}' enabled!" | ||
// For simplicity here, we'll assume the main ID can convey enough. |
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.
- _____
// Fallback for environments where Services.uuid might not be available directly | ||
// This is a simplified UUID v4 generator, consider a more robust one if needed. |
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.
- _____
// We need PlacesUtils to be available. Assuming it's loaded similarly to other storage files. | ||
// A more robust way would be to ensure PlacesUtils is loaded before calling init. | ||
if (globalThis.PlacesUtils) { | ||
ZenLiveFolderStorage.init(); | ||
} else { | ||
// If PlacesUtils is not available, wait for a global event or use a lazy loader. | ||
// For simplicity, we'll assume it becomes available. | ||
// In a real scenario, this needs careful handling of dependencies. | ||
console.warn( | ||
'PlacesUtils not immediately available for ZenLiveFolderStorage. Will try to initialize later.' | ||
); | ||
// Fallback or error handling |
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.
- _____
Etc...
Really like this PR! I would recommend moving the GitHub implementation to their own location and exposing an internal livefolders API instead. This would allow the project to add future integrations easily and possibly in the future expose the internal API, allowing plugins or mods (when able to run JavaScript) to be written. An additional nice feature is if we could have live elements (this most likely should be included in a separate PR). Live elements would show things like upcoming calendar items right from the browser. |
@ZacharyEllison One additional requirement we may need to address is how to handle OAuth2 clients. The current PR supports public GitHub repositories, but it would be great to include the ability to add private repositories as well. I often use this feature at work to keep track of open PRs within my team. |
Also for organisation SSO too. many people would benefit from that and also if its possible to add that 🔑 button on the folder to complete SSO so that private PRs can be fetched Great work btw Thanks Man. |
@ZacharyEllison , is there some progress on this pr? |
How did you even make live folders before folders even exist |
@mr-cheffy from scrolling through the code, it seems to only make a "folder" in the backend, but just pin the tab in the UI. I am not too sure as I did not have a lot of time to look at it. |
This update introduces "Live Folders," starting with support for GitHub Pull Requests.
Here's what it does:
Core Logic & Storage:
UI Integration:
Configuration & Error Handling:
Unit Tests:
This feature allows you to create dynamic folders that stay updated with information from external sources, beginning with GitHub Pull Requests.