mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Merge branch 'master' into feature/camera-gallery
This commit is contained in:
4 files changed
+56
No files matched your search
@@ -11,6 +11,9 @@
|
|||||||
"horizontal": "right",
|
"horizontal": "right",
|
||||||
"vertical": "top"
|
"vertical": "top"
|
||||||
},
|
},
|
||||||
|
"general": {
|
||||||
|
"useDashNumber": false
|
||||||
|
},
|
||||||
"twitter": {
|
"twitter": {
|
||||||
"showNotifications": true,
|
"showNotifications": true,
|
||||||
"generateProfileNameFromUsers": true,
|
"generateProfileNameFromUsers": true,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { useSelloutService } from "./apps/sellout/hooks/useSelloutService";
|
|||||||
import { useBankService } from './apps/bank/hooks/useBankService';
|
import { useBankService } from './apps/bank/hooks/useBankService';
|
||||||
import { useNotesService } from "./apps/notes/hooks/useNotesService";
|
import { useNotesService } from "./apps/notes/hooks/useNotesService";
|
||||||
import { usePhotoService } from "./apps/camera/hooks/usePhotoService";
|
import { usePhotoService } from "./apps/camera/hooks/usePhotoService";
|
||||||
|
import Nui from "./os/nui-events/utils/Nui";
|
||||||
|
|
||||||
//These events are just for testing. Comment it out before building.
|
//These events are just for testing. Comment it out before building.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -234,6 +235,12 @@ function Phone() {
|
|||||||
|
|
||||||
const calling = false;
|
const calling = false;
|
||||||
|
|
||||||
|
document.onkeyup = function(data) {
|
||||||
|
if (data.which == 27) {
|
||||||
|
Nui.send("phone:close");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={currentTheme()}>
|
<ThemeProvider theme={currentTheme()}>
|
||||||
<div className="PhoneWrapper">
|
<div className="PhoneWrapper">
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ interface TwitterConfig {
|
|||||||
maxImages: number;
|
maxImages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface General {
|
||||||
|
useDashNumber: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
interface NotificationConfig {
|
interface NotificationConfig {
|
||||||
horizontal: "left" | "center" | "right";
|
horizontal: "left" | "center" | "right";
|
||||||
vertical: "bottom" | "top";
|
vertical: "bottom" | "top";
|
||||||
@@ -32,4 +36,5 @@ export interface ServerConfig {
|
|||||||
twitter: TwitterConfig;
|
twitter: TwitterConfig;
|
||||||
bank: BankConfig;
|
bank: BankConfig;
|
||||||
notificationPosition: NotificationConfig;
|
notificationPosition: NotificationConfig;
|
||||||
|
general: General;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { ESX } from "./server";
|
import { ESX } from "./server";
|
||||||
import { pool } from "./db";
|
import { pool } from "./db";
|
||||||
|
import config from "../utils/config";
|
||||||
|
import { getIdentifierByPhoneNumber, usePhoneNumber } from "./functions";
|
||||||
|
|
||||||
//db = DatabaseConfig //helper variable for use in server function
|
//db = DatabaseConfig //helper variable for use in server function
|
||||||
|
|
||||||
@@ -13,6 +15,40 @@ interface Credentials {
|
|||||||
phone_number: string;
|
phone_number: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Generate phone number
|
||||||
|
|
||||||
|
function getRandomPhoneNumber() {
|
||||||
|
let randomNumber: string = null;
|
||||||
|
|
||||||
|
if (!config.general.useDashNumber) {
|
||||||
|
randomNumber = Math.floor(Math.random() * 10000000).toString(); // 10000000 creates a number with 7 characters.
|
||||||
|
} else {
|
||||||
|
randomNumber = Math.floor(Math.random() * 10000000).toString().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
|
||||||
|
}
|
||||||
|
|
||||||
|
return randomNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function generatePhoneNumber(identifier: string) {
|
||||||
|
const _identifier = identifier;
|
||||||
|
let phoneNumber = await usePhoneNumber(_identifier);
|
||||||
|
let id = await getIdentifierByPhoneNumber(phoneNumber)
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (!phoneNumber) {
|
||||||
|
phoneNumber = await getRandomPhoneNumber();
|
||||||
|
const query = "UPDATE users SET phone_number = ? WHERE identifier = ?";
|
||||||
|
await pool.query(query, [phoneNumber, _identifier])
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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]);
|
||||||
@@ -21,6 +57,11 @@ async function getCredentials(identifier: string): Promise<string> {
|
|||||||
return number[0].phone_number;
|
return number[0].phone_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onNet('esx:playerLoaded', async (playerId: number, xPlayer: any) => {
|
||||||
|
const identifier = xPlayer.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;
|
||||||
|
|||||||
Reference in new issue
Block a user