fca-kteam 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fca-kteam might be problematic. Click here for more details.

Files changed (104) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.cache/replit/nix/env.json +1 -0
  3. package/.config/configstore/update-notifier-npm.json +4 -0
  4. package/.config/configstore/update-notifier-npm.json.1735545094 +4 -0
  5. package/.gitattributes +2 -0
  6. package/.replit +80 -0
  7. package/.upm/store.json +1 -0
  8. package/Extra/Database/index.js +358 -0
  9. package/Extra/ExtraAddons.js +78 -0
  10. package/Extra/ExtraFindUID.js +60 -0
  11. package/Extra/ExtraGetThread.js +118 -0
  12. package/Extra/ExtraScreenShot.js +430 -0
  13. package/Extra/ExtraUptimeRobot.js +26 -0
  14. package/Extra/Html/Classic/script.js +119 -0
  15. package/Extra/Html/Classic/style.css +8 -0
  16. package/Extra/Security/Index.js +146 -0
  17. package/Extra/Security/Step_1.js +11 -0
  18. package/Extra/Security/Step_2.js +20 -0
  19. package/Extra/Security/Step_3.js +20 -0
  20. package/Extra/Src/History.js +115 -0
  21. package/Extra/Src/Last-Run.js +65 -0
  22. package/Extra/Src/Premium.js +84 -0
  23. package/Func/AcceptAgreement.js +32 -0
  24. package/Func/ClearCache.js +64 -0
  25. package/Func/ReportV1.js +54 -0
  26. package/LICENSE +24 -0
  27. package/Language/index.json +177 -0
  28. package/README.md +136 -0
  29. package/SECURITY.md +17 -0
  30. package/broadcast.js +38 -0
  31. package/index.js +1381 -0
  32. package/logger.js +65 -0
  33. package/package.json +97 -0
  34. package/replit.nix +8 -0
  35. package/src/Dev_Horizon_Data.js +125 -0
  36. package/src/Premium.js +30 -0
  37. package/src/Screenshot.js +85 -0
  38. package/src/addExternalModule.js +16 -0
  39. package/src/addUserToGroup.js +79 -0
  40. package/src/changeAdminStatus.js +79 -0
  41. package/src/changeArchivedStatus.js +41 -0
  42. package/src/changeAvt.js +85 -0
  43. package/src/changeBio.js +65 -0
  44. package/src/changeBlockedStatus.js +36 -0
  45. package/src/changeGroupImage.js +106 -0
  46. package/src/changeNickname.js +45 -0
  47. package/src/changeThreadColor.js +62 -0
  48. package/src/changeThreadEmoji.js +42 -0
  49. package/src/createNewGroup.js +70 -0
  50. package/src/createPoll.js +60 -0
  51. package/src/deleteMessage.js +45 -0
  52. package/src/deleteThread.js +43 -0
  53. package/src/forwardAttachment.js +48 -0
  54. package/src/getAccessToken.js +32 -0
  55. package/src/getCurrentUserID.js +7 -0
  56. package/src/getEmojiUrl.js +27 -0
  57. package/src/getFriendsList.js +73 -0
  58. package/src/getMessage.js +80 -0
  59. package/src/getThreadHistory.js +537 -0
  60. package/src/getThreadInfo.js +348 -0
  61. package/src/getThreadList.js +213 -0
  62. package/src/getThreadMain.js +220 -0
  63. package/src/getThreadPictures.js +59 -0
  64. package/src/getUID.js +59 -0
  65. package/src/getUserID.js +62 -0
  66. package/src/getUserInfo.js +129 -0
  67. package/src/getUserInfoMain.js +65 -0
  68. package/src/getUserInfoV2.js +36 -0
  69. package/src/getUserInfoV3.js +63 -0
  70. package/src/getUserInfoV4.js +55 -0
  71. package/src/getUserInfoV5.js +61 -0
  72. package/src/handleFriendRequest.js +46 -0
  73. package/src/handleMessageRequest.js +49 -0
  74. package/src/httpGet.js +49 -0
  75. package/src/httpPost.js +48 -0
  76. package/src/httpPostFormData.js +41 -0
  77. package/src/listenMqtt.js +702 -0
  78. package/src/logout.js +68 -0
  79. package/src/markAsDelivered.js +48 -0
  80. package/src/markAsRead.js +70 -0
  81. package/src/markAsReadAll.js +43 -0
  82. package/src/markAsSeen.js +51 -0
  83. package/src/muteThread.js +47 -0
  84. package/src/removeUserFromGroup.js +49 -0
  85. package/src/resolvePhotoUrl.js +37 -0
  86. package/src/searchForThread.js +43 -0
  87. package/src/sendMessage.js +334 -0
  88. package/src/sendTypingIndicator.js +80 -0
  89. package/src/setMessageReaction.js +109 -0
  90. package/src/setPostReaction.js +102 -0
  91. package/src/setTitle.js +74 -0
  92. package/src/threadColors.js +39 -0
  93. package/src/unfriend.js +43 -0
  94. package/src/unsendMessage.js +40 -0
  95. package/test/data/shareAttach.js +146 -0
  96. package/test/data/something.mov +0 -0
  97. package/test/data/test.png +0 -0
  98. package/test/data/test.txt +7 -0
  99. package/test/env/.env +0 -0
  100. package/test/example-config.json +18 -0
  101. package/test/test-page.js +140 -0
  102. package/test/test.js +385 -0
  103. package/test/testv2.js +3 -0
  104. package/utils.js +1648 -0
@@ -0,0 +1 @@
1
+ {"nonce":1274403581809695478,"last_updated":{"seconds":1682747902,"nanos":11151000}}
@@ -0,0 +1 @@
1
+ {"entries":{"replit.nix":{"env":{"AR":"ar","AS":"as","CC":"gcc","CONFIG_SHELL":"/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash","CXX":"g++","HOST_PATH":"/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin:/nix/store/7rfpsb04f2r6a755bqmmj1i90x8p1b18-typescript-language-server-3.1.0/bin:/nix/store/zdcnqq55qi214j46zgw2qa1jp4dpdf2m-yarn-1.22.19/bin:/nix/store/hqc964yg79161afx85fvcmg1a6879k5i-jest-cli-23.6.0/bin:/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin:/nix/store/mydc6f4k2z73xlcz7ilif3v2lcaiqvza-findutils-4.9.0/bin:/nix/store/j9p3g8472iijd50vhdprx0nmk2fqn5gv-diffutils-3.8/bin:/nix/store/89zs7rms6x00xfq4dq6m7mjnhkr8a6r4-gnused-4.8/bin:/nix/store/86bp03jkmsl6f92w0yzg4s59g5mhxwmy-gnugrep-3.7/bin:/nix/store/hwcdqw4jrjnd37wxqgsd47hd0j8bnj09-gawk-5.1.1/bin:/nix/store/cfbhw8r8ags41vwqaz47r583d0p4h4a1-gnutar-1.34/bin:/nix/store/p3m1ndl1lapwrlh698bnb5lvvxh67378-gzip-1.12/bin:/nix/store/a8mhcagrsly7c7mpjrpsnaahk4aax056-bzip2-1.0.8-bin/bin:/nix/store/mblgz65m3zv9x548a3d5m96fj2pbwr09-gnumake-4.3/bin:/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin:/nix/store/v7ljksji50mg3w61dykaa3n3y79n6nil-patch-2.7.6/bin:/nix/store/zlcnmqq14jz5x9439jf937mvayyl63da-xz-5.2.7-bin/bin:/nix/store/y6aj732zm9m87c82fpvf103a1xb22blp-file-5.43/bin","LD":"ld","LOCALE_ARCHIVE":"/usr/lib/locale/locale-archive","NIX_BINTOOLS":"/nix/store/1d6ian3r8kdzspw8hacjhl3xkp40g1lj-binutils-wrapper-2.39","NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu":"1","NIX_BUILD_CORES":"8","NIX_BUILD_TOP":"/tmp","NIX_CC":"/nix/store/dq0xwmsk1g0i2ayg6pb7y87na2knzylh-gcc-wrapper-11.3.0","NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu":"1","NIX_CFLAGS_COMPILE":" -frandom-seed=7ya8xlq922 -isystem /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/include -isystem /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/include","NIX_ENFORCE_NO_NATIVE":"1","NIX_HARDENING_ENABLE":"fortify stackprotector pic strictoverflow format relro bindnow","NIX_INDENT_MAKE":"1","NIX_LDFLAGS":"-rpath /nix/store/7ya8xlq922h1fx115xra9kl0d0pfk2ab-nix-shell/lib64 -rpath /nix/store/7ya8xlq922h1fx115xra9kl0d0pfk2ab-nix-shell/lib ","NIX_STORE":"/nix/store","NM":"nm","NODE_PATH":"/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/lib/node_modules:/nix/store/7rfpsb04f2r6a755bqmmj1i90x8p1b18-typescript-language-server-3.1.0/lib/node_modules:/nix/store/hqc964yg79161afx85fvcmg1a6879k5i-jest-cli-23.6.0/lib/node_modules","OBJCOPY":"objcopy","OBJDUMP":"objdump","PATH":"/nix/store/bap4d0lpcrhpwmpb8ayjcgkmvfj62lnq-bash-interactive-5.1-p16/bin:/nix/store/pr5n59mb4jzmfx6kanwxly0l07p861fg-patchelf-0.15.0/bin:/nix/store/dq0xwmsk1g0i2ayg6pb7y87na2knzylh-gcc-wrapper-11.3.0/bin:/nix/store/1gf2flfqnpqbr1b4p4qz2f72y42bs56r-gcc-11.3.0/bin:/nix/store/57xv61c5zi8pphjbcwxxjlgc34p61ic9-glibc-2.35-163-bin/bin:/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin:/nix/store/1d6ian3r8kdzspw8hacjhl3xkp40g1lj-binutils-wrapper-2.39/bin:/nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39/bin:/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin:/nix/store/7rfpsb04f2r6a755bqmmj1i90x8p1b18-typescript-language-server-3.1.0/bin:/nix/store/zdcnqq55qi214j46zgw2qa1jp4dpdf2m-yarn-1.22.19/bin:/nix/store/hqc964yg79161afx85fvcmg1a6879k5i-jest-cli-23.6.0/bin:/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin:/nix/store/mydc6f4k2z73xlcz7ilif3v2lcaiqvza-findutils-4.9.0/bin:/nix/store/j9p3g8472iijd50vhdprx0nmk2fqn5gv-diffutils-3.8/bin:/nix/store/89zs7rms6x00xfq4dq6m7mjnhkr8a6r4-gnused-4.8/bin:/nix/store/86bp03jkmsl6f92w0yzg4s59g5mhxwmy-gnugrep-3.7/bin:/nix/store/hwcdqw4jrjnd37wxqgsd47hd0j8bnj09-gawk-5.1.1/bin:/nix/store/cfbhw8r8ags41vwqaz47r583d0p4h4a1-gnutar-1.34/bin:/nix/store/p3m1ndl1lapwrlh698bnb5lvvxh67378-gzip-1.12/bin:/nix/store/a8mhcagrsly7c7mpjrpsnaahk4aax056-bzip2-1.0.8-bin/bin:/nix/store/mblgz65m3zv9x548a3d5m96fj2pbwr09-gnumake-4.3/bin:/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin:/nix/store/v7ljksji50mg3w61dykaa3n3y79n6nil-patch-2.7.6/bin:/nix/store/zlcnmqq14jz5x9439jf937mvayyl63da-xz-5.2.7-bin/bin:/nix/store/y6aj732zm9m87c82fpvf103a1xb22blp-file-5.43/bin","RANLIB":"ranlib","READELF":"readelf","SIZE":"size","SOURCE_DATE_EPOCH":"315532800","STRINGS":"strings","STRIP":"strip","XDG_DATA_DIRS":"/nix/store/pr5n59mb4jzmfx6kanwxly0l07p861fg-patchelf-0.15.0/share","_":"/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin/env","__ETC_PROFILE_SOURCED":"1","buildInputs":"/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1 /nix/store/7rfpsb04f2r6a755bqmmj1i90x8p1b18-typescript-language-server-3.1.0 /nix/store/zdcnqq55qi214j46zgw2qa1jp4dpdf2m-yarn-1.22.19 /nix/store/hqc964yg79161afx85fvcmg1a6879k5i-jest-cli-23.6.0","buildPhase":"echo \"------------------------------------------------------------\" \u003e\u003e$out\necho \" WARNING: the existence of this path is not guaranteed.\" \u003e\u003e$out\necho \" It is an internal implementation detail for pkgs.mkShell.\" \u003e\u003e$out\necho \"------------------------------------------------------------\" \u003e\u003e$out\necho \u003e\u003e $out\n# Record all build inputs as runtime dependencies\nexport \u003e\u003e $out\n","builder":"/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash","cmakeFlags":"","configureFlags":"","depsBuildBuild":"","depsBuildBuildPropagated":"","depsBuildTarget":"","depsBuildTargetPropagated":"","depsHostHost":"","depsHostHostPropagated":"","depsTargetTarget":"","depsTargetTargetPropagated":"","doCheck":"","doInstallCheck":"","mesonFlags":"","name":"nix-shell","nativeBuildInputs":"","out":"/nix/store/7ya8xlq922h1fx115xra9kl0d0pfk2ab-nix-shell","outputs":"out","patches":"","phases":"buildPhase","propagatedBuildInputs":"","propagatedNativeBuildInputs":"","shell":"/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash","shellHook":"","stdenv":"/nix/store/kmfaajdpyyyg319vfqni5jm9wkxjmf73-stdenv-linux","strictDeps":"","system":"x86_64-linux"},"dependencies":[{"path":"replit.nix","mod_time":"2023-01-20T17:24:06.730825035Z"}],"channel":"stable-22_11","channel_nix_path":"/nix/store/hcrk0m2pzjqjwljjfj495789jlapk49d-nixpkgs-stable-22_11-22.11.tar.gz/nixpkgs-stable-22_11"}}}
@@ -0,0 +1,4 @@
1
+ {
2
+ "optOut": false,
3
+ "lastUpdateCheck": 1682745574823
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "optOut": false,
3
+ "lastUpdateCheck": 1678825045705
4
+ }
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
package/.replit ADDED
@@ -0,0 +1,80 @@
1
+
2
+ hidden = [".config", "package-lock.json"]
3
+ run = "npm run start"
4
+
5
+ [[hints]]
6
+ regex = "Error \\[ERR_REQUIRE_ESM\\]"
7
+ message = "We see that you are using require(...) inside your code. We currently do not support this syntax. Please use 'import' instead when using external modules. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)"
8
+
9
+ [nix]
10
+ channel = "stable-22_11"
11
+
12
+ [env]
13
+ XDG_CONFIG_HOME = "/home/runner/$REPL_SLUG/.config"
14
+ PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin"
15
+ npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global"
16
+
17
+ [gitHubImport]
18
+ requiredFiles = [".replit", "replit.nix", ".config", "package.json", "package-lock.json"]
19
+
20
+ [packager]
21
+ language = "nodejs"
22
+
23
+ [packager.features]
24
+ packageSearch = true
25
+ guessImports = true
26
+ enabledForHosting = false
27
+
28
+ [unitTest]
29
+ language = "nodejs"
30
+
31
+ [debugger]
32
+ support = true
33
+
34
+ [debugger.interactive]
35
+ transport = "localhost:0"
36
+ startCommand = [ "dap-node" ]
37
+
38
+ [debugger.interactive.initializeMessage]
39
+ command = "initialize"
40
+ type = "request"
41
+
42
+ [debugger.interactive.initializeMessage.arguments]
43
+ clientID = "replit"
44
+ clientName = "replit.com"
45
+ columnsStartAt1 = true
46
+ linesStartAt1 = true
47
+ locale = "en-us"
48
+ pathFormat = "path"
49
+ supportsInvalidatedEvent = true
50
+ supportsProgressReporting = true
51
+ supportsRunInTerminalRequest = true
52
+ supportsVariablePaging = true
53
+ supportsVariableType = true
54
+
55
+ [debugger.interactive.launchMessage]
56
+ command = "launch"
57
+ type = "request"
58
+
59
+ [debugger.interactive.launchMessage.arguments]
60
+ args = []
61
+ console = "externalTerminal"
62
+ cwd = "."
63
+ environment = []
64
+ pauseForSourceMap = false
65
+ program = "./index.js"
66
+ request = "launch"
67
+ sourceMaps = true
68
+ stopOnEntry = false
69
+ type = "pwa-node"
70
+
71
+ [languages]
72
+
73
+ [languages.javascript]
74
+ pattern = "**/{*.js,*.jsx,*.ts,*.tsx}"
75
+
76
+ [languages.javascript.languageServer]
77
+ start = "typescript-language-server --stdio"
78
+
79
+ [deployment]
80
+ run = ["sh", "-c", "npm run start"]
@@ -0,0 +1 @@
1
+ {"version":2,"languages":{"nodejs-npm":{"guessedImports":["lodash","better-sqlite3","is-hexcolor","bluebird","axios","chalk","pretty-ms","crypto-js","npmlog","body-parser","form-data","tough-cookie","totp-generator","https-proxy-agent","fs-extra","aes-js","request","mqtt","cheerio","express","figlet","file-url","puppeteer","got","websocket-stream","node-fetch","synthetic-horizon-database","uuid-apikey"],"guessedImportsHash":"9dd962a1709f1d694aea803508d9e9f8"}}}
@@ -0,0 +1,358 @@
1
+ var get = require('lodash/get'),
2
+ set = require('lodash/set'),
3
+ fetch = require("node-fetch"),
4
+ BetterDB = require("better-sqlite3"),
5
+ db = new BetterDB(__dirname + "/SyntheticDatabase.sqlite");
6
+
7
+ module.exports = {
8
+ get: function(key, ops,forceFuction) {
9
+ if (process.env["REPL_ID"] == undefined || forceFuction) {
10
+ if (!key)
11
+ throw new TypeError(
12
+ "No key specified."
13
+ );
14
+ return arbitrate("fetch", { id: key, ops: ops || {} });
15
+ }
16
+ else return fetch(process.env.REPLIT_DB_URL + "/" + key)
17
+ .then((e) => e.text())
18
+ .then((strValue) => {
19
+ if (ops && ops.raw) return strValue;
20
+ if (!strValue) return null;
21
+ try {
22
+ var value = JSON.parse(strValue);
23
+ } catch (_err) {
24
+ throw new SyntaxError(
25
+ `Failed to parse value of ${key}, try passing a raw option to get the raw value`
26
+ );
27
+ }
28
+ if (value === null || value === undefined) {
29
+ return null;
30
+ }
31
+ return value;
32
+ });
33
+ },
34
+
35
+ set: function(key, value,forceFuction) {
36
+ if (process.env["REPL_ID"] == undefined || forceFuction) {
37
+ if (!key)
38
+ throw new TypeError(
39
+ "No key specified."
40
+ );
41
+ return arbitrate("set",{
42
+ stringify: false,
43
+ id: key,
44
+ data: value,
45
+ ops: {},
46
+ });
47
+ }
48
+ else return fetch(process.env.REPLIT_DB_URL, {
49
+ method: "POST",
50
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
51
+ body: encodeURIComponent(key) + "=" + encodeURIComponent(JSON.stringify(value)),
52
+ });
53
+ },
54
+ has: function(key,forceFuction) {
55
+ if (process.env["REPL_ID"] == undefined || forceFuction) {
56
+ if (!key)
57
+ throw new TypeError(
58
+ "No key specified."
59
+ );
60
+ return arbitrate("has", { id: key, ops: {} });
61
+ }
62
+ else return fetch(process.env.REPLIT_DB_URL + "/" + key)
63
+ .then((e) => e.text())
64
+ .then((strValue) => {
65
+ if (strValue === "") return false;
66
+ return true;
67
+ });
68
+ },
69
+ delete: function(key,forceFuction) {
70
+ if (process.env["REPL_ID"] == undefined || forceFuction) {
71
+ if (!key)
72
+ throw new TypeError(
73
+ "No key specified."
74
+ );
75
+ return arbitrate("delete", { id: key, ops: {} });
76
+ }
77
+ else return fetch(process.env.REPLIT_DB_URL + "/" + key, {
78
+ method: "DELETE",
79
+ });
80
+ },
81
+
82
+ deleteMultiple: function(forceFuction,...args) {
83
+ if (process.env["REPL_ID"] == undefined || forceFuction) {
84
+ if (!key)
85
+ throw new TypeError(
86
+ "No key specified."
87
+ );
88
+ try {
89
+ for (let i of args) {
90
+ arbitrate("delete", { id: i, ops: {} });
91
+ }
92
+ return true;
93
+ }
94
+ catch (err) {
95
+ return false;
96
+ }
97
+ }
98
+ else {
99
+ const promises = [];
100
+
101
+ for (const arg of args) {
102
+ promises.push(this.delete(arg));
103
+ }
104
+
105
+ Promise.all(promises);
106
+
107
+ return this;
108
+ }
109
+ },
110
+
111
+ empty: async function(forceFuction) {
112
+ if (process.env["REPL_ID"] == undefined || forceFuction) {
113
+ return arbitrate("clear");
114
+ }
115
+ else {
116
+ const promises = [];
117
+ for (const key of await this.list()) {
118
+ promises.push(this.delete(key));
119
+ }
120
+
121
+ Promise.all(promises);
122
+
123
+ return this;
124
+ }
125
+ },
126
+
127
+ list: async function(forceFuction) {
128
+ if (process.env["REPL_ID"] == undefined || forceFuction) {
129
+ return arbitrate("all",{ ops: {} });
130
+ }
131
+ else {
132
+ return fetch(
133
+ this.key + `?encode=true&prefix=${encodeURIComponent(true)}`
134
+ )
135
+ .then((r) => r.text())
136
+ .then((t) => {
137
+ if (t.length === 0) {
138
+ return [];
139
+ }
140
+ return t.split("\n").map(decodeURIComponent);
141
+ });
142
+ }
143
+ }
144
+ }
145
+
146
+ var methods = {
147
+ fetch: function(db, params, options) {
148
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
149
+ if (!fetched) return null;
150
+ try {
151
+ fetched = JSON.parse(fetched.json)
152
+ } catch (e) {
153
+ fetched = fetched.json;
154
+ }
155
+ if (params.ops.target) fetched = get(fetched, params.ops.target);
156
+ return fetched;
157
+ },
158
+ set: function(db, params, options) {
159
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
160
+ if (!fetched) {
161
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
162
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
163
+ }
164
+ try {
165
+ fetched = JSON.parse(fetched);
166
+ } catch (e) {
167
+ fetched = fetched;
168
+ }
169
+ if (typeof fetched === 'object' && params.ops.target) {
170
+ params.data = JSON.parse(params.data);
171
+ params.data = set(fetched, params.ops.target, params.data);
172
+ }
173
+ else if (params.ops.target) throw new TypeError('Cannot target a non-object.');
174
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(JSON.stringify(params.data), params.id);
175
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
176
+ if (newData === '{}') return null;
177
+ else {
178
+ try { newData = JSON.parse(newData);
179
+ }
180
+ catch (e) {
181
+ newData = newData;
182
+ }
183
+ return newData;
184
+ }
185
+ },
186
+ add: function addDB(db, params, options) {
187
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
188
+ if (!fetched) {
189
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
190
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
191
+ }
192
+ if (params.ops.target) {
193
+ try {
194
+ fetched = JSON.parse(fetched)
195
+ }
196
+ catch (e) {
197
+ fetched = fetched;
198
+ }
199
+ let oldValue = get(fetched, params.ops.target);
200
+ if (oldValue === undefined) oldValue = 0;
201
+ else if (isNaN(oldValue)) throw new Error(`Data @ ID: "${params.id}" IS NOT A number.\nFOUND: ${fetched}\nEXPECTED: number`);
202
+ params.data = set(fetched, params.ops.target, oldValue + JSON.parse(params.data));
203
+ }
204
+ else {
205
+ if (fetched.json === '{}') fetched.json = 0;
206
+ try {
207
+ fetched.json = JSON.parse(fetched)
208
+ } catch (e) {
209
+ fetched.json = fetched.json;
210
+ }
211
+ if (isNaN(fetched.json)) throw new Error(`Data @ ID: "${params.id}" IS NOT A number.\nFOUND: ${fetched.json}\nEXPECTED: number`);
212
+ params.data = parseInt(fetched.json, 10) + parseInt(params.data, 10);
213
+ }
214
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(JSON.stringify(params.data), params.id);
215
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
216
+ if (newData === '{}') return null;
217
+ else {
218
+ try {
219
+ newData = JSON.parse(newData);
220
+ }
221
+ catch (e) {
222
+ newData = newData;
223
+ }
224
+ return newData;
225
+ }
226
+ },
227
+ subtract: function subtractDB(db, params, options) {
228
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
229
+ if (!fetched) {
230
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
231
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
232
+ }
233
+ if (params.ops.target) {
234
+ try { fetched = JSON.parse(fetched); } catch (e) {}
235
+ params.data = JSON.parse(params.data);
236
+ let oldValue = get(fetched, params.ops.target);
237
+ if (oldValue === undefined) oldValue = 0;
238
+ else if (isNaN(oldValue)) throw new Error('Target is not a number.');
239
+ params.data = set(fetched, params.ops.target, oldValue - params.data);
240
+ } else {
241
+ if (fetched.json === '{}') fetched.json = 0;
242
+ else fetched.json = JSON.parse(fetched.json);
243
+ try { fetched.json = JSON.parse(fetched); } catch (e) {}
244
+ if (isNaN(fetched.json)) throw new Error('Target is not a number.');
245
+ params.data = parseInt(fetched.json, 10) - parseInt(params.data, 10);
246
+ }
247
+ params.data = JSON.stringify(params.data);
248
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(params.data, params.id);
249
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
250
+ if (newData === '{}') return null;
251
+ else {
252
+ try { newData = JSON.parse(newData); } catch (e) {}
253
+ return newData;
254
+ }
255
+ },
256
+ push: function pushDB(db, params, options) {
257
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
258
+ if (!fetched) {
259
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
260
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
261
+ }
262
+ if (params.ops.target) {
263
+ fetched = JSON.parse(fetched.json);
264
+ try { fetched = JSON.parse(fetched) } catch (e) {}
265
+ params.data = JSON.parse(params.data);
266
+ if (typeof fetched !== 'object') throw new TypeError('Cannot push into a non-object.');
267
+ let oldArray = get(fetched, params.ops.target);
268
+ if (oldArray === undefined) oldArray = [];
269
+ else if (!Array.isArray(oldArray)) throw new TypeError('Target is not an array.');
270
+ oldArray.push(params.data);
271
+ params.data = set(fetched, params.ops.target, oldArray);
272
+ } else {
273
+ if (fetched.json === '{}') fetched.json = [];
274
+ else fetched.json = JSON.parse(fetched.json);
275
+ try { fetched.json = JSON.parse(fetched.json); } catch (e) {}
276
+ params.data = JSON.parse(params.data);
277
+ if (!Array.isArray(fetched.json)) throw new TypeError('Target is not an array.');
278
+ fetched.json.push(params.data);
279
+ params.data = fetched.json;
280
+ }
281
+ params.data = JSON.stringify(params.data);
282
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(params.data, params.id);
283
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
284
+ if (newData === '{}') return null;
285
+ else {
286
+ newData = JSON.parse(newData)
287
+ try { newData = JSON.parse(newData) } catch (e) {}
288
+ return newData
289
+ }
290
+ },
291
+ delete: function deleteDB(db, params, options) {
292
+ const unset = require('lodash/unset');
293
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
294
+ if (!fetched) return false;
295
+ else fetched = JSON.parse(fetched.json);
296
+ try { fetched = JSON.parse(fetched); } catch (e) {}
297
+ if (typeof fetched === 'object' && params.ops.target) {
298
+ unset(fetched, params.ops.target);
299
+ fetched = JSON.stringify(fetched);
300
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(fetched, params.id);
301
+ return true;
302
+ }
303
+ else if (params.ops.target) throw new TypeError('Target is not an object.');
304
+ else db.prepare(`DELETE FROM ${options.table} WHERE ID = (?)`).run(params.id);
305
+ return true;
306
+ },
307
+ has: function hasDB(db, params, options) {
308
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
309
+ if (!fetched) return false;
310
+ else fetched = JSON.parse(fetched.json);
311
+ try { fetched = JSON.parse(fetched) } catch (e) {}
312
+ if (params.ops.target) fetched = get(fetched, params.ops.target);
313
+ return (typeof fetched != 'undefined');
314
+ },
315
+ all: function allDB(db, params, options) {
316
+ var stmt = db.prepare(`SELECT * FROM ${options.table} WHERE ID IS NOT NULL`);
317
+ let resp = [];
318
+ for (var row of stmt.iterate()) {
319
+ try {
320
+ resp.push({
321
+ ID: row.ID,
322
+ data: JSON.parse(row.json)
323
+ });
324
+ }
325
+ catch (e) {
326
+ return [];
327
+ }
328
+ }
329
+ return resp;
330
+ },
331
+ type: function typeDB(db, params, options) {
332
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
333
+ if (!fetched) return null; // If empty, return null
334
+ fetched = JSON.parse(fetched.json);
335
+ try { fetched = JSON.parse(fetched); } catch (e) {}
336
+ if (params.ops.target) fetched = get(fetched, params.ops.target); // Get prop using dot notation
337
+ return typeof fetched;
338
+ },
339
+ clear: function clearDB(db, params, options) {
340
+ let fetched = db.prepare(`DELETE FROM ${options.table}`).run();
341
+ if(!fetched) return null;
342
+ return fetched.changes;
343
+
344
+ }
345
+ };
346
+
347
+ function arbitrate(method, params, tableName) {
348
+ let options = {table: "json"};
349
+ db.prepare(`CREATE TABLE IF NOT EXISTS ${options.table} (ID TEXT, json TEXT)`).run();
350
+ if (params.ops.target && params.ops.target[0] === ".") params.ops.target = params.ops.target.slice(1); // Remove prefix if necessary
351
+ if (params.data && params.data === Infinity) throw new TypeError(`You cannot set Infinity into the database @ ID: ${params.id}`);
352
+ if (params.id && typeof params.id == "string" && params.id.includes(".")) {
353
+ let unparsed = params.id.split(".");
354
+ params.id = unparsed.shift();
355
+ params.ops.target = unparsed.join(".");
356
+ }
357
+ return methods[method](db, params, options);
358
+ }
@@ -0,0 +1,78 @@
1
+ var utils = require('../utils');
2
+ var logger = require('../logger')
3
+ var OTP = require('totp-generator');
4
+
5
+ module.exports.getInfo = async function (id,jar,ctx,defaultFuncs) {
6
+ var AccessToken = await module.exports.getAccessToken(jar,ctx,defaultFuncs);
7
+ var { body:Data } = await utils.get(`https://graph.facebook.com/${id}?fields=name,first_name,email,about,birthday,gender,website,hometown,link,location,quotes,relationship_status,significant_other,username,subscribers.limite(0)&access_token=${AccessToken}`,jar,null,ctx.globalOptions);
8
+ var Format = {
9
+ id: JSON.parse(Data).id || "Không Có Dữ Liệu",
10
+ name: JSON.parse(Data).name || "Không Có Dữ Liệu",
11
+ first_name: JSON.parse(Data).first_name || "Không Có Dữ Liệu",
12
+ username: JSON.parse(Data).username || "Không Có Dữ Liệu",
13
+ link: JSON.parse(Data).link || "Không Có Dữ Liệu",
14
+ verified: JSON.parse(Data).verified || "Không Có Dữ Liệu",
15
+ about: JSON.parse(Data).about || "Không Có Dữ Liệu",
16
+ avatar: `https://graph.facebook.com/${id}/picture?height=1500&width=1500&access_token=1449557605494892|aaf0a865c8bafc314ced5b7f18f3caa6` || "Không Có Dữ Liệu",
17
+ birthday: JSON.parse(Data).birthday || "Không Có Dữ Liệu",
18
+ follow: JSON.parse(Data).subscribers.summary.total_count || "Không Có Dữ Liệu",
19
+ gender: JSON.parse(Data).gender || "Không Có Dữ Liệu",
20
+ hometown: JSON.parse(Data).hometown || "Không Có Dữ Liệu",
21
+ email: JSON.parse(Data).email || "Không Có Dữ Liệu",
22
+ interested_in: JSON.parse(Data).interested_in || "Không Có Dữ Liệu",
23
+ location: JSON.parse(Data).location || "Không Có Dữ Liệu",
24
+ locale: JSON.parse(Data).locale || "Không Có Dữ Liệu",
25
+ relationship_status: JSON.parse(Data).relationship_status || "Không Có Dữ Liệu",
26
+ love: JSON.parse(Data).significant_other || "Không Có Dữ Liệu",
27
+ website: JSON.parse(Data).website || "Không Có Dữ Liệu",
28
+ quotes: JSON.parse(Data).quotes || "Không Có Dữ Liệu",
29
+ timezone: JSON.parse(Data).timezone || "Không Có Dữ Liệu",
30
+ updated_time: JSON.parse(Data).updated_time || "Không Có Dữ Liệu"
31
+ }
32
+ return Format;
33
+ }
34
+
35
+ /**
36
+ * Help: @ManhG
37
+ * Author: @KanzuWakazaki
38
+ */
39
+
40
+ module.exports.getAccessToken = async function (jar, ctx,defaultFuncs) {
41
+ if (global.Fca.Data.AccessToken) {
42
+ return global.Fca.Data.AccessToken;
43
+ }
44
+ else {
45
+ var netURLS = "https://business.facebook.com/security/twofactor/reauth/enter/"
46
+ return defaultFuncs.get('https://business.facebook.com/business_locations', jar, null, ctx.globalOptions).then(async function(data) {
47
+ try {
48
+ if (/"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1]) {
49
+ global.Fca.Data.AccessToken = /"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1];
50
+ return /"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1];
51
+ }
52
+ }
53
+ catch (_) {
54
+ if (global.Fca.Require.FastConfig.AuthString.includes('|')) return logger.Error(global.Fca.Require.Language.Index.Missing)
55
+ var OPTCODE = global.Fca.Require.FastConfig.AuthString.includes(" ") ? global.Fca.Require.FastConfig.AuthString.replace(RegExp(" ", 'g'), "") : global.Fca.Require.FastConfig.AuthString;
56
+ var Form = {
57
+ approvals_code: OTP(String(OPTCODE)),
58
+ save_device: true,
59
+ lsd: utils.getFrom(data.body, "[\"LSD\",[],{\"token\":\"", "\"}")
60
+ }
61
+ return defaultFuncs.post(netURLS, jar, Form, ctx.globalOptions, {
62
+ referer: "https://business.facebook.com/security/twofactor/reauth/?twofac_next=https%3A%2F%2Fbusiness.facebook.com%2Fbusiness_locations&type=avoid_bypass&app_id=0&save_device=1",
63
+ }).then(async function(data) {
64
+ if (String(data.body).includes(false)) throw { Error: "Invaild OTP | FastConfigFca.json: AuthString" }
65
+ return defaultFuncs.get('https://business.facebook.com/business_locations', jar, null, ctx.globalOptions,{
66
+ referer: "https://business.facebook.com/security/twofactor/reauth/?twofac_next=https%3A%2F%2Fbusiness.facebook.com%2Fbusiness_locations&type=avoid_bypass&app_id=0&save_device=1",
67
+ }).then(async function(data) {
68
+ var Access_Token = /"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1];
69
+ global.Fca.Data.AccessToken = Access_Token;
70
+ return Access_Token;
71
+ });
72
+ });
73
+ }
74
+ })
75
+ }
76
+ }
77
+
78
+ //hard working =))
@@ -0,0 +1,60 @@
1
+ const got = global.Fca.Require.Fetch;
2
+
3
+ /**
4
+ * @param {string | URL} url
5
+ * @param {{ sendMessage: (arg0: string, arg1: any) => any; }} api
6
+ */
7
+ async function getUIDSlow(url,api) {
8
+ var FormData = require("form-data");
9
+ var Form = new FormData();
10
+ var Url = new URL(url);
11
+ Form.append('username', Url.pathname.replace(/\//g, ""));
12
+ try {
13
+ var data = await got.post('https://api.findids.net/api/get-uid-from-username',{
14
+ body: Form,
15
+ userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.79 Safari/537.36'
16
+ })
17
+ } catch (e) {
18
+ console.log(global.Fca.Data.event.threadID,e)
19
+ return api.sendMessage("Lỗi: " + e.message,global.Fca.Data.event.threadID);
20
+ }
21
+ if (JSON.parse(data.body.toString()).status != 200) return api.sendMessage('Đã bị lỗi !',global.Fca.Data.event.threadID)
22
+ if (typeof JSON.parse(data.body.toString()).error === 'string') return "errr"
23
+ else return JSON.parse(data.body.toString()).data.id || "nịt";
24
+ }
25
+
26
+ /**
27
+ * @param {string | URL} url
28
+ * @param {{ sendMessage: (arg0: string, arg1: any, arg2: any) => any; }} api
29
+ */
30
+ async function getUIDFast(url,api) {
31
+ var FormData = require("form-data");
32
+ var Form = new FormData();
33
+ var Url = new URL(url);
34
+ Form.append('link', Url.href);
35
+ try {
36
+ var data = await got.post('https://id.traodoisub.com/api.php',{
37
+ body: Form
38
+ })
39
+ } catch (e) {
40
+ return api.sendMessage("Lỗi: " + e.message,global.Fca.Data.event.threadID,global.Fca.Data.event.messageID);
41
+ }
42
+ if (JSON.parse(data.body.toString()).error) return api.sendMessage(JSON.parse(data.body.toString()).error,global.Fca.Data.event.threadID,global.Fca.Data.event.messageID);
43
+ else return JSON.parse(data.body.toString()).id || "co cai nit huhu";
44
+ }
45
+
46
+ /**
47
+ * @param {any} url
48
+ * @param {any} api
49
+ */
50
+ async function getUID(url,api) {
51
+ var getUID = await getUIDFast(url,api);
52
+ if (!isNaN(getUID) == true) return getUID;
53
+ else {
54
+ let getUID = await getUIDSlow(url,api);
55
+ if (!isNaN(data) == true) return getUID;
56
+ else return null;
57
+ }
58
+ }
59
+
60
+ module.exports = getUID;