271 Commits

Author SHA1 Message Date
Alexander Tkachov
7798c2af9f CLOUD: Prepare #4860 to merge
- regenerate themes .zips;
- minor cleanup.
2023-04-08 16:20:11 +02:00
Alexander Tkachov
f08da80efa CLOUD: Add another connectStorage() version
This new version looks for "storage" key in JSON and uses it to determine which storage needs to be connected.
2023-04-08 16:20:11 +02:00
Alexander Tkachov
24407665ab CLOUD: Add new flow constructors for OD, Box, GD 2023-04-08 16:20:11 +02:00
Alexander Tkachov
b4dd48f395 CLOUD: Add new flow (WIP)
- allow OPTIONS HTTP method to be handled by local webserver;
- add /connect_cloud endpoint;
- add new DropboxStorage constructor that works with JSON response instead of requesting that via shortcode;
- add CloudManager::connectStorage() overload for this new JSON flow.

/connect_cloud endpoint allows cross-origin request (via CORS HTTP headers) from cloud.scummvm.org, so user's browser sends the JSON response directly to ScummVM app, instead of the app requesting that response from the site.

This commit is WIP, introducing a new constructor for Dropbox only, and not changing the GUI part at all.
2023-04-08 16:20:11 +02:00
Cameron Cawley
28d7b361ea COMMON: Move more file format code into common/formats 2022-12-11 22:33:23 +01:00
Alexander Tkachev
09639e7f23 GUI: Add files amount to SaveLoadCloudSyncProgressDialog
Also adds Cloud::Storage::SyncDownloadingInfo struct to pass around a bunch of numbers instead of having 3 methods for each number (in CloudManager, Storage and SavesSyncRequest).
2022-08-02 22:08:19 +02:00
Alexander Tkachev
85739018fe GUI: Show bytes sizes in saves sync dialog
And also makes percentage calculated based on bytes sizes, not files count.
2022-08-02 22:08:19 +02:00
Alexander Tkachev
645e1a0c83 CLOUD: Make cloud sync load timestamps less
No need to reload the timestamps file all time (invalidating save file manager's cache) -- it's loaded once in the beginning of a sync and then is updated one file at a time.
2022-08-02 22:08:19 +02:00
Alexander Tkachev
6901e941aa CLOUD: Fix #11244: Crash when loading a save from the launcher
Removing GUI::CommandSender from SavesSyncRequest, so it doesn't update SaveLoadCloudSyncProgressDialog or SaveLoadChooserDialog from another thread.

Instead, these two are now polling CloudMan once per second themselves.
2022-08-02 22:08:19 +02:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Eugene Sandulenko
fa685f83ac
CLOUD: Fix overridden methods 2021-12-01 00:30:47 +01:00
Eugene Sandulenko
65020829fc
BACKENDS: CLOUD: Fix overridden methods 2021-11-18 22:38:42 +01:00
Orgad Shaneh
44219dfa1a BACKENDS: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Orgad Shaneh
b11c5ace90 BACKENDS: JANITORIAL: Remove 'virtual' when override is specified 2021-11-14 14:31:41 +02:00
Alexandre Detiste
6044504762 JANITORIAL: typos
some in the variable names, some in the comments;
no change for the strings that interract with original games assets
2021-10-31 20:46:31 +01:00
Orgad Shaneh
db7699228c MISC: Fix printf long/int64 type mismatches
Cast to [unsigned] long.
2021-10-23 02:48:27 +03:00
D G Turner
b5c3a179c7 CLOUD: Fix for GCC Warnings from 64-bit Stream API Changes 2021-07-09 04:36:14 +01:00
Martin Gerhardy
36afa639a4 EVENTRECORDER: skip some getMillis for the event recorder
they are running as event source and would bring the event recorder into an out-of-sync state
2021-07-08 15:05:35 +02:00
Orgad Shaneh
a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Orgad Shaneh
50f7d7d017 CLOUD: Fix compiler warnings on linux64
uint64 is unsigned long on linux64 (first match in
configure:find_type_with_size), so the format should be lu, but this is
incompatible with Win64, so just cast to make it portable and warning-
clean.

Amends commit 1496ad6bb5.
2021-04-09 18:19:28 +01:00
Orgad Shaneh
1496ad6bb5 CLOUD: Fix format for uint64 variables 2021-03-25 08:23:44 +02:00
SupSuper
70dc08f46e JANITORIAL: Cleanup inconsistent includes 2021-02-22 10:54:07 +00:00
Alexander Tkachov
8c16575035 CLOUD: Update Dropbox to use refresh_token
Dropbox is switching to short-lived access_token OAuth. This commit adapts Cloud::DropboxStorage to use refresh_token similarly to how other Storages do: by introducing a DropboxTokenRefresher.

It is used instead of plain CurlJsonRequest. It just checks if received JSON has access_token-related error and tries to refresh it, then repeats the original request transparently for the caller. If no such errors found, it just passes the info to the caller.
2021-02-04 01:57:48 +01:00
aryanrawlani28
4b6976c558 GUI: U32: Reduce number of files changed and fixes
Up until last commit, everything was working fine but the amount of files changed was too large. This commit tries to reduce the changes.

- Add a fake constructor to Keymap, text-to-speech, setDescription (save-state)
- Redirecting functions for PopUpWidget::appendEntry, ButtonWidget::setLabel, GUIErrorMessage
- Use the above functions and constructors to reduce changes in Engines
- Fix warnings being in unicode. Only output english text in - Warnings, Errors, etc.
- Mark some strings as "translation" strings. (Not yet added to POTFILES)
- Remove some CP related things from po/modules.mk
- Previously used some Common::convertToU32 where it was not necessary, replace this with u32constructor
2020-08-30 14:43:41 +02:00
aryanrawlani28
185fb72783 GUI: U32: Improve U32 code
- Revert accidentally put translations in mt32.cpp
- Use U32::format in some places earlier missed
- Add %u and %i for u32::format
- Add support for GUIErrorMsgFormat to use u32::format internally
- Use the above whereever needed
- Improve linux tts by removing redundant code
- Some places I had changed nullptr -> "". Revert this
2020-08-30 14:43:41 +02:00
aryanrawlani28
b9a449480b GUI: U32: Remove u32::format references
- Removed because implicit conversion can simply handle this usecase
2020-08-30 14:43:41 +02:00
aryanrawlani28
f800ca4ada GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes.

- Return U32String from TransMan getTranslation()
- Change tooltips to be U32Strings
- Remove temporary code of convertToU32String
- U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc)
- U32 for music plugins
- U32 for OSD messages
- Add some helper functions to ustr.cpp
- Change default tooltips from nullptr & 0 -> ""
- Some runtime exceptions may occur when changing languages due to incorrect String::Format
2020-08-30 14:43:41 +02:00
Thanasis Antoniou
f971e1e4a8 GUI: OPTIONS: Cloud storage list populated with translated string on addCloudControls()
Resolves a bug with displaying the wrong (previous) translation when switch theme language

