mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Feat: Changed SS Basic to Convar
Screenshot Basic token is now set using a replicated convar. i.e +setr "SCREENSHOT_BASIC_TOKEN" "token"
This commit is contained in:
1 parent
0200a68a4e
commit
76a7829370
1 file changed
+6
-4
@@ -1,6 +1,6 @@
|
|||||||
import events from "../utils/events";
|
import events from "../utils/events";
|
||||||
import { Delay } from "../utils/fivem";
|
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
|
const exp = (global as any).exports
|
||||||
|
|
||||||
@@ -111,18 +111,20 @@ onNet(events.CAMERA_SEND_PHOTOS, (photos: string[]) => {
|
|||||||
|
|
||||||
function takePhoto() {
|
function takePhoto() {
|
||||||
const [width, height] = GetActiveScreenResolution();
|
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(
|
exp["screenshot-basic"].requestScreenshotUpload(
|
||||||
"https://api.imgur.com/3/image",
|
"https://api.imgur.com/3/image",
|
||||||
"imgur",
|
"imgur",
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'authorization': `Client-ID ${ tokenData.token }`,
|
'authorization': `Client-ID ${ SCREENSHOT_BASIC_TOKEN }`,
|
||||||
'content-type': 'multipart/form-data'
|
'content-type': 'multipart/form-data'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(data: string) => {
|
(data: string) => {
|
||||||
console.log("herrrrroooooooo")
|
|
||||||
const imageLink = JSON.parse(data).data.link;
|
const imageLink = JSON.parse(data).data.link;
|
||||||
emitNet(events.CAMERA_UPLOAD_PHOTO, imageLink)
|
emitNet(events.CAMERA_UPLOAD_PHOTO, imageLink)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user