bulltrackers-module 1.0.600 → 1.0.601
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,19 +13,36 @@ const { isDeveloper } = require('../helpers/data-fetchers/firestore.js'); // Usi
|
|
|
13
13
|
|
|
14
14
|
// List of public routes that don't require userCid
|
|
15
15
|
// Also includes routes that use Firebase Auth token authentication (like /verification/lookup)
|
|
16
|
+
// And routes that return static/public data (like /alerts/types)
|
|
16
17
|
const PUBLIC_ROUTES = [
|
|
17
18
|
'/watchlists/public',
|
|
18
19
|
'/popular-investors/trending',
|
|
19
20
|
'/popular-investors/categories',
|
|
20
21
|
'/popular-investors/master-list',
|
|
21
22
|
'/popular-investors/search',
|
|
22
|
-
'/verification/lookup' // Uses Firebase Auth token instead of userCid
|
|
23
|
+
'/verification/lookup', // Uses Firebase Auth token instead of userCid
|
|
24
|
+
'/alerts/types', // Static data - doesn't need userCid
|
|
25
|
+
'/alerts/dynamic-watchlist-computations', // Static data - doesn't need userCid
|
|
26
|
+
'/popular-investors/track-view' // Optional userCid - can track views anonymously
|
|
23
27
|
];
|
|
24
28
|
|
|
25
29
|
const isPublicRoute = (path, originalUrl) => {
|
|
26
30
|
// Check both the path and originalUrl to handle Express routing
|
|
27
31
|
const fullPath = originalUrl || path;
|
|
28
|
-
|
|
32
|
+
|
|
33
|
+
// Check exact matches and pattern matches
|
|
34
|
+
for (const route of PUBLIC_ROUTES) {
|
|
35
|
+
// Exact match
|
|
36
|
+
if (fullPath === route || fullPath.includes(route)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
// Pattern match for routes with parameters (e.g., /popular-investors/:piId/track-view)
|
|
40
|
+
if (route.includes('/track-view') && fullPath.includes('/track-view')) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return false;
|
|
29
46
|
};
|
|
30
47
|
|
|
31
48
|
const resolveUserIdentity = async (req, res, next) => {
|