StashNotifications

:placard: Summary Adds a notification button on the nav bar whenever you have out of date plugins and scrapers. You can then quickly update those plugins/scrapers on the fly.
:link: Repository https://github.com/stashapp/CommunityScripts/tree/main/plugins/stashNotifications
:information_source: Source URL https://stashapp.github.io/CommunityScripts/stable/index.yml
:open_book: Install How to install a plugin?

Features

  • Receive updates on out-of-date plugins and scrapers.
  • Quickly update plugins/scrapers wherever you are in Stash. No need to go to the settings page!
  • Button is hidden when everything is up-to-date to reduce clutter on the nav bar.

Installation

By default, the community scripts repository for adding plugins is added to Stash. Simply search the plugin in the list on the Settings > Plugins page and install.

Screenshots

Clicking on the notification will open a small window, allowing you to either update the plugin or all plugins with available updates. This functionality is also available for scrapers.

In the future, I want to expand this to other types of notifications. This plugin is available in the community repository for folks to modify it however they like. If you want to add notification types, please feel free to do so.

My development repository for the plugin is located here.

4 Likes

Stash notifications recommends to update scrapers that are already up to date. A lot of the scrapers I use get a notification similar to this one:

The version number is always off by one number or letter, but as you can see from the timestamp, it’s the same version. If I chose to update the scraper the problem goes away, until I reload the page. Do you know what this could be?

I’m going to be busy due to the holidays, but I will look into this and update it as soon as I can. The plugin is recognizing that 1-character difference between the versions which is why it reappears. Just need to figure out why the current version is missing the character.

I didn’t have a sec to fix it yet, but I gave Claude an investigation task on this:

StashNotifications False Update Bug — Root Cause Analysis

## Summary

The stashNotifications plugin shows false update notifications for scrapers/plugins that are already at their latest version. The root cause is **not in the plugin itself** — it’s in how `build_site.sh` generates version identifiers for the package index.

## The Bug

`build_site.sh` generates version strings using git’s abbreviated commit hash format:

```bash

# CommunityScrapers - build_site.sh line 36

version=$(git log -n 1 --pretty=format:%h – “$versionFile”)

# CommunityScripts - build_site.sh line 32

version=$(git log -n 1 --pretty=format:%h – “$dir”/*)

```

The `%h` format produces a **short hash whose length is not stable over time**. Git uses the minimum number of hex characters needed to uniquely identify a commit within the repository. As the repo grows (more commits are added), git may need more characters to maintain uniqueness.

## How It Manifests

1. User installs a scraper when the index lists version `3f254b5` (7 chars). This gets saved to their local manifest.

2. More commits are added to the repo. The index is regenerated (e.g., because a different scraper was updated).

3. Git now produces `3f254b51` (8 chars) for the **exact same commit** — it needs the extra character for uniqueness in the larger repo.

4. Stash fetches the new index: `source_package.version = “3f254b51”`, compares to local `manifest.version = “3f254b5”` — strict string mismatch.

5. Both stashNotifications and Stash’s own package manager UI show a false update notification.

## Why It Wasn’t Always Broken

This is a progressive issue. The short hash length only changes when enough new commits accumulate to create potential ambiguity. Repos that are small or slow-growing may never hit it. But CommunityScrapers/CommunityScripts have enough activity that the abbreviated hash length has shifted over time.

## Where the Fix Belongs

The fix needs to happen in `build_site.sh` in both repositories:

- `stashapp/CommunityScrapers/build_site.sh` (line 36)

- `stashapp/CommunityScripts/build_site.sh` (line 32)

The version generation needs to produce a stable identifier that doesn’t change based on repo size.

## Data Flow Reference

For context, here’s how the version flows through the system:

1. `build_site.sh` writes `version: ` to `index.yml` (the remote package index)

2. Stash fetches `index.yml` via `pkg/pkg/repository_http.go` → populates `RemotePackage.Version`

3. At install time, `pkg/pkg/manager.go` copies `RemotePackage.PackageVersion` directly to `Manifest.PackageVersion` and saves it locally

4. Later, `internal/api/resolver_query_package.go` serves both values via GraphQL: `pkg.version` (from local manifest) and `pkg.source_package.version` (from fresh remote index)

5. The stashNotifications plugin compares these with strict equality (`!==`) — which is a perfectly reasonable comparison; the data it receives is just inconsistent