Author SHA1 Message Date
Christopher b38b488a42 remove marketplace fontawesome icons 2021-03-18 15:53:23 +01:00
Christopher c39468eb34 tweak(phone/bank): remove fontaswesome icons 2021-03-18 15:49:20 +01:00
Taso a2c0f94bd8 fix(whoops): Forgot to remove the string-parser change from last commit 2021-03-17 20:27:25 -04:00
Taso e8d28359a9 chore(server): Bumped deps & tweaked build
We are now ignoring the Cardinal and parse-connection-string warnings
that used to pop up after build.

Deps were bumped using standard `yarn upgrade`
2021-03-17 20:11:37 -04:00
Taso 67b557b7c3 fix(phone/sourcemaps): Add .map to client files 2021-03-17 17:36:45 -04:00
Taso 4b29cbbce3 fix(phone/home): Fixed incorrect props for Grid item 2021-03-17 13:59:53 -04:00
Taso 06137d77ad fix(phone/notifications): Fixed error when setting for app is not defined 2021-03-17 13:55:45 -04:00
Taso 279778e4f3 tweak(phone/webpack): Generate source maps 2021-03-17 11:18:37 -04:00
Taso a6e8c769c0 feat(locale): Added a locale setting in Settings app
This removes the need to rebuild the phone in order to change language
2021-03-17 10:24:28 -04:00
Bombay 5c6538b340 Fix : Typo (#171) 2021-03-17 06:37:48 -04:00
Taso 1ecdb7a4a8 fix(locales): Fixed Bosnian Alpha-2 code 2021-03-16 21:14:52 -04:00
Taso d5d483eee8 tweak(phone/settings): Enabled copy and paste for number 2021-03-16 17:56:40 -04:00
Taso ef30daeb65 fix(phone/twitter): Altered transform on ShowMore
I wasn't sure what the comment was referring to, but changed this to a
standard top offset, and it fixed a issue with the transform being
screwed up between tweets.
2021-03-16 17:45:54 -04:00
Taso 19e228894d tweak(phone/settings): Added streamer mode desc 2021-03-16 17:31:41 -04:00
Taso a244183976 fix(server/types): Fixed type on Tweet create sql resp 2021-03-16 16:24:27 -04:00
Taso e01057d818 refactor(server/tweets): Slight tweaks to twitter handling on server 2021-03-16 16:24:27 -04:00
Taso 9ffca0d14e chore(server/messages): Type create message response 2021-03-16 16:24:27 -04:00
Taso 1a9c21f89d fix/cleanup(server/twitter): Fix for fetch after tweet & gen cleanup 2021-03-16 16:24:27 -04:00
Taso 3031e650e3 cleanup(server/marketplace): General cleanup of marketplace
Tweaked SQL tables to reference 'marketplace' and not 'sellout'

Removed if/else in favor of if/return
2021-03-16 16:24:27 -04:00
Taso 23ef9b8cd6 chore(server/photo): Added try/catch to missing sql query 2021-03-16 16:24:27 -04:00
Taso 598bcd2eb3 chore(server/notes): Removed redundant pSource call 2021-03-16 16:24:27 -04:00
Taso 78961b788f tweak(server/messages): General cleanup changes and added missing docs
I personally don't like if else chains, so changed to if checks
2021-03-16 16:24:27 -04:00
Taso adf9758d9f tweak(server/calls): Tweaked call handling
Added Sanity checks

Switched timestamp creation to server
2021-03-16 16:24:27 -04:00
Christopher Gjelten bc8a89d825 Update discord.ts 2021-03-16 16:55:11 +01:00
28 changed files with 1613 additions and 1941 deletions

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
<img src="https://beta.iodine.gg/zVkK7.png" width="500" height="300" />
NPWD is our current running project. Our team has been working on the project since Auguest, 2020. This resource isn’t complete yet and currently has no ETA for release. Feel free to test it out in a dev enviorment by following the installation guide.
NPWD is our current running project. Our team has been working on the project since Auguest, 2020. This resource isn’t complete yet and currently has no ETA for release. Feel free to test it out in a dev environment by following the installation guide.
Written completely by the Project Error Dev Team in [React](https://reactjs.org/) with a [TypeScript](https://www.typescriptlang.org/) client/server environment.
+1
View File
@@ -16,5 +16,6 @@ ui_page 'resources/html/index.html'
files {
'resources/html/index.html',
'resources/html/*.js',
'resources/html/*.map',
'resources/html/media/**/*'
}
+2 -11
View File
@@ -63,7 +63,7 @@ CREATE TABLE IF NOT EXISTS npwd_notes (
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS npwd_sellout_listings (
CREATE TABLE IF NOT EXISTS npwd_marketplace_listings (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(255) DEFAULT NULL,
username varchar(255) DEFAULT NULL,
@@ -75,12 +75,6 @@ CREATE TABLE IF NOT EXISTS npwd_sellout_listings (
createdAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
updatedAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 31,
AVG_ROW_LENGTH = 2048,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci;
);
CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
@@ -88,10 +82,7 @@ CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
listing_id int(11) DEFAULT NULL,
profile varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci;
);
CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
`id` int NOT NULL AUTO_INCREMENT,
+9 -2
View File
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import './Phone.css';
import './i18n';
import { Route } from 'react-router-dom';
@@ -33,11 +33,18 @@ import { usePhone } from './os/phone/hooks/usePhone';
import { useTranslation } from 'react-i18next';
function Phone() {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const { apps } = useApps();
const [settings] = useSettings();
// Set language from local storage
// This will only trigger on first mount & settings changes
useEffect(() => {
i18n.changeLanguage(settings.language.value).catch((e) => console.error(e));
}, [i18n, settings.language]);
useNuiService();
useKeyboardService();
usePhoneService();
@@ -3,8 +3,9 @@ import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faHome, faList, faMoneyCheck } from '@fortawesome/free-solid-svg-icons';
import HomeIcon from '@material-ui/icons/Home';
import LocalAtmIcon from '@material-ui/icons/LocalAtm';
import ListIcon from '@material-ui/icons/List';
const useStyles = makeStyles((theme) => ({
root: {
@@ -30,21 +31,9 @@ export const NavigationBar = () => {
showLabels
className={classes.root}
>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faHome} />}
to="/bank"
/>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faMoneyCheck} />}
to="/bank/account"
/>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faList} />}
to="/bank/transactions"
/>
<BottomNavigationAction component={Link} icon={<HomeIcon />} to="/bank" />
<BottomNavigationAction component={Link} icon={<LocalAtmIcon />} to="/bank/account" />
<BottomNavigationAction component={Link} icon={<ListIcon />} to="/bank/transactions" />
</BottomNavigation>
);
};
@@ -2,9 +2,8 @@ import React, { useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom';
import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faHome } from '@fortawesome/free-solid-svg-icons';
import AddCircleIcon from '@material-ui/icons/AddCircle';
import HomeIcon from '@material-ui/icons/Home';
const useStyles = makeStyles((theme) => ({
root: {
@@ -28,11 +27,7 @@ export const NavigationBar = () => {
showLabels
className={classes.root}
>
<BottomNavigationAction
component={Link}
icon={<FontAwesomeIcon icon={faHome} />}
to="/sellout"
/>
<BottomNavigationAction component={Link} icon={<HomeIcon />} to="/sellout" />
<BottomNavigationAction component={Link} icon={<AddCircleIcon />} to="/sellout/new" />
</BottomNavigation>
);
@@ -67,12 +67,13 @@ interface ISettingSwitch {
value: boolean;
onClick: any;
icon: JSX.Element;
secondary: string;
}
export const SettingSwitch = ({ label, value, onClick, icon }: ISettingSwitch) => (
export const SettingSwitch = ({ label, value, onClick, icon, secondary }: ISettingSwitch) => (
<ListItem divider button>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={label} />
<ListItemText primary={label} secondary={secondary} />
<ListItemSecondaryAction>
<Switch color="primary" checked={value} onChange={() => onClick(value)} />
</ListItemSecondaryAction>
@@ -25,10 +25,13 @@ import {
LibraryMusic,
VolumeUp,
FileCopy,
Book,
} from '@material-ui/icons';
import { ListSubheader } from '@material-ui/core';
import { useSettings } from '../hooks/useSettings';
import { setClipboard } from '../../../os/phone/hooks/useClipboard';
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
const SubHeaderComp = (props: { text: string }) => (
<ListSubheader color="primary" component="div" disableSticky>
@@ -42,8 +45,8 @@ export const SettingsApp = () => {
const simcard = useSimcard();
const [settings, setSettings] = useSettings();
const { t } = useTranslation();
// TODO: Uncomment when #135 is merged
// const { addAlert } = useSnackbar();
const { addAlert } = useSnackbar();
const handleSettingChange = (key: string | number, value: unknown) => {
setSettings({ ...settings, [key]: value });
@@ -84,16 +87,18 @@ export const SettingsApp = () => {
),
);
const languages = config.languages.map(
MapSettingItem(settings.language, (val: SettingOption) => handleSettingChange('language', val)),
);
const handleCopyPhoneNumber = () => {
// TODO: Dependent on #132 merge
// setClipboard(simcard.number)
// TODO: Dependent on #135 merge
// addAlert({
// message: t('GENERIC_WRITE_TO_CLIPBOARD_MESSAGE', {
// content: 'number',
// }),
// type: 'success',
// });
setClipboard(simcard.number);
addAlert({
message: t('GENERIC_WRITE_TO_CLIPBOARD_MESSAGE', {
content: 'number',
}),
type: 'success',
});
};
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
@@ -101,7 +106,7 @@ export const SettingsApp = () => {
<AppWrapper>
<AppTitle app={settingsApp} />
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
<List disablePadding subheader={<SubHeaderComp text="Phone" />}>
<List disablePadding subheader={<SubHeaderComp text={t('SETTINGS.CATEGORY.PHONE')} />}>
<SettingItemIconAction
label={t('APPS_SETTINGS_PHONE_NUMBER')}
labelSecondary={simcard.number}
@@ -140,12 +145,20 @@ export const SettingsApp = () => {
/>
<SettingSwitch
label={t('APPS_SETTINGS_OPTION_STREAMER_MODE')}
secondary={t('APPS_SETTING_STREAMER_MODE_DESC')}
icon={<VisibilityOffIcon />}
value={settings.streamerMode}
onClick={(curr) => handleSettingChange('streamerMode', !curr)}
/>
</List>
<List disablePadding subheader={<SubHeaderComp text="Appearance" />}>
<List disablePadding subheader={<SubHeaderComp text={t('SETTINGS.CATEGORY.APPEARANCE')} />}>
<SettingItem
label={t('SETTINGS.OPTIONS.LANGUAGE')}
value={settings.language.label}
options={languages}
onClick={openMenu}
icon={<Book />}
/>
<SettingItem
label={t('APPS_SETTINGS_OPTION_THEME')}
value={settings.theme.label}
@@ -26,6 +26,7 @@ export const settingsState = atom({
});
export interface IPhoneSettings {
language: SettingOption;
wallpaper: SettingOption;
frame: SettingOption;
theme: SettingOption;
@@ -6,30 +6,8 @@ import { usePhone } from '../../../../os/phone/hooks/usePhone';
import Nui from '../../../../os/nui-events/utils/Nui';
import ReportButton from '../buttons/ReportButton';
/**
* Ok this is some bullshit. Due to either scaling issues or the NUI
* overlay being different than the display resolution just letting
* material-ui determine what the anchor positioning of the popover
* is not reliable and has some error that appears to scale vertically.
*
* This vertical offset raises the popover positioning implementing the
* transformOrigin prop that material-ui's Popover element provides.
*
* These coefficients are NOT based on any known offsets or calc()
* functions. They are empiricallly determined. The actual scaling issue
* does NOT appear to be linear, but over the comparatively low height
* of the phone compared to the window it produces results that are within
* acceptable tolerances from the player's perspective.
* @param top - the computed distance from the top of the window to the top
* of the anchor element
*/
function calculateVerticalOffset(top: number): number {
return top * 0.2 - 38;
}
export const ShowMore = ({ id, isReported, isMine }) => {
const [anchorEl, setAnchorEl] = useState<Element | null>(null);
const [verticalOffset, setVerticalOffset] = useState(0);
const { t } = useTranslation();
const { config } = usePhone();
@@ -38,14 +16,10 @@ export const ShowMore = ({ id, isReported, isMine }) => {
const handleClick = (event: React.MouseEvent) => {
const element = event.currentTarget;
setAnchorEl(element);
const top = window.pageYOffset + element.getBoundingClientRect().top;
setVerticalOffset(calculateVerticalOffset(top));
};
const handleClose = () => {
setAnchorEl(null);
setVerticalOffset(0);
};
const handleDeleteTweet = () => {
@@ -72,7 +46,7 @@ export const ShowMore = ({ id, isReported, isMine }) => {
open={Boolean(anchorEl)}
onClose={handleClose}
transformOrigin={{
vertical: verticalOffset,
vertical: -30,
horizontal: 'left',
}}
>
+44 -2
View File
@@ -1,6 +1,6 @@
{
"cellProvider": "AT&T",
"language": "en",
"defaultLanguage": "en",
"wallpapers": [
{
"label": "Minimal",
@@ -67,6 +67,44 @@
"value": 0.7
}
],
"languages": [
{
"label": "English",
"value": "en"
},
{
"label": "Español",
"value": "es"
},
{
"label": "Français",
"value": "fr"
},
{
"label": "Türk",
"value": "tr"
},
{
"label": "Norsk",
"value": "no"
},
{
"label": "Svenska",
"value": "sv"
},
{
"label": "Português",
"value": "pt"
},
{
"label": "Português (BR)",
"value": "ptbr"
},
{
"label": "Bosanski",
"value": "ba"
}
],
"ringtones": [
{
"label": "Marimba",
@@ -98,6 +136,10 @@
}
],
"defaultSettings": {
"language": {
"label": "English",
"value": "en"
},
"wallpaper": {
"label": "Project Error",
"value": "projecterror.jpg"
@@ -107,7 +149,7 @@
"value": "default.png"
},
"theme": {
"label": "taso-dark",
"label": "Taso Dark",
"value": "taso-dark"
},
"zoom": {
+7 -5
View File
@@ -3,7 +3,7 @@ import { initReactI18next } from 'react-i18next';
import en from './locale/en.json';
import es from './locale/es.json';
import fr from './locale/fr.json';
import bs from './locale/bs.json';
import ba from './locale/ba.json';
import sv from './locale/sv.json';
import no from './locale/no.json';
import tr from './locale/tr.json';
@@ -15,7 +15,7 @@ const resources = {
en,
es,
fr,
bs,
ba,
no,
sv,
tr,
@@ -27,9 +27,11 @@ i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources,
lng: config.language,
keySeparator: false, // we do not use keys in form messages.welcome
lng: config.defaultLanguage,
react: {
bindI18n: 'languageChanged',
},
keySeparator: '.', // we do not use keys in form messages.welcome
interpolation: {
escapeValue: false, // react already safes from xss
@@ -129,4 +129,4 @@
"GENERIC_WRITE_TO_CLIPBOARD_TOOLTIP": "Kopiraj {{ content }}",
"GENERIC_WRITE_TO_CLIPBOARD_MESSAGE": "Kopirano je {{ content }} u međuspremnik!"
}
}
}
-127
View File
@@ -1,127 +0,0 @@
{
"translation": {
"DATE_FORMAT": "MM/DD/YYYY",
"DATE_TIME_FORMAT": "MM/DD/YYYY hh:mm A",
"COMING_SOON": "Coming soon...",
"APPS_DIALER": "Telephone",
"APPS_CONTACTS": "Contacti",
"APPS_MESSAGES": "Poruke",
"APPS_CALCULATOR": "Calculator",
"APPS_SETTINGS": "Postavke",
"APPS_BANK": "WhoDis Banka",
"APPS_NOTES": "Bilješke",
"APPS_EXAMPLE": "Primjerna Aplikacija",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
"APPS_CAMERA": "Camera",
"APPS_DIALER_INCOMING_CALL_TITLE": "Incoming Phone Call",
"APPS_DIALER_CURRENT_CALL_TITLE": "Current Phone Call",
"APPS_DIALER_CURRENT_CALL_WITH": "In call with {{ transmitter }}",
"APPS_DIALER_TRANSMITTER_IS_CALLING": "{{ transmitter }} is calling you!",
"APPS_DIALER_ACCEPT_CALL": "Accept",
"APPS_DIALER_REJECT_CALL": "Reject",
"APPS_DIALER_END_CALL": "End",
"APPS_TWITTER_TWEET": "Tweet",
"APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "Šta ima?",
"APPS_TWITTER_IMAGE_PLACEHOLDER": "Link do vašeg slike ili gifa",
"APPS_TWITTER_SUBMIT_IMAGE": "Dodati Slike",
"APPS_TWITTER_CLOSE_IMAGE": "Zatvori",
"APPS_TWITTER_CLOSE": "Zatvori",
"APPS_TWITTER_DELETE": "Izbriši",
"APPS_TWITTER_REPORT": "Prijavi",
"APPS_TWITTER_REPORTED": "Prijavio",
"APPS_TWITTER_JUST_NOW": "Tek Sada",
"APPS_TWITTER_SEARCH_TWEETS": "Potražite za tweet",
"APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Pretražite sa imenom profila ili poruke",
"APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Poruka ide preko ograničenje broj Slova",
"APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT": "Message is over the new line limit",
"APPS_TWITTER_CREATE_SUCCESS": "Vaš tweet je uspješno poslan",
"APPS_TWITTER_CREATE_FAILED": "Slanje vašeg tweeta nije uspjelo",
"APPS_TWITTER_EDIT_PROFILE_AVATAR": "URL za avatar",
"APPS_TWITTER_EDIT_PROFILE_NAME": "Ime profila",
"APPS_TWITTER_EDIT_PROFILE_BIO": "Descriptcia",
"APPS_TWITTER_EDIT_PROFILE_LOCATION": "Lokacija",
"APPS_TWITTER_EDIT_PROFILE_JOB": "Posao",
"APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Ažuriran vam je profil!",
"APPS_TWITTER_EDIT_PROFILE_FAILURE": "Nismo uspjeli ažurirati vaš profil!",
"APPS_TWITTER_TIME_JUST_NOW": "Tek Sada",
"APPS_TWITTER_TIME_MINUTES": "m",
"APPS_TWITTER_TIME_HOURS": "h",
"APPS_TWITTER_TIME_DAYS": "d",
"APPS_TWITTER_NEW_BROADCAST": "New tweet from @{{ profile_name }}!",
"APPS_TWITTER_UNREAD_MESSAGES": "You have {{ count }} new tweets in your timeline!",
"APPS_BANK_TRANSFER": "Prebaciti Novac",
"APPS_BANK_HOME_TITLE": "Dobrodošli!",
"APPS_BANK_ACCOUNT_LINK": "Račun",
"APPS_BANK_TIME_JUST_NOW": "Tek Sada",
"APPS_BANK_ACCOUNT_TITLE": "Sažetak računa",
"APPS_BANK_ACCOUNT_TRANSACTIONS": "Transakcije",
"APPS_BANK_ACCOUNT_SEE_TRANSACTION": "Vidjeti sve",
"APPS_BANK_ACTIONS_TRANSFER": "Prebaciti Novac",
"APPS_BANK_ALERT_TRANSFER_SUCCESS": "uspješno prebacio novac!",
"APPS_BANK_ALERT_TRANSFER_FAILURE": "Nismo uspjeli prebaciti novac!",
"APPS_MESSAGES_SEARCH_PLACEHOLDER": "Po tražiti poruke ...",
"APPS_MESSAGES_NEW_MESSAGE": "Poruka...",
"APPS_MESSAGES_NEW_MESSAGE_FAILED:": "Failed to send message",
"APPS_MESSAGES_NEW_MESSAGE_GROUP": "Brojevi Telephona...",
"APPS_MESSAGES_GROUP_CHAT_LABEL": "Oznaka grupnog chata...",
"APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Pošalji",
"APPS_MESSAGES_INVALID_PHONE_NUMBER": "Nije validan brok telephona: ",
"APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Ova groupa već postoji!",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Nismo mogli napraviti ovu groupu!",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Ne možete sami sebe dodati u grupu!",
"APPS_MESSAGES_INPUT_NAME_OR_NUMBER": "Search contacts or type number and press enter",
"APPS_CONTACT_FORM_NAME": "Ime",
"APPS_CONTACT_FORM_NUMBER": "Brok",
"APPS_CONTACT_FORM_AVATAR": "URL za avatar",
"APPS_CONTACT_ADD_SUCCESS": "Uspješno napravili novi kontakt!",
"APPS_CONTACT_ADD_FAILED": "Nismo uspjeli stvoriti novi kontakt!",
"APPS_CONTACT_UPDATE_SUCCESS": "Uspješno ažurirali kontakt!",
"APPS_CONTACT_UPDATE_FAILED": "Nismo uspjeli ažurirati kontakt!",
"APPS_CONTACT_DELETE_SUCCESS": "Uspješno izbrisali kontakt!",
"APPS_CONTACT_DELETE_FAILED": "Nismo uspjeli izbrisati ovaj kontakt!",
"APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Search contacts",
"APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Name",
"APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Number",
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Add Contact",
"APPS_NOTES_ADD_SUCCESS": "Successfully saved note.",
"APPS_NOTES_ADD_FAILED": "Failed to save note.",
"APPS_NOTES_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_NOTES_UPDATE_FAILED": "Failed to update note.",
"APPS_NOTES_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_NOTES_DELETE_FAILED": "Failed to delete note.",
"APPS_CALCULATOR_COPIED": "Result was copied to clipboard!",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing",
"APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Failed to create a new listing",
"APPS_SETTINGS_PHONE_NUMBER": "Phone Number",
"APPS_SETTINGS_OPTION_WALLPAPER": "Wallpaper",
"APPS_SETTINGS_OPTION_FRAME": "Frame",
"APPS_SETTINGS_OPTION_THEME": "Theme",
"APPS_SETTINGS_OPTION_ZOOM": "Zoom",
"APPS_SETTINGS_OPTION_RINGTONE": "Ringtone",
"APPS_SETTINGS_OPTION_RINGTONEVOL": "Ringtone Volume",
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
"GENERIC_SAVE": "Save",
"GENERIC_UPDATE": "Update",
"GENERIC_DELETE": "Delete",
"GENERIC_CLOSE": "Close",
"GENERIC_CANCEL": "Cancel",
"GENERIC_TITLE": "Title",
"GENERIC_CONTENT": "Content"
}
}
+10
View File
@@ -2,6 +2,15 @@
"translation": {
"DATE_FORMAT": "MM/DD/YYYY",
"DATE_TIME_FORMAT": "MM/DD/YYYY hh:mm A",
"SETTINGS": {
"CATEGORY": {
"APPEARANCE": "Appearance",
"PHONE": "Phone"
},
"OPTIONS": {
"LANGUAGE": "Language"
}
},
"COMING_SOON": "Coming soon...",
"INITIALIZING": "Initializing",
@@ -121,6 +130,7 @@
"APPS_SETTINGS_OPTION_NOTIFICATION_FILTER": "Notification Filters",
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
"APPS_SETTING_STREAMER_MODE_DESC": "Hide images before they are shown",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing",
"APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Failed to create a new listing",
+1 -1
View File
@@ -17,7 +17,7 @@ export const getSoundSettings = (
try {
return app
? {
sound: getPath[type](settings[`${app}_${type}`].value || settings[type].value),
sound: getPath[type](settings[`${app}_${type}`]?.value || settings[type].value),
volume: (settings[`${app}_${type}Vol`] || settings[`${type}Vol`]) / 100,
}
: {
+1 -1
View File
@@ -9,7 +9,7 @@ export const GridMenu = ({ items, Component = AppIcon, xs = undefined }) => {
{items &&
items.length &&
items.map((item) => (
<Grid item xs={xs} key={item.id} alignItems="center" justify="center">
<Grid item xs={xs} key={item.id}>
<Box textAlign="center">
<Link to={item.path}>
<Component {...item} />
+1
View File
@@ -4,6 +4,7 @@ const webpack = require('webpack');
module.exports = (options) => ({
mode: options.mode,
entry: options.entry,
devtool: 'source-maps',
output: {
path: path.resolve(process.cwd(), '../resources/html'),
filename: '[name].js',
+2 -4
View File
@@ -6,8 +6,7 @@ const exp = (global as any).exports;
RegisterNuiCallbackType(events.PHONE_INITIALIZE_CALL); // Fires when the call is started.
on(`__cfx_nui:${events.PHONE_INITIALIZE_CALL}`, (data: any, cb: Function) => {
const start = Date.now();
emitNet(events.PHONE_INITIALIZE_CALL, data.number, start);
emitNet(events.PHONE_INITIALIZE_CALL, data.number);
cb();
});
@@ -58,8 +57,7 @@ onNet(
RegisterNuiCallbackType(events.PHONE_CALL_REJECTED); // Fires when cancelling and rejecting a call.
on(`__cfx_nui:${events.PHONE_CALL_REJECTED}`, (data: any, cb: Function) => {
const end = Date.now();
emitNet(events.PHONE_CALL_REJECTED, data.phoneNumber, end);
emitNet(events.PHONE_CALL_REJECTED, data.phoneNumber);
cb();
});
+1 -1
View File
@@ -35,7 +35,7 @@ const postToWebhook = async (content: DiscordMessage): Promise<AxiosResponse | v
// If convar isnt set
if (!DISCORD_WEBHOOK) {
discordLogger.warn(
'Got a request to report a listing but discord is not configures. See README o how to configure discord endpoints.',
'Got a request to report a listing but discord is not configures. See README on how to configure discord endpoints.',
);
return;
}
+19 -7
View File
@@ -1,6 +1,5 @@
import events from '../utils/events';
import { getIdentifierByPhoneNumber, getPlayer, getSource } from './functions';
import { getPlayerFromIdentifier } from './functions';
import { ICall } from '../../typings/call';
@@ -30,9 +29,11 @@ async function fetchCalls(phoneNumber: string): Promise<ICall[]> {
let calls: Map<string, ICall> = new Map();
onNet(events.PHONE_INITIALIZE_CALL, async (phoneNumber: string, timestamp: number) => {
onNet(events.PHONE_INITIALIZE_CALL, async (phoneNumber: string) => {
const _source = getSource();
const startCallTimeUnix = new Date().getTime() / 1000;
const callIdentifier = uuidv4();
// the client that is calling
@@ -60,7 +61,7 @@ onNet(events.PHONE_INITIALIZE_CALL, async (phoneNumber: string, timestamp: numbe
transmitterSource: _source,
receiver: receiverNumber,
receiverSource: xReceiver.source,
start: timestamp / 1000,
start: Math.floor(startCallTimeUnix),
accepted: false,
});
@@ -81,6 +82,10 @@ onNet(events.PHONE_ACCEPT_CALL, async (transmitterNumber: string) => {
const pSource = getSource();
try {
const currentCall = calls.get(transmitterNumber);
// Sanity check if call exists in current set
if (!currentCall) new Error('Transmitter number does not exist in set.');
const channelId = pSource;
await updateCall(currentCall, true, null);
@@ -109,6 +114,9 @@ onNet(events.PHONE_CALL_REJECTED, async (transmitterNumber: string, timestamp: n
const pSource = getSource();
try {
const currentCall = calls.get(transmitterNumber);
// Sanity check if call exists in current set
if (!currentCall) new Error('Transmitter number does not exist in set.');
await updateCall(currentCall, false, timestamp);
// player who is called and initiasted the rejection.
@@ -124,13 +132,17 @@ onNet(events.PHONE_CALL_REJECTED, async (transmitterNumber: string, timestamp: n
}
});
onNet(events.PHONE_END_CALL, async (transmitterNumber: string, timestamp: number) => {
onNet(events.PHONE_END_CALL, async (transmitterNumber: string) => {
const pSource = getSource();
try {
const currentTimeUnix = new Date().getTime() / 1000;
const currentCall = calls.get(transmitterNumber);
const endTime = timestamp / 1000;
await updateCall(currentCall, false, endTime);
const accepted = calls.get(pSource);
// Sanity check if call exists in current set
if (!currentCall) new Error('Transmitter number does not exist in set.');
await updateCall(currentCall, false, currentTimeUnix);
// player who is being called
emitNet(events.PHONE_CALL_WAS_ENDED, currentCall.receiverSource);
+29 -26
View File
@@ -1,11 +1,8 @@
import md5 from 'md5';
import events from '../utils/events';
import { CreateMessageGroupResult, Message, MessageGroup } from '../../typings/messages';
import { pool, withTransaction } from './db';
import { getIdentifier, getSource, getPlayerFromIdentifier } from './functions';
import { mainLogger } from './sv_logger';
import { group } from 'console';
const messageLogger = mainLogger.child({ module: 'messages' });
@@ -45,13 +42,14 @@ interface MessageGroupMapping {
* @param userIdentifier - identifier of the user creating this message
* @param groupId - the message group ID to attach this message to
* @param message - content of the message
* @param participants -
*/
async function createMessage(
userIdentifier: string,
groupId: string,
message: string,
participants: string[],
): Promise<any> {
): Promise<UnformattedMessageGroup[]> {
const query = `
INSERT INTO npwd_messages
(user_identifier, message, group_id)
@@ -71,7 +69,7 @@ async function createMessage(
.map((s) => pool.query(groupQuery, [s, groupId])),
);
return results;
return <UnformattedMessageGroup[]>results;
}
/**
@@ -172,7 +170,7 @@ async function createMessageGroup(
(user_identifier, group_id, participant_identifier)
VALUES (?, ?, ?)
`;
const [results] = await pool.query(query, [userIdentifier, groupId, participantIdentifier]);
await pool.query(query, [userIdentifier, groupId, participantIdentifier]);
}
/**
@@ -379,7 +377,8 @@ function getIdentifiersFromParticipants(groupId: string) {
/**
* Sets the current message isRead to 0 for said player
* @param id
* @param groupId The unique group ID for the message
* @param identifier The identifier for the player
*/
async function setMessageRead(groupId: string, identifier: string) {
const query =
@@ -408,40 +407,44 @@ onNet(
const result = await createMessageGroupsFromPhoneNumbers(_identifier, phoneNumbers, label);
if (result.error && result.duplicate) {
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: 'MESSAGES_MESSAGE_GROUP_DUPLICATE',
type: 'error',
});
}
// if the phoneNumber is invalid
} else if (result.error && result.phoneNumber) {
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
// if the phoneNumber is invalid
if (result.error && result.phoneNumber) {
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: 'MESSAGES_INVALID_PHONE_NUMBER',
type: 'error',
});
}
// if you are try to add yourself
} else if (result.error && result.mine) {
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
// if you are try to add yourself
if (result.error && result.mine) {
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: 'MESSAGES_MESSAGE_GROUP_CREATE_MINE',
type: 'error',
});
} else if (result.error) {
// if it just fails, welp
}
// if it just fails, welp
if (result.error) {
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, _source, result);
emitNet(events.MESSAGES_ACTION_RESULT, _source, {
return emitNet(events.MESSAGES_ACTION_RESULT, _source, {
message: `MESSAGES_MESSAGE_GROUP_CREATE_FAILED:`,
type: 'error',
});
} else {
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, _source, result);
if (result.identifiers) {
for (const participantId of result.identifiers) {
// we don't broadcast to the source of the event.
if (participantId !== _identifier) {
const participantPlayer = getPlayerFromIdentifier(participantId);
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, participantPlayer.source);
}
}
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, _source, result);
if (result.identifiers) {
for (const participantId of result.identifiers) {
// we don't broadcast to the source of the event.
if (participantId !== _identifier) {
const participantPlayer = getPlayerFromIdentifier(participantId);
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, participantPlayer.source);
}
}
}
-1
View File
@@ -95,7 +95,6 @@ onNet(events.NOTE_UPDATE_NOTE, async (note: Note) => {
type: 'success',
});
} catch (e) {
const pSource = (global as any).source;
emitNet(events.NOTE_UPDATE_NOTE_FAILURE, pSource);
notesLogger.error(`Failed to update note, ${e.message}`, {
source: pSource,
+10 -5
View File
@@ -14,8 +14,7 @@ async function uploadPhoto(identifier: string, image: string) {
async function getPhotosByIdentifier(identifier: string): Promise<IPhoto[]> {
const query = '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;
return <IPhoto[]>results;
}
async function deletePhoto(photo: IPhoto, identifier: string) {
@@ -38,9 +37,15 @@ onNet(events.CAMERA_UPLOAD_PHOTO, async (image: string) => {
onNet(events.CAMERA_FETCH_PHOTOS, async () => {
const _source = getSource();
const identifier = getIdentifier(_source);
const photos = await getPhotosByIdentifier(identifier);
emitNet(events.CAMERA_SEND_PHOTOS, source, photos);
try {
const identifier = getIdentifier(_source);
const photos = await getPhotosByIdentifier(identifier);
emitNet(events.CAMERA_SEND_PHOTOS, _source, photos);
} catch (e) {
photoLogger.error(`Failed to fetch photos, ${e.message}`, {
source: _source,
});
}
});
onNet(events.CAMERA_DELETE_PHOTO, async (photo: IPhoto) => {
+16 -17
View File
@@ -1,5 +1,6 @@
import events from '../utils/events';
import { getIdentifier, getPlayer, getSource } from './functions';
import { ESX } from './server';
import { pool } from './db';
import { mainLogger } from './sv_logger';
import { MarketplaceListing } from '../../typings/marketplace';
@@ -8,12 +9,10 @@ import { reportListingToDiscord } from './discord';
const selloutLogger = mainLogger.child({ module: 'sellout' });
async function fetchAllListings(): Promise<MarketplaceListing[]> {
const query = 'SELECT * FROM npwd_sellout_listings ORDER BY id DESC';
const query = 'SELECT * FROM npwd_marketplace_listings ORDER BY id DESC';
const [results] = await pool.query(query);
const listings = <MarketplaceListing[]>results;
return listings;
return <MarketplaceListing[]>results;
}
async function addListing(
@@ -24,7 +23,7 @@ async function addListing(
listing: MarketplaceListing,
): Promise<void> {
const query =
'INSERT INTO npwd_sellout_listings (identifier, username, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?, ?)';
'INSERT INTO npwd_marketplace_listings (identifier, username, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?, ?)';
await pool.query(query, [
identifier,
username,
@@ -37,17 +36,16 @@ async function addListing(
}
async function deleteListing(listingId: number, identifier: string): Promise<void> {
const query = 'DELETE FROM npwd_sellout_listings WHERE id = ? AND identifier = ?';
const query = 'DELETE FROM npwd_marketplace_listings WHERE id = ? AND identifier = ?';
await pool.query(query, [listingId, identifier]);
}
async function getListing(listingId: number): Promise<MarketplaceListing> {
const query = `SELECT * FROM npwd_sellout_listings WHERE id = ?`;
const query = `SELECT * FROM npwd_marketplace_listings WHERE id = ?`;
const [results] = await pool.query(query, [listingId]);
const listings = <MarketplaceListing[]>results;
const listing = listings[0];
return listing;
return listings[0];
}
async function reportListing(listingId: number, profile: string): Promise<void> {
@@ -144,18 +142,19 @@ onNet(events.SELLOUT_REPORT_LISTING, async (listing: MarketplaceListing) => {
if (reportExists) {
// send an info alert
selloutLogger.error(`This listing has already been reported`);
emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
return emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
message: 'MARKETPLACE_REPORT_LISTING_FAILED',
type: 'info',
});
} else {
await reportListing(rListing.id, rListing.name);
await reportListingToDiscord(rListing, reportingPlayer);
emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
message: 'MARKETPLACE_REPORT_LISTING_SUCCESS',
type: 'success',
});
}
await reportListing(rListing.id, rListing.name);
await reportListingToDiscord(rListing, reportingPlayer);
emitNet(events.SELLOUT_ACTION_RESULT, pSource, {
message: 'MARKETPLACE_REPORT_LISTING_SUCCESS',
type: 'success',
});
} catch (e) {
selloutLogger.error(`Failed to report listing ${e.message}`, {
source: pSource,
+16 -9
View File
@@ -5,6 +5,7 @@ import events from '../utils/events';
import config from '../utils/config';
import { reportTweetToDiscord } from './discord';
import { mainLogger } from './sv_logger';
import { ResultSetHeader } from 'mysql2';
const twitterLogger = mainLogger.child({ module: 'twitter' });
@@ -95,6 +96,7 @@ async function fetchTweetsFiltered(profileId: number, searchValue: string): Prom
/**
* Retrieve a Tweet by ID
* @param profileId Unique id for the twitter profile (NOT user identifier)
* @param tweetId - primary key of the tweet ID
*/
async function getTweet(profileId: number, tweetId: number): Promise<Tweet> {
@@ -131,7 +133,11 @@ async function createTweet(identifier: string, tweet: NewTweet): Promise<Tweet>
tweet.images,
tweet.retweet,
]);
const insertData = <any>results;
// This should not be an any type and instead should be
// a Tweet[] according to mysql2 documentation. But instead
// this exec promise returns the row itself, not an array of rows like it states
// Therefore type assertion doesn't work here for correctly typing this out.
const insertData = <ResultSetHeader>results;
return await getTweet(profile.id, insertData.insertId);
}
@@ -189,7 +195,8 @@ async function createDefaultProfile(identifier: string): Promise<Profile> {
INSERT INTO npwd_twitter_profiles (identifier, profile_name)
VALUES (?, ?)
`;
const [result] = await pool.execute(query, [identifier, profileName]);
await pool.execute(query, [identifier, profileName]);
return getProfile(identifier);
}
@@ -251,7 +258,7 @@ async function deleteTweet(identifier: string, tweetId: number): Promise<void> {
DELETE FROM npwd_twitter_tweets
WHERE identifier = ? AND id = ?
`;
const [result] = await pool.execute(query, [identifier, tweetId]);
await pool.execute(query, [identifier, tweetId]);
}
/**
@@ -428,11 +435,10 @@ onNet(events.TWITTER_RETWEET, async (tweetId: number) => {
// alert the player that they have already retweeted
// this post (or that they are the original poster)
if (await doesRetweetExist(tweetId, identifier)) {
emitNet(events.TWITTER_RETWEET_EXISTS, _source, {
return emitNet(events.TWITTER_RETWEET_EXISTS, _source, {
message: 'TWITTER_RETWEET_EXISTS',
type: 'error',
});
return;
}
// our message for this row is blank because when we
@@ -460,13 +466,14 @@ onNet(events.TWITTER_REPORT, async (tweetId: number) => {
const tweet = await getTweet(profile.id, tweetId);
const reportExists = await doesReportExist(tweet.id, profile.id);
if (reportExists) {
twitterLogger.warn('This profile has already reported this tweet');
} else {
await createTweetReport(tweet.id, profile.id);
await reportTweetToDiscord(tweet, profile);
return twitterLogger.warn('This profile has already reported this tweet');
}
await createTweetReport(tweet.id, profile.id);
await reportTweetToDiscord(tweet, profile);
emitNet(events.TWITTER_REPORT_SUCCESS, _source);
} catch (e) {
emitNet(events.TWITTER_REPORT_FAILURE, _source);
+2 -1
View File
@@ -16,7 +16,6 @@ const server = {
],
},
plugins: [
new webpack.DefinePlugin({ 'global.GENTLY': false }),
new RemovePlugin({
before: {
include: [path.resolve(buildPath, 'server')],
@@ -25,6 +24,8 @@ const server = {
include: [path.resolve(buildPath, 'server')],
},
}),
// Ignore cardinal as its optional
new webpack.IgnorePlugin(/^cardinal$/, /./),
],
optimization: {
minimize: true,
+1401 -1653
View File
File diff suppressed because it is too large. Load diff