mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 22:16:54 +00:00
Fix: prettier config in resources\ not being standard.
This commit is contained in:
1 parent
d56112a0cb
commit
ec1451a9aa
28 files changed
+349
-349
No files matched your search
@@ -2,5 +2,5 @@
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 2,
|
||||
"semi": true,
|
||||
"singleQuote": false
|
||||
"singleQuote": true
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import events from "../utils/events";
|
||||
import events from '../utils/events';
|
||||
|
||||
onNet(events.BANK_SEND_TRANSFERS, (transfer: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "BANK",
|
||||
method: "setTransaction",
|
||||
app: 'BANK',
|
||||
method: 'setTransaction',
|
||||
data: transfer,
|
||||
})
|
||||
);
|
||||
@@ -13,8 +13,8 @@ onNet(events.BANK_SEND_TRANSFERS, (transfer: any) => {
|
||||
onNet(events.BANK_SEND_CREDENTIALS, (credentials: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "BANK",
|
||||
method: "setCredentials",
|
||||
app: 'BANK',
|
||||
method: 'setCredentials',
|
||||
data: credentials,
|
||||
})
|
||||
);
|
||||
@@ -33,8 +33,8 @@ onNet(events.BANK_ADD_TRANSFER_SUCCESS, () => {
|
||||
onNet(events.BANK_TRANSACTION_ALERT, (bool: boolean) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "BANK",
|
||||
method: "setAlert",
|
||||
app: 'BANK',
|
||||
method: 'setAlert',
|
||||
data: bool,
|
||||
})
|
||||
);
|
||||
@@ -43,8 +43,8 @@ onNet(events.BANK_TRANSACTION_ALERT, (bool: boolean) => {
|
||||
onNet(events.BANK_TRANSACTION_NOTIFICATION, (transfer: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "BANK",
|
||||
method: "setNotification",
|
||||
app: 'BANK',
|
||||
method: 'setNotification',
|
||||
data: transfer,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import events from "../utils/events";
|
||||
import events from '../utils/events';
|
||||
|
||||
onNet(events.CONTACTS_SEND_CONTACTS, (contacts: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "CONTACTS",
|
||||
method: "setContacts",
|
||||
app: 'CONTACTS',
|
||||
method: 'setContacts',
|
||||
data: contacts,
|
||||
})
|
||||
);
|
||||
@@ -45,8 +45,8 @@ onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {
|
||||
onNet(events.CONTACTS_ACTION_RESULT, (result: string) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "CONTACTS",
|
||||
method: "setAlert",
|
||||
app: 'CONTACTS',
|
||||
method: 'setAlert',
|
||||
data: result,
|
||||
})
|
||||
);
|
||||
|
||||
+52
-52
@@ -1,17 +1,17 @@
|
||||
import { ESX } from "../client/client";
|
||||
import config from "../utils/config";
|
||||
import { Delay } from "../utils/fivem";
|
||||
import events from "../utils/events";
|
||||
import { ESX } from '../client/client';
|
||||
import config from '../utils/config';
|
||||
import { Delay } from '../utils/fivem';
|
||||
import events from '../utils/events';
|
||||
|
||||
RegisterCommand(
|
||||
"phone:close",
|
||||
'phone:close',
|
||||
(source: any, args: string[], raw: any) => {
|
||||
phoneCloseAnim();
|
||||
SetNuiFocus(false, false);
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: false,
|
||||
})
|
||||
);
|
||||
@@ -22,7 +22,7 @@ RegisterCommand(
|
||||
let prop = 0;
|
||||
let isPhoneOpen = false;
|
||||
let propCreated = false;
|
||||
let phoneModel = "prop_amb_phone"; // Refered to in newphoneProp function. Requires custom phone being streamed.
|
||||
let phoneModel = 'prop_amb_phone'; // Refered to in newphoneProp function. Requires custom phone being streamed.
|
||||
|
||||
const newPhoneProp = async () => {
|
||||
//Function for creating the phone prop
|
||||
@@ -31,7 +31,7 @@ const newPhoneProp = async () => {
|
||||
RequestModel(phoneModel);
|
||||
while (!HasModelLoaded(phoneModel)) {
|
||||
await Delay(1);
|
||||
console.log("MODEL HASNT LOADED");
|
||||
console.log('MODEL HASNT LOADED');
|
||||
}
|
||||
|
||||
const playerPed = PlayerPedId();
|
||||
@@ -65,9 +65,9 @@ const newPhoneProp = async () => {
|
||||
true
|
||||
); //-- Attaches the phone to the player.
|
||||
propCreated = true;
|
||||
console.log("prop created");
|
||||
console.log('prop created');
|
||||
} else if (propCreated) {
|
||||
console.log("prop already created");
|
||||
console.log('prop already created');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ function deletePhone() {
|
||||
DeleteEntity(prop);
|
||||
prop = 0;
|
||||
propCreated = false;
|
||||
console.log("prop destroyed");
|
||||
console.log('prop destroyed');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,19 +92,19 @@ async function loadAnimDict(dict: any) {
|
||||
|
||||
async function phoneOpenAnim() {
|
||||
//Phone Open Animation
|
||||
console.log("phoneOpenAnim"); //Left for testing purposes.
|
||||
console.log('phoneOpenAnim'); //Left for testing purposes.
|
||||
const flag = 50; //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||
deletePhone(); //Deleting before creating a new phone where itll be deleted again.
|
||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) {
|
||||
//-- true refers to at get in.
|
||||
const dict = "anim@cellphone@in_car@ps";
|
||||
const dict = 'anim@cellphone@in_car@ps';
|
||||
|
||||
ClearPedTasks(GetPlayerPed(-1));
|
||||
await loadAnimDict(dict);
|
||||
TaskPlayAnim(
|
||||
GetPlayerPed(-1),
|
||||
dict,
|
||||
"cellphone_text_in",
|
||||
'cellphone_text_in',
|
||||
8.0,
|
||||
-1,
|
||||
-1,
|
||||
@@ -118,14 +118,14 @@ async function phoneOpenAnim() {
|
||||
await newPhoneProp(); //Creates the phone and attaches it.
|
||||
} else {
|
||||
//While not in a vehicle it will use this dict.
|
||||
const dict = "cellphone@";
|
||||
const dict = 'cellphone@';
|
||||
|
||||
ClearPedTasks(GetPlayerPed(-1));
|
||||
await loadAnimDict(dict);
|
||||
TaskPlayAnim(
|
||||
GetPlayerPed(-1),
|
||||
dict,
|
||||
"cellphone_text_in",
|
||||
'cellphone_text_in',
|
||||
8.0,
|
||||
-1,
|
||||
-1,
|
||||
@@ -142,14 +142,14 @@ async function phoneOpenAnim() {
|
||||
|
||||
async function phoneCloseAnim() {
|
||||
//Phone Close Animation
|
||||
console.log("phoneCloseAnim"); //Left for testing purposes.
|
||||
console.log('phoneCloseAnim'); //Left for testing purposes.
|
||||
const flag = 50; //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||
const anim = "cellphone_text_out";
|
||||
const anim = 'cellphone_text_out';
|
||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) {
|
||||
//true refers to at get in.
|
||||
const dict = "anim@cellphone@in_car@ps";
|
||||
const dict = 'anim@cellphone@in_car@ps';
|
||||
|
||||
StopAnimTask(GetPlayerPed(-1), dict, "cellphone_text_in", 1.0); //Stop the pull out animation
|
||||
StopAnimTask(GetPlayerPed(-1), dict, 'cellphone_text_in', 1.0); //Stop the pull out animation
|
||||
deletePhone(); //Deletes the prop early incase they get out of the vehicle.
|
||||
await Delay(250); //lets it get to a certain point
|
||||
loadAnimDict(dict); //loads the new animation
|
||||
@@ -170,9 +170,9 @@ async function phoneCloseAnim() {
|
||||
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0); //clears the animation
|
||||
} else {
|
||||
//While not in a vehicle it will use this dict.
|
||||
const dict = "cellphone@";
|
||||
const dict = 'cellphone@';
|
||||
|
||||
StopAnimTask(GetPlayerPed(-1), dict, "cellphone_text_in", 1.0); //Stop the pull out animation
|
||||
StopAnimTask(GetPlayerPed(-1), dict, 'cellphone_text_in', 1.0); //Stop the pull out animation
|
||||
await Delay(100); //lets it get to a certain point
|
||||
loadAnimDict(dict); //loads the new animation
|
||||
TaskPlayAnim(
|
||||
@@ -197,24 +197,24 @@ async function phoneCloseAnim() {
|
||||
async function carryingPhone(cb: any) {
|
||||
if (ESX === null) return cb(0);
|
||||
ESX.TriggerServerCallback(
|
||||
"phone:getItemAmount",
|
||||
'phone:getItemAmount',
|
||||
(qtty: number) => {
|
||||
cb(qtty > 0);
|
||||
},
|
||||
"phone"
|
||||
'phone'
|
||||
);
|
||||
}
|
||||
|
||||
function noPhone() {
|
||||
if (ESX === null) return;
|
||||
ESX.ShowNotification("Oi Mate, No El Telephono", false, false, 1);
|
||||
ESX.ShowNotification('Oi Mate, No El Telephono', false, false, 1);
|
||||
}
|
||||
|
||||
function sendPhoneConfig() {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "phoneConfig",
|
||||
app: 'PHONE',
|
||||
method: 'phoneConfig',
|
||||
data: config,
|
||||
})
|
||||
);
|
||||
@@ -246,20 +246,20 @@ setTick(() => {
|
||||
|
||||
async function Phone() {
|
||||
if (config.PhoneAsItem) {
|
||||
console.log("CONFIG ON");
|
||||
console.log('CONFIG ON');
|
||||
carryingPhone(async (carryingPhone: any) => {
|
||||
if (carryingPhone) {
|
||||
if (!isPhoneOpen) {
|
||||
isPhoneOpen = true;
|
||||
await phoneOpenAnim(); // Animation starts before the phone is open
|
||||
emitNet("phone:getCredentials");
|
||||
console.log("Sellout fetched from client side"); // Gets the credentials. Will eventually most likely only get the phone number and name, idk.
|
||||
emitNet('phone:getCredentials');
|
||||
console.log('Sellout fetched from client side'); // Gets the credentials. Will eventually most likely only get the phone number and name, idk.
|
||||
SetCursorLocation(0.9, 0.922); //Experimental
|
||||
let res = GetActiveScreenResolution();
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: true,
|
||||
})
|
||||
);
|
||||
@@ -271,8 +271,8 @@ async function Phone() {
|
||||
SendNuiMessage(
|
||||
//Hides phone
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: false,
|
||||
})
|
||||
);
|
||||
@@ -286,18 +286,18 @@ async function Phone() {
|
||||
}
|
||||
});
|
||||
} else if (!config.PhoneAsItem) {
|
||||
console.log("CONFIG OFF");
|
||||
console.log('CONFIG OFF');
|
||||
if (!isPhoneOpen) {
|
||||
isPhoneOpen = true;
|
||||
await phoneOpenAnim(); // Animation starts before the phone is open
|
||||
emitNet("phone:getCredentials");
|
||||
console.log("Sellout fetched from client side");
|
||||
emitNet('phone:getCredentials');
|
||||
console.log('Sellout fetched from client side');
|
||||
SetCursorLocation(0.936, 0.922); //Experimental
|
||||
let res = GetActiveScreenResolution();
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: true,
|
||||
})
|
||||
);
|
||||
@@ -309,8 +309,8 @@ async function Phone() {
|
||||
SendNuiMessage(
|
||||
//Hides phone
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: false,
|
||||
})
|
||||
);
|
||||
@@ -352,7 +352,7 @@ on(`__cfx_nui:${events.OPEN_APP_CAMERA}`, () => {
|
||||
});
|
||||
|
||||
RegisterCommand(
|
||||
"phone",
|
||||
'phone',
|
||||
() => {
|
||||
//-- Toggles Phone
|
||||
Phone();
|
||||
@@ -360,17 +360,17 @@ RegisterCommand(
|
||||
false
|
||||
);
|
||||
|
||||
RegisterNuiCallbackType("phone:close");
|
||||
RegisterNuiCallbackType('phone:close');
|
||||
on(`__cfx_nui:phone:close`, () => {
|
||||
Phone();
|
||||
}); // Called for when the phone is closed via the UI.
|
||||
|
||||
AddEventHandler("onResourceStop", function (resource: string) {
|
||||
AddEventHandler('onResourceStop', function (resource: string) {
|
||||
if (resource === GetCurrentResourceName()) {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: false,
|
||||
})
|
||||
);
|
||||
@@ -386,11 +386,11 @@ AddEventHandler("onResourceStop", function (resource: string) {
|
||||
function countPhone(cb: any) {
|
||||
if (ESX === null) return cb(0);
|
||||
ESX.TriggerServerCallback(
|
||||
"phone:getItemAmount",
|
||||
'phone:getItemAmount',
|
||||
(qtty: number) => {
|
||||
cb(qtty > 0);
|
||||
},
|
||||
"phone"
|
||||
'phone'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -416,11 +416,11 @@ let destroyedPhone = false;
|
||||
// }
|
||||
// });
|
||||
|
||||
onNet("phone:sendCredentials", (number: string) => {
|
||||
onNet('phone:sendCredentials', (number: string) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "SIMCARD",
|
||||
method: "setNumber",
|
||||
app: 'SIMCARD',
|
||||
method: 'setNumber',
|
||||
data: number,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import events from "../utils/events";
|
||||
import { Message, MessageGroup } from "../../phone/src/common/typings/messages";
|
||||
import { sendMessageEvent } from "../utils/messages";
|
||||
import events from '../utils/events';
|
||||
import { Message, MessageGroup } from '../../phone/src/common/typings/messages';
|
||||
import { sendMessageEvent } from '../utils/messages';
|
||||
|
||||
/**
|
||||
* Messages get message groups
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import events from "../utils/events";
|
||||
import events from '../utils/events';
|
||||
|
||||
onNet(events.NOTE_SEND_NOTE, (notes: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "NOTES",
|
||||
method: "setNotes",
|
||||
app: 'NOTES',
|
||||
method: 'setNotes',
|
||||
data: notes,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import events from "../utils/events";
|
||||
import { Delay } from "../utils/fivem";
|
||||
const SCREENSHOT_BASIC_TOKEN = GetConvar("SCREENSHOT_BASIC_TOKEN", "none");
|
||||
import events from '../utils/events';
|
||||
import { Delay } from '../utils/fivem';
|
||||
const SCREENSHOT_BASIC_TOKEN = GetConvar('SCREENSHOT_BASIC_TOKEN', 'none');
|
||||
|
||||
const exp = (global as any).exports;
|
||||
|
||||
@@ -8,8 +8,8 @@ function closePhoneTemp() {
|
||||
SendNuiMessage(
|
||||
//Hides phone
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: false,
|
||||
})
|
||||
);
|
||||
@@ -19,8 +19,8 @@ function openPhoneTemp() {
|
||||
SendNuiMessage(
|
||||
//Opens phone
|
||||
JSON.stringify({
|
||||
app: "PHONE",
|
||||
method: "setVisibility",
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
data: true,
|
||||
})
|
||||
);
|
||||
@@ -29,7 +29,7 @@ function openPhoneTemp() {
|
||||
let takingPhoto = false;
|
||||
|
||||
function CellFrontCamActivate(activate: any) {
|
||||
return Citizen.invokeNative("0x2491A93618B7D838", activate);
|
||||
return Citizen.invokeNative('0x2491A93618B7D838', activate);
|
||||
}
|
||||
|
||||
RegisterNuiCallbackType(events.CAMERA_TAKE_PHOTO);
|
||||
@@ -57,7 +57,7 @@ on(`__cfx_nui:${events.CAMERA_TAKE_PHOTO}`, async () => {
|
||||
} else if (IsControlJustPressed(1, 176)) {
|
||||
takePhoto();
|
||||
await Delay(200);
|
||||
console.log("phone closing");
|
||||
console.log('phone closing');
|
||||
DestroyMobilePhone();
|
||||
CellCamActivate(false, false);
|
||||
|
||||
@@ -96,8 +96,8 @@ onNet(events.CAMERA_SEND_PHOTOS, (photos: string[]) => {
|
||||
console.log(photos);
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "CAMERA",
|
||||
method: "setPhotos",
|
||||
app: 'CAMERA',
|
||||
method: 'setPhotos',
|
||||
data: photos,
|
||||
})
|
||||
);
|
||||
@@ -106,18 +106,18 @@ onNet(events.CAMERA_SEND_PHOTOS, (photos: string[]) => {
|
||||
function takePhoto() {
|
||||
const [width, height] = GetActiveScreenResolution();
|
||||
// Return and log error if screenshot basic token not found
|
||||
if (SCREENSHOT_BASIC_TOKEN === "none") {
|
||||
if (SCREENSHOT_BASIC_TOKEN === 'none') {
|
||||
return console.error(
|
||||
"Screenshot basic token not found. Please set in server.cfg"
|
||||
'Screenshot basic token not found. Please set in server.cfg'
|
||||
);
|
||||
}
|
||||
exp["screenshot-basic"].requestScreenshotUpload(
|
||||
"https://api.imgur.com/3/image",
|
||||
"imgur",
|
||||
exp['screenshot-basic'].requestScreenshotUpload(
|
||||
'https://api.imgur.com/3/image',
|
||||
'imgur',
|
||||
{
|
||||
headers: {
|
||||
authorization: `Client-ID ${SCREENSHOT_BASIC_TOKEN}`,
|
||||
"content-type": "multipart/form-data",
|
||||
'content-type': 'multipart/form-data',
|
||||
},
|
||||
},
|
||||
(data: string) => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import events from "../utils/events";
|
||||
import events from '../utils/events';
|
||||
|
||||
onNet(events.SELLOUT_SEND_LISTING, (listing: any) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "SELLOUT",
|
||||
method: "setListings",
|
||||
app: 'SELLOUT',
|
||||
method: 'setListings',
|
||||
data: listing,
|
||||
})
|
||||
);
|
||||
@@ -17,6 +17,6 @@ on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: any) => {
|
||||
|
||||
setTimeout(() => {
|
||||
emitNet(events.SELLOUT_FETCH_LISTING);
|
||||
console.log("Fetched");
|
||||
console.log('Fetched');
|
||||
}, 500);
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import events from "../utils/events";
|
||||
import { sendTwitterMessage } from "../utils/messages";
|
||||
import events from '../utils/events';
|
||||
import { sendTwitterMessage } from '../utils/messages';
|
||||
|
||||
/**
|
||||
* Twitter get or create profile
|
||||
|
||||
+10
-10
@@ -1,18 +1,18 @@
|
||||
import { Client } from "esx.js";
|
||||
import { Client } from 'esx.js';
|
||||
|
||||
import "./cl_main";
|
||||
import "./cl_twitter";
|
||||
import "./cl_contacts";
|
||||
import "./cl_sellout";
|
||||
import "./cl_bank";
|
||||
import "./cl_notes";
|
||||
import "./cl_photo";
|
||||
import "./cl_messages";
|
||||
import './cl_main';
|
||||
import './cl_twitter';
|
||||
import './cl_contacts';
|
||||
import './cl_sellout';
|
||||
import './cl_bank';
|
||||
import './cl_notes';
|
||||
import './cl_photo';
|
||||
import './cl_messages';
|
||||
|
||||
export let ESX: Client = null;
|
||||
|
||||
setTick(() => {
|
||||
while (ESX === null) {
|
||||
emit("esx:getSharedObject", (obj: Client) => (ESX = obj));
|
||||
emit('esx:getSharedObject', (obj: Client) => (ESX = obj));
|
||||
}
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import mysql from "mysql2/promise";
|
||||
import { ConnectionStringParser } from "connection-string-parser";
|
||||
import mysql from 'mysql2/promise';
|
||||
import { ConnectionStringParser } from 'connection-string-parser';
|
||||
import {
|
||||
CONNECTION_STRING,
|
||||
DEFAULT_PORT,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
getServerHost,
|
||||
getUserId,
|
||||
getPassword,
|
||||
} from "./db_utils";
|
||||
} from './db_utils';
|
||||
|
||||
// we require set mysql_connection_string to be set in the config
|
||||
const mysqlConnectionString = GetConvar(CONNECTION_STRING, null);
|
||||
@@ -26,7 +26,7 @@ if (mysqlConnectionString === null) {
|
||||
* https://brouznouf.github.io/fivem-mysql-async/config/ and we need to handle both of them.
|
||||
*/
|
||||
export function generateConnectionPool() {
|
||||
if (mysqlConnectionString.includes("database=")) {
|
||||
if (mysqlConnectionString.includes('database=')) {
|
||||
// This is checking for this format:
|
||||
// set mysql_connection_string "server=127.0.0.1;database=es_extended;userid=user;password=pass"
|
||||
const config = parseSemiColonFormat(mysqlConnectionString);
|
||||
@@ -44,7 +44,7 @@ export function generateConnectionPool() {
|
||||
// This is checking for this format:
|
||||
// set mysql_connection_string "mysql://root:[email protected]/es_extended?charset=utf8mb4"
|
||||
const connectionStringParser = new ConnectionStringParser({
|
||||
scheme: "mysql",
|
||||
scheme: 'mysql',
|
||||
hosts: [],
|
||||
});
|
||||
const connectionOjbect = connectionStringParser.parse(
|
||||
@@ -75,7 +75,7 @@ export async function withTransaction(queries: Promise<any>[]): Promise<any[]> {
|
||||
await connection.release();
|
||||
return results;
|
||||
} catch (err) {
|
||||
console.warn("Error when submitting queries");
|
||||
console.warn('Error when submitting queries');
|
||||
await connection.rollback();
|
||||
await connection.release();
|
||||
return Promise.reject(err);
|
||||
|
||||
@@ -1,93 +1,93 @@
|
||||
import * as db from "./db_utils";
|
||||
import * as db from './db_utils';
|
||||
|
||||
const t = "test value";
|
||||
const t = 'test value';
|
||||
|
||||
describe("parseSemiColonFormat", () => {
|
||||
it("Raises a error with invalid string", () => {
|
||||
expect(() => db.parseSemiColonFormat("no_variables_here")).toThrowError();
|
||||
describe('parseSemiColonFormat', () => {
|
||||
it('Raises a error with invalid string', () => {
|
||||
expect(() => db.parseSemiColonFormat('no_variables_here')).toThrowError();
|
||||
});
|
||||
|
||||
it("Correctly parses configuration options", () => {
|
||||
const test = "server=127.0.0.1;database=es_extended;userid=user;";
|
||||
it('Correctly parses configuration options', () => {
|
||||
const test = 'server=127.0.0.1;database=es_extended;userid=user;';
|
||||
const result = db.parseSemiColonFormat(test);
|
||||
|
||||
expect(result.server).toEqual("127.0.0.1");
|
||||
expect(result.database).toEqual("es_extended");
|
||||
expect(result.userid).toEqual("user");
|
||||
expect(result.server).toEqual('127.0.0.1');
|
||||
expect(result.database).toEqual('es_extended');
|
||||
expect(result.userid).toEqual('user');
|
||||
expect(result.password).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getServerHost", () => {
|
||||
it("returns default", () => {
|
||||
describe('getServerHost', () => {
|
||||
it('returns default', () => {
|
||||
expect(db.getServerHost({})).toEqual(db.DEFAULT_HOST);
|
||||
});
|
||||
|
||||
it("Correctly returns host", () => {
|
||||
it('Correctly returns host', () => {
|
||||
expect(db.getServerHost({ host: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns server", () => {
|
||||
it('Correctly returns server', () => {
|
||||
expect(db.getServerHost({ server: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns data source", () => {
|
||||
expect(db.getServerHost({ "data source": t })).toEqual(t);
|
||||
it('Correctly returns data source', () => {
|
||||
expect(db.getServerHost({ 'data source': t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns datasource", () => {
|
||||
it('Correctly returns datasource', () => {
|
||||
expect(db.getServerHost({ datasource: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns addr", () => {
|
||||
it('Correctly returns addr', () => {
|
||||
expect(db.getServerHost({ addr: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns address", () => {
|
||||
it('Correctly returns address', () => {
|
||||
expect(db.getServerHost({ address: t })).toEqual(t);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getUserId", () => {
|
||||
it("returns default", () => {
|
||||
describe('getUserId', () => {
|
||||
it('returns default', () => {
|
||||
expect(db.getUserId({})).toEqual(db.DEFAULT_USER);
|
||||
});
|
||||
|
||||
it("Correctly returns user", () => {
|
||||
it('Correctly returns user', () => {
|
||||
expect(db.getUserId({ user: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns user id", () => {
|
||||
expect(db.getUserId({ "user id": t })).toEqual(t);
|
||||
it('Correctly returns user id', () => {
|
||||
expect(db.getUserId({ 'user id': t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns userid", () => {
|
||||
it('Correctly returns userid', () => {
|
||||
expect(db.getUserId({ userid: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns user name", () => {
|
||||
expect(db.getUserId({ "user name": t })).toEqual(t);
|
||||
it('Correctly returns user name', () => {
|
||||
expect(db.getUserId({ 'user name': t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns username", () => {
|
||||
it('Correctly returns username', () => {
|
||||
expect(db.getUserId({ username: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns uid", () => {
|
||||
it('Correctly returns uid', () => {
|
||||
expect(db.getUserId({ uid: t })).toEqual(t);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getPassword", () => {
|
||||
describe('getPassword', () => {
|
||||
// it("returns default", () => {
|
||||
// expect(() => db.getPassword({})).toThrowError();
|
||||
// });
|
||||
|
||||
it("Correctly returns password", () => {
|
||||
it('Correctly returns password', () => {
|
||||
expect(db.getPassword({ password: t })).toEqual(t);
|
||||
});
|
||||
|
||||
it("Correctly returns pwd", () => {
|
||||
it('Correctly returns pwd', () => {
|
||||
expect(db.getPassword({ pwd: t })).toEqual(t);
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
export const CONNECTION_STRING = "mysql_connection_string";
|
||||
export const CONNECTION_STRING = 'mysql_connection_string';
|
||||
export const DEFAULT_PORT = 3306;
|
||||
export const DEFAULT_HOST = "localhost";
|
||||
export const DEFAULT_USER = "root";
|
||||
export const DEFAULT_HOST = 'localhost';
|
||||
export const DEFAULT_USER = 'root';
|
||||
|
||||
interface Map {
|
||||
[key: string]: string;
|
||||
@@ -12,7 +12,7 @@ interface Map {
|
||||
* @param connectionString - mysql_connection_string value
|
||||
*/
|
||||
export function parseSemiColonFormat(connectionString: string): Map {
|
||||
const parts = connectionString.split(";");
|
||||
const parts = connectionString.split(';');
|
||||
if (parts.length === 1) {
|
||||
throw new Error(
|
||||
`Connection string ${connectionString} is in the incorrect format. Please follow the README.`
|
||||
@@ -20,7 +20,7 @@ export function parseSemiColonFormat(connectionString: string): Map {
|
||||
}
|
||||
|
||||
return parts.reduce((connectionInfo: Map, part) => {
|
||||
const [key, value] = part.split("=");
|
||||
const [key, value] = part.split('=');
|
||||
connectionInfo[key] = value;
|
||||
return connectionInfo;
|
||||
}, {});
|
||||
@@ -34,7 +34,7 @@ export function getServerHost(config: Map): string {
|
||||
return (
|
||||
config.host ||
|
||||
config.server ||
|
||||
config["data source"] ||
|
||||
config['data source'] ||
|
||||
config.datasource ||
|
||||
config.addr ||
|
||||
config.address ||
|
||||
@@ -49,9 +49,9 @@ export function getServerHost(config: Map): string {
|
||||
export function getUserId(config: Map): string {
|
||||
return (
|
||||
config.user ||
|
||||
config["user id"] ||
|
||||
config['user id'] ||
|
||||
config.userid ||
|
||||
config["user name"] ||
|
||||
config['user name'] ||
|
||||
config.username ||
|
||||
config.uid ||
|
||||
DEFAULT_USER
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import axios from "axios";
|
||||
import axios from 'axios';
|
||||
|
||||
import { Tweet, Profile } from "../../phone/src/common/typings/twitter";
|
||||
import { IMAGE_DELIMITER } from "../../phone/src/apps/twitter/utils/images";
|
||||
import { Tweet, Profile } from '../../phone/src/common/typings/twitter';
|
||||
import { IMAGE_DELIMITER } from '../../phone/src/apps/twitter/utils/images';
|
||||
|
||||
const DISCORD_TOKEN_ENV_VAR = "discord_bot_token";
|
||||
const DISCORD_TOKEN = GetConvar(DISCORD_TOKEN_ENV_VAR, "");
|
||||
const DISCORD_CHANNEL_ENV_VAR = "discord_channel_id";
|
||||
const DISCORD_CHANNEL_ID = GetConvar(DISCORD_CHANNEL_ENV_VAR, "");
|
||||
const DISCORD_TOKEN_ENV_VAR = 'discord_bot_token';
|
||||
const DISCORD_TOKEN = GetConvar(DISCORD_TOKEN_ENV_VAR, '');
|
||||
const DISCORD_CHANNEL_ENV_VAR = 'discord_channel_id';
|
||||
const DISCORD_CHANNEL_ID = GetConvar(DISCORD_CHANNEL_ENV_VAR, '');
|
||||
const DISCORD_HEADERS = { authorization: `Bot ${DISCORD_TOKEN}` };
|
||||
|
||||
const BASE_URL = "https://discord.com/api";
|
||||
const BASE_URL = 'https://discord.com/api';
|
||||
const POST_CHANNEL_URL = `${BASE_URL}/channels/${DISCORD_CHANNEL_ID}/messages`;
|
||||
|
||||
export async function reportTweetToDiscord(
|
||||
@@ -34,7 +34,7 @@ export async function reportTweetToDiscord(
|
||||
${tweet.message}
|
||||
|
||||
**Reported Images**:
|
||||
${tweet.images.split(IMAGE_DELIMITER).join("\n")}
|
||||
${tweet.images.split(IMAGE_DELIMITER).join('\n')}
|
||||
`;
|
||||
|
||||
return await axios.post(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { pool } from "./db";
|
||||
import { ESX } from "./server";
|
||||
import { pool } from './db';
|
||||
import { ESX } from './server';
|
||||
|
||||
interface IPhoneNumber {
|
||||
phone_number: string;
|
||||
@@ -10,7 +10,7 @@ interface Iidentifier {
|
||||
}
|
||||
|
||||
export async function usePhoneNumber(identifier: string): Promise<string> {
|
||||
const query = "SELECT phone_number FROM users WHERE identifier = ?";
|
||||
const query = 'SELECT phone_number FROM users WHERE identifier = ?';
|
||||
const [results] = await pool.query(query, [identifier]);
|
||||
const phoneNumber = <IPhoneNumber[]>results;
|
||||
return phoneNumber[0].phone_number;
|
||||
@@ -25,7 +25,7 @@ export async function useIdentifier(): Promise<string> {
|
||||
export async function getIdentifierByPhoneNumber(
|
||||
phoneNumber: string
|
||||
): Promise<string> {
|
||||
const query = "SELECT identifier FROM users WHERE phone_number = ?";
|
||||
const query = 'SELECT identifier FROM users WHERE phone_number = ?';
|
||||
const [results] = await pool.query(query, [phoneNumber]);
|
||||
const identifier = <Iidentifier[]>results;
|
||||
return identifier[0].identifier;
|
||||
|
||||
+11
-11
@@ -1,19 +1,19 @@
|
||||
import { Server } from "esx.js";
|
||||
import { Server } from 'esx.js';
|
||||
|
||||
import "./db";
|
||||
import "./sv_twitter";
|
||||
import "./sv_main";
|
||||
import "./sv_contacts";
|
||||
import "./sv_sellout";
|
||||
import "./sv_bank";
|
||||
import "./sv_notes";
|
||||
import "./sv_photo";
|
||||
import "./sv_messages";
|
||||
import './db';
|
||||
import './sv_twitter';
|
||||
import './sv_main';
|
||||
import './sv_contacts';
|
||||
import './sv_sellout';
|
||||
import './sv_bank';
|
||||
import './sv_notes';
|
||||
import './sv_photo';
|
||||
import './sv_messages';
|
||||
|
||||
export let ESX: Server = null;
|
||||
|
||||
export const getSource = () => (global as any).source;
|
||||
|
||||
emit("esx:getSharedObject", (obj: Server) => (ESX = obj));
|
||||
emit('esx:getSharedObject', (obj: Server) => (ESX = obj));
|
||||
|
||||
// i llke t-notify
|
||||
+17
-17
@@ -1,17 +1,17 @@
|
||||
import events from "../utils/events";
|
||||
import { ESX } from "./server";
|
||||
import { getSource } from "./functions";
|
||||
import { pool } from "./db";
|
||||
import events from '../utils/events';
|
||||
import { ESX } from './server';
|
||||
import { getSource } from './functions';
|
||||
import { pool } from './db';
|
||||
import {
|
||||
Transfer,
|
||||
IBankCredentials,
|
||||
} from "../../phone/src/common/typings/bank";
|
||||
import { useIdentifier } from "./functions";
|
||||
import { type } from "os";
|
||||
} from '../../phone/src/common/typings/bank';
|
||||
import { useIdentifier } from './functions';
|
||||
import { type } from 'os';
|
||||
|
||||
async function fetchAllTransactions(identifier: string): Promise<Transfer[]> {
|
||||
const query =
|
||||
"SELECT * FROM npwd_bank_transfers WHERE identifier = ? ORDER BY id DESC";
|
||||
'SELECT * FROM npwd_bank_transfers WHERE identifier = ? ORDER BY id DESC';
|
||||
const [results] = await pool.query(query, [identifier]);
|
||||
const transactions = <Transfer[]>results;
|
||||
|
||||
@@ -20,7 +20,7 @@ async function fetchAllTransactions(identifier: string): Promise<Transfer[]> {
|
||||
|
||||
function fetchCredentials(): IBankCredentials {
|
||||
const name = ESX.GetPlayerFromId(getSource()).getName();
|
||||
const balance = ESX.GetPlayerFromId(getSource()).getAccount("bank").money;
|
||||
const balance = ESX.GetPlayerFromId(getSource()).getAccount('bank').money;
|
||||
|
||||
const result = {
|
||||
name,
|
||||
@@ -35,7 +35,7 @@ async function addTransfer(
|
||||
transfer: Transfer
|
||||
): Promise<any> {
|
||||
const xPlayer = ESX.GetPlayerFromId(getSource());
|
||||
const bankBalance = xPlayer.getAccount("bank").money;
|
||||
const bankBalance = xPlayer.getAccount('bank').money;
|
||||
const sourceName = xPlayer.getName();
|
||||
|
||||
const xTarget = ESX.GetPlayerFromId(transfer.targetID);
|
||||
@@ -45,18 +45,18 @@ async function addTransfer(
|
||||
} else if (transfer.transferAmount < bankBalance) {
|
||||
emitNet(events.BANK_TRANSACTION_ALERT, getSource(), true);
|
||||
|
||||
xTarget.addAccountMoney("bank", transfer.transferAmount);
|
||||
xPlayer.removeAccountMoney("bank", transfer.transferAmount);
|
||||
xTarget.addAccountMoney('bank', transfer.transferAmount);
|
||||
xPlayer.removeAccountMoney('bank', transfer.transferAmount);
|
||||
|
||||
const query =
|
||||
"INSERT INTO npwd_bank_transfers (identifier, target, amount, message, type, source) VALUES (?, ?, ?, ?, ?, ?)";
|
||||
'INSERT INTO npwd_bank_transfers (identifier, target, amount, message, type, source) VALUES (?, ?, ?, ?, ?, ?)';
|
||||
|
||||
const [results] = await pool.query(query, [
|
||||
identifier,
|
||||
transfer.targetID,
|
||||
transfer.transferAmount,
|
||||
transfer.message,
|
||||
"Transfer",
|
||||
'Transfer',
|
||||
sourceName,
|
||||
]);
|
||||
const insertData = <any>results;
|
||||
@@ -69,7 +69,7 @@ async function addTransfer(
|
||||
* @param transferId - transfer id
|
||||
*/
|
||||
async function getTransfer(transferId: number): Promise<Transfer> {
|
||||
const query = "SELECT * FROM npwd_bank_transfers WHERE id = ?";
|
||||
const query = 'SELECT * FROM npwd_bank_transfers WHERE id = ?';
|
||||
const [results] = await pool.query(query, [transferId]);
|
||||
const transfers = <Transfer[]>results;
|
||||
const transfer = transfers[0];
|
||||
@@ -84,7 +84,7 @@ onNet(events.BANK_FETCH_TRANSACTIONS, async () => {
|
||||
|
||||
emitNet(events.BANK_SEND_TRANSFERS, _source, transfer);
|
||||
} catch (error) {
|
||||
console.log("Failed to fetch transactions");
|
||||
console.log('Failed to fetch transactions');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -105,6 +105,6 @@ onNet(events.BANK_GET_CREDENTIALS, () => {
|
||||
const credentials = fetchCredentials();
|
||||
emitNet(events.BANK_SEND_CREDENTIALS, getSource(), credentials);
|
||||
} catch (error) {
|
||||
console.log("Failed to fetch credentials");
|
||||
console.log('Failed to fetch credentials');
|
||||
}
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ESX } from "./server";
|
||||
import { pool } from "./db";
|
||||
import events from "../utils/events";
|
||||
import { useIdentifier, getSource } from "./functions";
|
||||
import { ESX } from './server';
|
||||
import { pool } from './db';
|
||||
import events from '../utils/events';
|
||||
import { useIdentifier, getSource } from './functions';
|
||||
|
||||
interface Contacts {
|
||||
id?: number;
|
||||
@@ -15,7 +15,7 @@ interface ContactId {
|
||||
}
|
||||
|
||||
async function fetchAllContacts(identifier: string): Promise<Contacts[]> {
|
||||
const query = "SELECT * FROM npwd_phone_contacts WHERE identifier = ?";
|
||||
const query = 'SELECT * FROM npwd_phone_contacts WHERE identifier = ?';
|
||||
const [results] = await pool.query(query, [identifier]);
|
||||
const contacts = <Contacts[]>results;
|
||||
return contacts;
|
||||
@@ -28,7 +28,7 @@ async function addContact(
|
||||
avatar: string
|
||||
): Promise<any> {
|
||||
const query =
|
||||
"INSERT INTO npwd_phone_contacts (identifier, number, display, avatar) VALUES (?, ?, ?, ?)";
|
||||
'INSERT INTO npwd_phone_contacts (identifier, number, display, avatar) VALUES (?, ?, ?, ?)';
|
||||
|
||||
const [result] = await pool.query(query, [
|
||||
identifier,
|
||||
@@ -43,7 +43,7 @@ async function updateContact(
|
||||
identifier: string
|
||||
): Promise<any> {
|
||||
const query =
|
||||
"UPDATE npwd_phone_contacts SET number = ?, display = ?, avatar = ? WHERE id = ? AND identifier = ?";
|
||||
'UPDATE npwd_phone_contacts SET number = ?, display = ?, avatar = ? WHERE id = ? AND identifier = ?';
|
||||
await pool.query(query, [
|
||||
contact.number,
|
||||
contact.display,
|
||||
@@ -58,7 +58,7 @@ async function deleteContact(
|
||||
identifier: string
|
||||
): Promise<any> {
|
||||
const query =
|
||||
"DELETE FROM npwd_phone_contacts WHERE id = ? AND identifier = ?";
|
||||
'DELETE FROM npwd_phone_contacts WHERE id = ? AND identifier = ?';
|
||||
await pool.query(query, [contact.id, identifier]);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ onNet(events.CONTACTS_GET_CONTACTS, async () => {
|
||||
const contacts = await fetchAllContacts(_identifier);
|
||||
emitNet(events.CONTACTS_SEND_CONTACTS, _source, contacts);
|
||||
} catch (error) {
|
||||
console.log("Failed to fetch contacts: ", error);
|
||||
console.log('Failed to fetch contacts: ', error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -86,10 +86,10 @@ onNet(
|
||||
emitNet(
|
||||
events.CONTACTS_ACTION_RESULT,
|
||||
getSource(),
|
||||
"CONTACT_ADD_SUCCESS"
|
||||
'CONTACT_ADD_SUCCESS'
|
||||
);
|
||||
} catch (error) {
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), "CONTACT_ADD_FAILED");
|
||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_ADD_FAILED');
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -103,13 +103,13 @@ onNet(events.CONTACTS_UPDATE_CONTACT, async (contact: Contacts) => {
|
||||
emitNet(
|
||||
events.CONTACTS_ACTION_RESULT,
|
||||
getSource(),
|
||||
"CONTACT_UPDATE_SUCCESS"
|
||||
'CONTACT_UPDATE_SUCCESS'
|
||||
);
|
||||
} catch (error) {
|
||||
emitNet(
|
||||
events.CONTACTS_ACTION_RESULT,
|
||||
getSource(),
|
||||
"CONTACT_UPDATE_FAILED"
|
||||
'CONTACT_UPDATE_FAILED'
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -122,13 +122,13 @@ onNet(events.CONTACTS_DELETE_CONTACT, async (contact: ContactId) => {
|
||||
emitNet(
|
||||
events.CONTACTS_ACTION_RESULT,
|
||||
getSource(),
|
||||
"CONTACT_DELETE_SUCCESS"
|
||||
'CONTACT_DELETE_SUCCESS'
|
||||
);
|
||||
} catch (error) {
|
||||
emitNet(
|
||||
events.CONTACTS_ACTION_RESULT,
|
||||
getSource(),
|
||||
"CONTACT_DELETE_FAILED"
|
||||
'CONTACT_DELETE_FAILED'
|
||||
);
|
||||
}
|
||||
});
|
||||
+12
-12
@@ -1,7 +1,7 @@
|
||||
import { ESX } from "./server";
|
||||
import { pool } from "./db";
|
||||
import config from "../utils/config";
|
||||
import { getIdentifierByPhoneNumber, usePhoneNumber } from "./functions";
|
||||
import { ESX } from './server';
|
||||
import { pool } from './db';
|
||||
import config from '../utils/config';
|
||||
import { getIdentifierByPhoneNumber, usePhoneNumber } from './functions';
|
||||
|
||||
//db = DatabaseConfig //helper variable for use in server function
|
||||
|
||||
@@ -25,7 +25,7 @@ function getRandomPhoneNumber() {
|
||||
} else {
|
||||
randomNumber = Math.floor(Math.random() * 10000000)
|
||||
.toString()
|
||||
.replace(/(\d{3})(\d{4})/, "$1-$2"); // ;
|
||||
.replace(/(\d{3})(\d{4})/, '$1-$2'); // ;
|
||||
// The numbers inside {} in replace() can be changed to how many digits you want on each side of the dash.
|
||||
// Example: 123-4567
|
||||
}
|
||||
@@ -41,7 +41,7 @@ async function generatePhoneNumber(identifier: string) {
|
||||
do {
|
||||
if (!phoneNumber) {
|
||||
phoneNumber = await getRandomPhoneNumber();
|
||||
const query = "UPDATE users SET phone_number = ? WHERE identifier = ?";
|
||||
const query = 'UPDATE users SET phone_number = ? WHERE identifier = ?';
|
||||
await pool.query(query, [phoneNumber, _identifier]);
|
||||
} else {
|
||||
break;
|
||||
@@ -50,26 +50,26 @@ async function generatePhoneNumber(identifier: string) {
|
||||
}
|
||||
|
||||
async function getCredentials(identifier: string): Promise<string> {
|
||||
const query = "SELECT phone_number FROM users WHERE identifier = ?";
|
||||
const query = 'SELECT phone_number FROM users WHERE identifier = ?';
|
||||
const [result] = await pool.query(query, [identifier]);
|
||||
const number = <Credentials[]>result;
|
||||
if (number.length === 0) return "###-####";
|
||||
if (number.length === 0) return '###-####';
|
||||
return number[0].phone_number;
|
||||
}
|
||||
|
||||
onNet("esx:playerLoaded", async (playerId: number, xPlayer: any) => {
|
||||
onNet('esx:playerLoaded', async (playerId: number, xPlayer: any) => {
|
||||
const identifier = xPlayer.identifier;
|
||||
await generatePhoneNumber(identifier);
|
||||
});
|
||||
|
||||
onNet("phone:getCredentials", async () => {
|
||||
onNet('phone:getCredentials', async () => {
|
||||
try {
|
||||
const _source = (global as any).source;
|
||||
const xPlayer = ESX.GetPlayerFromId(_source);
|
||||
const _identifier = xPlayer.getIdentifier();
|
||||
const number = await getCredentials(_identifier);
|
||||
emitNet("phone:sendCredentials", _source, number);
|
||||
emitNet('phone:sendCredentials', _source, number);
|
||||
} catch (error) {
|
||||
console.log("Failed to get number. ", error);
|
||||
console.log('Failed to get number. ', error);
|
||||
}
|
||||
});
|
||||
@@ -1,13 +1,13 @@
|
||||
import md5 from "md5";
|
||||
import md5 from 'md5';
|
||||
|
||||
import events from "../utils/events";
|
||||
import events from '../utils/events';
|
||||
import {
|
||||
Message,
|
||||
MessageGroup,
|
||||
CreateMessageGroupResult,
|
||||
} from "../../phone/src/common/typings/messages";
|
||||
import { pool, withTransaction } from "./db";
|
||||
import { getSource, useIdentifier } from "./functions";
|
||||
} from '../../phone/src/common/typings/messages';
|
||||
import { pool, withTransaction } from './db';
|
||||
import { getSource, useIdentifier } from './functions';
|
||||
|
||||
/**
|
||||
* Used for the raw npwd_messages_groups row responses
|
||||
@@ -188,7 +188,7 @@ async function getIdentifierFromPhoneNumber(
|
||||
`;
|
||||
const [results] = await pool.query(query, [phoneNumber]);
|
||||
const identifiers = <any>results;
|
||||
return identifiers[0]["identifier"];
|
||||
return identifiers[0]['identifier'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,7 +235,7 @@ async function getConsolidatedMessageGroups(
|
||||
(mapping: MessageGroupMapping, messageGroup: UnformattedMessageGroup) => {
|
||||
const groupId = messageGroup.group_id;
|
||||
const displayTerm =
|
||||
messageGroup.display || messageGroup.phone_number || "???";
|
||||
messageGroup.display || messageGroup.phone_number || '???';
|
||||
|
||||
if (groupId in mapping) {
|
||||
mapping[groupId].participants = mapping[groupId].participants.concat(
|
||||
@@ -288,7 +288,7 @@ async function getFormattedMessageGroups(
|
||||
return {
|
||||
...group,
|
||||
groupId,
|
||||
groupDisplay: group.participants.join(", "),
|
||||
groupDisplay: group.participants.join(', '),
|
||||
// note that 1 here references how many participants besides the user
|
||||
isGroupChat: group.participants.length > 1,
|
||||
};
|
||||
@@ -336,7 +336,7 @@ async function createMessageGroupsFromPhoneNumbers(
|
||||
// that this not change! Changing this order can result in the ability
|
||||
// of duplicate message groups being created.
|
||||
identifiers.sort();
|
||||
const mergedIdentifiers = identifiers.join("-");
|
||||
const mergedIdentifiers = identifiers.join('-');
|
||||
// we don't need this to be secure. Its purpose is to create a unique
|
||||
// string derived from the identifiers. In this way we can check
|
||||
// that this groupId isn't used before. If it has then it means
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import events from "../utils/events";
|
||||
import { pool } from "./db";
|
||||
import { useIdentifier, getSource } from "./functions";
|
||||
import { Note, NoteId } from "../../phone/src/common/typings/notes";
|
||||
import events from '../utils/events';
|
||||
import { pool } from './db';
|
||||
import { useIdentifier, getSource } from './functions';
|
||||
import { Note, NoteId } from '../../phone/src/common/typings/notes';
|
||||
|
||||
async function addNote(identifier: string, note: Note): Promise<any> {
|
||||
const query =
|
||||
"INSERT INTO npwd_notes (identifier, title, content) VALUES (?, ?, ?)";
|
||||
'INSERT INTO npwd_notes (identifier, title, content) VALUES (?, ?, ?)';
|
||||
await pool.query(query, [identifier, note.title, note.content]);
|
||||
}
|
||||
|
||||
async function fetchAllNotes(identifier: string): Promise<Note[]> {
|
||||
const query =
|
||||
"SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC";
|
||||
'SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC';
|
||||
const [result] = await pool.query(query, [identifier]);
|
||||
const notes = <Note[]>result;
|
||||
return notes;
|
||||
}
|
||||
|
||||
async function deleteNote(noteId: number, identifier: string) {
|
||||
const query = "DELETE FROM npwd_notes WHERE id = ? AND identifier = ?";
|
||||
const query = 'DELETE FROM npwd_notes WHERE id = ? AND identifier = ?';
|
||||
await pool.query(query, [noteId, identifier]);
|
||||
}
|
||||
|
||||
async function updateNote(note: Note, identifier: string): Promise<any> {
|
||||
const query =
|
||||
"UPDATE npwd_notes SET title = ?, content = ? WHERE id = ? AND identifier = ?";
|
||||
'UPDATE npwd_notes SET title = ?, content = ? WHERE id = ? AND identifier = ?';
|
||||
await pool.query(query, [note.title, note.content, note.id, identifier]);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
||||
addNote(_identifier, note);
|
||||
emitNet(events.NOTE_SEND_NOTE_SUCCESS, getSource());
|
||||
} catch (error) {
|
||||
console.log("NOTES ERROR: ", error);
|
||||
console.log('NOTES ERROR: ', error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ onNet(events.NOTE_FETCH_ALL_NOTES, async () => {
|
||||
const notes = await fetchAllNotes(_identifier);
|
||||
emitNet(events.NOTE_SEND_NOTE, _source, notes);
|
||||
} catch (error) {
|
||||
console.log("NOTE ERROR: ", error);
|
||||
console.log('NOTE ERROR: ', error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ onNet(events.NOTE_DELETE_NOTE, async (noteId: NoteId) => {
|
||||
const id = noteId.id;
|
||||
await deleteNote(id, _identifier);
|
||||
} catch (error) {
|
||||
console.log("NOTE ERROR:", error);
|
||||
console.log('NOTE ERROR:', error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import events from "../utils/events";
|
||||
import { ESX, getSource } from "./server";
|
||||
import { pool } from "./db";
|
||||
import { useIdentifier } from "./functions";
|
||||
import { IPhoto } from "../../phone/src/common/typings/photo";
|
||||
import events from '../utils/events';
|
||||
import { ESX, getSource } from './server';
|
||||
import { pool } from './db';
|
||||
import { useIdentifier } from './functions';
|
||||
import { IPhoto } from '../../phone/src/common/typings/photo';
|
||||
|
||||
async function uploadPhoto(identifier: string, image: string) {
|
||||
const query =
|
||||
"INSERT INTO npwd_phone_gallery (identifier, image) VALUES (?, ?)";
|
||||
'INSERT INTO npwd_phone_gallery (identifier, image) VALUES (?, ?)';
|
||||
await pool.query(query, [identifier, image]);
|
||||
}
|
||||
|
||||
async function getPhotosByIdentifier(identifier: string): Promise<IPhoto[]> {
|
||||
const query =
|
||||
"SELECT id, image FROM npwd_phone_gallery WHERE identifier = ? ORDER BY id DESC";
|
||||
'SELECT id, image FROM npwd_phone_gallery WHERE identifier = ? ORDER BY id DESC';
|
||||
const [results] = await pool.query(query, [identifier]);
|
||||
const photos = <IPhoto[]>results;
|
||||
return photos;
|
||||
@@ -20,7 +20,7 @@ async function getPhotosByIdentifier(identifier: string): Promise<IPhoto[]> {
|
||||
|
||||
async function deletePhoto(photo: IPhoto, identifier: string) {
|
||||
const query =
|
||||
"DELETE FROM npwd_phone_gallery WHERE id = ? AND identifier = ?";
|
||||
'DELETE FROM npwd_phone_gallery WHERE id = ? AND identifier = ?';
|
||||
await pool.query(query, [photo.id, identifier]);
|
||||
console.log(photo.id);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import events from "../utils/events";
|
||||
import { ESX } from "./server";
|
||||
import { getSource } from "./functions";
|
||||
import { pool } from "./db";
|
||||
import { usePhoneNumber } from "./functions";
|
||||
import events from '../utils/events';
|
||||
import { ESX } from './server';
|
||||
import { getSource } from './functions';
|
||||
import { pool } from './db';
|
||||
import { usePhoneNumber } from './functions';
|
||||
|
||||
interface Listing {
|
||||
title: string;
|
||||
@@ -12,7 +12,7 @@ interface Listing {
|
||||
}
|
||||
|
||||
async function fetchAllListings(): Promise<Listing[]> {
|
||||
const query = "SELECT * FROM npwd_sellout_listings ORDER BY id DESC";
|
||||
const query = 'SELECT * FROM npwd_sellout_listings ORDER BY id DESC';
|
||||
|
||||
const [results] = await pool.query(query);
|
||||
const listings = <Listing[]>results;
|
||||
@@ -27,7 +27,7 @@ async function addListing(
|
||||
listing: Listing
|
||||
): Promise<any> {
|
||||
const query =
|
||||
"INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)";
|
||||
'INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)';
|
||||
await pool.query(query, [
|
||||
identifier,
|
||||
name,
|
||||
@@ -57,6 +57,6 @@ onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
|
||||
const phoneNumber = await usePhoneNumber(_identifier);
|
||||
addListing(_identifier, name, phoneNumber, listing);
|
||||
} catch (error) {
|
||||
console.log("Failed to add contact: ", error);
|
||||
console.log('Failed to add contact: ', error);
|
||||
}
|
||||
});
|
||||
@@ -1,10 +1,10 @@
|
||||
import { pool } from "./db";
|
||||
import { ESX } from "./server";
|
||||
import { getSource } from "./functions";
|
||||
import { Tweet, Profile } from "../../phone/src/common/typings/twitter";
|
||||
import events from "../utils/events";
|
||||
import config from "../utils/config";
|
||||
import { reportTweetToDiscord } from "./discord";
|
||||
import { pool } from './db';
|
||||
import { ESX } from './server';
|
||||
import { getSource } from './functions';
|
||||
import { Tweet, Profile } from '../../phone/src/common/typings/twitter';
|
||||
import events from '../utils/events';
|
||||
import config from '../utils/config';
|
||||
import { reportTweetToDiscord } from './discord';
|
||||
|
||||
interface ProfileName {
|
||||
profile_name: string;
|
||||
@@ -153,7 +153,7 @@ async function getProfile(identifier: string): Promise<Profile | null> {
|
||||
* @param identifier - player's identifier
|
||||
*/
|
||||
async function generateProfileName(identifier: string): Promise<string> {
|
||||
const defaultProfileName = "";
|
||||
const defaultProfileName = '';
|
||||
if (!config.twitter.generateProfileNameFromUsers) return defaultProfileName;
|
||||
|
||||
const query = `
|
||||
@@ -378,7 +378,7 @@ onNet(events.TWITTER_REPORT, async (tweetId: number) => {
|
||||
|
||||
const reportExists = await doesReportExist(tweet.id, profile.id);
|
||||
if (reportExists) {
|
||||
console.warn("This profile has already reported this tweet");
|
||||
console.warn('This profile has already reported this tweet');
|
||||
} else {
|
||||
await createTweetReport(tweet.id, profile.id);
|
||||
await reportTweetToDiscord(tweet, profile);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default {
|
||||
TWITTER: "TWITTER",
|
||||
MESSAGES: "MESSAGES",
|
||||
TWITTER: 'TWITTER',
|
||||
MESSAGES: 'MESSAGES',
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import config from "../../config.json";
|
||||
import { ServerConfig } from "../../phone/src/common/typings/config";
|
||||
import config from '../../config.json';
|
||||
import { ServerConfig } from '../../phone/src/common/typings/config';
|
||||
|
||||
export default <ServerConfig>config;
|
||||
+79
-79
@@ -1,97 +1,97 @@
|
||||
export default {
|
||||
// Twitter
|
||||
TWITTER_FETCH_TWEETS: "phone:fetchTweets",
|
||||
TWITTER_FETCH_TWEETS_SUCCESS: "fetchTweets",
|
||||
TWITTER_FETCH_TWEETS_FAILURE: "fetchTweetsFailed",
|
||||
TWITTER_FETCH_TWEETS_FILTERED: "phone:fetchTweetsFiltered",
|
||||
TWITTER_FETCH_TWEETS_FILTERED_SUCCESS: "fetchTweetsFiltered",
|
||||
TWITTER_FETCH_TWEETS_FILTERED_FAILURE: "fetchTweetsFilteredFailed",
|
||||
TWITTER_GET_OR_CREATE_PROFILE: "phone:getOrCreateTwitterProfile",
|
||||
TWITTER_GET_OR_CREATE_PROFILE_SUCCESS: "getOrCreateTwitterProfile",
|
||||
TWITTER_GET_OR_CREATE_PROFILE_FAILURE: "getOrCreateTwitterProfileFailed",
|
||||
TWITTER_UPDATE_PROFILE: "phone:updateTwitterProfile",
|
||||
TWITTER_UPDATE_PROFILE_LOADING: "updateProfileLoading",
|
||||
TWITTER_UPDATE_PROFILE_RESULT: "updateProfileResult",
|
||||
TWITTER_CREATE_TWEET: "phone:createTweet",
|
||||
TWITTER_CREATE_TWEET_LOADING: "createTweetLoading",
|
||||
TWITTER_CREATE_TWEET_RESULT: "createTweetResult",
|
||||
TWITTER_CREATE_TWEET_BROADCAST: "createTweetBroadcast",
|
||||
TWITTER_CREATE_TWEET_FAILURE: "createTweetResultFailed",
|
||||
TWITTER_DELETE_TWEET: "phone:deleteTweet",
|
||||
TWITTER_DELETE_TWEET_SUCCESS: "deleteTweetSuccess",
|
||||
TWITTER_DELETE_TWEET_FAILURE: "deleteTweetFailed",
|
||||
TWITTER_TOGGLE_LIKE: "phone:toggleLike",
|
||||
TWITTER_TOGGLE_LIKE_SUCCESS: "toggleLikeSuccess",
|
||||
TWITTER_TOGGLE_LIKE_FAILURE: "toggleLikeFailed",
|
||||
TWITTER_REPORT: "phone:reportTweet",
|
||||
TWITTER_REPORT_SUCCESS: "reportTweetSuccess",
|
||||
TWITTER_REPORT_FAILURE: "reportTweetFailed",
|
||||
TWITTER_FETCH_TWEETS: 'phone:fetchTweets',
|
||||
TWITTER_FETCH_TWEETS_SUCCESS: 'fetchTweets',
|
||||
TWITTER_FETCH_TWEETS_FAILURE: 'fetchTweetsFailed',
|
||||
TWITTER_FETCH_TWEETS_FILTERED: 'phone:fetchTweetsFiltered',
|
||||
TWITTER_FETCH_TWEETS_FILTERED_SUCCESS: 'fetchTweetsFiltered',
|
||||
TWITTER_FETCH_TWEETS_FILTERED_FAILURE: 'fetchTweetsFilteredFailed',
|
||||
TWITTER_GET_OR_CREATE_PROFILE: 'phone:getOrCreateTwitterProfile',
|
||||
TWITTER_GET_OR_CREATE_PROFILE_SUCCESS: 'getOrCreateTwitterProfile',
|
||||
TWITTER_GET_OR_CREATE_PROFILE_FAILURE: 'getOrCreateTwitterProfileFailed',
|
||||
TWITTER_UPDATE_PROFILE: 'phone:updateTwitterProfile',
|
||||
TWITTER_UPDATE_PROFILE_LOADING: 'updateProfileLoading',
|
||||
TWITTER_UPDATE_PROFILE_RESULT: 'updateProfileResult',
|
||||
TWITTER_CREATE_TWEET: 'phone:createTweet',
|
||||
TWITTER_CREATE_TWEET_LOADING: 'createTweetLoading',
|
||||
TWITTER_CREATE_TWEET_RESULT: 'createTweetResult',
|
||||
TWITTER_CREATE_TWEET_BROADCAST: 'createTweetBroadcast',
|
||||
TWITTER_CREATE_TWEET_FAILURE: 'createTweetResultFailed',
|
||||
TWITTER_DELETE_TWEET: 'phone:deleteTweet',
|
||||
TWITTER_DELETE_TWEET_SUCCESS: 'deleteTweetSuccess',
|
||||
TWITTER_DELETE_TWEET_FAILURE: 'deleteTweetFailed',
|
||||
TWITTER_TOGGLE_LIKE: 'phone:toggleLike',
|
||||
TWITTER_TOGGLE_LIKE_SUCCESS: 'toggleLikeSuccess',
|
||||
TWITTER_TOGGLE_LIKE_FAILURE: 'toggleLikeFailed',
|
||||
TWITTER_REPORT: 'phone:reportTweet',
|
||||
TWITTER_REPORT_SUCCESS: 'reportTweetSuccess',
|
||||
TWITTER_REPORT_FAILURE: 'reportTweetFailed',
|
||||
|
||||
// Contacts
|
||||
CONTACTS_SEND_CONTACTS: "phone:sendContacts",
|
||||
CONTACTS_GET_CONTACTS: "phone:getContacts",
|
||||
CONTACTS_ADD_CONTACT_NUI: "contacts:add",
|
||||
CONTACTS_ADD_CONTACT: "contacts:add",
|
||||
CONTACTS_ADD_CONTACT_SUCCESS: "contacts:addSuccess",
|
||||
CONTACTS_UPDATE_CONTACT: "phone:updateContact",
|
||||
CONTACTS_DELETE_CONTACT: "phone:deleteContact",
|
||||
CONTACTS_DELETE_CONTACT_SUCCESS: "contacts:deleteSuccess",
|
||||
CONTACTS_UPDATE_CONTACT_SUCCESS: "phone:updateContactSuccess",
|
||||
CONTACTS_SEND_CONTACTS: 'phone:sendContacts',
|
||||
CONTACTS_GET_CONTACTS: 'phone:getContacts',
|
||||
CONTACTS_ADD_CONTACT_NUI: 'contacts:add',
|
||||
CONTACTS_ADD_CONTACT: 'contacts:add',
|
||||
CONTACTS_ADD_CONTACT_SUCCESS: 'contacts:addSuccess',
|
||||
CONTACTS_UPDATE_CONTACT: 'phone:updateContact',
|
||||
CONTACTS_DELETE_CONTACT: 'phone:deleteContact',
|
||||
CONTACTS_DELETE_CONTACT_SUCCESS: 'contacts:deleteSuccess',
|
||||
CONTACTS_UPDATE_CONTACT_SUCCESS: 'phone:updateContactSuccess',
|
||||
|
||||
// Sellout
|
||||
SELLOUT_ADD_LISTING: "phone:addListing",
|
||||
SELLOUT_FETCH_LISTING: "phone:fetchAllListings",
|
||||
SELLOUT_SEND_LISTING: "phone:sendAllListings",
|
||||
SELLOUT_ADD_LISTING: 'phone:addListing',
|
||||
SELLOUT_FETCH_LISTING: 'phone:fetchAllListings',
|
||||
SELLOUT_SEND_LISTING: 'phone:sendAllListings',
|
||||
|
||||
//
|
||||
BANK_ADD_TRANSFER: "phone:addTransfer",
|
||||
BANK_ADD_TRANSFER_SUCCESS: "phone:addTransferSuccess",
|
||||
BANK_FETCH_TRANSACTIONS: "phone:fetchAllTransactions",
|
||||
BANK_SEND_TRANSFERS: "phone:sendTransfers",
|
||||
BANK_TRANSACTION_ALERT: "phone:bankTransactionAlert",
|
||||
BANK_TRANSACTION_NOTIFICATION: "phone:bankTransactionNotification",
|
||||
BANK_SEND_CREDENTIALS: "phone:sendBankCredentials",
|
||||
BANK_GET_CREDENTIALS: "phone:getBankCredentials",
|
||||
BANK_ADD_TRANSFER: 'phone:addTransfer',
|
||||
BANK_ADD_TRANSFER_SUCCESS: 'phone:addTransferSuccess',
|
||||
BANK_FETCH_TRANSACTIONS: 'phone:fetchAllTransactions',
|
||||
BANK_SEND_TRANSFERS: 'phone:sendTransfers',
|
||||
BANK_TRANSACTION_ALERT: 'phone:bankTransactionAlert',
|
||||
BANK_TRANSACTION_NOTIFICATION: 'phone:bankTransactionNotification',
|
||||
BANK_SEND_CREDENTIALS: 'phone:sendBankCredentials',
|
||||
BANK_GET_CREDENTIALS: 'phone:getBankCredentials',
|
||||
|
||||
//messages
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS: "phone:fetchMessageGroups",
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS: "phone:fetchMessageGroupsSuccess",
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS_FAILED: "phone:fetchMessageGroupsFailed",
|
||||
MESSAGES_CREATE_MESSAGE_GROUP: "phone:createMessageGroup",
|
||||
MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS: "phone:createMessageGroupSuccess",
|
||||
MESSAGES_CREATE_MESSAGE_GROUP_FAILED: "phone:createMessageGroupFailed",
|
||||
MESSAGES_SEND_MESSAGE: "phone:sendMessage",
|
||||
MESSAGES_SEND_MESSAGE_SUCCESS: "phone:sendMessageSuccess",
|
||||
MESSAGES_SEND_MESSAGE_FAILED: "phone:sendMessageFailed",
|
||||
MESSAGES_FETCH_MESSAGES: "phone:fetchMessages",
|
||||
MESSAGES_FETCH_MESSAGES_SUCCESS: "phone:fetchMessagesSuccess",
|
||||
MESSAGES_FETCH_MESSAGES_FAILED: "phone:fetchMessagesFailed",
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS: 'phone:fetchMessageGroups',
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS: 'phone:fetchMessageGroupsSuccess',
|
||||
MESSAGES_FETCH_MESSAGE_GROUPS_FAILED: 'phone:fetchMessageGroupsFailed',
|
||||
MESSAGES_CREATE_MESSAGE_GROUP: 'phone:createMessageGroup',
|
||||
MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS: 'phone:createMessageGroupSuccess',
|
||||
MESSAGES_CREATE_MESSAGE_GROUP_FAILED: 'phone:createMessageGroupFailed',
|
||||
MESSAGES_SEND_MESSAGE: 'phone:sendMessage',
|
||||
MESSAGES_SEND_MESSAGE_SUCCESS: 'phone:sendMessageSuccess',
|
||||
MESSAGES_SEND_MESSAGE_FAILED: 'phone:sendMessageFailed',
|
||||
MESSAGES_FETCH_MESSAGES: 'phone:fetchMessages',
|
||||
MESSAGES_FETCH_MESSAGES_SUCCESS: 'phone:fetchMessagesSuccess',
|
||||
MESSAGES_FETCH_MESSAGES_FAILED: 'phone:fetchMessagesFailed',
|
||||
|
||||
// Notes
|
||||
NOTE_ADD_NOTE: "phone:addNote",
|
||||
NOTE_FETCH_ALL_NOTES: "phone:fetchAllNotes",
|
||||
NOTE_SEND_NOTE: "phone:sendNote",
|
||||
NOTE_SEND_NOTE_SUCCESS: "phone:sendNoteSuccess",
|
||||
NOTE_DELETE_NOTE: "phone:deleteNote",
|
||||
NOTE_UPDATE_NOTE: "phone:updateNote",
|
||||
NOTE_UPDATE_NOTE_SUCCESS: "phone:updateNoteSuccess",
|
||||
NOTE_UPDATE_NOTE_FAILURE: "phone:updateNoteFailure",
|
||||
NOTE_ADD_NOTE: 'phone:addNote',
|
||||
NOTE_FETCH_ALL_NOTES: 'phone:fetchAllNotes',
|
||||
NOTE_SEND_NOTE: 'phone:sendNote',
|
||||
NOTE_SEND_NOTE_SUCCESS: 'phone:sendNoteSuccess',
|
||||
NOTE_DELETE_NOTE: 'phone:deleteNote',
|
||||
NOTE_UPDATE_NOTE: 'phone:updateNote',
|
||||
NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess',
|
||||
NOTE_UPDATE_NOTE_FAILURE: 'phone:updateNoteFailure',
|
||||
|
||||
// DO NOT CHANGE WHATS BELOW, PLEASE - CHIP
|
||||
OPEN_APP_CONTACTS: "phone:app:CONTACTS",
|
||||
OPEN_APP_BANK: "phone:app:BANK",
|
||||
OPEN_APP_NOTES: "phone:app:NOTES",
|
||||
OPEN_APP_LISTINGS: "phone:app:SELLOUT",
|
||||
OPEN_APP_CAMERA: "phone:app:CAMERA",
|
||||
OPEN_APP_CONTACTS: 'phone:app:CONTACTS',
|
||||
OPEN_APP_BANK: 'phone:app:BANK',
|
||||
OPEN_APP_NOTES: 'phone:app:NOTES',
|
||||
OPEN_APP_LISTINGS: 'phone:app:SELLOUT',
|
||||
OPEN_APP_CAMERA: 'phone:app:CAMERA',
|
||||
|
||||
// camera
|
||||
CAMERA_TAKE_PHOTO: "phone:TakePhoto",
|
||||
CAMERA_UPLOAD_PHOTO: "phone:UploadPhoto",
|
||||
CAMERA_FETCH_PHOTOS: "phone:FetchPhotos",
|
||||
CAMERA_SEND_PHOTOS: "phone:SendPhotos",
|
||||
CAMERA_DELETE_PHOTO: "photo:deletePhoto",
|
||||
CAMERA_DELETE_PHOTO_SUCCESS: "phone:deletePhotoSuccess",
|
||||
CONTACTS_ACTION_RESULT: "phone:contactActionResult",
|
||||
CAMERA_TAKE_PHOTO: 'phone:TakePhoto',
|
||||
CAMERA_UPLOAD_PHOTO: 'phone:UploadPhoto',
|
||||
CAMERA_FETCH_PHOTOS: 'phone:FetchPhotos',
|
||||
CAMERA_SEND_PHOTOS: 'phone:SendPhotos',
|
||||
CAMERA_DELETE_PHOTO: 'photo:deletePhoto',
|
||||
CAMERA_DELETE_PHOTO_SUCCESS: 'phone:deletePhotoSuccess',
|
||||
CONTACTS_ACTION_RESULT: 'phone:contactActionResult',
|
||||
// copy
|
||||
PHONE_USE_CLIPBOARD: "phone:useClipboard",
|
||||
PHONE_USE_CLIPBOARD: 'phone:useClipboard',
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import apps from "./apps";
|
||||
import apps from './apps';
|
||||
|
||||
function sendMessage(app: string, method: string, data: any) {
|
||||
return SendNuiMessage(
|
||||
|
||||
Reference in new issue
Block a user