+22
-2
packages/extension/src/content/index.ts
+22
-2
packages/extension/src/content/index.ts
···
30
30
platform: 'twitter',
31
31
displayName: 'Twitter/X',
32
32
hostPatterns: ['twitter.com', 'x.com'],
33
-
followingPathPattern: /^\/[^/]+\/following$/,
33
+
// Match /username/following or /following with optional trailing slash
34
+
followingPathPattern: /^\/?([^/]+\/)?following\/?$/,
34
35
createScraper: () => new TwitterScraper()
35
36
}
36
37
// Future platforms can be added here:
···
152
153
* Notify background of current page on load
153
154
*/
154
155
(function init() {
156
+
const host = window.location.hostname;
157
+
const path = window.location.pathname;
158
+
159
+
console.log('[ATlast] Content script loaded');
160
+
console.log('[ATlast] Current URL:', window.location.href);
161
+
console.log('[ATlast] Host:', host);
162
+
console.log('[ATlast] Path:', path);
163
+
155
164
const detection = detectPlatform();
156
165
157
166
if (detection) {
158
-
console.log(`[ATlast] Detected ${detection.config.displayName} ${detection.pageType} page`);
167
+
console.log(`[ATlast] ✅ Detected ${detection.config.displayName} ${detection.pageType} page`);
159
168
160
169
// Notify background that we're on a supported page
161
170
sendToBackground({
···
165
174
platform: detection.config.platform,
166
175
pageType: detection.pageType
167
176
}
177
+
}).then(() => {
178
+
console.log('[ATlast] ✅ Notified background: ready state');
179
+
}).catch(err => {
180
+
console.error('[ATlast] ❌ Failed to notify background:', err);
168
181
});
182
+
} else {
183
+
console.log('[ATlast] ℹ️ Not on a supported page');
184
+
console.log('[ATlast] Supported patterns:', PLATFORMS.map(p => ({
185
+
platform: p.platform,
186
+
hosts: p.hostPatterns,
187
+
pattern: p.followingPathPattern.toString()
188
+
})));
169
189
}
170
190
})();