Fix: prettier config in resources\ not being standard.

This commit is contained in:
Taso committed 2021-01-13 20:36:03 -05:00
1 parent d56112a0cb
commit ec1451a9aa
28 files changed
+349 -349

No files matched your search

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