Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrepol742 committed Apr 18, 2024
1 parent 9f0a2a7 commit efa6549
Show file tree
Hide file tree
Showing 43 changed files with 318 additions and 306 deletions.
433 changes: 225 additions & 208 deletions index.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/redfox/src/addUserToGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function addUserToGroup(userID, threadID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/createNewGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
/*jshint -W088 */
/*jshint -W038 */

var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function createNewGroup(participantIDs, groupTitle, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/createPoll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function createPoll(title, threadID, options, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/deleteMessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function deleteMessage(messageOrMessages, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/deleteThread.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function deleteThread(threadOrThreads, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/eventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
*/

const ex_utils = require("../../utils");
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));
var mqtt = require("mqtt");
var websocket = require("websocket-stream");
var HttpsProxyAgent = require("https-proxy-agent");
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/forwardAttachment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function forwardAttachment(attachmentID, userOrUsers, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/getFriendsList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//var cheerio = require("cheerio");
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

// [almost] copy pasted from one of FB's minified file (GenderConst)
var GENDERS = {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/getThreadHistory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

function formatAttachmentsGraphQLResponse(attachment) {
switch (attachment.__typename) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/getThreadInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));
function formatEventReminders(reminder) {
return {
reminderID: reminder.id,
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/getThreadPictures.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function getThreadPictures(threadID, offset, limit, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/getUserID.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

function formatData(data) {
return {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/getUserInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

function formatData(data) {
var retObj = {};
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/handleFriendRequest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function handleFriendRequest(userID, accept, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/handleMessageRequest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function handleMessageRequest(threadID, accept, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/httpGet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function httpGet(url, form, callback, notAPI) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/httpPost.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function httpGet(url, form, callback, notAPI) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/logout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));
var ex_utils = require("../../utils");

module.exports = function (defaultFuncs, api, ctx) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/markAsDelivered.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function markAsDelivered(threadID, messageID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/markAsRead.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return async function markAsRead(threadID, read, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/markAsReadAll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function markAsReadAll(callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/markAsSeen.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function markAsRead(seen_timestamp, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/muteThread.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
// muteSecond: -1=permanent mute, 0=unmute, 60=one minute, 3600=one hour, etc.
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/removeUserFromGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function removeUserFromGroup(userID, threadID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/resolvePhotoUrl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function resolvePhotoUrl(photoID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/searchForThread.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function searchForThread(name, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/sendMessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));
var ex_utils = require("../../utils");
var bluebird = require("bluebird");

Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/sendTypingIndicator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
function makeTypingIndicator(typ, threadID, callback, isGroup) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setArchivedStatus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setArchivedStatus(threadOrThreads, archive, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setBio.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setBio(bio, publish, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setBlockedStatus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setBlockedStatus(userID, block, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setGroupImage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));
var bluebird = require("bluebird");

module.exports = function (defaultFuncs, api, ctx) {
Expand Down
70 changes: 15 additions & 55 deletions src/redfox/src/setMessageReaction.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
var utils = require("../utils");
/*
* This file is part of Project Orion.
*
* Portions of this file are derived from code licensed under the MIT License.
*
* The original code licensed under the MIT and its copyright information can be found at <https://github.com/mrepol742/project-orion/blob/master/src/redfox/LICENSE/>.
*
* This file is also subject to the terms and conditions of the GNU General Public License (GPL) vesion 3.0 License, a copy of which can be found in the LICENSE file at the root of this distribution.
*
* Copyright (c) 2022 Melvin Jones
*/

const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setMessageReaction(reaction, messageID, callback, forceCustomReaction) {
Expand All @@ -18,59 +31,6 @@ module.exports = function (defaultFuncs, api, ctx) {
};
}

switch (reaction) {
case "\uD83D\uDE0D": //:heart_eyes:
case "\uD83D\uDE06": //:laughing:
case "\uD83D\uDE2E": //:open_mouth:
case "\uD83D\uDE22": //:cry:
case "\uD83D\uDE20": //:angry:
case "\uD83D\uDC4D": //:thumbsup:
case "\uD83D\uDC4E": //:thumbsdown:
case "\u2764": //:heart:
case "\uD83D\uDC97": //:glowingheart:
case "":
//valid
break;
case ":heart_eyes:":
case ":love:":
reaction = "\uD83D\uDE0D";
break;
case ":laughing:":
case ":haha:":
reaction = "\uD83D\uDE06";
break;
case ":open_mouth:":
case ":wow:":
reaction = "\uD83D\uDE2E";
break;
case ":cry:":
case ":sad:":
reaction = "\uD83D\uDE22";
break;
case ":angry:":
reaction = "\uD83D\uDE20";
break;
case ":thumbsup:":
case ":like:":
reaction = "\uD83D\uDC4D";
break;
case ":thumbsdown:":
case ":dislike:":
reaction = "\uD83D\uDC4E";
break;
case ":heart:":
reaction = "\u2764";
break;
case ":glowingheart:":
reaction = "\uD83D\uDC97";
break;
default:
if (forceCustomReaction) {
break;
}
return callback({ error: "Reaction is not a valid emoji." });
}

var variables = {
data: {
client_mutation_id: ctx.clientMutationId++,
Expand All @@ -92,7 +52,7 @@ module.exports = function (defaultFuncs, api, ctx) {
.then(utils.parseAndCheckLogin(ctx.jar, defaultFuncs))
.then(function (resData) {
if (!resData) {
throw { error: "setReaction returned empty object." };
throw { error: "glowingheart returned empty object." };
}
if (resData.error) {
throw resData;
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setNickname.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setNickname(nickname, threadID, participantID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setPostReaction.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function unsendMessage(postID, type, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setThreadColor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setThreadColor(color, threadID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setThreadEmoji.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setThreadEmoji(emoji, threadID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/setTitle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function setTitle(newTitle, threadID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/unfriend.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function unsendMessage(userID, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/redfox/src/unsendMessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var utils = require("../utils");
const path = require("path");
var utils = require(path.join(__dirname, '..', 'utils'));

module.exports = function (defaultFuncs, api, ctx) {
return function unsendMessage(messageID, callback) {
Expand Down
1 change: 0 additions & 1 deletion src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const express = require("express");
const path = require("path");
const router = express.Router();

console.log(path.join(__dirname, "public"))
router.use(express.static(path.join(__dirname, "public")));

router.get('/', (req, res) => {
Expand Down
3 changes: 0 additions & 3 deletions src/test.js

This file was deleted.

0 comments on commit efa6549

Please sign in to comment.