Skip to content

Conversation

Yusyuriv
Copy link
Member

@Yusyuriv Yusyuriv commented Sep 4, 2025

This is following this change in the main repository: Flow-Launcher/Flow.Launcher#3933. This PR should be merged after the full switch to main branch in PluginsManifest repository.

@Yusyuriv Yusyuriv self-assigned this Sep 4, 2025
@coderabbitai coderabbitai bot added the bug Something isn't working label Sep 4, 2025
@Yusyuriv Yusyuriv removed the bug Something isn't working label Sep 4, 2025
Copy link
Contributor

coderabbitai bot commented Sep 4, 2025

📝 Walkthrough

Walkthrough

Updated the plugins manifest fetch URL in src/getPluginsJson.ts from plugin_api_v2/plugins.json to main/plugins.json. No changes to types, control flow, caching, or error handling.

Changes

Cohort / File(s) Summary of changes
Plugin manifest fetch URL update
src/getPluginsJson.ts
Switched source URL for fetching plugins JSON to main/plugins.json; downstream mapping, caching, and return logic unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • jjw24
  • onesounds
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Yusyuriv-patch-1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cdca8d4 and 9e3a0f6.

📒 Files selected for processing (1)
  • src/getPluginsJson.ts (1 hunks)
🔇 Additional comments (1)
src/getPluginsJson.ts (1)

26-26: Verified plugin manifest URLs are live
Both the primary and fallback endpoints return HTTP 200 and expose the expected JSON structure:

  • main/plugins.json keys: Author, Description, E-tag, ID, Language, Name, UrlDownload, UrlSourceCode, Version, Website
  • plugin_api_v2/plugins.json keys: Author, DateAdded, Description, ID, IcoPath, Language, LatestReleaseDate, Name, UrlDownload, UrlSourceCode, Version, Website

All set to merge.

export async function getPluginsJson() {
if (!cachedData?.length) {
const data: FlowPlugin[] = await fetch("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json").then(v => v.json());
const data: FlowPlugin[] = await fetch("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json").then(v => v.json());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Harden the manifest fetch (ok-check, timeout, and safe fallback).

If main/plugins.json isn’t live yet or GitHub responds non-200/transiently, .json() will throw and break the build. Add res.ok handling, a short timeout, and a fallback to the previous manifest path.

-    const data: FlowPlugin[] = await fetch("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json").then(v => v.json());
+    const urls = [
+      // Allow override via env during migration or local testing
+      (import.meta as any)?.env?.PLUGINS_MANIFEST_URL
+        ?? process.env.PLUGINS_MANIFEST_URL
+        ?? "https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json",
+      // Fallback to old location (remove once migration is fully done)
+      "https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json",
+    ].filter(Boolean) as string[];
+
+    const controller = new AbortController();
+    const timeout = setTimeout(() => controller.abort(), 10_000);
+    let data: FlowPlugin[] | undefined;
+    for (const url of urls) {
+      try {
+        const res = await fetch(url, {
+          signal: controller.signal,
+          headers: { accept: "application/json" },
+        });
+        if (!res.ok) continue;
+        data = await res.json();
+        break;
+      } catch {
+        // try next URL
+      }
+    }
+    clearTimeout(timeout);
+    if (!data) {
+      throw new Error("Failed to fetch plugins manifest from any known URL.");
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const data: FlowPlugin[] = await fetch("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json").then(v => v.json());
// Hardened manifest fetch: support env override, timeout, ok-check, and fallback URL
const urls = [
// Allow override via env during migration or local testing
(import.meta as any)?.env?.PLUGINS_MANIFEST_URL
?? process.env.PLUGINS_MANIFEST_URL
?? "https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json",
// Fallback to old location (remove once migration is fully done)
"https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json",
].filter(Boolean) as string[];
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 10_000);
let data: FlowPlugin[] | undefined;
for (const url of urls) {
try {
const res = await fetch(url, {
signal: controller.signal,
headers: { accept: "application/json" },
});
if (!res.ok) continue;
data = await res.json();
break;
} catch {
// try next URL on error (including timeout)
}
}
clearTimeout(timeout);
if (!data) {
throw new Error("Failed to fetch plugins manifest from any known URL.");
}
🤖 Prompt for AI Agents
In src/getPluginsJson.ts around line 26, the fetch call lacks ok-checks, a
timeout, and a fallback; update it to use an AbortController with a short
timeout (e.g., 3s), await fetch and verify res.ok before calling res.json(), and
if the first request fails (network error, non-ok, or timeout) attempt the
previous manifest URL (e.g., the same raw GitHub path but using the prior
branch/path such as "master/plugins.json"); if both attempts fail, handle
gracefully by returning an empty array (or a safe default) and log a warning
instead of letting .json() throw and break the build.

@jjw24 jjw24 added the enhancement New feature or request label Sep 4, 2025
Copy link
Member

@jjw24 jjw24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, got to this before I did 😆. Thank you

@jjw24 jjw24 merged commit aae8444 into master Sep 4, 2025
1 check passed
@jjw24 jjw24 deleted the Yusyuriv-patch-1 branch September 4, 2025 11:16
@Yusyuriv
Copy link
Member Author

Yusyuriv commented Sep 4, 2025

Is it okay to merge it immediately? Won't that stop updates for all plugins for all users until v2.0.0 is released?

Edit: Sorry, got a little mixed up. Still, won't that prevent plugin updates from displaying on the website until v2.0.0 is released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants