stfca 1.0.7 → 1.0.9
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 +34 -7
- package/checkUpdate.js +33 -15
- package/index.js +11 -0
- package/package.json +15 -13
- package/CHANGELOG.md +0 -65
package/README.md
CHANGED
|
@@ -32,22 +32,49 @@ yarn add stfca
|
|
|
32
32
|
|
|
33
33
|
## 🔄 Auto-Update Feature
|
|
34
34
|
|
|
35
|
-
ST-FCA includes an automatic update
|
|
35
|
+
ST-FCA includes an **automatic update system** that keeps your package up-to-date seamlessly:
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
2. 💾 Creates automatic backups
|
|
39
|
-
3. 📦 Downloads and installs updates
|
|
40
|
-
4. 🔄 Restarts automatically to apply changes
|
|
37
|
+
### How It Works
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
1. 🔍 **Automatic Check**: Checks for updates when you start your bot
|
|
40
|
+
2. 📋 **Shows Changes**: Displays recent changelog updates
|
|
41
|
+
3. 📦 **NPM Update**: Runs `npm install stfca@latest` automatically
|
|
42
|
+
4. 🔄 **Auto-Restart**: Restarts your bot to apply changes
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### For Bot Projects
|
|
45
|
+
|
|
46
|
+
If you're using ST-FCA in your bot project (like [ST-BOT](https://github.com/sheikhtamimlover/ST-BOT)), the package will:
|
|
47
|
+
|
|
48
|
+
- ✅ Detect when a new version is available
|
|
49
|
+
- ✅ Automatically update to the latest version via npm
|
|
50
|
+
- ✅ Update your `node_modules/stfca` folder
|
|
51
|
+
- ✅ Restart your bot with the new version
|
|
52
|
+
|
|
53
|
+
### Manual Update
|
|
54
|
+
|
|
55
|
+
You can also update manually:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install stfca@latest
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or check for updates programmatically:
|
|
45
62
|
|
|
46
63
|
```javascript
|
|
47
64
|
const { checkForFCAUpdate } = require('stfca/checkUpdate.js');
|
|
48
65
|
await checkForFCAUpdate();
|
|
49
66
|
```
|
|
50
67
|
|
|
68
|
+
### Update Notifications
|
|
69
|
+
|
|
70
|
+
The auto-update system will:
|
|
71
|
+
- Show the current and latest versions
|
|
72
|
+
- Display recent changes from the changelog
|
|
73
|
+
- Inform you when the update is complete
|
|
74
|
+
- Automatically restart your application
|
|
75
|
+
|
|
76
|
+
**Note**: Updates are non-blocking and won't interrupt your bot's startup if the update check fails.
|
|
77
|
+
|
|
51
78
|
## ⚠️ Important Disclaimer
|
|
52
79
|
|
|
53
80
|
**We are not responsible if your account gets banned for spammy activities such as:**
|
package/checkUpdate.js
CHANGED
|
@@ -8,24 +8,24 @@ async function checkForFCAUpdate() {
|
|
|
8
8
|
try {
|
|
9
9
|
console.log('\x1b[33m%s\x1b[0m', '🔍 Checking for ST-FCA updates...');
|
|
10
10
|
|
|
11
|
-
// Get latest version from
|
|
12
|
-
const { data:
|
|
13
|
-
'https://
|
|
11
|
+
// Get latest version from npm registry
|
|
12
|
+
const { data: npmData } = await axios.get(
|
|
13
|
+
'https://registry.npmjs.org/stfca/latest'
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
const latestVersion =
|
|
17
|
-
const currentPackagePath = path.join(__dirname, 'package.json');
|
|
16
|
+
const latestVersion = npmData.version;
|
|
18
17
|
|
|
19
|
-
// Check
|
|
20
|
-
let currentVersion = '1.0.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
// Check current installed version in node_modules
|
|
19
|
+
let currentVersion = '1.0.8';
|
|
20
|
+
const nodeModulesPackagePath = path.join(process.cwd(), 'node_modules', 'stfca', 'package.json');
|
|
21
|
+
if (fs.existsSync(nodeModulesPackagePath)) {
|
|
22
|
+
const installedPackage = JSON.parse(fs.readFileSync(nodeModulesPackagePath, 'utf-8'));
|
|
23
|
+
currentVersion = installedPackage.version;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (latestVersion !== currentVersion) {
|
|
27
27
|
console.log('\x1b[32m%s\x1b[0m', `✨ New ST-FCA version available: ${latestVersion} (current: ${currentVersion})`);
|
|
28
|
-
console.log('\x1b[33m%s\x1b[0m', '📦 Updating ST-FCA...');
|
|
28
|
+
console.log('\x1b[33m%s\x1b[0m', '📦 Updating ST-FCA package...');
|
|
29
29
|
|
|
30
30
|
// Show changelog
|
|
31
31
|
try {
|
|
@@ -41,15 +41,15 @@ async function checkForFCAUpdate() {
|
|
|
41
41
|
// Silently ignore changelog fetch errors
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
//
|
|
45
|
-
await
|
|
44
|
+
// Update npm package
|
|
45
|
+
await updateNpmPackage(latestVersion);
|
|
46
46
|
|
|
47
47
|
console.log('\x1b[32m%s\x1b[0m', '✅ ST-FCA updated successfully!');
|
|
48
48
|
console.log('\x1b[33m%s\x1b[0m', '🔄 Restarting to apply changes...');
|
|
49
49
|
|
|
50
50
|
// Restart the process
|
|
51
51
|
setTimeout(() => {
|
|
52
|
-
process.exit(
|
|
52
|
+
process.exit(2);
|
|
53
53
|
}, 1000);
|
|
54
54
|
|
|
55
55
|
return true;
|
|
@@ -63,6 +63,24 @@ async function checkForFCAUpdate() {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
async function updateNpmPackage(version) {
|
|
67
|
+
try {
|
|
68
|
+
console.log('\x1b[36m%s\x1b[0m', '📦 Running npm install stfca@latest...');
|
|
69
|
+
|
|
70
|
+
// Execute npm install command
|
|
71
|
+
execSync('npm install stfca@latest --save', {
|
|
72
|
+
cwd: process.cwd(),
|
|
73
|
+
stdio: 'inherit'
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
console.log('\x1b[32m%s\x1b[0m', '✅ Package updated successfully!');
|
|
77
|
+
return true;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.log('\x1b[31m%s\x1b[0m', '❌ Failed to update package:', error.message);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
66
84
|
async function performComprehensiveUpdate() {
|
|
67
85
|
try {
|
|
68
86
|
// Step 1: Get the complete file tree from GitHub
|
|
@@ -205,4 +223,4 @@ function deleteLocalFile(filePath) {
|
|
|
205
223
|
}
|
|
206
224
|
}
|
|
207
225
|
|
|
208
|
-
module.exports = { checkForFCAUpdate, performComprehensiveUpdate };
|
|
226
|
+
module.exports = { checkForFCAUpdate, performComprehensiveUpdate, updateNpmPackage };
|
package/index.js
CHANGED
|
@@ -13,6 +13,17 @@ const Boolean_Option = ['online', 'selfListen', 'listenEvents', 'updatePresence'
|
|
|
13
13
|
global.ditconmemay = false;
|
|
14
14
|
global.stfcaUpdateChecked = false;
|
|
15
15
|
|
|
16
|
+
// Auto-check for updates on package load (non-blocking)
|
|
17
|
+
if (!global.stfcaUpdateChecked) {
|
|
18
|
+
global.stfcaUpdateChecked = true;
|
|
19
|
+
const { checkForFCAUpdate } = require("./checkUpdate");
|
|
20
|
+
setImmediate(() => {
|
|
21
|
+
checkForFCAUpdate().catch(() => {
|
|
22
|
+
// Silent fail - don't interrupt user's bot
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
function setOptions(globalOptions, options) {
|
|
17
28
|
Object.keys(options).map(function (key) {
|
|
18
29
|
switch (Boolean_Option.includes(key)) {
|
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stfca",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Unofficial Facebook Chat API for Node.js - Enhanced by ST | Sheikh Tamim",
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "Unofficial Facebook Chat API for Node.js with Auto-Update System - Enhanced by ST | Sheikh Tamim",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"src/",
|
|
8
8
|
"index.js",
|
|
9
9
|
"utils.js",
|
|
10
|
-
"checkUpdate.js"
|
|
11
|
-
"README.md",
|
|
12
|
-
"CHANGELOG.md"
|
|
10
|
+
"checkUpdate.js"
|
|
13
11
|
],
|
|
14
12
|
"scripts": {
|
|
15
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -37,16 +35,20 @@
|
|
|
37
35
|
},
|
|
38
36
|
"homepage": "https://github.com/sheikhtamimlover/ST-FCA#readme",
|
|
39
37
|
"dependencies": {
|
|
40
|
-
"axios": "^1.4
|
|
38
|
+
"axios": "^1.8.4",
|
|
41
39
|
"bluebird": "^3.7.2",
|
|
42
|
-
"
|
|
40
|
+
"chalk": "^4.1.2",
|
|
41
|
+
"cheerio": "^1.0.0-rc.10",
|
|
43
42
|
"duplexify": "^4.1.3",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
43
|
+
"gradient-string": "^2.0.2",
|
|
44
|
+
"https-proxy-agent": "^4.0.0",
|
|
45
|
+
"mqtt": "^4.3.8",
|
|
46
|
+
"npmlog": "^1.2.0",
|
|
47
|
+
"request": "^2.53.0",
|
|
48
|
+
"sequelize": "^6.37.6",
|
|
49
|
+
"sqlite3": "^5.1.7",
|
|
50
|
+
"totp-generator": "^1.0.0",
|
|
51
|
+
"ws": "^8.18.1"
|
|
50
52
|
},
|
|
51
53
|
"engines": {
|
|
52
54
|
"node": ">=14.0.0"
|
package/CHANGELOG.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# Changelog
|
|
3
|
-
|
|
4
|
-
All notable changes to ST-FCA will be documented in this file.
|
|
5
|
-
|
|
6
|
-
## [1.0.5] - 2025-01-13
|
|
7
|
-
|
|
8
|
-
### Added
|
|
9
|
-
- 🔄 Comprehensive update system that properly syncs all files
|
|
10
|
-
- 📂 Automatic file tree comparison between local and GitHub
|
|
11
|
-
- ➕ Smart file addition for new files in updates
|
|
12
|
-
- ♻️ Automatic modification detection and update
|
|
13
|
-
- 🗑️ Automatic deletion of removed files from old versions
|
|
14
|
-
- 🎯 No backup folder creation - cleaner updates
|
|
15
|
-
|
|
16
|
-
### Changed
|
|
17
|
-
- Improved update mechanism to handle version jumps (e.g., 1.0.3 → 1.0.6)
|
|
18
|
-
- Enhanced file synchronization to ensure no missing files
|
|
19
|
-
- Better error handling during updates
|
|
20
|
-
- Auto-restart after successful update
|
|
21
|
-
|
|
22
|
-
### Fixed
|
|
23
|
-
- Missing files when updating across multiple versions
|
|
24
|
-
- Outdated files not being properly replaced
|
|
25
|
-
- Orphaned files from old versions not being cleaned up
|
|
26
|
-
|
|
27
|
-
## [1.0.4] - 2025-01-13
|
|
28
|
-
|
|
29
|
-
### Added
|
|
30
|
-
- 🔄 Automatic update checking on package initialization
|
|
31
|
-
- ⚡ Non-blocking update process - doesn't interrupt user's bot startup
|
|
32
|
-
- 🎯 Update check runs once per session to avoid redundant checks
|
|
33
|
-
- 💡 Silent error handling for update checks
|
|
34
|
-
|
|
35
|
-
### Changed
|
|
36
|
-
- Update checker now integrated directly into login flow
|
|
37
|
-
- Improved user experience with seamless auto-updates
|
|
38
|
-
|
|
39
|
-
## [1.0.3] - 2025-01-13
|
|
40
|
-
|
|
41
|
-
### Added
|
|
42
|
-
- 🎨 Enhanced MQTT connection logging with visual indicators
|
|
43
|
-
- 🔄 Auto-reconnect status display
|
|
44
|
-
- 📊 Connection region display
|
|
45
|
-
- ⚡ Automatic update checking and installation
|
|
46
|
-
- 💾 Automatic backup creation before updates
|
|
47
|
-
- 🎯 Better error messages and debugging
|
|
48
|
-
- 📋 Changelog tracking
|
|
49
|
-
- 🌟 Branding: "Maintained & Enhanced by ST | Sheikh Tamim"
|
|
50
|
-
|
|
51
|
-
### Changed
|
|
52
|
-
- Improved console output with colors and formatting
|
|
53
|
-
- Better connection status messages
|
|
54
|
-
- Enhanced stability and error handling
|
|
55
|
-
|
|
56
|
-
### Fixed
|
|
57
|
-
- MQTT reconnection reliability
|
|
58
|
-
- Connection timeout handling
|
|
59
|
-
- Error message clarity
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
**Maintained & Enhanced by ST | Sheikh Tamim**
|
|
64
|
-
GitHub: https://github.com/sheikhtamimlover/ST-FCA
|
|
65
|
-
NPM: https://www.npmjs.com/package/stfca
|