stfca 1.0.16 → 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 +33 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stfca",
3
- "version": "1.0.16",
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
@@ -2818,6 +2818,35 @@ function getJazoest() {
2818
2818
  return result;
2819
2819
  }
2820
2820
 
2821
+ function getEventTime() {
2822
+ return Date.now();
2823
+ }
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
+
2821
2850
  function cleanHTML(text) {
2822
2851
  text = text.replace(/(<br>)|(<\/?i>)|(<\/?em>)|(<\/?b>)|(!?~)|(&amp;)|(&#039;)|(&lt;)|(&gt;)|(&quot;)/g, (match) => {
2823
2852
  switch (match) {
@@ -2894,5 +2923,8 @@ module.exports = {
2894
2923
  getAdminTextMessageType,
2895
2924
  setProxy,
2896
2925
  isDMThread,
2897
- getJazoest
2926
+ getJazoest,
2927
+ getEventTime,
2928
+ getSessionID,
2929
+ getFormData
2898
2930
  };