Skip to content

Commit

Permalink
Merge pull request #134 from Psiphon-Inc/next-release
Browse files Browse the repository at this point in the history
v183
  • Loading branch information
adamkruger authored Apr 30, 2024
2 parents 29ad2fa + 77065bc commit 037a8e9
Show file tree
Hide file tree
Showing 19 changed files with 1,105 additions and 1,021 deletions.
7 changes: 7 additions & 0 deletions src/connectionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,13 @@ bool ConnectionManager::RequireUpgrade(void)

DWORD WINAPI ConnectionManager::ConnectionManagerUpgradeThread(void* object)
{
// We do not want to upgrade if we're running on a legacy version of Windows.
if (IsOSLegacy())
{
my_print(NOT_SENSITIVE, false, _T("Legacy OS detected; disabling upgrade via VPN"));
return 0;
}

my_print(NOT_SENSITIVE, true, _T("%s: enter"), __TFUNCTION__);

my_print(NOT_SENSITIVE, false, _T("Downloading new version..."));
Expand Down
5 changes: 5 additions & 0 deletions src/diagnostic_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,11 @@ string GetClientPlatform()
string(CLIENT_PLATFORM)
+ "_" + WStringToUTF8(sysInfo.version)
+ "_" + WStringToUTF8(mshtmlVersion);

if (IsOSLegacy()) {
cachedResult += "_LEGACY";
}

return cachedResult;
}

