fca-dongdev-remake 0.0.1-security → 1.7.8

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

Potentially problematic release.


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

Files changed (112) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.cache/replit/modules.stamp +1 -0
  3. package/.cache/replit/nix/env.json +1 -0
  4. package/.gitattributes +2 -0
  5. package/.upm/store.json +1 -0
  6. package/DOCS.md +1738 -0
  7. package/Extra/ExtraAddons.js +78 -0
  8. package/Extra/ExtraFindUID.js +60 -0
  9. package/Extra/ExtraGetThread.js +118 -0
  10. package/Extra/ExtraScreenShot.js +673 -0
  11. package/Extra/ExtraTranslate.js +62 -0
  12. package/Extra/ExtraUptimeRobot.js +59 -0
  13. package/Extra/Html/Classic/script.js +231 -0
  14. package/Extra/Html/Classic/style.css +8 -0
  15. package/Extra/PM2/ecosystem.config.js +23 -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/Extra/Src/SecurityCheck.js +2 -0
  24. package/Func/AcceptAgreement.js +32 -0
  25. package/Func/ClearCache.js +64 -0
  26. package/Func/ReportV1.js +54 -0
  27. package/Horizon_Package/Synthetic-Horizon-Database/index.js +358 -0
  28. package/Horizon_Package/Synthetic-Horizon-Database/package-lock.json +2945 -0
  29. package/Horizon_Package/Synthetic-Horizon-Database/package.json +27 -0
  30. package/Horizon_Package/Synthetic-Horizon-Database/readme.md +8 -0
  31. package/Horizon_Package/horizon-sp/README.md +11 -0
  32. package/Horizon_Package/horizon-sp/index.js +41 -0
  33. package/Horizon_Package/horizon-sp/logger.js +16 -0
  34. package/Horizon_Package/horizon-sp/package-lock.json +150 -0
  35. package/Horizon_Package/horizon-sp/package.json +20 -0
  36. package/LICENSE.md +23 -0
  37. package/Language/index.json +176 -0
  38. package/OldSecurity.js +100 -0
  39. package/README.md +125 -3
  40. package/SECURITY.md +21 -0
  41. package/Settngs/Database.js +21 -0
  42. package/Settngs/Location.js +59 -0
  43. package/Settngs/Location.json +24 -0
  44. package/Settngs/Settings.js +59 -0
  45. package/StateCrypt.js +98 -0
  46. package/broadcast.js +38 -0
  47. package/index.js +1333 -0
  48. package/logger.js +65 -0
  49. package/package.json +89 -3
  50. package/src/Horizon_Data.js +125 -0
  51. package/src/K2IMG.js +8 -0
  52. package/src/Premium.js +30 -0
  53. package/src/Screenshot.js +85 -0
  54. package/src/T2S.js +8 -0
  55. package/src/addExternalModule.js +16 -0
  56. package/src/addUserToGroup.js +79 -0
  57. package/src/changeAdminStatus.js +79 -0
  58. package/src/changeArchivedStatus.js +41 -0
  59. package/src/changeAvt.js +85 -0
  60. package/src/changeBio.js +65 -0
  61. package/src/changeBlockedStatus.js +36 -0
  62. package/src/changeGroupImage.js +106 -0
  63. package/src/changeNickname.js +45 -0
  64. package/src/changeThreadColor.js +62 -0
  65. package/src/changeThreadEmoji.js +42 -0
  66. package/src/createNewGroup.js +70 -0
  67. package/src/createPoll.js +60 -0
  68. package/src/deleteMessage.js +45 -0
  69. package/src/deleteThread.js +43 -0
  70. package/src/forwardAttachment.js +48 -0
  71. package/src/getAccessToken.js +32 -0
  72. package/src/getCurrentUserID.js +7 -0
  73. package/src/getEmojiUrl.js +27 -0
  74. package/src/getFriendsList.js +73 -0
  75. package/src/getMessage.js +80 -0
  76. package/src/getThreadHistory.js +537 -0
  77. package/src/getThreadInfo.js +348 -0
  78. package/src/getThreadList.js +213 -0
  79. package/src/getThreadMain.js +219 -0
  80. package/src/getThreadPictures.js +59 -0
  81. package/src/getUID.js +59 -0
  82. package/src/getUserID.js +62 -0
  83. package/src/getUserInfo.js +129 -0
  84. package/src/getUserInfoMain.js +65 -0
  85. package/src/getUserInfoV2.js +36 -0
  86. package/src/getUserInfoV3.js +63 -0
  87. package/src/getUserInfoV4.js +55 -0
  88. package/src/getUserInfoV5.js +61 -0
  89. package/src/handleFriendRequest.js +46 -0
  90. package/src/handleMessageRequest.js +49 -0
  91. package/src/httpGet.js +49 -0
  92. package/src/httpPost.js +48 -0
  93. package/src/httpPostFormData.js +41 -0
  94. package/src/listenMqtt.js +702 -0
  95. package/src/logout.js +68 -0
  96. package/src/markAsDelivered.js +48 -0
  97. package/src/markAsRead.js +70 -0
  98. package/src/markAsReadAll.js +43 -0
  99. package/src/markAsSeen.js +51 -0
  100. package/src/muteThread.js +47 -0
  101. package/src/removeUserFromGroup.js +49 -0
  102. package/src/resolvePhotoUrl.js +37 -0
  103. package/src/searchForThread.js +43 -0
  104. package/src/sendMessage.js +334 -0
  105. package/src/sendTypingIndicator.js +80 -0
  106. package/src/setMessageReaction.js +109 -0
  107. package/src/setPostReaction.js +102 -0
  108. package/src/setTitle.js +74 -0
  109. package/src/threadColors.js +39 -0
  110. package/src/unfriend.js +43 -0
  111. package/src/unsendMessage.js +40 -0
  112. package/utils.js +1643 -0
@@ -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
+ }