mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
feat(config): Allow config to be edited without rebuild
This commit is contained in:
1 parent
1a3d02f1e3
commit
a880ae66ea
9 files changed
+19
-11
No files matched your search
@@ -14,6 +14,7 @@ server_script {
|
|||||||
ui_page 'resources/html/index.html'
|
ui_page 'resources/html/index.html'
|
||||||
|
|
||||||
files {
|
files {
|
||||||
|
'config.json',
|
||||||
'resources/html/index.html',
|
'resources/html/index.html',
|
||||||
'resources/html/*.js',
|
'resources/html/*.js',
|
||||||
'resources/html/*.map',
|
'resources/html/*.map',
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import config from '../utils/config';
|
|
||||||
import { sendMessage } from '../utils/messages';
|
import { sendMessage } from '../utils/messages';
|
||||||
import { PhoneEvents } from '../../typings/phone';
|
import { PhoneEvents } from '../../typings/phone';
|
||||||
import { TwitterEvents } from '../../typings/twitter';
|
import { TwitterEvents } from '../../typings/twitter';
|
||||||
@@ -11,6 +10,7 @@ import { BankEvents } from '../../typings/bank';
|
|||||||
import { PhotoEvents } from '../../typings/photo';
|
import { PhotoEvents } from '../../typings/photo';
|
||||||
import { CallEvents } from '../../typings/call';
|
import { CallEvents } from '../../typings/call';
|
||||||
import { MatchEvents } from '../../typings/match';
|
import { MatchEvents } from '../../typings/match';
|
||||||
|
import { config } from './client';
|
||||||
|
|
||||||
let isPhoneOpen = false;
|
let isPhoneOpen = false;
|
||||||
let isPlayerReady = false;
|
let isPlayerReady = false;
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import ClientUtils from './cl_utils';
|
import ClientUtils from './cl_utils';
|
||||||
|
import { IServerConfig } from '../../typings/config';
|
||||||
|
|
||||||
|
// Setup and export the config for the resource
|
||||||
|
export const config: IServerConfig = JSON.parse(
|
||||||
|
LoadResourceFile(GetCurrentResourceName(), 'config.json'),
|
||||||
|
);
|
||||||
|
|
||||||
import './cl_main';
|
import './cl_main';
|
||||||
import './cl_twitter';
|
import './cl_twitter';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { pool } from './db';
|
import { pool } from './db';
|
||||||
import config from '../utils/config';
|
import { config } from './server';
|
||||||
import { mainLogger } from './sv_logger';
|
import { mainLogger } from './sv_logger';
|
||||||
import { Player, Players, PlayersByIdentifier } from './players/sv_players';
|
import { Player, Players, PlayersByIdentifier } from './players/sv_players';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import { Server } from 'esx.js';
|
import { Server } from 'esx.js';
|
||||||
|
import { IServerConfig } from '../../typings/config';
|
||||||
|
|
||||||
|
// Setup and export config loaded at runtime
|
||||||
|
export const config: IServerConfig = JSON.parse(
|
||||||
|
LoadResourceFile(GetCurrentResourceName(), 'config.json'),
|
||||||
|
);
|
||||||
|
|
||||||
import './db';
|
import './db';
|
||||||
import './sv_twitter';
|
import './sv_twitter';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
import config from '../utils/config';
|
import { config } from './server';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
// Needed to manually apply a color to componenent property of log
|
// Needed to manually apply a color to componenent property of log
|
||||||
@@ -13,8 +13,7 @@ const formatLogs = (log: winston.Logform.TransformableInfo): string => {
|
|||||||
return `${log.label} [${log.level}]: ${log.message}`;
|
return `${log.label} [${log.level}]: ${log.message}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const findLogPath = () =>
|
const findLogPath = () => `${path.join(GetResourcePath(GetCurrentResourceName()), 'sv_npwd.log')}`;
|
||||||
`${path.join(GetResourcePath(GetCurrentResourceName()), 'sv_npwd.log')}`;
|
|
||||||
// Initiate the main logger for NPWD
|
// Initiate the main logger for NPWD
|
||||||
|
|
||||||
export const mainLogger = winston.createLogger({
|
export const mainLogger = winston.createLogger({
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ResultSetHeader, RowDataPacket } from 'mysql2';
|
|||||||
|
|
||||||
import { pool } from './db';
|
import { pool } from './db';
|
||||||
import { getIdentifier, getSource } from './functions';
|
import { getIdentifier, getSource } from './functions';
|
||||||
import config from '../utils/config';
|
import { config } from './server';
|
||||||
import { Like, Match, Profile, MatchEvents, NewProfile } from '../../typings/match';
|
import { Like, Match, Profile, MatchEvents, NewProfile } from '../../typings/match';
|
||||||
import { mainLogger } from './sv_logger';
|
import { mainLogger } from './sv_logger';
|
||||||
import { generateProfileName } from './players/sv_players';
|
import { generateProfileName } from './players/sv_players';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ResultSetHeader } from 'mysql2';
|
|||||||
import { pool } from './db';
|
import { pool } from './db';
|
||||||
import { getIdentifier, getSource } from './functions';
|
import { getIdentifier, getSource } from './functions';
|
||||||
import { NewTweet, Tweet, Profile } from '../../typings/twitter';
|
import { NewTweet, Tweet, Profile } from '../../typings/twitter';
|
||||||
import config from '../utils/config';
|
import { config } from './server';
|
||||||
import { reportTweetToDiscord } from './discord';
|
import { reportTweetToDiscord } from './discord';
|
||||||
import { mainLogger } from './sv_logger';
|
import { mainLogger } from './sv_logger';
|
||||||
import { generateProfileName, getDefaultProfileNames } from './players/sv_players';
|
import { generateProfileName, getDefaultProfileNames } from './players/sv_players';
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
import config from '../../config.json';
|
|
||||||
import { IServerConfig } from '../../typings/config';
|
|
||||||
|
|
||||||
export default <IServerConfig>config;
|
|
||||||
Reference in new issue
Block a user