Skip to content

Commit

Permalink
feat(resources): added support for identifier prefix for older esx ve…
Browse files Browse the repository at this point in the history
…rsions. (#244)
  • Loading branch information
ImBaphomettt authored Jun 9, 2021
1 parent 6a3bef1 commit 94633e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"enableMultiChar": false
},
"database": {
"useIdentifierPrefix": false,
"playerTable": "users",
"identifierColumn": "identifier"
},
Expand Down
5 changes: 4 additions & 1 deletion resources/server/utils/getPlayerGameLicense.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { config } from '../server';

export const getPlayerGameLicense = (src: number): null | string => {
// Parse specifically for license identifier as its
// guaranteed
Expand All @@ -6,7 +8,8 @@ export const getPlayerGameLicense = (src: number): null | string => {
let playerIdentifier;
for (const identifier of playerIdentifiers) {
if (identifier.includes('license:')) {
playerIdentifier = identifier.split(':')[1];
if (config.database.useIdentifierPrefix) playerIdentifier = identifier;
else playerIdentifier = identifier.split(':')[1];
}
}

Expand Down
3 changes: 2 additions & 1 deletion typings/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface MatchConfig {
generateProfileNameFromUsers: boolean;
allowEditableProfileName: boolean;
}

interface Debug {
level: 'error' | 'warn' | 'info' | 'verbose' | 'debug' | 'silly';
enabled: boolean;
Expand All @@ -35,10 +36,10 @@ interface BankConfig {
showNotifications: boolean;
}


interface DatabaseConfig {
playerTable: string;
identifierColumn: string;
useIdentifierPrefix: boolean;
}

export interface ResourceConfig {
Expand Down

0 comments on commit 94633e5

Please sign in to comment.