Previously, a translated string was stored in cloudmanager _storages config items, which would become stale if the theme language was changed.
2020-02-09 22:06:19 +02:00
Bastien Bouclet
edf82fea97 CLOUD: Remove the saves sync finished OSD message
It's not very good for immersion when it appears after an autosave. The
cloud icon is a good enough indication that cloud synchronization
happened.
2019-11-15 19:32:59 +01:00
Bastien Bouclet
c847476a93 CLOUD: Only download saves when necessary
Prevents the save/load dialog from refreshing and loosing the selection
when there is no file to download.
2019-11-10 11:06:08 +01:00
D G Turner
f47a58ba64 CLOUD: Add Missing Default Switch Cases
These are flagged by GCC if -Wswitch-default is enabled.
2019-10-04 00:08:14 +01:00
D G Turner
78495ae462 CLOUD: Fix MSVC Warning in Google Drive Token Refresher
This was reported by Henke37 on IRC.
2019-09-15 23:56:51 +01:00
Alexander Tkachev
5b5a89e3e7 CLOUD: Make Network::ErrorResponse messages more verbose
This commit updates all usages of Network::ErrorResponse to specify at
least method name if not precise reason why operation failed.
2019-08-25 12:15:14 +03:00
Alexander Tkachev
24b1ec0ded CLOUD: Handle HTTP response headers case-insensitively
RFC 2616 states that HTTP headers are not case-sensitive and also allows
arbitrary number of whitespace characters around header value. Previous
implementation was dependant on headers to be in "Title-Case" and to
have only one space before header value. That has lead to cloud sync
failure on Debian x64 (user's network environment was probably the
reason though).

This commit adds a new method, which parses headers name-value pairs
into HashMap. To ensure case-insensitivity, all headers names are
converted to lowercase, and thus code that uses this method should
specify headers in lowercase. All usages of raw headers contents were
updated to use this method.
2019-08-25 12:15:14 +03:00
D G Turner
fb54cc1f77 CLOUD: Fix Inverted Test Regression in Debug Message Code
This was introduced by my previous commit to this where I accidently
inverted the tests during refactoring.
2019-08-24 16:59:17 +01:00
Alexander Tkachev
1c0b697a59 CLOUD: Fix OneDriveTokenRefresher
If user doesn't have a "saves" folder, listing it as a first step of
syncing save files would result in 404 from OneDrive.
OneDriveTokenRefresher handles token-related errors (401), so when it
meets 404, it calls its finishError method. But because there was some
strange behaviour from OneDrive with sending invalid JSON, this method
tries fixing JSON and parsing it again. If it is valid, it calls
non-error method again, and in result we get stack overflow.

In order to fix that, I've added a non-JSON prefix "<irrecoverable>", so
finishError won't be able to parse JSON and thus won't call finishJson
again. Saves syncing callback does check string contents apart from
trying to parse JSON, so it still works and correctly handles the
situation when "saves" directory is missing. But, if needed, code can be
updated to search for the prefix I've added and remove it before parsing
original JSON.
2019-08-04 04:36:59 +07:00
D G Turner
466b162996 CLOUD: Fix GCC Compilation Warning in Debug Code.
The warning emitted here was due to debug() call with an empty format
string, so this could have been fixed by replacing this with "%s", "".

However, this change should be better since it avoids the duplication
of the number of file check over several lines and reduces the string
duplication i.e. DRY improvements.
2019-08-03 14:52:57 +01:00
Alexander Tkachev
f6a17e679f CLOUD: Ask user to manually enable Storage
For more security, newly connected Storage only gets username/used space
information and is disabled until user manually presses the button.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
85431c39bf CLOUD: Change interaction with /refresh endpoint
Refresh token is now passed as custom HTTP header, not in GET parameter,
to prevent them being written into server logs.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
e7ca2b8db0 CLOUD: Ignore hidden files in sync/download
In PR#1754 we've discussed and decided to ignore hidden (having a name
starting with '.') files while syncing saves or downloading game files.
This commit adds a CloudManager method to test whether file should be
ignored, and this method could be extended later if we need to ignore
some other specific file names.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
16d97b6948 CLOUD: Minor fixes for the PR#1754
- added missing 'd' in "%d" in SavesSyncRequest;
- removed trailing ',' in enum in gui/options.h;
- fixed #endif to have // before USE_LIBCURL in gui/options.h.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
99c2418d1a GUI: Rewrite Cloud tab
- StorageWizardDialog is removed, along with bmps it was using;
- EditTextWidget now accepts custom font in constructor;
- ScrollContainer scrollbar now jumps to top when content height changes
so it's "overscrolled";
- IndexPageHandler now does not awaits for `code` GET-parameter, as
local webserver is no longer used to connect Storages;
- CloudManager and all corresponding Storages are updated to support
disconnecting and to notify about successful connection.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
31628d6428 CLOUD: Refactor BaseStorage largest methods
Not sure if that's really better, but it was really annoying to
copy-paste `delete a; delete b; return;` in every error-handling
section.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
72c7f8226c CLOUD: Minor cleanup in OneDriveTokenRefresher 2019-07-30 14:51:41 -04:00
Alexander Tkachev
1e92e7b9f3 CLOUD: Fix saves syncing
This mostly affects OneDrive saves syncing, because it is the only cloud
provider to return 0 as timestamp of (non-)created file. 0 is treated as
EOF in /saves/timestamps file, thus all timestamps after such 0
timestamps were ignored and files were reuploaded as being "new". This
commit also adds more verbose debug information on SavesSyncRequest
decisions making for easier debugging.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
edbea10c2e CLOUD: Fix OneDriveStorage API interaction
Something changed and old API endpoint "api.onedrive.com" now does not
work. The other one, "graph.microsoft.com", does, but there were some
other changes in JSON it returns. These changes are also in this commit.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
e8669f693c CLOUD: Update BaseStorage to expect no refresh_token
While refreshing access_token, some cloud providers also pass a new
refresh_token. Google Drive does not, and accepts the same refresh_token
next time. These changes allow this to happen.
2019-07-30 14:51:41 -04:00
Alexander Tkachev
60504dce75 CLOUD: Update storages to refresh token via cloud.scummvm.org 2019-07-30 14:51:41 -04:00
Alexander Tkachev
4a427faf9c CLOUD: Get rid of 'dists/clouds/cloud_keys.h' 2019-07-30 14:51:41 -04:00
Alexander Tkachev
0ee0e2d537 CLOUD: Update GoogleDriveStorage and BoxStorage to auth via cloud.scummvm.org 2019-07-30 14:51:41 -04:00