Explorar el Código

remove dead code around overriding dav path in URL

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Matthieu Gallien hace 4 años
padre
commit
c40d276770
Se han modificado 5 ficheros con 30 adiciones y 81 borrados
  1. 30 49
      src/cmd/cmd.cpp
  2. 0 10
      src/libsync/account.cpp
  3. 0 3
      src/libsync/account.h
  4. 0 10
      src/libsync/theme.cpp
  5. 0 9
      src/libsync/theme.h

+ 30 - 49
src/cmd/cmd.cpp

@@ -75,7 +75,6 @@ struct CmdOptions
     bool useNetrc;
     bool interactive;
     bool ignoreHiddenFiles;
-    bool nonShib;
     QString exclude;
     QString unsyncedfolders;
     QString davPath;
@@ -188,8 +187,6 @@ void help()
     std::cout << "  --password, -p [pass]  Use [pass] as password" << std::endl;
     std::cout << "  -n                     Use netrc (5) for login" << std::endl;
     std::cout << "  --non-interactive      Do not block execution with interaction" << std::endl;
-    std::cout << "  --nonshib              Use Non Shibboleth WebDAV authentication" << std::endl;
-    std::cout << "  --davpath [path]       Custom themed dav path, overrides --nonshib" << std::endl;
     std::cout << "  --max-sync-retries [n] Retries maximum n times (default to 3)" << std::endl;
     std::cout << "  --uplimit [n]          Limit the upload speed of files to n KB/s" << std::endl;
     std::cout << "  --downlimit [n]        Limit the download speed of files to n KB/s" << std::endl;
@@ -263,10 +260,6 @@ void parseOptions(const QStringList &app_args, CmdOptions *options)
             options->exclude = it.next();
         } else if (option == "--unsyncedfolders" && !it.peekNext().startsWith("-")) {
             options->unsyncedfolders = it.next();
-        } else if (option == "--nonshib") {
-            options->nonShib = true;
-        } else if (option == "--davpath" && !it.peekNext().startsWith("-")) {
-            options->davPath = it.next();
         } else if (option == "--max-sync-retries" && !it.peekNext().startsWith("-")) {
             options->restartTimes = it.next().toInt();
         } else if (option == "--uplimit" && !it.peekNext().startsWith("-")) {
@@ -328,7 +321,6 @@ int main(int argc, char **argv)
     options.useNetrc = false;
     options.interactive = true;
     options.ignoreHiddenFiles = false; // Default is to sync hidden files
-    options.nonShib = false;
     options.restartTimes = 3;
     options.uplimit = 0;
     options.downlimit = 0;
@@ -352,14 +344,6 @@ int main(int argc, char **argv)
         options.target_url.append("/");
     }
 
-    if (options.nonShib) {
-        account->setNonShib(true);
-    }
-
-    if (!options.davPath.isEmpty()) {
-        account->setDavPath(options.davPath);
-    }
-
     if (!options.target_url.contains(account->davPath())) {
         options.target_url.append(account->davPath());
     }
@@ -461,41 +445,38 @@ int main(int argc, char **argv)
     account->setUrl(url);
     account->setSslErrorHandler(sslErrorHandler);
 
