Skip to content

Commit bfb8427

Browse files
committed
feat: add version-history handoff links for Greasy Fork and GitHub sources
1 parent 8b498ac commit bfb8427

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ All notable changes to ScriptHunt will be documented in this file.
2424
- Diagnostics exports now include `schema: "scripthunt-diagnostics"` and `schemaVersion: 1` for future replay/migration, plus preference schema diagnostics.
2525
- Installed-script import now recognizes Violentmonkey/ScriptCat manager backup formats (`meta.name`/`custom.includes` shape and `list` arrays) alongside ScriptHunt JSON and generic arrays. Manager backups show "(detected manager backup)" in the import toast.
2626
- Live source canary tests (`npm run test:canary`) verify Greasy Fork, ScriptCat, GitHub, and allorigins proxy are reachable with expected response shapes. Excluded from the default deterministic test suite.
27+
- Result cards show "Version History" links for Greasy Fork (versions page) and GitHub (commits page) sources. Scrape-only sources omit the link.
2728

2829
## [v0.4.1]
2930

ROADMAP.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,3 @@
1717
Complexity: M
1818

1919

20-
- [ ] P3 — Add source version-history and diff handoff links
21-
Why: Users deciding whether to install or update need a quick path to source history, but ScriptHunt should link to catalog/GitHub history instead of hosting script versions itself.
22-
Evidence: OpenUserJS#1023, Tampermonkey#2015, GitHub Search API docs; index.html:1438, index.html:1473, index.html:1573.
23-
Touches: index.html source normalizers/result cards/comparison modal, adapter fixtures, README source notes.
24-
Acceptance: result cards show source-history or diff links when a source provides a stable history/repository URL, omit them otherwise, and tests cover Greasy Fork, GitHub repository/code, and scrape-only fallback behavior.
25-
Complexity: M

index.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,14 +1716,16 @@ <h3>Search userscripts everywhere</h3>
17161716
}
17171717

17181718
function normGF(item, srcId) {
1719+
var pageUrl = item.url || ('https://greasyfork.org/en/scripts/' + item.id);
17191720
return { id: srcId + '-' + item.id, source: srcId, name: item.name || 'Untitled', description: item.description || '',
17201721
author: (item.users && item.users[0] && item.users[0].name) || 'Unknown',
1721-
url: item.url || ('https://greasyfork.org/en/scripts/' + item.id),
1722+
url: pageUrl,
17221723
installUrl: item.code_url || '', version: item.version || '',
17231724
dailyInstalls: item.daily_installs || 0, totalInstalls: item.total_installs || 0,
17241725
rating: item.good_ratings || 0, badRating: item.bad_ratings || 0,
17251726
createdAt: item.created_at || '', updatedAt: item.code_updated_at || '',
1726-
license: normalizeLicense(item.license), _gfId: item.id };
1727+
license: normalizeLicense(item.license), _gfId: item.id,
1728+
historyUrl: pageUrl ? pageUrl.replace(/\/?$/, '/versions') : '' };
17271729
}
17281730

17291731
/* ===== Source: GitHub Repos ===== */
@@ -1753,7 +1755,8 @@ <h3>Search userscripts everywhere</h3>
17531755
author: (item.owner && item.owner.login) || 'Unknown', url: item.html_url, installUrl: '',
17541756
version: '', dailyInstalls: 0, totalInstalls: 0, rating: item.stargazers_count || 0, badRating: 0,
17551757
createdAt: item.created_at || '', updatedAt: item.updated_at || '',
1756-
license: normalizeLicense(item.license && item.license.spdx_id), stars: item.stargazers_count || 0, forks: item.forks_count || 0, language: item.language || '' };
1758+
license: normalizeLicense(item.license && item.license.spdx_id), stars: item.stargazers_count || 0, forks: item.forks_count || 0, language: item.language || '',
1759+
historyUrl: item.html_url ? item.html_url + '/commits' : '' };
17571760
}
17581761

17591762
/* ===== Source: GitHub Code Search (authenticated) ===== */
@@ -2515,6 +2518,7 @@ <h3>Search userscripts everywhere</h3>
25152518
h += '<div class="card-meta">' + meta.join('') + '</div>';
25162519
h += '<div class="trust-details" id="' + trustId + '">' + renderTrustDetails(item) + '</div>';
25172520
var urlLinks = renderScriptUrlLinks(item);
2521+
if (item.historyUrl) urlLinks += '<a class="script-url-link" href="' + safeHref(item.historyUrl) + '" target="_blank" rel="noopener">Version History</a>';
25182522
if (urlLinks) h += '<div class="script-url-list">' + urlLinks + '</div>';
25192523
h += renderAppliesToEvidence(item._appliesTo);
25202524
h += renderProvenance(item, installed);

0 commit comments

Comments
 (0)