Skip to content

Ajit/poslish app#2165

Merged
deadlyjack merged 3 commits into
mainfrom
ajit/poslish-app
Jun 8, 2026
Merged

Ajit/poslish app#2165
deadlyjack merged 3 commits into
mainfrom
ajit/poslish-app

Conversation

@deadlyjack

Copy link
Copy Markdown
Member

No description provided.

Ajit Kumar added 2 commits June 9, 2026 00:24
fix(updates): correct semver version comparison logic
refactor(plugin): replace rating colors with theme variables

- Add fetchPromotions() to cache promotional content from API
- Render cached promotions as settings items with image icons
- Support item.image in settings list for inline image rendering
- Fix version check to compare semver components sequentially
- Add --success-text-color CSS variable and ThemeBuilder accessor
- Replace hardcoded brand icon colors with inherited theme colors
- Add like/like-solid icon glyphs with cache-busting font URL (?v3)
- Add settings-category-discover-apps i18n string across all locales
- Fix file mode on style.css (755→644)
- Validate promotion icon/link_text types before rendering
@github-actions github-actions Bot added the translations Anything related to Translations Whether a Issue or PR label Jun 8, 2026
@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR polishes the app by adding a server-driven promotions section to the settings page, fixing a version-comparison bug, refreshing the plugin rating display, and updating the icon font with new icons and simplified brand-colour rules.

  • Promotions feature: fetchPromotions() fetches and caches app-promotion entries from the API; mainSettings.js reads the cache and injects them as a "Discover more apps" settings category with image icons and system.openInBrowser click handling; settingsPage.js is extended to render an <img> inside the icon span.
  • Version comparison fix: The old Array.some() check didn't short-circuit when a higher-precedence segment was already lower, potentially showing false update notifications for versions like 1.11.x vs 2.0.x; the new loop breaks correctly on the first differing segment.
  • UI refresh: Plugin rating badges switch from coloured background chips to plain coloured text using the new --success-text-color theme variable; the rating-medium class is intentionally removed; brand icon colours are stripped from style.css.

Confidence Score: 5/5

Safe to merge; the promotions feature validates click-target URLs but leaves the icon image URL unvalidated — a low-impact gap worth a follow-up.

All changed paths are well-contained: the version-comparison rewrite is a straightforward loop improvement, the UI changes are cosmetic, and the promotions feature correctly validates promo.url before browser navigation. The one gap — promo.icon reaching img src without a scheme check — is limited in impact because image loading in a WebView doesn't execute JS and the remote data comes from the project's own API endpoint.

src/settings/mainSettings.js — the promo.icon field is passed to img src without scheme validation, unlike promo.url which has an https-only guard.

Important Files Changed

Filename Overview
src/main.js Adds fetchPromotions() call on startup that caches API data into localStorage; also fixes the version-comparison loop to correctly short-circuit on lower version segments.
src/settings/mainSettings.js Reads cached promotions from localStorage and appends them as a 'Discover more apps' category; promo.url is scheme-validated but promo.icon is not before use as img src.
src/components/settingsPage.js Adds support for an image property on list items, rendering an img tag inside the icon span; existing link-handling in resolveItemInteraction correctly fires system.openInBrowser for promo items.
src/pages/plugin/plugin.view.js Swaps the rating icon to like-solid and removes the rating-medium CSS class (50-79% ratings now render without a tint color), matching the simplified plugin.scss styles.
src/theme/builder.js Adds --success-text-color CSS variable with default value rgb(22, 152, 44) and the corresponding getter/setter on ThemeBuilder.
src/pages/plugin/plugin.scss Simplifies rating badge styling: removes padding/background approach in favour of plain coloured text using the new --success-text-color and --danger-color variables; removes rating-medium class.
src/res/icons/style.css Updates icon font to v3, adds like/like-solid icon definitions, expands font-face selector to cover icon- prefixed classes, and strips hard-coded brand colours from icon rules.

Sequence Diagram

sequenceDiagram
    participant App as App (onDeviceReady)
    participant API as API (/promotions)
    participant LS as localStorage
    participant MS as mainSettings()
    participant SP as settingsPage
    participant Browser as system.openInBrowser

    App->>API: fetch /promotions
    API-->>App: "[{label, url, icon, link_text}, ...]"
    App->>LS: setItem("cached_promotions", JSON)

    Note over MS: User opens Settings
    MS->>LS: getItem("cached_promotions")
    LS-->>MS: cached promotions array
    MS->>SP: "push items with link=promo.url, image=promo.icon"
    SP-->>MS: settings page rendered

    Note over SP: User clicks promotion item
    SP->>Browser: system.openInBrowser(link)
Loading

Reviews (2): Last reviewed commit: "fix(promotions): allow server to clear c..." | Re-trigger Greptile

Comment thread src/main.js Outdated
Comment thread src/main.js
Comment thread src/settings/mainSettings.js
… URL scheme

- Remove data.length guard so empty [] response clears stale promotions
- Validate promo.url starts with http:// or https:// before rendering
@deadlyjack

Copy link
Copy Markdown
Member Author

@greptile_apps review again

@deadlyjack deadlyjack merged commit dbde879 into main Jun 8, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Jun 8, 2026
@deadlyjack deadlyjack deleted the ajit/poslish-app branch June 8, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

translations Anything related to Translations Whether a Issue or PR

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant