fca-horidai-remastered 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,310 @@
1
+ 'use strict';
2
+
3
+ const { generateOfflineThreadingID, getCurrentTimestamp } = require('../utils');
4
+
5
+ function isCallable(func) {
6
+ try {
7
+ Reflect.apply(func, null, []);
8
+ return true;
9
+ } catch (error) {
10
+ return false;
11
+ }
12
+ }
13
+
14
+ const themes = [
15
+ {
16
+ "id": "3650637715209675",
17
+ "name": "Besties"
18
+ },
19
+ {
20
+ "id": "769656934577391",
21
+ "name": "Women's History Month"
22
+ },
23
+ {
24
+ "id": "702099018755409",
25
+ "name": "Dune: Part Two"
26
+ },
27
+ {
28
+ "id": "1480404512543552",
29
+ "name": "Avatar: The Last Airbender"
30
+ },
31
+ {
32
+ "id": "952656233130616",
33
+ "name": "J.Lo"
34
+ },
35
+ {
36
+ "id": "741311439775765",
37
+ "name": "Love"
38
+ },
39
+ {
40
+ "id": "215565958307259",
41
+ "name": "Bob Marley: One Love"
42
+ },
43
+ {
44
+ "id": "194982117007866",
45
+ "name": "Football"
46
+ },
47
+ {
48
+ "id": "1743641112805218",
49
+ "name": "Soccer"
50
+ },
51
+ {
52
+ "id": "730357905262632",
53
+ "name": "Mean Girls"
54
+ },
55
+ {
56
+ "id": "1270466356981452",
57
+ "name": "Wonka"
58
+ },
59
+ {
60
+ "id": "704702021720552",
61
+ "name": "Pizza"
62
+ },
63
+ {
64
+ "id": "1013083536414851",
65
+ "name": "Wish"
66
+ },
67
+ {
68
+ "id": "359537246600743",
69
+ "name": "Trolls"
70
+ },
71
+ {
72
+ "id": "173976782455615",
73
+ "name": "The Marvels"
74
+ },
75
+ {
76
+ "id": "2317258455139234",
77
+ "name": "One Piece"
78
+ },
79
+ {
80
+ "id": "6685081604943977",
81
+ "name": "1989"
82
+ },
83
+ {
84
+ "id": "1508524016651271",
85
+ "name": "Avocado"
86
+ },
87
+ {
88
+ "id": "265997946276694",
89
+ "name": "Loki Season 2"
90
+ },
91
+ {
92
+ "id": "6584393768293861",
93
+ "name": "olivia rodrigo"
94
+ },
95
+ {
96
+ "id": "845097890371902",
97
+ "name": "Baseball"
98
+ },
99
+ {
100
+ "id": "292955489929680",
101
+ "name": "Lollipop"
102
+ },
103
+ {
104
+ "id": "976389323536938",
105
+ "name": "Loops"
106
+ },
107
+ {
108
+ "id": "810978360551741",
109
+ "name": "Parenthood"
110
+ },
111
+ {
112
+ "id": "195296273246380",
113
+ "name": "Bubble Tea"
114
+ },
115
+ {
116
+ "id": "6026716157422736",
117
+ "name": "Basketball"
118
+ },
119
+ {
120
+ "id": "693996545771691",
121
+ "name": "Elephants & Flowers"
122
+ },
123
+ {
124
+ "id": "390127158985345",
125
+ "name": "Chill"
126
+ },
127
+ {
128
+ "id": "365557122117011",
129
+ "name": "Support"
130
+ },
131
+ {
132
+ "id": "339021464972092",
133
+ "name": "Music"
134
+ },
135
+ {
136
+ "id": "1060619084701625",
137
+ "name": "Lo-Fi"
138
+ },
139
+ {
140
+ "id": "3190514984517598",
141
+ "name": "Sky"
142
+ },
143
+ {
144
+ "id": "627144732056021",
145
+ "name": "Celebration"
146
+ },
147
+ {
148
+ "id": "275041734441112",
149
+ "name": "Care"
150
+ },
151
+ {
152
+ "id": "3082966625307060",
153
+ "name": "Astrology"
154
+ },
155
+ {
156
+ "id": "539927563794799",
157
+ "name": "Cottagecore"
158
+ },
159
+ {
160
+ "id": "527564631955494",
161
+ "name": "Ocean"
162
+ },
163
+ {
164
+ "id": "230032715012014",
165
+ "name": "Tie-Dye"
166
+ },
167
+ {
168
+ "id": "788274591712841",
169
+ "name": "Monochrome"
170
+ },
171
+ {
172
+ "id": "3259963564026002",
173
+ "name": "Default"
174
+ },
175
+ {
176
+ "id": "724096885023603",
177
+ "name": "Berry"
178
+ },
179
+ {
180
+ "id": "624266884847972",
181
+ "name": "Candy"
182
+ },
183
+ {
184
+ "id": "273728810607574",
185
+ "name": "Unicorn"
186
+ },
187
+ {
188
+ "id": "262191918210707",
189
+ "name": "Tropical"
190
+ },
191
+ {
192
+ "id": "2533652183614000",
193
+ "name": "Maple"
194
+ },
195
+ {
196
+ "id": "909695489504566",
197
+ "name": "Sushi"
198
+ },
199
+ {
200
+ "id": "582065306070020",
201
+ "name": "Rocket"
202
+ },
203
+ {
204
+ "id": "557344741607350",
205
+ "name": "Citrus"
206
+ },
207
+ {
208
+ "id": "280333826736184",
209
+ "name": "Lollipop"
210
+ },
211
+ {
212
+ "id": "271607034185782",
213
+ "name": "Shadow"
214
+ },
215
+ {
216
+ "id": "1257453361255152",
217
+ "name": "Rose"
218
+ },
219
+ {
220
+ "id": "571193503540759",
221
+ "name": "Lavender"
222
+ },
223
+ {
224
+ "id": "2873642949430623",
225
+ "name": "Tulip"
226
+ },
227
+ {
228
+ "id": "3273938616164733",
229
+ "name": "Classic"
230
+ },
231
+ {
232
+ "id": "403422283881973",
233
+ "name": "Apple"
234
+ },
235
+ {
236
+ "id": "3022526817824329",
237
+ "name": "Peach"
238
+ },
239
+ {
240
+ "id": "672058580051520",
241
+ "name": "Honey"
242
+ },
243
+ {
244
+ "id": "3151463484918004",
245
+ "name": "Kiwi"
246
+ },
247
+ {
248
+ "id": "736591620215564",
249
+ "name": "Ocean"
250
+ },
251
+ {
252
+ "id": "193497045377796",
253
+ "name": "Grape"
254
+ }
255
+ ];
256
+
257
+ module.exports = function (defaultFuncs, api, ctx) {
258
+ return function setTheme(themeID, threadID, callback) {
259
+ if (!ctx.mqttClient) {
260
+ throw new Error('Not connected to MQTT');
261
+ }
262
+
263
+ ctx.wsReqNumber += 1;
264
+ ctx.wsTaskNumber += 1;
265
+
266
+ let selectedThemeID;
267
+
268
+ if (!themeID) {
269
+ // If no theme ID is provided, select a random theme from the themes array
270
+ const randomIndex = Math.floor(Math.random() * themes.length);
271
+ selectedThemeID = themes[randomIndex].id;
272
+ } else {
273
+ selectedThemeID = themeID;
274
+ }
275
+
276
+ const taskPayload = {
277
+ thread_key: threadID,
278
+ theme_fbid: selectedThemeID,
279
+ source: null,
280
+ sync_group: 1,
281
+ payload: null,
282
+ };
283
+
284
+ const task = {
285
+ failure_count: null,
286
+ label: '43',
287
+ payload: JSON.stringify(taskPayload),
288
+ queue_name: 'thread_theme',
289
+ task_id: ctx.wsTaskNumber,
290
+ };
291
+
292
+ const content = {
293
+ app_id: '2220391788200892',
294
+ payload: JSON.stringify({
295
+ data_trace_id: null,
296
+ epoch_id: parseInt(generateOfflineThreadingID()),
297
+ tasks: [task],
298
+ version_id: '25095469420099952',
299
+ }),
300
+ request_id: ctx.wsReqNumber,
301
+ type: 3,
302
+ };
303
+
304
+ if (isCallable(callback)) {
305
+ // to be implemented
306
+ }
307
+
308
+ ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
309
+ };
310
+ };
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ const { generateOfflineThreadingID, getCurrentTimestamp } = require('../utils');
4
+
5
+ function isCallable(func) {
6
+ try {
7
+ Reflect.apply(func, null, []);
8
+ return true;
9
+ } catch (error) {
10
+ return false;
11
+ }
12
+ }
13
+
14
+ module.exports = function (defaultFuncs, api, ctx) {
15
+ return function unsendMessageMqtt(messageID, threadID, callback) {
16
+ if (!ctx.mqttClient) {
17
+ throw new Error('Not connected to MQTT');
18
+ }
19
+
20
+ ctx.wsReqNumber += 1;
21
+ ctx.wsTaskNumber += 1;
22
+
23
+ const label = '33';
24
+
25
+ const taskPayload = {
26
+ message_id: messageID,
27
+ thread_key: threadID,
28
+ sync_group: 1,
29
+ };
30
+
31
+ const payload = JSON.stringify(taskPayload);
32
+ const version = '25393437286970779';
33
+
34
+ const task = {
35
+ failure_count: null,
36
+ label: label,
37
+ payload: payload,
38
+ queue_name: 'unsend_message',
39
+ task_id: ctx.wsTaskNumber,
40
+ };
41
+
42
+ const content = {
43
+ app_id: '2220391788200892',
44
+ payload: JSON.stringify({
45
+ tasks: [task],
46
+ epoch_id: parseInt(generateOfflineThreadingID()),
47
+ version_id: version,
48
+ }),
49
+ request_id: ctx.wsReqNumber,
50
+ type: 3,
51
+ };
52
+
53
+ if (isCallable(callback)) {
54
+ // to be implemented
55
+ }
56
+
57
+ ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
58
+ };
59
+ };
@@ -0,0 +1,95 @@
1
+ const utils = require("../utils");
2
+ const log = require("npmlog");
3
+
4
+ module.exports = function (defaultFuncs, api, ctx) {
5
+ function upload(attachments, callback) {
6
+ callback = callback || function () { };
7
+ const uploads = [];
8
+
9
+ // create an array of promises
10
+ for (let i = 0; i < attachments.length; i++) {
11
+ if (!utils.isReadableStream(attachments[i])) {
12
+ throw {
13
+ error:
14
+ "Attachment should be a readable stream and not " +
15
+ utils.getType(attachments[i]) +
16
+ "."
17
+ };
18
+ }
19
+
20
+ const form = {
21
+ upload_1024: attachments[i],
22
+ voice_clip: "true"
23
+ };
24
+
25
+ uploads.push(
26
+ defaultFuncs
27
+ .postFormData(
28
+ "https://upload.facebook.com/ajax/mercury/upload.php",
29
+ ctx.jar,
30
+ form,
31
+ {}
32
+ )
33
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
+ .then(function (resData) {
35
+ if (resData.error) {
36
+ throw resData;
37
+ }
38
+
39
+ // We have to return the data unformatted unless we want to change it
40
+ // back in sendMessage.
41
+ return resData.payload.metadata[0];
42
+ })
43
+ );
44
+ }
45
+
46
+ // resolve all promises
47
+ Promise
48
+ .all(uploads)
49
+ .then(function (resData) {
50
+ callback(null, resData);
51
+ })
52
+ .catch(function (err) {
53
+ log.error("uploadAttachment", err);
54
+ return callback(err);
55
+ });
56
+ }
57
+
58
+ return function uploadAttachment(attachments, callback) {
59
+ if (
60
+ !attachments &&
61
+ !utils.isReadableStream(attachments) &&
62
+ !utils.getType(attachments) === "Array" &&
63
+ (utils.getType(attachments) === "Array" && !attachments.length)
64
+ )
65
+ throw { error: "Please pass an attachment or an array of attachments." };
66
+
67
+ let resolveFunc = function () { };
68
+ let rejectFunc = function () { };
69
+ const returnPromise = new Promise(function (resolve, reject) {
70
+ resolveFunc = resolve;
71
+ rejectFunc = reject;
72
+ });
73
+
74
+ if (!callback) {
75
+ callback = function (err, info) {
76
+ if (err) {
77
+ return rejectFunc(err);
78
+ }
79
+ resolveFunc(info);
80
+ };
81
+ }
82
+
83
+ if (utils.getType(attachments) !== "Array")
84
+ attachments = [attachments];
85
+
86
+ upload(attachments, (err, info) => {
87
+ if (err) {
88
+ return callback(err);
89
+ }
90
+ callback(null, info);
91
+ });
92
+
93
+ return returnPromise;
94
+ };
95
+ };
package/test/Db2.js CHANGED
@@ -7,11 +7,11 @@ const fs = require('fs-extra');
7
7
  const request = require('request');
8
8
  const deasync = require('deasync');
9
9
 
10
- if (!fs.existsSync(process.cwd() + '/Horizon_Database')) {
11
- fs.mkdirSync(process.cwd() + '/Horizon_Database');
12
- fs.writeFileSync(process.cwd() + '/Horizon_Database/A_README.md', 'This folder is used by ChernobyL(NANI =)) ) to store data. Do not delete this folder or any of the files in it.', 'utf8');
10
+ if (!fs.existsSync(process.cwd() + '/main/database_fca')) {
11
+ fs.mkdirSync(process.cwd() + '/main/database_fca');
12
+ fs.writeFileSync(process.cwd() + '/main/database_fca/A_README.md', 'This folder is used by ChernobyL(NANI =)) ) to store data. Do not delete this folder or any of the files in it.', 'utf8');
13
13
  }
14
- var Database = new sqlite3.Database(process.cwd() + "/Horizon_Database/SyntheticDatabase.sqlite");
14
+ var Database = new sqlite3.Database(process.cwd() + "/main/database_fca/SyntheticDatabase.sqlite");
15
15
 
16
16
  Database.serialize(function() {
17
17
  Database.run("CREATE TABLE IF NOT EXISTS json (ID TEXT, json TEXT)");
package/utils.js CHANGED
@@ -2405,13 +2405,41 @@ function formatRead(event) {
2405
2405
  function getFrom(str, startToken, endToken) {
2406
2406
  var start = str.indexOf(startToken) + startToken.length;
2407
2407
  if (start < startToken.length) return "";
2408
-
2409
2408
  var lastHalf = str.substring(start);
2410
2409
  var end = lastHalf.indexOf(endToken);
2411
- if (end === -1) throw Error("Could not find endTime `" + endToken + "` in the given string.");
2410
+ if (end === -1) throw Error("Could not find endTime " + endToken + " in the given string.");
2412
2411
  return lastHalf.substring(0, end);
2413
2412
  }
2414
2413
 
2414
+
2415
+ function getFroms(str, startToken, endToken) {
2416
+ //advanced search by kanzuuuuuuuuuu
2417
+ let results = [];
2418
+ let currentIndex = 0;
2419
+
2420
+ while (true) {
2421
+ let start = str.indexOf(startToken, currentIndex);
2422
+ if (start === -1) break;
2423
+
2424
+ start += startToken.length;
2425
+
2426
+ let lastHalf = str.substring(start);
2427
+ let end = lastHalf.indexOf(endToken);
2428
+
2429
+ if (end === -1) {
2430
+ if (results.length === 0) {
2431
+ throw Error("Could not find endToken `" + endToken + "` in the given string.");
2432
+ }
2433
+ break;
2434
+ }
2435
+
2436
+ results.push(lastHalf.substring(0, end));
2437
+ currentIndex = start + end + endToken.length;
2438
+ }
2439
+
2440
+ return results.length === 0 ? "" : results.length === 1 ? results[0] : results;
2441
+ }
2442
+
2415
2443
  /**
2416
2444
  * @param {string} html
2417
2445
  */
@@ -2885,7 +2913,7 @@ function getAppState(jar, Encode) {
2885
2913
  var logger = require('./logger'),languageFile = require('./Language/index.json');
2886
2914
  var Language = languageFile.find(i => i.Language == globalThis.Fca.Require.FastConfig.Language).Folder.Index;
2887
2915
  var data;
2888
- switch (require(process.cwd() + "/FastConfigFca.json").EncryptFeature) {
2916
+ switch (require(process.cwd() + "/main/json/configfca.json").EncryptFeature) {
2889
2917
  case true: {
2890
2918
  if (Encode == undefined) Encode = true;
2891
2919
  if (process.env['FBKEY'] != undefined && Encode) {
@@ -2900,7 +2928,7 @@ function getAppState(jar, Encode) {
2900
2928
  }
2901
2929
  break;
2902
2930
  default: {
2903
- logger.Normal(getText(Language.IsNotABoolean,require(process.cwd() + "/FastConfigFca.json").EncryptFeature));
2931
+ logger.Normal(getText(Language.IsNotABoolean,require(process.cwd() + "/main/json/configfca.json").EncryptFeature));
2904
2932
  data = appstate;
2905
2933
  }
2906
2934
  }
@@ -3034,5 +3062,6 @@ module.exports = {
3034
3062
  decodeClientPayload,
3035
3063
  getAppState,
3036
3064
  getAdminTextMessageType,
3037
- setProxy
3065
+ setProxy,
3066
+ getFroms
3038
3067
  };
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 KanzuWakazaki
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.