choppingboard 1.0.2 → 1.0.3
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.
- package/README.md +74 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Chopping Board provides real-time insights into your Salad chopping operations a
|
|
|
13
13
|
- **Real-time Earnings** - Hourly and daily earnings with automatic updates every 5 minutes
|
|
14
14
|
- **Moving Averages** - 7, 14, 30, 50, and 100-day moving averages for trend analysis
|
|
15
15
|
- **Earnings Predictions** - Estimated daily earnings based on current performance
|
|
16
|
-
- **Reward Management** - Track assign Salad rewards to your sub-accounts
|
|
16
|
+
- **Reward Management** - Track and assign Salad rewards to your sub-accounts
|
|
17
17
|
|
|
18
18
|
### Energy Monitoring
|
|
19
19
|
- **TPLink Integration** - Monitor electricity consumption via TPLink smart meters
|
|
@@ -47,18 +47,31 @@ Chopping Board provides real-time insights into your Salad chopping operations a
|
|
|
47
47
|
|
|
48
48
|
## Installation
|
|
49
49
|
|
|
50
|
-
### 1. Install
|
|
50
|
+
### 1. Install Node.js and npm
|
|
51
|
+
|
|
52
|
+
If you don't have Node.js installed, download and install it from the official website:
|
|
53
|
+
|
|
54
|
+
**[Download Node.js](https://nodejs.org/)** - Choose the LTS (Long Term Support) version
|
|
55
|
+
|
|
56
|
+
This will install both Node.js and npm. Verify the installation by running:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
node --version
|
|
60
|
+
npm --version
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. Install Package
|
|
51
64
|
|
|
52
65
|
```bash
|
|
53
66
|
npm install choppingboard-opensource
|
|
54
67
|
```
|
|
55
68
|
|
|
56
|
-
###
|
|
69
|
+
### 3. Create Your Server File
|
|
57
70
|
|
|
58
|
-
|
|
71
|
+
Create a new file (e.g., `server.js` or `index.js`) in your project:
|
|
59
72
|
|
|
60
73
|
```javascript
|
|
61
|
-
const { start } = require('
|
|
74
|
+
const { start } = require('choppingboard-opensource');
|
|
62
75
|
const path = require('path');
|
|
63
76
|
|
|
64
77
|
const server = start({
|
|
@@ -68,7 +81,7 @@ const server = start({
|
|
|
68
81
|
});
|
|
69
82
|
```
|
|
70
83
|
|
|
71
|
-
###
|
|
84
|
+
### 4. Get Your Salad Auth Token
|
|
72
85
|
|
|
73
86
|
To obtain your Salad authentication token:
|
|
74
87
|
|
|
@@ -77,23 +90,34 @@ To obtain your Salad authentication token:
|
|
|
77
90
|
3. Go to the **Application** or **Storage** tab
|
|
78
91
|
4. Find **Cookies** → `https://app.salad.com`
|
|
79
92
|
5. Copy the value of the authentication cookie
|
|
80
|
-
6. Paste into
|
|
93
|
+
6. Paste into your server file replacing `'YOUR_SALAD_AUTH_TOKEN_HERE'`
|
|
81
94
|
|
|
82
95
|
> **Note:** You can also update the token later through the web dashboard under "Settings" → "Auth Token"
|
|
83
96
|
|
|
84
|
-
###
|
|
97
|
+
### 5. Start the Server
|
|
98
|
+
|
|
99
|
+
Run your server file:
|
|
85
100
|
|
|
86
|
-
**Production:**
|
|
87
101
|
```bash
|
|
88
|
-
|
|
102
|
+
node server.js
|
|
89
103
|
```
|
|
90
104
|
|
|
91
|
-
|
|
105
|
+
Or add a start script to your `package.json`:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"scripts": {
|
|
110
|
+
"start": "node server.js"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then run:
|
|
92
116
|
```bash
|
|
93
|
-
npm
|
|
117
|
+
npm start
|
|
94
118
|
```
|
|
95
119
|
|
|
96
|
-
###
|
|
120
|
+
### 6. Access Dashboard
|
|
97
121
|
|
|
98
122
|
Open your browser and navigate to:
|
|
99
123
|
```
|
|
@@ -106,14 +130,21 @@ The database will automatically initialize on first run.
|
|
|
106
130
|
|
|
107
131
|
### Application Settings
|
|
108
132
|
|
|
109
|
-
Configure via
|
|
133
|
+
Configure via your server file or through the web dashboard:
|
|
110
134
|
|
|
111
135
|
| Setting | Description | Default |
|
|
112
136
|
|---------|-------------|---------|
|
|
113
137
|
| `port` | Server port number | `3001` |
|
|
114
138
|
| `databasePath` | SQLite database file location | `./data/salad.db` |
|
|
115
139
|
| `saladAuthToken` | Salad API authentication token | Required |
|
|
116
|
-
|
|
140
|
+
|
|
141
|
+
### Dashboard Settings (via Web Interface)
|
|
142
|
+
|
|
143
|
+
Additional settings configurable through the web dashboard under "App Settings":
|
|
144
|
+
|
|
145
|
+
| Setting | Description | Default |
|
|
146
|
+
|---------|-------------|---------|
|
|
147
|
+
| Dashboard Refresh Interval | How often the dashboard polls the server (minutes) | `2` |
|
|
117
148
|
| KWh Price | Electricity cost per kilowatt-hour | `0.105` |
|
|
118
149
|
|
|
119
150
|
### Database Location
|
|
@@ -122,15 +153,17 @@ The SQLite database is stored at the path specified in `databasePath`. The `data
|
|
|
122
153
|
|
|
123
154
|
**Default:** `./data/salad.db`
|
|
124
155
|
|
|
125
|
-
### Data Collection
|
|
156
|
+
### Data Collection vs Dashboard Refresh
|
|
126
157
|
|
|
127
|
-
Data
|
|
158
|
+
**Data Collection Interval (Server-side):**
|
|
159
|
+
- The server automatically fetches data from Salad's API every **5 minutes** (hardcoded)
|
|
160
|
+
- This includes earnings data, machine status, and TPLink meter readings
|
|
161
|
+
- Cannot be changed via dashboard settings
|
|
128
162
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
```
|
|
163
|
+
**Dashboard Refresh Interval (Client-side):**
|
|
164
|
+
- Controls how often your browser refreshes the dashboard data from the server
|
|
165
|
+
- Configurable in "App Settings" (default: 2 minutes)
|
|
166
|
+
- Only affects how often the dashboard updates, not how often data is collected
|
|
134
167
|
|
|
135
168
|
## Usage
|
|
136
169
|
|
|
@@ -269,46 +302,31 @@ The application uses SQLite with the following tables:
|
|
|
269
302
|
|
|
270
303
|
## Development
|
|
271
304
|
|
|
272
|
-
###
|
|
305
|
+
### For Contributors
|
|
273
306
|
|
|
274
|
-
|
|
275
|
-
open-source-stack/
|
|
276
|
-
├── app.js # Main server initialization
|
|
277
|
-
├── example.js # Entry point and configuration
|
|
278
|
-
├── package.json # Dependencies and scripts
|
|
279
|
-
├── lib/
|
|
280
|
-
│ ├── database.js # Database schema and connection
|
|
281
|
-
│ └── queries.js # Database query functions
|
|
282
|
-
├── service/
|
|
283
|
-
│ └── app.js # Salad API and TPLink integration
|
|
284
|
-
├── website/
|
|
285
|
-
│ ├── app.js # Express application setup
|
|
286
|
-
│ ├── routes/
|
|
287
|
-
│ │ └── router.js # Route handlers
|
|
288
|
-
│ ├── views/
|
|
289
|
-
│ │ ├── index.ejs # Main dashboard template
|
|
290
|
-
│ │ ├── head.ejs # HTML head section
|
|
291
|
-
│ │ ├── header.ejs # Navigation bar
|
|
292
|
-
│ │ └── scripts.ejs # JavaScript includes
|
|
293
|
-
│ └── public/ # Static assets (CSS, fonts, images)
|
|
294
|
-
└── data/
|
|
295
|
-
└── salad.db # SQLite database (auto-created)
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Running in Development Mode
|
|
307
|
+
If you want to contribute to Chopping Board or modify the source code:
|
|
299
308
|
|
|
300
|
-
|
|
309
|
+
1. Clone the repository:
|
|
310
|
+
```bash
|
|
311
|
+
git clone <repository-url>
|
|
312
|
+
cd open-source-stack
|
|
313
|
+
npm install
|
|
314
|
+
```
|
|
301
315
|
|
|
316
|
+
2. Run in development mode with auto-reload:
|
|
302
317
|
```bash
|
|
303
318
|
npm run dev
|
|
304
319
|
```
|
|
305
320
|
|
|
306
|
-
|
|
321
|
+
3. The project structure includes:
|
|
322
|
+
- `app.js` - Main server initialization
|
|
323
|
+
- `lib/` - Database schema and queries
|
|
324
|
+
- `service/` - Salad API and TPLink integration
|
|
325
|
+
- `website/` - Express routes, views, and static assets
|
|
326
|
+
|
|
327
|
+
### Extending Functionality
|
|
307
328
|
|
|
308
|
-
|
|
309
|
-
2. **Database Queries**: Add functions in `lib/queries.js`
|
|
310
|
-
3. **API Integration**: Extend `service/app.js` for external APIs
|
|
311
|
-
4. **UI**: Modify templates in `website/views/`
|
|
329
|
+
The module exports a `start()` function that initializes the server. Advanced users can access internal components by exploring the module structure, though the primary interface is the configuration object passed to `start()`.
|
|
312
330
|
|
|
313
331
|
## Troubleshooting
|
|
314
332
|
|
|
@@ -323,7 +341,7 @@ npm run dev
|
|
|
323
341
|
### Authentication Issues
|
|
324
342
|
|
|
325
343
|
**Issue:** `401 Unauthorized` from Salad API
|
|
326
|
-
- **Solution:** Update your Salad auth token in the dashboard or
|
|
344
|
+
- **Solution:** Update your Salad auth token in the dashboard or in your server file
|
|
327
345
|
|
|
328
346
|
**Issue:** Token expired
|
|
329
347
|
- **Solution:** Log into Salad dashboard and retrieve a fresh authentication token
|
|
@@ -339,7 +357,7 @@ npm run dev
|
|
|
339
357
|
### Port Already in Use
|
|
340
358
|
|
|
341
359
|
**Issue:** `EADDRINUSE: address already in use :::3001`
|
|
342
|
-
- **Solution:** Change the port in
|
|
360
|
+
- **Solution:** Change the port in your server file or stop the process using port 3001
|
|
343
361
|
|
|
344
362
|
```bash
|
|
345
363
|
# Find process using port 3001
|