Skip to content

Commit

Permalink
tweak: minor stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Dec 28, 2021
1 parent f71facd commit 23d4fba
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
3 changes: 0 additions & 3 deletions dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ The code to set godmode is there, but not working






Pro debug da playerlist:
- comando pra printar: [primeiro,ultimo,count,sum]
- comando get initial
Expand Down
2 changes: 1 addition & 1 deletion menu/src/components/PlayerModal/Tabs/DialogBanView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const DialogBanView: React.FC = () => {

return (
<DialogContent>
<Typography variant="h6" sx={{mb: 2}}>Ban Player</Typography>
<Typography variant="h6" sx={{mb: 2}}>{t("nui_menu.player_modal.ban.title")}</Typography>
<form onSubmit={handleBan}>
<TextField
autoFocus
Expand Down
2 changes: 1 addition & 1 deletion menu/src/components/PlayerModal/Tabs/DialogHistoryView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const DialogHistoryView: React.FC = () => {
},
WHITELIST: {
title: t("nui_menu.player_modal.history.action_types.whitelist"),
color: "#c2293e",
color: "#86c012",
},
"WHITELIST-REVOKED": {
title: t("nui_menu.player_modal.history.action_types.whitelist_revoked"),
Expand Down
12 changes: 6 additions & 6 deletions src/components/webServer/webSocket.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//Requires
const modulename = 'WebSocket';
const xss = require('../../extras/xss')({mark:['class']});
const xss = require('../../extras/xss')({ mark: ['class'] });
const { dir, log, logOk, logWarn, logError } = require('../../extras/console')(modulename);
const {authLogic} = require('./requestAuthenticator');
const { authLogic } = require('./requestAuthenticator');

//Helpers
const getIP = (socket) => {
Expand All @@ -18,7 +18,7 @@ const terminateSession = (socket) => {
try {
socket.emit('goDashboard');
socket.disconnect(0);
} catch (error) {}
} catch (error) { }
};


Expand Down Expand Up @@ -73,7 +73,7 @@ module.exports = class WebSocket {
const logPrefix = `SocketIO:${roomName}`;

//Checking Auth/Perms
const {isValidAuth, isValidPerm} = authLogic(socket.session, room.permission, logPrefix);
const { isValidAuth, isValidPerm } = authLogic(socket.session, room.permission, logPrefix);
if (!isValidAuth || !isValidPerm) {
if (GlobalData.verbose) log('dropping new connection without auth or perm', logPrefix);
//${getIP(socket)} ???
Expand All @@ -83,7 +83,7 @@ module.exports = class WebSocket {
//Setting up event handlers
Object.keys(room.commands).forEach((commandName) => {
socket.on(commandName, (...cmdArgs) => {
const {isValidAuth, isValidPerm} = authLogic(socket.session, room.commands[commandName].permission, logPrefix);
const { isValidAuth, isValidPerm } = authLogic(socket.session, room.commands[commandName].permission, logPrefix);

if (!isValidAuth || !isValidPerm) {
if (GlobalData.verbose) log('dropping existing connection due to missing auth/permissionnew', logPrefix);
Expand All @@ -107,7 +107,7 @@ module.exports = class WebSocket {
if (GlobalData.verbose) log(`Socket error with message: ${error.message}`, 'SocketIO');
});

log(`Connected: ${socket.session.auth.username} from ${getIP(socket)}`, 'SocketIO');
if (GlobalData.verbose) log(`Connected: ${socket.session.auth.username} from ${getIP(socket)}`, 'SocketIO');
} catch (error) {
log(`Error handling new connection: ${error.message}`, 'SocketIO');
socket.disconnect();
Expand Down
7 changes: 5 additions & 2 deletions src/webroutes/authentication/providerRedirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const genCallbackURL = (ctx, provider) => {
return ctx.protocol + '://' + ctx.get('host') + `/auth/${provider}/callback`;
};
const returnJustMessage = (ctx, errorTitle, errorMessage) => {
return ctx.utils.render('login', {template: 'justMessage', errorTitle, errorMessage});
return ctx.utils.render('login', { template: 'justMessage', errorTitle, errorMessage });
};

/**
Expand All @@ -31,7 +31,10 @@ module.exports = async function ProviderRedirect(ctx) {

//Generatte CitizenFX provider Auth URL
try {
const urlCitizenFX = await globals.adminVault.providers.citizenfx.getAuthURL(genCallbackURL(ctx, 'citizenfx'), ctx.session._sessCtx.externalKey);
const urlCitizenFX = await globals.adminVault.providers.citizenfx.getAuthURL(
genCallbackURL(ctx, 'citizenfx'),
ctx.session._sessCtx.externalKey,
);
return ctx.response.redirect(urlCitizenFX);
} catch (error) {
if (GlobalData.verbose) logWarn(`Failed to generate CitizenFX Auth URL with error: ${error.message}`);
Expand Down
2 changes: 1 addition & 1 deletion src/webroutes/authentication/verifyPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = async function AuthVerify(ctx) {
let admin = globals.adminVault.getAdminByName(ctx.request.body.username);
if (!admin) {
logWarn(`Wrong username for from: ${ctx.ip}`);
renderData.message = 'Wrong Password!';
renderData.message = 'Wrong Username!';
return ctx.utils.render('login', renderData);
}
if (!VerifyPasswordHash(ctx.request.body.password.trim(), admin.password_hash)) {
Expand Down

0 comments on commit 23d4fba

Please sign in to comment.