Commit Graph

53 Commits

Author SHA1 Message Date
Ben e3dbdcbdff
HTTP_C::Implement Context::MakeRequest (#4754)
* HTTP_C::Implement Context::MakeRequest

* httplib: Add add_client_cert_ASN1 and set_verify

* HTTP_C: Fix request methode strings case in MakeRequest

* HTTP_C: clang-format and cleanups

* HTTP_C: Add comment about async in BeginRequest and BeginRequestAsync

* Update httplib to contain all the changes we need; adapt http_c and web_services to the changes in httplib; addressed minor review comments

* Add android-ifaddrs
2020-02-21 19:04:04 +01:00
zhupengfei 36051204cc core, web_service: Check for error when registering rooms
The `Register()` function can now handle error results and the error will be passed immediately to the Qt frontend, instead of being ignored silently and failing later with a "Room is not registered".
2019-04-20 12:50:14 +08:00
Weiyi Wang 4a206237be
Merge pull request #4726 from FearlessTobi/port-2312
Port yuzu-emu/yuzu#2312: "general: Use deducation guides for std::lock_guard and std::unique_lock"
2019-04-13 18:00:09 -04:00
Lioncash b7518fc26c web_service: Remove unnecessary inclusions
Reduces the potential amount of rebuilding necessary if any headers
change. In particular, we were including a header from the core library
when we don't even link the core library to the web_service library, so
this also gets rid of an indirect dependency.
2019-04-07 18:27:14 +02:00
Lioncash 21c71d21ae general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities
means that we no longer need to hardcode the mutex type into the locks
themselves, making it easier to switch mutex types, should it ever be
necessary in the future.
2019-04-07 15:14:29 +02:00
zhupengfei 4574bd1e5c
web_service: Change endpoint to `/lobby`.
Preparation for shipping.
2018-12-16 10:48:42 +08:00
zhupengfei 9d062d63da
network, citra_qt: Give moderation permission to community mods
Based on the `roles` payload in the JWT, the rooms will now give mod permission to Citra Community Moderators. To notify the client of its permissions, a new response, IdJoinSuccessAsMod is added, and there's now a new RoomMember::State called Moderator.
2018-12-15 20:28:03 +08:00
zhupengfei 386bf5c861
citra_qt: Use the new verify backend; UI changes
Displayed username along with nickname (when they are not identical); Requested and displayed user's avatar; Made the dialog bigger for extended names.

Added a few functions to web_backend (GetImage, GetPlain) to support getting data in multiple content-types.

Added a no_avatar icon for users without avatars.
2018-12-15 11:02:54 +08:00
zhupengfei e04f75e1bf
web_backend: added GetExternalJWT function
To support requesting external JWTs to use them as verification tokens.
2018-12-15 11:02:53 +08:00
zhupengfei ab335ccf1b
core, web_service: Changes to announce service
Separated registering and updating to correspond to the new announce API endpoint. Also added a verify_UID for JWT audience verification.
2018-12-15 11:02:52 +08:00
zhupengfei 1a8841f96e
network, web_service: Add Verification backend and use new lobby API
Added verify_backend to load user_data for members. and removed method to generate UID as this is now done server-side.

Added GetUsername function and a "token" param to room_member.
Also added a username to ChatEntry, so that the username can be shown (along with nicknames) in the chat dialog.
2018-12-15 11:02:51 +08:00
adityaruplaha 5f0e189238
Add Support for Room Descriptions 2018-12-15 11:02:50 +08:00
fearlessTobi b7117bf050 compatdb: Use a seperate endpoint for testcase submission 2018-10-27 12:20:03 +02:00
Weiyi Wang 59cb0ec570
Merge pull request #4359 from FearlessTobi/port-webstuff
web_service: Port yuzu-emu/yuzu#1465 and Port yuzu-emu/yuzu#1473 (Many self-contained changes)
2018-10-26 22:34:51 -04:00
fearlessTobi d28233961b Put WebResult into a seperate file 2018-10-27 00:39:02 +02:00
Lioncash 9f6c1b058a CMakeLists: Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
This is more localized to what we want to enforce directory-wise with
the project. CMAKE_SOURCE_DIR indicates the root of the source tree, but
this would cause the wrong behavior if someone included yuzu as part of
a larger buildsystem (for whatever reason). Instead, we want to use the
directory where the "project(yuzu)" command was declared as the root
path reference.
2018-10-27 00:20:52 +02:00
Lioncash 8b98560ebb web_backend: Make Client use the PImpl idiom
Like with TelemetryJson, we can make the implementation details private
and avoid the need to expose httplib to external libraries that need to
use the Client class.
2018-10-23 15:42:22 +02:00
Lioncash 25038aeb0d telemetry_json: Use the PImpl idiom to avoid unnecessary dependency exposure
Users of the web_service library shouldn't need to care about an
external library like json.h. However, given it's exposed in our
interface, this requires that other libraries publicly link in the JSON
library. We can do better.

By using the PImpl idiom, we can hide this dependency in the cpp file
and remove the need to link that library in altogether.
2018-10-23 15:35:17 +02:00
Lioncash 131ce59800 telemetry_json: Add missing override specifier to the destructor of TelemetryJson 2018-10-23 15:33:41 +02:00
Lioncash 8747d93f6a telemetry_json: Take std::string parameters by value
Taking them by const reference isn't advisable here, because it means
the std::move calls were doing nothing and we were always copying the
std::string instances.
2018-10-23 15:33:34 +02:00
Lioncash c9013c481a telemetry_json: Remove unnecessary includes
Removes unused includes. Also rectifies a missing <chrono> include.
2018-10-23 15:33:18 +02:00
Weiyi Wang 65ec8de31e web_service: hide dependencies to private 2018-10-20 10:47:17 -04:00
fearlessTobi 57d68bb541 Address review comments 2018-10-20 10:35:55 -04:00
fearlessTobi 7daac96862 Review comments - part 5 2018-10-20 10:35:55 -04:00
fearlessTobi 9901b289b6 Review comments -part 4 2018-10-20 10:35:55 -04:00
fearlessTobi 08793a6dae Review comments - part 3 2018-10-20 10:35:55 -04:00
fearlessTobi b0aed19823 Address a bunch of review comments 2018-10-20 10:35:55 -04:00
Weiyi Wang f3d59556ef web_backend: protect jwt cache with a mutex 2018-09-17 14:28:58 -04:00
Weiyi Wang 77c1f647cb web_service: stop using std::future + callback style async 2018-09-13 16:14:34 -04:00
fearlessTobi b82bf1ccdb Change variable name to web_api_url 2018-09-12 19:07:06 +02:00
fearlessTobi d408f89a91 Rename announce-url, use variable for JWT retrieval url 2018-09-05 03:07:04 +02:00
Tobias 604c1b5fc3
web_service: Change authentication system to use JWT (#4041)
* Change authentication system to JWT

* Address review comments
* Get rid of global variable, fix some documentations, fix a bug when verificating
* Refactor PostJson to avoid code duplication
* Rename jwt_token, add functionality to request a new JWT when getting a 401
* Take bools by value instead of const reference
* Send request again when JWT is invalid and use forward declarations
* Omit brackets
2018-08-25 21:39:23 +02:00
wwylele 0eab948728 reformat all files with clang-format 2018-06-29 16:56:12 +03:00
wwylele 7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
James d184a3a1ee Update cpp-httplib for gzip + chunked encoding fixes 2018-06-14 16:00:07 +10:00
Lioncash 38b9d1780f verify_login: Make VerifyLogin exceptionless
This function can be simplified by attempting to find the username
within the JSON object and then only accessing it if it does. There's no
need to blindly access the data itself.

This also eliminates the need to copy the string to a local as well,
since we already have the element itself, we can just compare against
it. For the failure case, it's the same if we were checking that the
provided username string is empty.
2018-03-28 21:34:21 -04:00
Daniel Lim Wee Soong c82cd30f62 web_service: Migrate logging macros
Follow-up of #3533

Replace prefix of all logging macros from LOG to NGLOG
2018-03-25 15:35:06 +08:00
James 9283053701 Move WebServices to use LibreSSL + cpp-httplib (#3501)
Move WebServices to use LibreSSL + cpp-httplib

Remove curl + openssl build dependencies
2018-03-24 13:19:35 -06:00
hubslave 93fd55249b Fix build on platforms without std::string_view
json.hpp wants it, but it isn't always available. Rather than patch
json.hpp directly to remove the dependency, provide a json.h wrapper
header that subs in std::experimental::string_view using preprocessor
magic. All the consumers of json.hpp are in src/web_service, so the
wrapper header is placed there as well.
2018-03-02 18:15:45 +02:00
B3n30 eba2351f9e Announce-Service: Add conditional variable for the wait in the announce thread 2017-12-14 12:36:37 +01:00
B3n30 93742f17b3 fixup! fixup! Add a service to announce multiplayer rooms to web service; Add the abiltiy to receive a list of all announced rooms from web service 2017-12-14 12:36:37 +01:00
B3n30 0432fc17eb Add a service to announce multiplayer rooms to web service; Add the abiltiy to receive a list of all announced rooms from web service 2017-12-14 12:36:37 +01:00
Lioncash ab021d163e CMakeLists: Derive the source directory grouping from targets themselves
Removes the need to store to separate SRC and HEADER variables,
and then construct the target in most cases.
2017-12-11 21:11:52 -05:00
B3n30 28c726f205 WebService: Verify username and token (#2930)
* WebService: Verify username and token; Log errors in PostJson

* Fixup: added docstrings to the functions

* Webservice: Added Icons to the verification, imrpved error detection in cpr, fixup nits

* fixup: fmt warning
2017-09-18 21:18:26 -04:00
bunnei 7698567fc9 web_backend: Fix CPR bug where Winsock is not properly initializing. 2017-08-26 19:45:41 -04:00
bunnei c8562b21d9 web_backend: Fix asynchronous JSON post by spawning new thread. 2017-08-25 23:37:47 -04:00
bunnei 04bd0c957e web_services: Refactor to remove dependency on Core. 2017-08-25 23:10:02 -04:00
bunnei 41328afb58 web_backend: User config for username and token, support anonymous post. 2017-08-25 23:10:01 -04:00
bunnei 28c3575679 web_backend: Specify api-version on JSON post. 2017-07-11 18:34:30 -04:00
bunnei 8af3ebb149 telemetry_session: Use TelemetryJson to submit real telemetry. 2017-07-11 18:33:40 -04:00