New upstream version 22.0.3+dfsg1

This commit is contained in:
Sebastian Ramacher 2018-12-16 17:14:58 +01:00
parent 665f64a933
commit cdc9a9fc87
334 changed files with 14525 additions and 2639 deletions

View file

@ -324,6 +324,8 @@ struct update_t {
memcpy(hash, from.hash, sizeof(hash));
memcpy(downloadhash, from.downloadhash, sizeof(downloadhash));
memcpy(my_hash, from.my_hash, sizeof(my_hash));
return *this;
}
};
@ -356,11 +358,11 @@ bool DownloadWorkerThread()
WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS,
(LPVOID)&tlsProtocols, sizeof(tlsProtocols));
HttpHandle hConnect = WinHttpConnect(hSession, L"obsproject.com",
HttpHandle hConnect = WinHttpConnect(hSession, L"cdn-fastly.obsproject.com",
INTERNET_DEFAULT_HTTPS_PORT, 0);
if (!hConnect) {
downloadThreadFailure = true;
Status(L"Update failed: Couldn't connect to obsproject.com");
Status(L"Update failed: Couldn't connect to cdn-fastly.obsproject.com");
return false;
}
@ -612,7 +614,7 @@ static inline bool has_str(const char *file, const char *str)
#define UTF8ToWideBuf(wide, utf8) UTF8ToWide(wide, _countof(wide), utf8)
#define WideToUTF8Buf(utf8, wide) WideToUTF8(utf8, _countof(utf8), wide)
#define UPDATE_URL L"https://obsproject.com/update_studio"
#define UPDATE_URL L"https://cdn-fastly.obsproject.com/update_studio"
static bool AddPackageUpdateFiles(json_t *root, size_t idx,
const wchar_t *tempPath)
@ -748,7 +750,7 @@ static void UpdateWithPatchIfAvailable(const char *name, const char *hash,
wchar_t sourceURL[1024];
wchar_t patchHashStr[BLAKE2_HASH_STR_LENGTH];
if (strncmp(source, "https://obsproject.com/", 23) != 0)
if (strncmp(source, "https://cdn-fastly.obsproject.com/", 34) != 0)
return;
string patchPackageName = name;
@ -957,10 +959,10 @@ static bool UpdateVS2017Redists(json_t *root)
WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS,
(LPVOID)&tlsProtocols, sizeof(tlsProtocols));
HttpHandle hConnect = WinHttpConnect(hSession, L"obsproject.com",
HttpHandle hConnect = WinHttpConnect(hSession, L"cdn-fastly.obsproject.com",
INTERNET_DEFAULT_HTTPS_PORT, 0);
if (!hConnect) {
Status(L"Update failed: Couldn't connect to obsproject.com");
Status(L"Update failed: Couldn't connect to cdn-fastly.obsproject.com");
return false;
}
@ -981,7 +983,7 @@ static bool UpdateVS2017Redists(json_t *root)
: L"vc2017redist_x64.exe";
wstring sourceURL;
sourceURL += L"https://obsproject.com/downloads/";
sourceURL += L"https://cdn-fastly.obsproject.com/downloads/";
sourceURL += file;
wstring destPath;

View file

@ -8,6 +8,7 @@
#include <QMessageBox>
#include <string>
#include <mutex>
#include <util/windows/WinHandle.hpp>
#include <util/util.hpp>
@ -27,11 +28,15 @@ using namespace std;
#define WIN_MANIFEST_URL "https://obsproject.com/update_studio/manifest.json"
#endif
#ifndef WIN_WHATSNEW_URL
#define WIN_WHATSNEW_URL "https://obsproject.com/update_studio/whatsnew.json"
#endif
#ifndef WIN_UPDATER_URL
#define WIN_UPDATER_URL "https://obsproject.com/update_studio/updater.exe"
#endif
static HCRYPTPROV provider = 0;
static __declspec(thread) HCRYPTPROV provider = 0;
#pragma pack(push, r1, 1)
@ -478,6 +483,32 @@ void GenerateGUID(string &guid)
HashToString(junk, &guid[0]);
}
string GetProgramGUID()
{
static mutex m;
lock_guard<mutex> lock(m);
/* NOTE: this is an arbitrary random number that we use to count the
* number of unique OBS installations and is not associated with any
* kind of identifiable information */
const char *pguid = config_get_string(GetGlobalConfig(),
"General", "InstallGUID");
string guid;
if (pguid)
guid = pguid;
if (guid.empty()) {
GenerateGUID(guid);
if (!guid.empty())
config_set_string(GetGlobalConfig(),
"General", "InstallGUID",
guid.c_str());
}
return guid;
}
void AutoUpdateThread::infoMsg(const QString &title, const QString &text)
{
OBSMessageBox::information(App()->GetMainWindow(), title, text);
@ -605,24 +636,7 @@ try {
/* ----------------------------------- *
* get current install GUID */
/* NOTE: this is an arbitrary random number that we use to count the
* number of unique OBS installations and is not associated with any
* kind of identifiable information */
const char *pguid = config_get_string(GetGlobalConfig(),
"General", "InstallGUID");
string guid;
if (pguid)
guid = pguid;
if (guid.empty()) {
GenerateGUID(guid);
if (!guid.empty())
config_set_string(GetGlobalConfig(),
"General", "InstallGUID",
guid.c_str());
}
string guid = GetProgramGUID();
if (!guid.empty()) {
string header = "X-OBS2-GUID: ";
header += guid;
@ -780,3 +794,101 @@ try {
} catch (string text) {
blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str());
}
/* ------------------------------------------------------------------------ */
void WhatsNewInfoThread::run()
try {
long responseCode;
vector<string> extraHeaders;
string text;
string error;
string signature;
CryptProvider localProvider;
BYTE whatsnewHash[BLAKE2_HASH_LENGTH];
bool success;
BPtr<char> whatsnewPath = GetConfigPathPtr(
"obs-studio\\updates\\whatsnew.json");
/* ----------------------------------- *
* create signature provider */
if (!CryptAcquireContext(&localProvider,
nullptr,
MS_ENH_RSA_AES_PROV,
PROV_RSA_AES,
CRYPT_VERIFYCONTEXT))
throw strprintf("CryptAcquireContext failed: %lu",
GetLastError());
provider = localProvider;
/* ----------------------------------- *
* avoid downloading json again */
if (CalculateFileHash(whatsnewPath, whatsnewHash)) {
char hashString[BLAKE2_HASH_STR_LENGTH];
HashToString(whatsnewHash, hashString);
string header = "If-None-Match: ";
header += hashString;
extraHeaders.push_back(move(header));
}
/* ----------------------------------- *
* get current install GUID */
string guid = GetProgramGUID();
if (!guid.empty()) {
string header = "X-OBS2-GUID: ";
header += guid;
extraHeaders.push_back(move(header));
}
/* ----------------------------------- *
* get json from server */
success = GetRemoteFile(WIN_WHATSNEW_URL, text, error, &responseCode,
nullptr, nullptr, extraHeaders, &signature);
if (!success || (responseCode != 200 && responseCode != 304)) {
if (responseCode == 404)
return;
throw strprintf("Failed to fetch whatsnew file: %s",
error.c_str());
}
/* ----------------------------------- *
* verify file signature */
if (responseCode == 200) {
success = CheckDataSignature(text, "whatsnew",
signature.data(), signature.size());
if (!success)
throw string("Invalid whatsnew signature");
}
/* ----------------------------------- *
* write or load json */
if (responseCode == 200) {
if (!QuickWriteFile(whatsnewPath, text.data(), text.size()))
throw strprintf("Could not write file '%s'",
whatsnewPath.Get());
} else {
if (!QuickReadFile(whatsnewPath, text))
throw strprintf("Could not read file '%s'",
whatsnewPath.Get());
}
/* ----------------------------------- *
* success */
emit Result(QString::fromUtf8(text.c_str()));
} catch (string text) {
blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str());
}

View file

@ -21,3 +21,15 @@ private slots:
public:
AutoUpdateThread(bool manualUpdate_) : manualUpdate(manualUpdate_) {}
};
class WhatsNewInfoThread : public QThread {
Q_OBJECT
virtual void run() override;
signals:
void Result(const QString &text);
public:
inline WhatsNewInfoThread() {}
};