Skip to content

[plugins] add LeetCode Pulse desktop widget - #227

Closed
mannish01 wants to merge 2 commits into
Ryoku-dev:mainfrom
mannish01:add-leetcode-pulse
Closed

mannish01 wants to merge 2 commits into
Ryoku-dev:mainfrom
mannish01:add-leetcode-pulse

Conversation

@mannish01

Copy link
Copy Markdown
Contributor

What is this?

Adds LeetCode Pulse, a community desktopWidget tile that shows a LeetCode profile's solved counts, rank, difficulty split, streak, acceptance rate, language mix and a 12-week activity map. First uploaded to https://github.com/mannish01/LeetCode-Pulse, now proposed for the Ryostore catalogue for approval.

Why it is useful

The same public alfa-leetcode-api used by the contributor's portfolio drives the tile. It has a username text setting (default MANISHX01, the contributor's profile) so any installer can point it at their own LeetCode summary, plus a pollSeconds interval (60–3600, default 600). The helper fetches four endpoints in parallel, computes the activity grid and caches the last good snapshot under pluginApi.stateDir so an API outage shows saved stats instead of zeros.

Changes

  • New plugins/leetcode-pulse/ with manifest.json, service/Main.qml, content/Widget.qml, bin/leetcode_pulse.py, README.md, LICENSE and a real preview capture.
  • New plugins/registry.json entry: official: false, upstream mannish01/LeetCode-Pulse, lastUpdated 2026-11-29.
  • Generated product-manifest.json and manifestSha256 via tools/pack-product.py --touch.

Security and privacy

  • Network hosts declared: alfa-leetcode-api.onrender.com (read-only public stats) and leetcode.com (opened only on an explicit click).
  • Writes only pulse.json under the plugin's own stateDir. No credentials, tokens, privileged commands, shell strings built from data, secrets or binaries.
  • Username is URL-encoded and passed as one path component. Plugin validates with 0 blocking / 0 warnings; the repo security screen reports 0 findings for these files.

Checklist

  • One folder under its catalogue with a manifest and a real preview image (not a placeholder).
  • One entry added to plugins/registry.json (lastUpdated 2026-11-29, official: false, manifest hash refreshed).
  • Tested live in Ryoku: rendered the actual Widget.qml in Quickshell with sample stats; fixed two QML warnings found that way (missing required property var modelData in the activity repeater and an undefined Theme.line colour) and re-rendered with a clean log.
  • tests/validate-catalogue.sh passes from the repo root.
  • tests/validate-store.py --categories plugins passes.
  • ryoku plugin validate plugins/leetcode-pulse → 0 blocking, 0 warnings.
  • tools/security-screen.py --staged → 0 blocking, 0 errors; 0 findings in this plugin.
  • I own the content, MIT licensed; it overwrites no user configuration and runs no privileged commands.

Note: the public API returned HTTP 429 from this machine's IP during testing, so the live call fell back to the cached-snapshot path exactly as designed; this does not affect the submission.

Community desktop tile showing a configurable LeetCode profile's solved counts, rank, difficulty split, streak, acceptance and 12-week activity, using the public alfa-leetcode-api with a cached offline fallback. Includes registry entry, product manifest and a real preview capture.

@neur0map neur0map left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔴 Changes requested — 0 critical and 2 major issue(s): see the inline comments and the walkthrough for fixes and an agent-ready prompt.

🧹 Nitpicks (3) — optional, not blocking
  1. plugins/leetcode-pulse/bin/leetcode_pulse.py:68-70 — Possible Bug — The cache is shared across usernames and is loaded without checking its username. If a user changes the setting while the API is unavailable, the widget displays the previous person's profile and clicking it opens that…

  2. plugins/leetcode-pulse/service/Main.qml:78-82 — Stability — The timeout clears loading but does not terminate the process. If a server keeps a response alive indefinitely, subsequent polls are skipped because statusProc.running remains true, so the widget cannot recover witho…

  3. plugins/leetcode-pulse/service/Main.qml:78-83 — Suggestion: bug — Stop the helper when refresh times out

    Suggested change

onTriggered: {
    if (svc.loading) {
        statusProc.running = false;
        svc.loading = false;
        svc.errorText = svc.errorText || "refresh timed out";
    }
}

@neur0map

neur0map commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

🦊 mika's review

Incremental review: new commits since the last checkpoint.

Summary

  • Add a themed desktop widget for public LeetCode statistics.
  • Poll configurable profiles and retain complete snapshots during outages.
  • Register the community plugin and its installation assets.

