Explorar o código

Informing the user when the retrieved version of the extension is not the latest one + As the "trust" flag now will always be "true", modifying the respective error message accordingly, but still keeping the possibility to flag the extension as untrusted

Source commit: c9e0d42790fd1115b761bf6019c1180f614515e5
Martin Prikryl %!s(int64=9) %!d(string=hai) anos
pai
achega
33d3519f52
Modificáronse 3 ficheiros con 12 adicións e 1 borrados
  1. 9 0
      source/forms/Preferences.cpp
  2. 1 0
      source/resource/TextsWin.h
  3. 2 1
      source/resource/TextsWin1.rc

+ 9 - 0
source/forms/Preferences.cpp

@@ -2433,6 +2433,7 @@ void __fastcall TPreferencesDialog::AddExtension()
     CustomWinConfiguration->History[HistoryKey] = History.get();
 
     bool Trusted;
+    bool Latest;
     UnicodeString FileName;
     UnicodeString ExtensionPath;
     std::unique_ptr<TStringList> Lines(new TStringList());
@@ -2470,6 +2471,8 @@ void __fastcall TPreferencesDialog::AddExtension()
           FileName = MakeValidFileName(ExtractFileNameFromUrl(Path));
         }
         Lines->Text = Http->Response;
+
+        Latest = Http->ResponseHeaders->Values["WinSCP-Extension-Skipped"].Trim().IsEmpty();
       }
       else
       {
@@ -2479,6 +2482,7 @@ void __fastcall TPreferencesDialog::AddExtension()
         }
 
         Trusted = true;
+        Latest = true;
 
         UnicodeString Id = WinConfiguration->GetExtensionId(Path);
         FileName = ExtractFileName(Path);
@@ -2574,6 +2578,11 @@ void __fastcall TPreferencesDialog::AddExtension()
       CustomCommandsView->ItemFocused->MakeVisible(false);
       UpdateControls();
 
+      if (!Latest)
+      {
+        MessageDialog(LoadStr(EXTENSION_NOT_LATEST), qtInformation, qaOK);
+      }
+
       if (IsUrl)
       {
         Configuration->Usage->Inc(L"ExtensionAddsFromUrl");

+ 1 - 0
source/resource/TextsWin.h

@@ -154,6 +154,7 @@
 #define INTERNAL_EDITOR_LARGE_FILE 1365
 #define CLOSE_BUTTON            1366
 #define EXTENSION_UNTRUSTED     1367
+#define EXTENSION_NOT_LATEST    1368
 
 #define WIN_INFORMATION_STRINGS 1400
 #define COMPARE_NO_DIFFERENCES  1402

+ 2 - 1
source/resource/TextsWin1.rc

@@ -155,7 +155,8 @@ BEGIN
         CONFIRM_UNREGISTER_URL, "Do you want to unregister WinSCP from handling all URL addresses?"
         INTERNAL_EDITOR_LARGE_FILE, "**Try to open large file?**\n\nThe file you are trying to open in an internal editor is too large (%s). WinSCP internal editor is not designed for editing large files. Consider using an external editor capable of editing large files.\n\nYou may try to open the file anyway, but you may run out of memory."
         CLOSE_BUTTON, "Close"
-        EXTENSION_UNTRUSTED, "The extension does not come from a trusted source or has not been reviewed yet. Are you sure you want to install it?"
+        EXTENSION_UNTRUSTED, "The extension does not come from a trusted source. Are you sure you want to install it?"
+        EXTENSION_NOT_LATEST, "**Using the last compatible and trusted version of the extension.**\n\nThe latest version of the extension is either not reviewed yet or is not compatible with this version of WinSCP."
 
         WIN_INFORMATION_STRINGS, "WIN_INFORMATION"
         COMPARE_NO_DIFFERENCES, "No differences found."