stfca 1.0.17 → 1.0.18

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils.js +28 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stfca",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
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": [
package/utils.js CHANGED
@@ -2822,6 +2822,31 @@ function getEventTime() {
2822
2822
  return Date.now();
2823
2823
  }
2824
2824
 
2825
+ function getSessionID() {
2826
+ return Math.random().toString(36).substring(2, 15);
2827
+ }
2828
+
2829
+ function getFormData(jar, url) {
2830
+ const cookies = jar.getCookies(url);
2831
+ const result = {};
2832
+
2833
+ cookies.forEach(cookie => {
2834
+ const parts = cookie.toString().split(';')[0].split('=');
2835
+ if (parts.length === 2) {
2836
+ const key = parts[0].trim();
2837
+ const value = parts[1].trim();
2838
+
2839
+ if (key === 'fb_dtsg') {
2840
+ result.fb_dtsg = value;
2841
+ } else if (key === 'lsd') {
2842
+ result.lsd = value;
2843
+ }
2844
+ }
2845
+ });
2846
+
2847
+ return result;
2848
+ }
2849
+
2825
2850
  function cleanHTML(text) {
2826
2851
  text = text.replace(/(<br>)|(<\/?i>)|(<\/?em>)|(<\/?b>)|(!?~)|(&amp;)|(&#039;)|(&lt;)|(&gt;)|(&quot;)/g, (match) => {
2827
2852
  switch (match) {
@@ -2899,5 +2924,7 @@ module.exports = {
2899
2924
  setProxy,
2900
2925
  isDMThread,
2901
2926
  getJazoest,
2902
- getEventTime
2927
+ getEventTime,
2928
+ getSessionID,
2929
+ getFormData
2903
2930
  };