Commit Graph

205 Commits

Author SHA1 Message Date
Chocobo1
ab64ee872b Use QString literals
The plan is to define `QT_NO_CAST_FROM_ASCII` eventually.
PR #16561.
2022-03-04 13:25:22 +08:00
Vladimir Golovnev
dd1bd8ad10 Implement class for handling filesystem paths
PR #15915.
2022-02-08 06:03:48 +03:00
Vladimir Golovnev (Glassez)
399d3ad85a Replace QStringRef with QStringView 2021-07-15 10:56:49 +03:00
HiFiPhile
f5315d9ba7 Add WebUI reverse proxy source IP resolution (#15047)
Co-authored-by: qix67
Co-authored-by: HiFiPhile <admin@hifiphile.com>
2021-06-23 09:01:36 +03:00
Vladimir Golovnev (Glassez)
97c7f3bc67 Raise minimum Qt version to 5.14 2021-06-03 08:56:41 +03:00
Chocobo1
ef79546508 Add connection_speed to advanced settings
Now we follow libtorrent current default value 30.
Closes #6973.

Also bump WebAPI version.
2021-05-21 14:37:57 +08:00
Vladimir Golovnev (Glassez)
61d2ff359b Use QRegularExpression instead of deprecated QRegExp
Now it follows closely the definition of wildcard for glob patterns.
The backslash (\) character is not an escape char in this context.
In order to match one of the special characters, place it in square
brackets (for example, [?]).
2021-03-22 07:50:47 +03:00
Vladimir Golovnev (Glassez)
c41df9ffbd Improve coding style 2020-11-17 21:02:37 +03:00
Mike Tzou
de85b8b552 Merge pull request #12859 from Chocobo1/gif
Move WebUI icons to its own folder
2020-05-21 10:59:52 +08:00
Thomas Piccirello
6e4f49fc57 Always specify Content-Type in Web API error responses 2020-05-19 01:08:06 -07:00
Chocobo1
02c25dbe2a Move WebUI icons to its own folder
After this change: "http://<server>/icons" will point to "src/icons"
folder and "http://<server>/images" points to the real "images" folder
in the relative path.
2020-05-19 14:58:49 +08:00
Chocobo1
be152f45c9 Define and use Http::HeaderMap type 2020-05-11 00:34:28 +08:00
Chocobo1
d57b9be706 Rename function 2020-05-10 02:53:32 +08:00
Chocobo1
74a2168bc1 Define and use a proper HTTP header structure 2020-05-10 02:53:11 +08:00
Chocobo1
957d697aee Prebuild HTTP headers as much as possible
This avoids some branching when building a HTTP response.
2020-05-10 02:50:13 +08:00
Chocobo1
2729c0cb6d Suppress misleading warning message
QString::split() was giving a non-empty QStringList, and
that caused Session::setBannedIPs() to emit misleading warning message.
2020-04-23 21:01:33 +08:00
Chocobo1
bb80b378c1 Add ability to send custom HTTP headers 2020-04-23 12:13:01 +08:00
FranciscoPombal
691d5e5d89 WebUI: Implement "Secure" flag for session cookie
Closes #11724.

Option is enabled by default for users using qBittorrent's built-in HTTPS capabilities. This flag will never be set if qBittorrent is using plain HTTP.

Users using HTTPS reverse proxies, like "qbt <-> (http) <-> proxy <-> (https) <-> user" should override the flag in the proxy in order to set it, if they wish to do so.
2019-12-23 17:58:08 +00:00
Chocobo1
8fe8cbd3d1 Reuse code path in switch cases 2019-11-14 12:14:29 +08:00
Chocobo1
f907328bdc Add const to class function 2019-08-14 20:29:01 +08:00
Chocobo1
230949ee3b Cache and reuse detected MIME type 2019-08-14 17:51:19 +08:00
Chocobo1
7a5e883cd2 Revise inline keyword usage
And let compiler decide whether to inline functions.
2019-07-16 18:42:55 +08:00
Chocobo1
89124bdcc8 Add WebAPI session timeout settings
Raise default timeout to 1 hour.
2019-06-15 18:57:19 +08:00
Chocobo1
e288de7ec1 Forward declare as much as possible 2019-05-19 12:06:18 +08:00
Chocobo1
c6f3da1097 Improve removeIf() to support set types
We can now replace QMutable*Iterator by removeIf() which usage is more consistent with other
algorithm functions.
2019-05-14 01:26:01 +08:00
Chocobo1
bd8d70bf60 Refactor HTTP query parsing 2019-05-09 12:41:30 +08:00
Chocobo1
69d29af097 Fix '+' char not decoded to space correctly
Closes #10606.
2019-05-09 11:17:41 +08:00
Chocobo1
375de4f8a6 Replace QMap with QHash when sensible 2019-05-01 11:09:25 +08:00
Chocobo1
49b57904f9 Use a random number for WebUI cache busting
Also fetch qbt version info via WebAPI properly.
2019-04-18 12:31:23 +08:00
CzBiX
d254a98662 Always use index.html as default page 2019-04-13 18:41:29 +08:00
sledgehammer999
5c63ad3b95 Raise minimum Qt version to 5.9.0 2019-03-04 16:48:49 +02:00
thalieht
8c944bd4e1 Avoid repeating the return type 2019-02-16 18:54:18 +02:00
thalieht
947c7e1d64 Convert to range-based for loop 2019-02-16 16:53:26 +02:00
Vladimir Golovnev (Glassez)
b0446380c6 Separate URL components before percent-decoding
Allow special characters in query string parameters.
Closes #9116.
2019-01-27 15:33:19 +03:00
Vladimir Golovnev (Glassez)
2ce3aa9731 Drop legacy WebAPI support 2019-01-10 20:16:06 +03:00
Chocobo1
e98d4e874f Unify translation files loading action
Since it is possible alternative WebUI could be coded in languages other than English,
WebUI must be able to load user-provided webui_en.qm.
At least one translated string must exist in order to generate an usable .qm file.
2018-12-18 23:14:09 +08:00
Chocobo1
c1912e17c1 Revise CSP header
The majority of the CSP is tuned for built-in WebUI, it may not be
suitable for alternative UI.

Also add QLatin1String to strings. This code path is called repeatedly,
it is worth adding QLatin1String to squeeze out the last bit of
performance.
2018-12-13 15:31:32 +08:00
Chocobo1
7fd30fa90f Enforce referrer-policy in WebUI
This stops leaking private data to other websites via Referrer header.
2018-12-10 22:17:04 +08:00
thalieht
1f36b8b89f Combine qAsConst() with copyAsConst() to asConst() 2018-11-28 23:41:23 +02:00
thalieht
6b1d26d555 Convert all foreach() to range-based for() 2018-11-28 23:40:12 +02:00
Mike Tzou
45cfac6c00 Merge pull request #9891 from Chocobo1/i18n
Fix missing words in WebUI
2018-11-24 10:55:13 +08:00
Chocobo1
b79a231d2e Fix missing words in WebUI
This is because Qt translator returns empty string when the translation
is not provided, now we fallback to the original string from source code.

Closes #9868.
2018-11-23 23:42:20 +08:00
Mike Tzou
70707a2664 Merge pull request #9884 from Piccirello/webui-cookie-samesite
Add SameSite attribute to WebUI session cookie
2018-11-22 10:40:37 +08:00
Thomas Piccirello
cd47380b85 Add SameSite attribute to WebUI session cookie
This attribute prevents the cookie from being submitted on any cross-site request, strongly limiting CSRF.

Closes #9877.
2018-11-20 22:12:24 -05:00
Chocobo1
344e47dcfb Add option for WebUI Host header validation
Closes #9743.
2018-11-19 11:05:04 +08:00
Vladimir Golovnev (Glassez)
f309a5279e Fix Alternative Web UI to be available 2018-10-29 08:32:57 +03:00
Vladimir Golovnev
7e36cc746f Merge pull request #8584 from Piccirello/new-search-api-2
WebUI search API. Closes #2495
2018-10-24 13:13:16 +03:00
Vladimir Golovnev (Glassez)
c1a4ef1377 Use independent translation for WebUI 2018-10-09 11:10:08 +03:00
Thomas Piccirello
0b6ae68801 Add WebUI search API controller
Closes #2495.
2018-09-30 20:07:27 -04:00
Chocobo1
71dcc76a64 Replace png icons with svg 2018-08-14 17:03:14 +08:00