Estimated review effort: 1/5 · risk: low

📁 Walkthrough details

plugins/leetcode-pulse/bin/leetcode_pulse.py

  • Fetches four public API endpoints in parallel and produces a JSON statistics snapshot.
  • Reuses a matching cached snapshot on partial failure and saves only complete responses.
    • Calculates acceptance, top languages, and 84 days of UTC activity.
    • URL-encodes the username and stores cache under the supplied state directory.

plugins/leetcode-pulse/service/Main.qml

  • Runs the helper on a configurable polling interval and exposes statistics and status to the widget.
  • Handles process errors and stops refreshes that exceed the timeout.
    • Passes the configured username and plugin state directory as process arguments.
    • Parses helper output and reports saved or unavailable statistics.

plugins/leetcode-pulse/content/Widget.qml

  • Renders a themed desktop tile with solved counts, rank, difficulty split, streak, acceptance, languages, and activity.
  • Opens the displayed LeetCode profile when clicked.
    • Shows syncing, saved, or live status.
    • Scales the tile and uses PluginKit theme values.

plugins/leetcode-pulse/manifest.json

  • Declares the community desktop widget, entry points, network hosts, and Python dependency.
  • Exposes username and refresh interval settings with defaults.
    • Sets default placement and compact density.

plugins/leetcode-pulse/product-manifest.json

  • Defines packaged files, checksums, permissions, and installation destinations.
    • Includes the helper, QML entry points, manifest, documentation, license, and preview.

plugins/registry.json

  • Adds the plugin to the catalogue with its upstream, preview, metadata, and product manifest checksum.
    • Marks the desktop widget as community-maintained.

plugins/leetcode-pulse/README.md

  • Documents installation, settings, data sources, caching, privacy, and maintenance.
    • Credits the author and public API.

plugins/leetcode-pulse/LICENSE

  • Adds the plugin's MIT license and copyright notice.
    • Identifies Manish as the copyright holder.

No actionable findings. Mika looked for bugs, security issues, and risks in the diff and came up empty on clear defects.

🧪 No relevant tests detected in the diff.

🚦 Merge recommendation: no_concerns_found


🦊 Generated by Mika — the Ryoku org's self-hosted AI code reviewer. Machine findings: verify before merging.

Calendar keys are Unix seconds, not day counts. Require all endpoints before calling a snapshot live so a partial outage cannot zero a good cache, scope cache reads to the configured username, and stop a stalled helper process on timeout.
@mannish01

Copy link
Copy Markdown
Contributor Author

Addressed all findings and nitpicks in ded200e (also mirrored to https://github.com/mannish01/LeetCode-Pulse): calendar timestamps fixed; snapshots are live only when all four endpoints answer; cache is username-scoped and only written on a fully live fetch; and the 25s timeout now sets statusProc.running = false so a stalled helper cannot block future polls. Mocked-endpoint tests: all-live → live=true with correct activity dot; partial outage → live=false, saved stats preserved and cache unchanged; username switch → no cross-account cache leak. ryoku plugin validate 0/0, catalogue/store validators pass, staged security screen 0 blocking/0 errors and 0 findings in this plugin.

@neur0map
neur0map dismissed their stale review November 29, 2026 18:32

Blocking findings were addressed (verified at ded200e12b).

@neur0map

Copy link
Copy Markdown
Member

Thanks for this, could Pulse become a second host inside LeetCode Summary, the bar glyph plus a desktop tile in one plugin like vpn and coffee do, instead of a second copy of the same code

@neur0map

Copy link
Copy Markdown
Member

Closing this one since LeetCode Summary covers the same stats, a desktop tile inside that plugin would be welcome as a follow up

@neur0map neur0map closed this Nov 30, 2026
@mannish01 mannish01 mentioned this pull request Nov 30, 2026
9 tasks done
@mannish01

Copy link
Copy Markdown
Contributor Author

Followed your suggestion: the desktop tile is now a second host inside LeetCode Summary (PR #228, commit 5c2af7f, version 0.2.0), sharing the bar plugin service/helper instead of duplicating the code. Leaving this closed PR as-is; #228 carries the merged feature.

@mannish01

Copy link
Copy Markdown
Contributor Author

Correction: #228 was already merged with the 0.1.0 bar plugin, so the desktop-tile follow-up is a new PR: #231 (version 0.2.0, based on current main). That PR carries the second host inside LeetCode Summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants