Skip to content

Commit

Permalink
Add desktop branding option to add url suffix during setup
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjv committed Nov 5, 2024
1 parent 4c13be0 commit 983d005
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gui/newwizard/states/serverurlsetupwizardstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ void ServerUrlSetupWizardState::evaluatePage()
userProvidedUrl.prepend(defaultUrlSchemeC);
}

return QUrl::fromUserInput(userProvidedUrl).adjusted(QUrl::RemoveUserInfo);
auto url = QUrl::fromUserInput(userProvidedUrl).adjusted(QUrl::RemoveUserInfo);
const QString serverPathOverride = Theme::instance()->overrideServerPath();
if (!serverPathOverride.isEmpty()) {
url.setPath(serverPathOverride);
}

return url;
}();

// (ab)use the account builder as temporary storage for the URL we are about to probe (after sanitation)
Expand Down
5 changes: 5 additions & 0 deletions src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ QString Theme::overrideServerUrlV2() const
return serverOverride;
}

QString Theme::overrideServerPath() const
{
return {};
}

void Theme::setSystrayUseMonoIcons(bool mono)
{
_mono = mono;
Expand Down
10 changes: 10 additions & 0 deletions src/libsync/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject
*/
QString overrideServerUrlV2() const;

/**
* If set to a non-empty string, the path part of the URL will be overwritten with this path.
* This can be used to set the end-point to a fixed location, and thereby shorten the URL that
* is given to the users.
*
* For example, if the URL for the product always contains `/dav` as the path, and setting that
* here, and the URL given to the user is `example.com`, the branded application will contact
* `example.com/dav`.
*/
virtual QString overrideServerPath() const;

/**
* The default folder name without path on the server at setup time.
Expand Down

0 comments on commit 983d005

Please sign in to comment.