-    // Perform a call to get the capabilities.
-    if (!options.nonShib) {
-        // Do not do it if '--nonshib' was passed. This mean we should only connect to the 'nonshib'
-        // dav endpoint. Since we do not get the capabilities, in that case, this has the additional
-        // side effect that chunking-ng will be disabled. (because otherwise it would use the new
-        // 'dav' endpoint instead of the nonshib one (which still use the old chunking)
-
-        QEventLoop loop;
-        auto *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
-        QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
-            auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject();
-            qDebug() << "Server capabilities" << caps;
-            account->setCapabilities(caps.toVariantMap());
-            account->setServerVersion(caps["core"].toObject()["status"].toObject()["version"].toString());
-            loop.quit();
-        });
-        job->start();
-        loop.exec();
-
-        if (job->reply()->error() != QNetworkReply::NoError){
-            std::cout<<"Error connecting to server\n";
-            return EXIT_FAILURE;
-        }
-
-        job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/user"));
-        QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
-            const QJsonObject data = json.object().value("ocs").toObject().value("data").toObject();
-            account->setDavUser(data.value("id").toString());
-            account->setDavDisplayName(data.value("display-name").toString());
-            loop.quit();
-        });
-        job->start();
-        loop.exec();
+    // Do not do it if '--nonshib' was passed. This mean we should only connect to the 'nonshib'
+    // dav endpoint. Since we do not get the capabilities, in that case, this has the additional
+    // side effect that chunking-ng will be disabled. (because otherwise it would use the new
+    // 'dav' endpoint instead of the nonshib one (which still use the old chunking)
+
+    QEventLoop loop;
+    auto *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
+    QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
+        auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject();
+        qDebug() << "Server capabilities" << caps;
+        account->setCapabilities(caps.toVariantMap());
+        account->setServerVersion(caps["core"].toObject()["status"].toObject()["version"].toString());
+        loop.quit();
+    });
+    job->start();
+    loop.exec();
+
+    if (job->reply()->error() != QNetworkReply::NoError){
+        std::cout<<"Error connecting to server\n";
+        return EXIT_FAILURE;
     }
 
+    job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/user"));
+    QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
+        const QJsonObject data = json.object().value("ocs").toObject().value("data").toObject();
+        account->setDavUser(data.value("id").toString());
+        account->setDavDisplayName(data.value("display-name").toString());
+        loop.quit();
+    });
+    job->start();
+    loop.exec();
+
     // much lower age than the default since this utility is usually made to be run right after a change in the tests
     SyncEngine::minimumFileAgeForUpload = std::chrono::milliseconds(0);
 

+ 0 - 10
src/libsync/account.cpp

@@ -59,7 +59,6 @@ const char app_password[] = "_app-password";
 Account::Account(QObject *parent)
     : QObject(parent)
     , _capabilities(QVariantMap())
-    , _davPath(Theme::instance()->webDavPath())
 {
     qRegisterMetaType<AccountPtr>("AccountPtr");
     qRegisterMetaType<Account *>("Account*");
@@ -560,15 +559,6 @@ void Account::setServerVersion(const QString &version)
     emit serverVersionChanged(this, oldServerVersion, version);
 }
 
-void Account::setNonShib(bool nonShib)
-{
-    if (nonShib) {
-        _davPath = Theme::instance()->webDavPathNonShib();
-    } else {
-        _davPath = Theme::instance()->webDavPath();
-    }
-}
-
 void Account::writeAppPasswordOnce(QString appPassword){
     if(_wroteAppPassword)
         return;

+ 0 - 3
src/libsync/account.h

@@ -124,8 +124,6 @@ public:
      * @returns the (themeable) dav path for the account.
      */
     QString davPath() const;
-    void setDavPath(const QString &s) { _davPath = s; }
-    void setNonShib(bool nonShib);
 
     /** Returns webdav entry URL, based on url() */
     QUrl davUrl() const;
@@ -329,7 +327,6 @@ private:
 
     static QString _configFileName;
 
-    QString _davPath; // defaults to value from theme, might be overwritten in brandings
     ClientSideEncryption _e2e;
 
     /// Used in RemoteWipe

+ 0 - 10
src/libsync/theme.cpp

@@ -643,16 +643,6 @@ bool Theme::wizardSelectiveSyncDefaultNothing() const
     return false;
 }
 
-QString Theme::webDavPath() const
-{
-    return QLatin1String("remote.php/dav/");
-}
-
-QString Theme::webDavPathNonShib() const
-{
-    return QLatin1String("remote.php/nonshib-webdav/");
-}
-
 bool Theme::linkSharing() const
 {
     return true;

+ 0 - 9
src/libsync/theme.h

@@ -337,15 +337,6 @@ public:
      */
     virtual bool wizardHideExternalStorageConfirmationCheckbox() const;
 
-    /**
-     * Alternative path on the server that provides access to the webdav capabilities
-     *
-     * Attention: Make sure that this string does NOT have a leading slash and that
-     * it has a trailing slash, for example "remote.php/dav/".
-     */
-    virtual QString webDavPath() const;
-    virtual QString webDavPathNonShib() const;
-
     /**
      * @brief Sharing options
      *