From 76a782937057405da8870a6de0b364dc4d646cae Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 15 Dec 2020 13:42:28 -0500 Subject: [PATCH] Feat: Changed SS Basic to Convar Screenshot Basic token is now set using a replicated convar. i.e +setr "SCREENSHOT_BASIC_TOKEN" "token" --- resources/client/cl_photo.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/client/cl_photo.ts b/resources/client/cl_photo.ts index 7a02ca5..b4792d5 100644 --- a/resources/client/cl_photo.ts +++ b/resources/client/cl_photo.ts @@ -1,6 +1,6 @@ import events from "../utils/events"; import { Delay } from "../utils/fivem"; -import { tokenData } from '../utils/token'; +const SCREENSHOT_BASIC_TOKEN = GetConvar('SCREENSHOT_BASIC_TOKEN', 'none') const exp = (global as any).exports @@ -111,18 +111,20 @@ onNet(events.CAMERA_SEND_PHOTOS, (photos: string[]) => { function takePhoto() { const [width, height] = GetActiveScreenResolution(); - console.log("photo taken") + // Return and log error if screenshot basic token not found + if (SCREENSHOT_BASIC_TOKEN === 'none') { + return console.error('Screenshot basic token not found. Please set in server.cfg'); + } exp["screenshot-basic"].requestScreenshotUpload( "https://api.imgur.com/3/image", "imgur", { headers: { - 'authorization': `Client-ID ${ tokenData.token }`, + 'authorization': `Client-ID ${ SCREENSHOT_BASIC_TOKEN }`, 'content-type': 'multipart/form-data' } }, (data: string) => { - console.log("herrrrroooooooo") const imageLink = JSON.parse(data).data.link; emitNet(events.CAMERA_UPLOAD_PHOTO, imageLink) }