DmACKGL / GCPhone-Rewritten

Improved version of the famous GCPhone resource
GNU General Public License v3.0
26 stars 14 forks source link

Imgur implementation #12

Open alanjo4 opened 3 years ago

alanjo4 commented 3 years ago

Is your feature request related to a problem? Please describe. Since the actual api link was removed, maybe you can implement the same functionality with this docs: https://apidocs.imgur.com/

Describe the solution you'd like You can use this file as a good "example": https://gist.github.com/eirikb/7404666 . But obviously without using jquery because (like) it won't be necessary since we have vue tools and axios method. After implement this approach, you can include in the config file the client ID, the cliente secret, the token and the refresh token to generate the URL.

Describe alternatives you've considered Probably another solution will be that each user create a self-hosted image server, with nodeJS or Java.

DmACKGL commented 3 years ago

I think this is already implemented: https://github.com/DmACKGL/GCPhone-Rewritten/blob/5d2a86d9049ff49b6f25bfe50580196d6ae0d9f9/src_htmlPhone/static/config/config.json#L42 Can you confirm sending an image through the messages app and checking the URL on the Database?

DmACKGL commented 3 years ago

Oh! my bad, I didn't realize what the question was. I'm sorry

DmACKGL commented 3 years ago

These changes should do the trick (i haven't tried yet)

config.lua

      Config.imgurToken = TOKEN

client.lua

      exports['screenshot-basic']:requestScreenshotUpload(data.url, data.field, {
       headers = {
        authorization = 'Client-ID ' .. Config.imgurToken,
        content-type = 'multipart/form-data',
       },
      },
      function(data)
        local resp = json.decode(data)
        DestroyMobilePhone()
        CellCamActivate(false, false)
        cb(json.encode({ url = resp.url }))
      end)

https://github.com/DmACKGL/GCPhone-Rewritten/blob/5d2a86d9049ff49b6f25bfe50580196d6ae0d9f9/resources/gcphone/client/client.lua#L788

alanjo4 commented 3 years ago

I'll try those changes and I'll keep you posted.

FYI when I try to take a photo with twitter app I get this error image

I've screenshot-basic update to the last version and I see that you include this line in config.json: "//": "REQUIRE https://github.com/citizenfx/screenshot-basic or set false",

So when I build the project it's supposed to include the screenshot-basic. Am I right?

DmACKGL commented 3 years ago

Screenshot-basic it's a resource for fivem, you need to put the resource on your resources folder, start it and wait until yarn automatically builds it

alanjo4 commented 3 years ago

Sure, nevermind, the problem with screenshot-basic is not related with gcphone, It seems like my server is not able to run webpack. Thanks!