diff --git a/config.json b/config.json index 695a711..18200fe 100644 --- a/config.json +++ b/config.json @@ -5,7 +5,7 @@ "PhoneAsItem": false, "SwimDestroy": false, "RunRate": 10, - "DestoryChance": 100, + "DestroyChance": 100, "DestroyPhoneReCheck": 3, "notificationPosition": { "horizontal": "right", @@ -22,7 +22,7 @@ "twitter": { "showNotifications": true, "generateProfileNameFromUsers": true, - "allowEdtiableProfileName": true, + "allowEditableProfileName": true, "allowDeleteTweets": true, "allowReportTweets": true, "characterLimit": 160, @@ -34,7 +34,7 @@ }, "match": { "generateProfileNameFromUsers": true, - "allowEdtiableProfileName": true + "allowEditableProfileName": true }, "bank": { "showNotifications": true diff --git a/phone/package.json b/phone/package.json index e05667c..0850fd1 100644 --- a/phone/package.json +++ b/phone/package.json @@ -41,17 +41,15 @@ "@types/react-router-dom": "^5.1.7", "@welldone-software/why-did-you-render": "^6.1.1", "@wojtekmaj/enzyme-adapter-react-17": "^0.6.1", - "cp-cli": "^2.0.0", "cross-env": "^7.0.2", "ts-loader": "^8.1.0", "typescript": "3.9.7" }, "scripts": { "i18n:missing": "node --experimental-json-modules i18n.missingKeys.js", - "copy:config": "cp-cli ../config.json ./src/config.autogen.json", "start": "cross-env PUBLIC_URL=/ craco start", "watch": "cross-env REACT_APP_IN_GAME=1 craco start", - "build": "yarn copy:config && craco build", + "build": "craco build", "test": "craco test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}" }, "eslintConfig": { diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 2c3f2d8..baa5654 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -31,10 +31,13 @@ import { usePhone } from './os/phone/hooks/usePhone'; import { useTranslation } from 'react-i18next'; import { useSnackbar } from './ui/hooks/useSnackbar'; import { PhoneEvents } from '../../typings/phone'; -import dayjs from 'dayjs'; +import { isDefaultWallpaper } from './apps/settings/utils/isDefaultWallpaper'; import { useKeyboardService } from './os/keyboard/hooks/useKeyboardService'; import PhoneWrapper from './PhoneWrapper'; +import dayjs from 'dayjs'; +import DefaultConfig from '../../config.json'; + function Phone() { const { t, i18n } = useTranslation(); @@ -138,4 +141,9 @@ InjectDebugData([ method: PhoneEvents.SET_TIME, data: dayjs().format('hh:mm'), }, + { + app: 'PHONE', + method: PhoneEvents.SET_CONFIG, + data: DefaultConfig, + }, ]); diff --git a/phone/src/apps/match/components/profile/ProfileForm.tsx b/phone/src/apps/match/components/profile/ProfileForm.tsx index 041d66d..c07b5f4 100644 --- a/phone/src/apps/match/components/profile/ProfileForm.tsx +++ b/phone/src/apps/match/components/profile/ProfileForm.tsx @@ -42,8 +42,8 @@ export function ProfileForm({ profile, showPreview }: IProps) { const Nui = useNuiRequest(); const classes = useStyles(); const { t } = useTranslation(); - const { config } = usePhone(); - + const { ResourceConfig } = usePhone(); + // note that this assumes we are defensively checking // that profile is not null in a parent above this component. // Annoyingling adding conditionals above this line to not render @@ -77,7 +77,7 @@ export function ProfileForm({ profile, showPreview }: IProps) { Nui.send(event, updatedProfile); }; - if (!profile && !config.match.allowEdtiableProfileName) { + if (!profile && !ResourceConfig.match.allowEditableProfileName) { return ; } @@ -101,7 +101,7 @@ export function ProfileForm({ profile, showPreview }: IProps) { label={t('APPS_MATCH_EDIT_PROFILE_NAME')} value={name} handleChange={setName} - allowChange={config.match.allowEdtiableProfileName} + allowChange={ResourceConfig.match.allowEditableProfileName} /> { const settingsApp = useApp('SETTINGS'); - const [config] = useConfig(); + const [config] = usePhoneConfig(); const simcard = useSimcard(); const [settings, setSettings] = useSettings(); const { t } = useTranslation(); diff --git a/phone/src/apps/twitter/components/AddTweetModal.tsx b/phone/src/apps/twitter/components/AddTweetModal.tsx index 5ccea84..314558c 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.tsx +++ b/phone/src/apps/twitter/components/AddTweetModal.tsx @@ -53,14 +53,14 @@ export const AddTweetModal = () => { const Nui = useNuiRequest(); const classes = useStyles(); const { message, setMessage, modalVisible, setModalVisible } = useModal(); - const { config } = usePhone(); + const { ResourceConfig } = usePhone(); const [showEmoji, setShowEmoji] = useState(false); const [showImagePrompt, setShowImagePrompt] = useState(false); const [link, setLink] = useState(''); const [images, setImages] = useState([]); - const { characterLimit, newLineLimit } = config.twitter; + const { characterLimit, newLineLimit } = ResourceConfig.twitter; const reset = () => { setShowImagePrompt(false); @@ -93,7 +93,7 @@ export const AddTweetModal = () => { window.addEventListener('keydown', _handleEscape, true); return () => window.removeEventListener('keydown', _handleEscape); }); - if (!config) return null; + if (!ResourceConfig) return null; const isValidMessage = (message) => { if (message.length > characterLimit) return false; @@ -154,7 +154,7 @@ export const AddTweetModal = () => { setMessage(message.concat(emojiObject.native)); }; - if (!config) return null; + if (!ResourceConfig) return null; return ( @@ -172,7 +172,9 @@ export const AddTweetModal = () => { />
setShowImageError(true); const handleImageLoad = () => setShowImageError(false); - if (!config || !config.twitter.enableAvatars) return null; + if (!ResourceConfig || !ResourceConfig.twitter.enableAvatars) return null; return (
diff --git a/phone/src/apps/twitter/components/buttons/IconButtons.tsx b/phone/src/apps/twitter/components/buttons/IconButtons.tsx index 1964466..d2b6ec5 100644 --- a/phone/src/apps/twitter/components/buttons/IconButtons.tsx +++ b/phone/src/apps/twitter/components/buttons/IconButtons.tsx @@ -20,10 +20,10 @@ const useStyles = makeStyles({ export const IconButtons = ({ onImageClick, onEmojiClick }) => { const classes = useStyles(); - const { config } = usePhone(); + const { ResourceConfig } = usePhone(); - if (!config) return null; - const { enableImages, enableEmojis } = config.twitter; + if (!ResourceConfig) return null; + const { enableImages, enableEmojis } = ResourceConfig.twitter; return (
diff --git a/phone/src/apps/twitter/components/profile/Profile.tsx b/phone/src/apps/twitter/components/profile/Profile.tsx index 01f6510..c12bedf 100644 --- a/phone/src/apps/twitter/components/profile/Profile.tsx +++ b/phone/src/apps/twitter/components/profile/Profile.tsx @@ -26,7 +26,7 @@ export function Profile() { const classes = useStyles(); const { t } = useTranslation(); const { profile } = useProfile(); - const { config } = usePhone(); + const { ResourceConfig } = usePhone(); // note that this assumes we are defensively checking // that profile is not null in a parent above this component. @@ -51,9 +51,9 @@ export function Profile() { }; // fetching the config is an asynchronous call so defend against it - if (!config) return null; + if (!ResourceConfig) return null; - const { enableAvatars, allowEdtiableProfileName } = config.twitter; + const { enableAvatars, allowEditableProfileName } = ResourceConfig.twitter; return (
@@ -69,7 +69,7 @@ export function Profile() { label={t('APPS_TWITTER_EDIT_PROFILE_NAME')} value={name} handleChange={handleNameChange} - allowChange={allowEdtiableProfileName} + allowChange={allowEditableProfileName} /> { const Nui = useNuiRequest(); const { t } = useTranslation(); const [anchorEl, setAnchorEl] = useState(null); - const { config } = usePhone(); + const { ResourceConfig } = usePhone(); - if (!config) return null; + if (!ResourceConfig) return null; const handleClick = (event: React.MouseEvent) => { const element = event.currentTarget; @@ -29,8 +29,8 @@ export const ShowMore = ({ id, isReported, isMine }) => { handleClose(); }; - const allowedToDelete = config.twitter.allowDeleteTweets && isMine; - const allowedToReport = config.twitter.allowReportTweets && !isMine; + const allowedToDelete = ResourceConfig.twitter.allowDeleteTweets && isMine; + const allowedToReport = ResourceConfig.twitter.allowReportTweets && !isMine; // if the user cannot perform any actions in show more then don't // allow them to interact with it diff --git a/phone/src/apps/twitter/components/tweet/Tweet.tsx b/phone/src/apps/twitter/components/tweet/Tweet.tsx index f49f49b..febfe98 100644 --- a/phone/src/apps/twitter/components/tweet/Tweet.tsx +++ b/phone/src/apps/twitter/components/tweet/Tweet.tsx @@ -81,10 +81,10 @@ export const Tweet = (tweet: ITweet) => { } = tweet; const classes = useStyles(); const { t } = useTranslation(); - const { config } = usePhone(); + const { ResourceConfig } = usePhone(); - if (!config) return null; - const { enableAvatars, enableImages } = config.twitter; + if (!ResourceConfig) return null; + const { enableAvatars, enableImages } = ResourceConfig.twitter; // this is a workaround to transfer string new lines and returns that // are stored into the database into html for the UI to render diff --git a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx index 43e68c4..9afe9ad 100644 --- a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx @@ -23,10 +23,10 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => { const textFieldRef = useRef(null); const textFieldInputRef = useRef(null); const classes = useStyles(); - const { config } = usePhone(); + const { ResourceConfig } = usePhone(); const { t } = useTranslation(); - const { characterLimit, newLineLimit } = config.twitter; + const { characterLimit, newLineLimit } = ResourceConfig.twitter; useEffect(() => { textFieldInputRef.current && textFieldInputRef.current.focus(); @@ -46,7 +46,7 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => { [handleChange], ); - if (!config) return null; + if (!ResourceConfig) return null; let errorMessage = null; diff --git a/phone/src/config.autogen.json b/phone/src/config.autogen.json deleted file mode 100644 index 18697d0..0000000 --- a/phone/src/config.autogen.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Locale": "en", - "KeyTogglePhone": 288, - "KeyTakeCall": 38, - "PhoneAsItem": false, - "SwimDestroy": false, - "RunRate": 10, - "DestoryChance": 100, - "DestroyPhoneReCheck": 3, - "notificationPosition": { - "horizontal": "right", - "vertical": "top" - }, - "general": { - "useDashNumber": true - }, - "twitter": { - "showNotifications": true, - "generateProfileNameFromUsers": true, - "allowEdtiableProfileName": true, - "allowDeleteTweets": true, - "allowReportTweets": true, - "characterLimit": 160, - "newLineLimit": 10, - "enableAvatars": true, - "enableEmojis": true, - "enableImages": true, - "maxImages": 3 - }, - "match": { - "generateProfileNameFromUsers": true, - "allowEdtiableProfileName": true - }, - "bank": { - "showNotifications": true - }, - "debug": { - "level": "debug", - "enabled": true - } -} diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/usePhoneConfig.ts similarity index 59% rename from phone/src/config/hooks/useConfig.ts rename to phone/src/config/hooks/usePhoneConfig.ts index 7789a0e..0fb0abe 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/usePhoneConfig.ts @@ -6,7 +6,10 @@ const configState = atom({ default: Default, }); -export const useConfig = (state: any = configState): any => { +// This is NOT the resource config but instead the NUI specific config, +// this means that if there are changs to the config in `../default.json`, +// it will require a rebuild for those to take effect. +export const usePhoneConfig = (state: any = configState): any => { const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { diff --git a/phone/src/os/phone/hooks/state.ts b/phone/src/os/phone/hooks/state.ts index e35284d..0b42183 100644 --- a/phone/src/os/phone/hooks/state.ts +++ b/phone/src/os/phone/hooks/state.ts @@ -1,13 +1,13 @@ import { atom } from 'recoil'; -import { IServerConfig } from '../../../../../typings/config'; +import { ResourceConfig } from '../../../../../typings/config'; export const phoneState = { visibility: atom({ key: 'phoneVisibility', default: false, }), - phoneConfig: atom({ - key: 'phoneConfig', + resourceConfig: atom({ + key: 'resourceConfig', default: null, }), phoneReady: atom({ diff --git a/phone/src/os/phone/hooks/usePhone.ts b/phone/src/os/phone/hooks/usePhone.ts index 172f439..43fed84 100644 --- a/phone/src/os/phone/hooks/usePhone.ts +++ b/phone/src/os/phone/hooks/usePhone.ts @@ -1,13 +1,12 @@ import { useRecoilValue } from 'recoil'; -import { IServerConfig } from '../../../../../typings/config'; -import ServerConfig from '../../../config.autogen.json'; +import { ResourceConfig } from '../../../../../typings/config'; import { useNotifications } from '../../notifications/hooks/useNotifications'; import { useNuiRequest } from 'fivem-nui-react-lib'; import { phoneState } from './state'; import { PhoneEvents } from '../../../../../typings/phone'; interface IUsePhone { - config?: IServerConfig; + ResourceConfig?: ResourceConfig; openPhone(): void; closePhone(): void; isPhoneOpen: boolean; @@ -18,6 +17,7 @@ export const usePhone = (): IUsePhone => { const Nui = useNuiRequest(); const isPhoneOpen = useRecoilValue(phoneState.visibility); const isPhoneReady = useRecoilValue(phoneState.phoneReady); + const config = useRecoilValue(phoneState.resourceConfig); const { removeAlerts } = useNotifications(); @@ -29,5 +29,11 @@ export const usePhone = (): IUsePhone => { Nui.send(PhoneEvents.OPEN_PHONE); }; - return { config: ServerConfig as any, closePhone, openPhone, isPhoneOpen, isPhoneReady }; + return { + ResourceConfig: config as ResourceConfig, + closePhone, + openPhone, + isPhoneOpen, + isPhoneReady, + }; }; diff --git a/phone/src/os/phone/hooks/usePhoneService.ts b/phone/src/os/phone/hooks/usePhoneService.ts index 71fbb88..faf94e3 100644 --- a/phone/src/os/phone/hooks/usePhoneService.ts +++ b/phone/src/os/phone/hooks/usePhoneService.ts @@ -13,11 +13,11 @@ export const usePhoneService = () => { }, [send]); const setVisibility = useSetRecoilState(phoneState.visibility); - const setPhoneConfig = useSetRecoilState(phoneState.phoneConfig); + const setResourceConfig = useSetRecoilState(phoneState.resourceConfig); const setPhoneReady = useSetRecoilState(phoneState.phoneReady); const setPhoneTime = useSetRecoilState(phoneState.phoneTime); useNuiEvent('PHONE', PhoneEvents.SET_VISIBILITY, setVisibility); useNuiEvent('PHONE', PhoneEvents.SET_PHONE_READY, setPhoneReady); - useNuiEvent('PHONE', PhoneEvents.SET_CONFIG, setPhoneConfig); + useNuiEvent('PHONE', PhoneEvents.SET_CONFIG, setResourceConfig); useNuiEvent('PHONE', PhoneEvents.SET_TIME, setPhoneTime); }; diff --git a/phone/src/ui/components/Notification.tsx b/phone/src/ui/components/Notification.tsx index b3fa467..557377d 100644 --- a/phone/src/ui/components/Notification.tsx +++ b/phone/src/ui/components/Notification.tsx @@ -21,13 +21,13 @@ const useStyles = makeStyles({ function Notification({ children, handleClose, open }) { const classes = useStyles(); - const { config } = usePhone(); + const { ResourceConfig } = usePhone(); const currentTheme = usePhoneTheme(); - if (!config) return null; + if (!ResourceConfig) return null; - const { horizontal, vertical } = config.notificationPosition; + const { horizontal, vertical } = ResourceConfig.notificationPosition; return ( diff --git a/phone/yarn.lock b/phone/yarn.lock index 748d3c3..c6f7cfd 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -2514,11 +2514,6 @@ ansi-regex@^2.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= - ansi-regex@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" @@ -3533,15 +3528,6 @@ clean-stack@^2.0.0: resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== -cliui@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" - integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" - cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -3588,11 +3574,6 @@ coa@^2.0.2: chalk "^2.4.1" q "^1.1.2" -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= - collect-v8-coverage@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" @@ -3866,14 +3847,6 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -cp-cli@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/cp-cli/-/cp-cli-2.0.0.tgz#0707ca60bcbf20884b16c2c110484263fa7f922d" - integrity sha512-UfGOwpKeEVfdT+RFBGqlXTPZfHSJn31vaIOvr/YXLk494k6/xWUbN8+YZ2EvM6G8C8dGaU2Hy0nBmYCR5ux15g== - dependencies: - fs-extra "7.0.1" - yargs "12.0.5" - create-ecdh@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" @@ -5504,7 +5477,7 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" -fs-extra@7.0.1, fs-extra@^7.0.0: +fs-extra@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -5611,11 +5584,6 @@ gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" - integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== - get-caller-file@^2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -6296,11 +6264,6 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== - ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" @@ -6493,13 +6456,6 @@ is-extglob@^2.1.0, is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= - dependencies: - number-is-nan "^1.0.0" - is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" @@ -7486,13 +7442,6 @@ last-call-webpack-plugin@^3.0.0: lodash "^4.17.5" webpack-sources "^1.1.0" -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== - dependencies: - invert-kv "^2.0.0" - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -7711,13 +7660,6 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" -map-age-cleaner@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -7754,15 +7696,6 @@ media-typer@0.3.0: resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= -mem@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" - integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^2.0.0" - p-is-promise "^2.0.0" - memory-fs@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -7869,7 +7802,7 @@ mime@^2.4.4: resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.2.tgz#6e3dc6cc2b9510643830e5f19d5cb753da5eeabe" integrity sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg== -mimic-fn@^2.0.0, mimic-fn@^2.1.0: +mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== @@ -8243,11 +8176,6 @@ num2fraction@^1.2.2: resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" integrity sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4= -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= - nwsapi@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" @@ -8465,20 +8393,6 @@ os-browserify@^0.3.0: resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= -os-locale@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" - integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== - dependencies: - execa "^1.0.0" - lcid "^2.0.0" - mem "^4.0.0" - -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= - p-each-series@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.2.0.tgz#105ab0357ce72b202a8a8b94933672657b5e2a9a" @@ -8489,11 +8403,6 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= -p-is-promise@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" - integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== - p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -10258,11 +10167,6 @@ require-from-string@^2.0.2: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" @@ -11077,23 +10981,6 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -string-width@^2.0.0, string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - string-width@^3.0.0, string-width@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" @@ -11186,13 +11073,6 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= - dependencies: - ansi-regex "^3.0.0" - strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" @@ -12363,14 +12243,6 @@ worker-rpc@^0.1.0: dependencies: microevent.ts "~0.1.1" -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" @@ -12431,7 +12303,7 @@ xtend@^4.0.0, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: +y18n@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== @@ -12451,14 +12323,6 @@ yaml@^1.10.0, yaml@^1.7.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yargs-parser@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" - integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - yargs-parser@^13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" @@ -12475,24 +12339,6 @@ yargs-parser@^18.1.2: camelcase "^5.0.0" decamelize "^1.2.0" -yargs@12.0.5: - version "12.0.5" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" - integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== - dependencies: - cliui "^4.0.0" - decamelize "^1.2.0" - find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^3.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^11.1.1" - yargs@^13.3.2: version "13.3.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" diff --git a/resources/client/client.ts b/resources/client/client.ts index 7b192e3..b71a071 100644 --- a/resources/client/client.ts +++ b/resources/client/client.ts @@ -1,8 +1,8 @@ import ClientUtils from './cl_utils'; -import { IServerConfig } from '../../typings/config'; +import { ResourceConfig } from '../../typings/config'; // Setup and export the config for the resource -export const config: IServerConfig = JSON.parse( +export const config: ResourceConfig = JSON.parse( LoadResourceFile(GetCurrentResourceName(), 'config.json'), ); diff --git a/resources/server/server.ts b/resources/server/server.ts index 03e381b..7f81c09 100644 --- a/resources/server/server.ts +++ b/resources/server/server.ts @@ -1,8 +1,8 @@ import { Server } from 'esx.js'; -import { IServerConfig } from '../../typings/config'; +import { ResourceConfig } from '../../typings/config'; // Setup and export config loaded at runtime -export const config: IServerConfig = JSON.parse( +export const config: ResourceConfig = JSON.parse( LoadResourceFile(GetCurrentResourceName(), 'config.json'), ); diff --git a/resources/server/sv_match.ts b/resources/server/sv_match.ts index 68ebf78..569a0d8 100644 --- a/resources/server/sv_match.ts +++ b/resources/server/sv_match.ts @@ -349,7 +349,7 @@ onNet(MatchEvents.GET_MATCHES, async () => { } }); -if (!config.match.allowEdtiableProfileName && !config.match.generateProfileNameFromUsers) { +if (!config.match.allowEditableProfileName && !config.match.generateProfileNameFromUsers) { const warning = `Both allowEdtiableProfileName and generateProfileNameFromUsers ` + `are set false - this means users will likely not have profile names ` + diff --git a/resources/server/sv_twitter.ts b/resources/server/sv_twitter.ts index e602aca..7ae7ce3 100644 --- a/resources/server/sv_twitter.ts +++ b/resources/server/sv_twitter.ts @@ -522,7 +522,7 @@ onNet(TwitterEvents.REPORT, async (tweetId: number) => { } }); -if (!config.twitter.allowEdtiableProfileName && !config.twitter.generateProfileNameFromUsers) { +if (!config.twitter.allowEditableProfileName && !config.twitter.generateProfileNameFromUsers) { const warning = `Both allowEdtiableProfileName and generateProfileNameFromUsers ` + `are set false - this means users will likely not have profile names ` + diff --git a/typings/config.ts b/typings/config.ts index 9ac250a..a8f83ae 100644 --- a/typings/config.ts +++ b/typings/config.ts @@ -1,7 +1,7 @@ interface TwitterConfig { showNotifications: boolean; generateProfileNameFromUsers: boolean; - allowEdtiableProfileName: boolean; + allowEditableProfileName: boolean; allowDeleteTweets: boolean; allowReportTweets: boolean; characterLimit: number; @@ -14,7 +14,7 @@ interface TwitterConfig { interface MatchConfig { generateProfileNameFromUsers: boolean; - allowEdtiableProfileName: boolean; + allowEditableProfileName: boolean; } interface Debug { level: 'error' | 'warn' | 'info' | 'verbose' | 'debug' | 'silly'; @@ -35,12 +35,13 @@ interface BankConfig { showNotifications: boolean; } + interface DatabaseConfig { playerTable: string; identifierColumn: string; } -export interface IServerConfig { +export interface ResourceConfig { database: DatabaseConfig; Locale: string; KeyTogglePhone: number; @@ -48,8 +49,6 @@ export interface IServerConfig { PhoneAsItem: boolean; SwimDestroy: boolean; RunRate: number; - DestoryChance: number; - DestroyPhoneReCheck: number; twitter: TwitterConfig; match: MatchConfig; bank: BankConfig;