Expand Down
9 changes: 7 additions & 2 deletions src/psiclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_PSIPHON_CREATED:
{
// Display client version number
my_print(NOT_SENSITIVE, false, (tstring(_T("Client Version: ")) + UTF8ToWString(CLIENT_VERSION)).c_str());
string clientVersion = "Client Version: "s + CLIENT_VERSION;
if (IsOSLegacy())
{
clientVersion += " LEGACY";
}
my_print(NOT_SENSITIVE, false, UTF8ToWString(clientVersion).c_str());

if (!IsOSSupported())
if (IsOSUnsupported())
{
// We're not showing the main app window, as it will probably be garbage
// and the app should close momentarily.
Expand Down
Binary file modified src/psiclient.rc
Binary file not shown.
5 changes: 5 additions & 0 deletions src/psiclient2015.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>psiphon</TargetName>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>psiphon</TargetName>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -366,6 +368,9 @@
<Image Include="psiclient.ico" />
<Image Include="systray-stopped.ico" />
</ItemGroup>
<ItemGroup>
<Manifest Include="psiphon.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/psiclient2015.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,7 @@
<Image Include="psiclient.ico" />
<Image Include="systray-stopped.ico" />
</ItemGroup>
<ItemGroup>
<Manifest Include="psiphon.manifest" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/psiclient_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void CreateHTMLControl(HWND hWndParent, float dpiScaling) {
initJSON["Cookies"] = Settings::GetCookies();
initJSON["Config"] = Json::Value();
initJSON["Config"]["ClientVersion"] = CLIENT_VERSION;
initJSON["Config"]["ClientBuild"] = GetBuildTimestamp();
initJSON["Config"]["ClientBuild"] = GetBuildTimestamp() + (IsOSLegacy() ? ".LEGACY" : "");
initJSON["Config"]["Language"] = WStringToUTF8(GetLocaleID());
initJSON["Config"]["Banner"] = "banner.png";
initJSON["Config"]["InfoURL"] = WStringToUTF8(INFO_LINK_URL);
Expand Down Expand Up @@ -365,7 +365,7 @@ static void AddStringTableEntry(const string& utf8EntryJson)

// As soon as the OS_UNSUPPORTED string is available, do the OS check.
if (key == STRING_KEY_OS_UNSUPPORTED) {
EnforceOSSupport(g_hWnd, wideStr);
EnforceOSSupport(g_hWnd, wideStr, FAQ_URL);
}
}

Expand Down
16 changes: 16 additions & 0 deletions src/psiphon.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<!-- Specifying compatibility with higher versions of Windows is necessary for GetVersionEx and helpers like IsWindows10OrGreater to work correctly -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 10 and Windows 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
14 changes: 12 additions & 2 deletions src/psiphon_tunnel_core_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,19 @@ bool WriteParameterFiles(const WriteParameterFilesIn& in, WriteParameterFilesOut
out.oldClientUpgradeFilename = filesystem::path(shortDataStoreDirectory).append(UPGRADE_EXE_NAME);

config["MigrateUpgradeDownloadFilename"] = WStringToUTF8(out.oldClientUpgradeFilename);
config["UpgradeDownloadURLs"] = LoadJSONArray(UPGRADE_URLS_JSON);
config["UpgradeDownloadClientVersionHeader"] = string("x-amz-meta-psiphon-client-version");
config["EnableUpgradeDownload"] = true;
config["UpgradeDownloadURLs"] = LoadJSONArray(UPGRADE_URLS_JSON);

// We do not want to upgrade if we're running on a legacy version of Windows.
if (IsOSLegacy())
{
my_print(NOT_SENSITIVE, false, _T("Legacy OS detected; disabling upgrade via tunnel-core"));
config["EnableUpgradeDownload"] = false;
}
else
{
config["EnableUpgradeDownload"] = true;
}

// Newer versions of tunnel-core download the upgrade file to its own data directory. Both oldClientUpgradeFilename and
// newClientUpgradeFilename should be deleted when Psiphon starts if they exist.
Expand Down
38 changes: 33 additions & 5 deletions src/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1839,19 +1839,47 @@ wstring GetDeviceRegion()
return L"";
}

bool IsOSSupported()
// This define and function are copied from the Windows 10.0 SDK. When we are ready to
// upgrade the Target Version (which will properly give us access to these), we should
// remove these.
#define _WIN32_WINNT_WIN10 0x0A00
VERSIONHELPERAPI IsWindows10OrGreater()
{
return IsWindows7OrGreater();
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0);
}

void EnforceOSSupport(HWND parentWnd, const wstring& message)
/// Should be true iff this is the last version to support a deprecated Windows OS version
/// (or versions). It will result in upgrades being blocked for users on that OS version.
/// When changing this value, the versions used in IsOSUnsupported and/or IsOSLegacy
/// must change.
#define IS_LEGACY_BUILD true

bool IsOSUnsupported()
{
if (IsOSSupported())
// We no longer support Windows XP or Vista.
return !IsWindows7OrGreater();
}

bool IsOSLegacy()
{
// Windows 7, 8, and 8.1 are considered legacy -- this is the last build
// that will support them.
return IS_LEGACY_BUILD && IsWindows7OrGreater() && !IsWindows10OrGreater();
}

void EnforceOSSupport(HWND parentWnd, const wstring& message, const string& faqURL)
{
if (!IsOSUnsupported())
{
return;
}

const wstring url = L"https://psiphon3.com/faq.html#windows-xp-eol";
wstring fragment = L"#windows-7-eol";
if (!IsWindows7OrGreater()) {
fragment = L"#windows-xp-eol";
}

const wstring url = UTF8ToWString(faqURL) + fragment;
const wstring messageURL = message + L"\n" + url;

::MessageBoxW(parentWnd, messageURL.c_str(), L"Psiphon", MB_OK | MB_ICONSTOP);
Expand Down
15 changes: 10 additions & 5 deletions src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,18 @@ void SetUiLocale(const wstring& uiLocale);
// running in. Returns ISO 3166-1 alpha-2 format.
wstring GetDeviceRegion();

/// Returns true if the current Windows version is supported by the Psiphon client.
/// Otherwise Psiphon will not and cannot function and the user should be told.
bool IsOSSupported();
/// Returns true if the current Windows version is unsupported by the Psiphon client.
/// In this case will not and cannot function and the user should be told.
bool IsOSUnsupported();

/// Check is the current Windows version is support. If it's not, show a message
/// Returns true if the current Windows version is considered "legacy". This means that
/// the Psiphon client will run on it, but future versions will not -- i.e., version
/// upgrades must be disabled.
bool IsOSLegacy();

/// Check if the current Windows version is supported. If it's not, show a message
/// and terminate the app.
void EnforceOSSupport(HWND parentWnd, const wstring& message);
void EnforceOSSupport(HWND parentWnd, const wstring& message, const string& faqURL);

/// Copy the given string to the clipboard. Returns true on success.
bool CopyToClipboard(HWND mainWnd, const tstring& s);
Expand Down
4 changes: 2 additions & 2 deletions src/webui/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@
"description": "Appears in the notification area balloon when Psiphon has been minimized to the Windows' notification area (aka 'system tray' aka 'systray', the area of the taskbar with the clock, battery indicator, and other icons)."
},
"appbackend#os-unsupported": {
"message": "Psiphon no longer supports Windows XP or Vista.\nPlease visit our website for more information.",
"description": "Appears in a message box when Psiphon is run on an unsuppoted version of Windows. Is followed by a URL."
"message": "Psiphon only supports Windows 10 and newer.\nPlease visit our website for more information.",
"description": "Appears in a message box when Psiphon is run on an unsupported version of Windows. Is followed by a URL."
},
"psicash#transaction-error-title": {
"message": "PsiCash transaction error",
Expand Down
4 changes: 2 additions & 2 deletions src/webui/_locales/haw-Arab/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"description": "Appears in the notification area balloon when Psiphon has been minimized to the Windows' notification area (aka 'system tray' aka 'systray', the area of the taskbar with the clock, battery indicator, and other icons). The word 'Psiphon' must not be translated or transliterated."
},
"appbackend#os-unsupported": {
"message": "‮Ԁsıdɥou‬ ‮uo‬ ‮ʅouƃǝɹ‬ ‮snddoɹʇs‬ ‮Mıupoʍs‬ ‮XԀ‬ ‮oɹ‬ ‮Ʌısʇɐ‬.\n‮Ԁʅǝɐsǝ‬ ‮ʌısıʇ‬ ‮onɹ‬ ‮ʍǝqsıʇǝ‬ ‮ɟoɹ‬ ‮ɯoɹǝ‬ ‮ıuɟoɹɯɐʇıou‬.",
"description": "Appears in a message box when Psiphon is run on an unsuppoted version of Windows. Is followed by a URL."
"message": "‮Ԁsıdɥou‬ ‮ouʅʎ‬ ‮snddoɹʇs‬ ‮Mıupoʍs‬ 10 ‮ɐup‬ ‮uǝʍǝɹ‬.\n‮Ԁʅǝɐsǝ‬ ‮ʌısıʇ‬ ‮onɹ‬ ‮ʍǝqsıʇǝ‬ ‮ɟoɹ‬ ‮ɯoɹǝ‬ ‮ıuɟoɹɯɐʇıou‬.",
"description": "Appears in a message box when Psiphon is run on an unsupported version of Windows. Is followed by a URL."
},
"appbackend#state-connected-body": {
"message": "‮Ǝxdʅoɹǝ‬ ‮qǝʎoup‬ ‮ʎonɹ‬ ‮qoɹpǝɹs‬!",
Expand Down
4 changes: 2 additions & 2 deletions src/webui/_locales/haw-Cyrl/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"description": "Appears in the notification area balloon when Psiphon has been minimized to the Windows' notification area (aka 'system tray' aka 'systray', the area of the taskbar with the clock, battery indicator, and other icons). The word 'Psiphon' must not be translated or transliterated."
},
"appbackend#os-unsupported": {
"message": "[Ƥşīīƥħǿǿƞ ƞǿǿ ŀǿǿƞɠḗḗř şŭŭƥƥǿǿřŧş Ẇīīƞḓǿǿẇş ẊƤ ǿǿř Ṽīīşŧȧȧ.\nƤŀḗḗȧȧşḗḗ ṽīīşīīŧ ǿǿŭŭř ẇḗḗƀşīīŧḗḗ ƒǿǿř ḿǿǿřḗḗ īīƞƒǿǿřḿȧȧŧīīǿǿƞ.]",
"description": "Appears in a message box when Psiphon is run on an unsuppoted version of Windows. Is followed by a URL."
"message": "[Ƥşīīƥħǿǿƞ ǿǿƞŀẏ şŭŭƥƥǿǿřŧş Ẇīīƞḓǿǿẇş 10 ȧȧƞḓ ƞḗḗẇḗḗř.\nƤŀḗḗȧȧşḗḗ ṽīīşīīŧ ǿǿŭŭř ẇḗḗƀşīīŧḗḗ ƒǿǿř ḿǿǿřḗḗ īīƞƒǿǿřḿȧȧŧīīǿǿƞ.]",
"description": "Appears in a message box when Psiphon is run on an unsupported version of Windows. Is followed by a URL."
},
"appbackend#state-connected-body": {
"message": "[Ḗḗẋƥŀǿǿřḗḗ ƀḗḗẏǿǿƞḓ ẏǿǿŭŭř ƀǿǿřḓḗḗřş!]",
Expand Down
Loading

0 comments on commit 037a8e9

Please sign in to comment.