Skip to content

Fix: Local Parsing for new Inspect Link Format#373

Merged
GODrums merged 8 commits intomasterfrom
fix/inspect-link-parsing
Mar 14, 2026
Merged

Fix: Local Parsing for new Inspect Link Format#373
GODrums merged 8 commits intomasterfrom
fix/inspect-link-parsing

Conversation

@GODrums
Copy link
Collaborator

@GODrums GODrums commented Mar 14, 2026

Adapts the extension according to the new inspect link format by parsing it locally. Uses our schema to get min/max float values.

Does NOT address Steam's missing asset description bug when looking at others' inventories yet.

Unsupported features:

  • lowest / highest float ranks

Note

Medium Risk
Moderate risk because it replaces the inspect-info source from a remote API call to local link decoding plus cached schema fetching, and updates inspect-link construction across inventory/market flows; errors here can break float/metadata display.

Overview
Switches FETCH_INSPECT_INFO from calling the CSFloat API to local parsing of inspect links via @csfloat/cs2-inspect-serializer, then enriches results with min/max float + names by fetching and caching the CSFloat schema in chrome.storage.local (new schema_fetcher + SCHEMA_CACHE).

Updates inspect-link generation in inventory, selected-item, and market listing helpers to support the new %propid:6% placeholder (including backfilling asset_properties on inconsistent Steam inventory structures), and adds the new dependency/typing + ESLint rule relaxation for namespace types.

Written by Cursor Bugbot for commit 12b2bd0. Configure here.

@GODrums GODrums self-assigned this Mar 14, 2026
@GODrums GODrums added the bug label Mar 14, 2026
@GODrums GODrums requested a review from Step7750 March 14, 2026 18:44
@GODrums GODrums marked this pull request as ready for review March 14, 2026 18:44
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: full_item_name never populated, breaks StatTrak/Souvenir detection
    • Added getFullItemName function to construct full_item_name from quality field (9=StatTrak, 12=Souvenir) combined with weapon_type and item_name.
  • ✅ Fixed: Wear name boundaries use wrong comparison operator
    • Changed first four comparisons in getWearName from <= to < to use exclusive upper bounds matching CS2 wear condition ranges.
  • ✅ Fixed: Inspect link returned without placeholder replacement for old format
    • Added fallback handling to replace %owner_steamid%, %assetid%, and %listingid% placeholders in old format inspect links across all three affected files.

Create PR

Or push these changes by commenting:

@cursor push bc7711efa5
Preview (bc7711efa5)
diff --git a/src/lib/bridge/handlers/fetch_inspect_info.ts b/src/lib/bridge/handlers/fetch_inspect_info.ts
--- a/src/lib/bridge/handlers/fetch_inspect_info.ts
+++ b/src/lib/bridge/handlers/fetch_inspect_info.ts
@@ -87,6 +87,9 @@
             console.error('Failed to fetch schema item metadata:', error);
         }
 
+        const quality = decoded.quality ?? 0;
+        const fullItemName = getFullItemName(quality, weaponType, itemName);
+
         return {
             iteminfo: {
                 stickers: decoded.stickers.map((sticker) => ({
@@ -104,7 +107,7 @@
                 defindex,
                 paintindex,
                 rarity: decoded.rarity ?? 0,
-                quality: decoded.quality ?? 0,
+                quality,
                 paintseed: decoded.paintseed ?? 0,
                 inventory: decoded.inventory ?? 0,
                 origin: decoded.origin ?? 0,
@@ -115,6 +118,7 @@
                 item_name: itemName,
                 rarity_name: rarityName,
                 wear_name: getWearName(floatvalue),
+                full_item_name: fullItemName,
             },
         };
     }
@@ -140,19 +144,19 @@
 }
 
 function getWearName(floatvalue: number): string | undefined {
-    if (floatvalue <= 0.07) {
+    if (floatvalue < 0.07) {
         return 'Factory New';
     }
 
-    if (floatvalue <= 0.15) {
+    if (floatvalue < 0.15) {
         return 'Minimal Wear';
     }
 
-    if (floatvalue <= 0.38) {
+    if (floatvalue < 0.38) {
         return 'Field-Tested';
     }
 
-    if (floatvalue <= 0.45) {
+    if (floatvalue < 0.45) {
         return 'Well-Worn';
     }
 
@@ -160,3 +164,18 @@
         return 'Battle-Scarred';
     }
 }
+
+function getFullItemName(quality: number, weaponType?: string, itemName?: string): string | undefined {
+    if (!weaponType || !itemName) {
+        return;
+    }
+
+    let prefix = '';
+    if (quality === 9) {
+        prefix = 'StatTrak™ ';
+    } else if (quality === 12) {
+        prefix = 'Souvenir ';
+    }
+
+    return `${prefix}${weaponType} | ${itemName}`;
+}

diff --git a/src/lib/components/common/item_holder_metadata.ts b/src/lib/components/common/item_holder_metadata.ts
--- a/src/lib/components/common/item_holder_metadata.ts
+++ b/src/lib/components/common/item_holder_metadata.ts
@@ -95,12 +95,15 @@
             return;
         }
 
-        const link = this.asset?.actions![0].link;
+        let link = this.asset?.actions![0].link;
         if (link.includes('%propid:6%')) {
             const propId = this.asset.asset_properties?.find((p) => p.propertyid === 6)?.string_value;
             if (!propId || !link) return;
             return link.replace('%propid:6%', propId);
         }
+        
+        link = link.replace('%owner_steamid%', this.ownerSteamId);
+        link = link.replace('%assetid%', this.assetId || '');
         return link;
     }
 

diff --git a/src/lib/components/inventory/selected_item_info.ts b/src/lib/components/inventory/selected_item_info.ts
--- a/src/lib/components/inventory/selected_item_info.ts
+++ b/src/lib/components/inventory/selected_item_info.ts
@@ -94,12 +94,15 @@
             return;
         }
 
-        const link = this.asset.description?.actions![0].link;
+        let link = this.asset.description?.actions![0].link;
         if (link.includes('%propid:6%')) {
             const propId = this.asset.asset_properties?.find((p) => p.propertyid === 6)?.string_value;
             if (!propId || !link) return;
             return link.replace('%propid:6%', propId);
         }
+        
+        link = link.replace('%owner_steamid%', g_ActiveInventory.m_owner.strSteamId);
+        link = link.replace('%assetid%', this.asset.assetid);
         return link;
     }
 

diff --git a/src/lib/components/market/helpers.ts b/src/lib/components/market/helpers.ts
--- a/src/lib/components/market/helpers.ts
+++ b/src/lib/components/market/helpers.ts
@@ -12,12 +12,15 @@
     const asset = g_rgAssets[AppId.CSGO][ContextId.PRIMARY][listingInfo.asset.id!];
     if (!asset || !asset.market_actions?.length) return;
 
-    const link = asset.market_actions[0].link;
+    let link = asset.market_actions[0].link;
     if (link.includes('%propid:6%')) {
         const propId = asset.asset_properties?.find((p) => p.propertyid === 6)?.string_value;
         if (!propId || !link) return;
         return link.replace('%propid:6%', propId);
     }
+    
+    link = link.replace('%listingid%', listingId);
+    link = link.replace('%assetid%', listingInfo.asset.id || '');
     return link;
 }

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Copy link
Member

@Step7750 Step7750 left a comment

Choose a reason for hiding this comment

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

Thanks Armin!

@GODrums GODrums merged commit 10fcaa6 into master Mar 14, 2026
2 checks passed
@GODrums GODrums deleted the fix/inspect-link-parsing branch March 14, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants