soyware / OpenMarketClient

Unofficial cross-platform console client for: market.csgo.com market.dota2.net tf2.tm rust.tm gifts.tm
GNU General Public License v2.0
8 stars 1 forks source link

Compile error on Ubuntu #20

Open nov-itipa opened 4 months ago

nov-itipa commented 4 months ago

I have compiled in the past a previous version, but the most recent one is giving me issues:


g++ -std=c++17 -O2 -Wall -I../libs/wolfssl -I../libs/curl/include -I../libs/rapidjson/include src/Precompiled.h -o build/linux/Precompiled.h.gch
src/Precompiled.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
mkdir -p build/linux
g++ -std=c++17 -O2 -Wall -include build/linux/Precompiled.h -I../libs/wolfssl -I../libs/curl/include -I../libs/rapidjson/include src/Main.cpp -o build/linux/OpenMarketClient -Wl,-rpath -Wl,/usr/local/lib/ -lpthread -lcurl -lwolfssl -lstdc++fs
src/Main.cpp:146: warning: ignoring #pragma warning  [-Wunknown-pragmas]
  146 | #pragma warning (suppress:4996)
      |
In file included from src/Steam/Steam.h:31,
                 from src/Main.cpp:5:
src/Steam/Guard.h: In function ‘bool Steam::Guard::AcceptConfirmations(CURL*, const char*, const char*, const char*, const char**, size_t)’:
src/Steam/Guard.h:426:23: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  426 |     printf("accepted %u out of %u\n", confirmedCount, offerIdCount);
      |                      ~^               ~~~~~~~~~~~~~~
      |                       |               |
      |                       unsigned int    size_t {aka long unsigned int}
      |                      %lu
src/Steam/Guard.h:426:33: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  426 |     printf("accepted %u out of %u\n", confirmedCount, offerIdCount);
      |                                ~^                     ~~~~~~~~~~~~
      |                                 |                     |
      |                                 unsigned int          size_t {aka long unsigned int}
      |                                %lu
In file included from src/Main.cpp:7:
src/Account.h: In member function ‘bool CAccount::IsRefreshTokenValid()’:
src/Account.h:273:85: error: cannot convert ‘size_t*’ {aka ‘long unsigned int*’} to ‘word32*’ {aka ‘unsigned int*’}
  273 |   if (Base64_Decode((byte*)encJwtPayload, encJwtPayloadPaddedSz, (byte*)jwtPayload, &jwtPayloadSz))
      |                                                                                     ^~~~~~~~~~~~~
      |                                                                                     |
      |                                                                                     size_t* {aka long unsigned int*}
In file included from src/Precompiled.h:49:
/usr/include/wolfssl/wolfcrypt/coding.h:37:40: note:   initializing argument 4 of ‘int Base64_Decode(const byte*, word32, byte*, word32*)’
   37 |                                word32* outLen);
      |                                ~~~~~~~~^~~~~~
make: *** [Makefile:25: build/linux/OpenMarketClient] Error 1```
soyware commented 4 months ago

just change or cast the variables to the requires types

nov-itipa commented 4 months ago

What about this? Also, after successfully compiling with these changes, why am I still needing the extension from market.csgo.com? I thought, enabling OpenMarketClient takes care of not having to run the extension?

diff --git a/src/Account.h b/src/Account.h
index 3e94a1b..2f56725 100644
--- a/src/Account.h
+++ b/src/Account.h
@@ -270,12 +270,18 @@ public:
                char jwtPayload[Base64ToPlainSize(sizeof(encJwtPayload))];
                size_t jwtPayloadSz = sizeof(jwtPayload);

-               if (Base64_Decode((byte*)encJwtPayload, encJwtPayloadPaddedSz, (byte*)jwtPayload, &jwtPayloadSz))
+               // Temporary variable for casting
+               word32 jwtPayloadSz_w32 = static_cast<word32>(jwtPayloadSz);
+
+               if (Base64_Decode((byte*)encJwtPayload, static_cast<word32>(encJwtPayloadPaddedSz), (byte*)jwtPayload, &jwtPayloadSz_w32))
                {
                        Log(LogChannel::GENERAL, "JWT payload decoding failed\n");
                        return false;
                }

+               // Update the original size variable
+               jwtPayloadSz = static_cast<word32>(jwtPayloadSz_w32);
+
                Base64ToBase64URL(jwtPayload, jwtPayloadSz);

                rapidjson::Document docJwtPayload;
@@ -857,4 +863,4 @@ public:

                return allOk;
        }
-};
\ No newline at end of file
+};
nov-itipa commented 4 months ago

If I put items for sale, and just close the tab for tf2 or csgo, OpenMarketClient should handle the rest, right? Yup, looks like, I just need to run this in the background and not worry about the browser extension.

nov-itipa commented 4 months ago

It looks like ping is deprecated: https://market.csgo.com/en/api/content/sell_buy#ping And is replaced by: https://market.csgo.com/en/api/content/sell_buy#ping-new I guess that's why I wasn't able to just keep running OpenMarketClient, still relying on the browser extension.

soyware commented 4 months ago

see https://github.com/soyware/OpenMarketClient/issues/19

nov-itipa commented 4 months ago

Would it be too difficult or bothersome for you to implement the ping-new functionality?