parse-dashboard-analytics 1.0.5 → 1.0.7

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.
@@ -1102,7 +1102,33 @@ You have direct access to the Parse database through function calls, so you can
1102
1102
  }
1103
1103
  return res.redirect(`${mountPath}login`);
1104
1104
  }
1105
- res.sendFile(path.join(__dirname, 'public', 'analytics.html'));
1105
+
1106
+ // Extract app ID from URL
1107
+ const appIdMatch = req.path.match(/\/apps\/([^\/]+)\/analytics_dashboard/);
1108
+ const appId = appIdMatch ? appIdMatch[1] : null;
1109
+
1110
+ // Find the app configuration
1111
+ let customAnalyticsPath = null;
1112
+ if (appId && config.apps) {
1113
+ const app = config.apps.find(app => app.appId === appId || app.appName === appId);
1114
+ if (app && app.analyticsPage) {
1115
+ customAnalyticsPath = app.analyticsPage;
1116
+ }
1117
+ }
1118
+
1119
+ // Use custom analytics page if specified, otherwise use default
1120
+ const analyticsFile = customAnalyticsPath || path.join(__dirname, 'public', 'analytics.html');
1121
+
1122
+ // Check if custom file exists
1123
+ if (customAnalyticsPath) {
1124
+ const fs = require('fs');
1125
+ if (!fs.existsSync(customAnalyticsPath)) {
1126
+ console.warn(`Custom analytics page not found: ${customAnalyticsPath}, falling back to default`);
1127
+ return res.sendFile(path.join(__dirname, 'public', 'analytics.html'));
1128
+ }
1129
+ }
1130
+
1131
+ res.sendFile(path.resolve(analyticsFile));
1106
1132
  });
1107
1133
 
1108
1134
  // For every other request, go to index.html. Let client-side handle the rest.
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "apps": [
3
3
  {
4
- "serverURL": "http://localhost:1337/parse",
4
+ "serverURL": "http://localhost:1338/parse",
5
5
  "appId": "mock-app-id",
6
6
  "masterKey": "mock-master-key",
7
7
  "appName": "Parse Dashboard Analytics Demo",
8
8
  "appNameForURL": "mock-app-id",
9
9
  "iconName": "",
10
10
  "primaryBackgroundColor": "#169CEE",
11
- "secondaryBackgroundColor": "#0F5B8A"
11
+ "secondaryBackgroundColor": "#0F5B8A",
12
+ "analyticsPage": "/Users/prayercircle/Development/parse-dashboard/parse-dashboard-analytics-dist/simple-analytics.html"
13
+ }
14
+ ],
15
+ "users": [
16
+ {
17
+ "user": "admin",
18
+ "pass": "password"
12
19
  }
13
20
  ],
14
21
  "iconsFolder": "icons"