mirror of
https://github.com/Zaarrg/stremio-community-v5.git
synced 2026-04-21 09:01:55 +00:00
More splash screen stuck fixes + Version 5.0.14
- More fixes for stuck on splash screen - Version bump to 5.0.14
This commit is contained in:
parent
75c59224e1
commit
37a20b1fe7
7 changed files with 94 additions and 45 deletions
|
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(stremio VERSION "5.0.13")
|
||||
project(stremio VERSION "5.0.14")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
|
|
|||
105
src/main.cpp
105
src/main.cpp
|
|
@ -61,7 +61,7 @@ using namespace Microsoft::WRL;
|
|||
#define APP_TITLE "Stremio - Freedom to Stream"
|
||||
#define APP_NAME "Stremio"
|
||||
#define APP_CLASS L"Stremio"
|
||||
#define APP_VERSION "5.0.13"
|
||||
#define APP_VERSION "5.0.14"
|
||||
// Please don't take this one main.cpp to seriously this was only a quick 1 week project with the main aspect being functionality not file structure ;)
|
||||
static TCHAR szWindowClass[] = APP_NAME;
|
||||
static TCHAR szTitle[] = APP_TITLE;
|
||||
|
|
@ -196,6 +196,7 @@ static void AppendToCrashLog(const std::string& message);
|
|||
bool FileExists(const std::wstring& path);
|
||||
bool DirectoryExists(const std::wstring& dirPath);
|
||||
static void refreshWeb(bool refreshAll);
|
||||
static void WaitAndRefreshIfNeeded();
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
|
@ -207,6 +208,39 @@ static const wchar_t* INIT_SHELL_SCRIPT = LR"JS_CODE(
|
|||
initShellComm();
|
||||
} catch(e) {
|
||||
console.error("Error calling initShellComm:", e);
|
||||
setTimeout(function() {
|
||||
try {
|
||||
initShellComm();
|
||||
} catch(innerError) {
|
||||
const errorMessage = {
|
||||
event: "app-error",
|
||||
reason: "shellComm"
|
||||
};
|
||||
if(window.chrome && window.chrome.webview && window.chrome.webview.postMessage) {
|
||||
window.chrome.webview.postMessage(JSON.stringify(errorMessage));
|
||||
} else {
|
||||
console.error("WebView postMessage API is not available.");
|
||||
}
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
})();
|
||||
)JS_CODE";
|
||||
static const wchar_t* EXEC_SHELL_SCRIPT = LR"JS_CODE(
|
||||
(function(){
|
||||
try {
|
||||
initShellComm();
|
||||
} catch(e) {
|
||||
console.error("Error exec initShellComm:", e);
|
||||
const errorMessage = {
|
||||
event: "app-error",
|
||||
reason: "shellComm"
|
||||
};
|
||||
if(window.chrome && window.chrome.webview && window.chrome.webview.postMessage) {
|
||||
window.chrome.webview.postMessage(JSON.stringify(errorMessage));
|
||||
} else {
|
||||
console.error("WebView exec postMessage API is not available.");
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
@ -964,7 +998,13 @@ static void HandleInboundJSON(const std::string &msg)
|
|||
};
|
||||
HandleMpvCommand(cmdArgs);
|
||||
} else if (ev == "refresh") {
|
||||
refreshWeb(argVec[0] == "all" ? TRUE : FALSE);
|
||||
refreshWeb(argVec[0] == "all");
|
||||
} else if (ev == "app-error") {
|
||||
if (j.contains("reason") && j["reason"].is_string() && j["reason"].get<std::string>() == "shellComm") {
|
||||
if (g_hSplash && !g_waitStarted.exchange(true)) {
|
||||
WaitAndRefreshIfNeeded();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
std::cout<<"Unknown event="<<ev<<"\n";
|
||||
}
|
||||
|
|
@ -1702,29 +1742,30 @@ LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS* ExceptionInfo) {
|
|||
|
||||
static void WaitAndRefreshIfNeeded() {
|
||||
std::thread([](){
|
||||
const int maxAttempts = 8;
|
||||
const int initialWaitTime = 8;
|
||||
const int maxAttempts = 10;
|
||||
const int initialWaitTime = 5;
|
||||
const int maxWaitTime = 60;
|
||||
|
||||
std::cout << "[WEBVIEW]: Web Page could not be reached, retrying..." << std::endl;
|
||||
refreshWeb(true);
|
||||
|
||||
for(int attempt = 0; attempt < maxAttempts; ++attempt) {
|
||||
int waitTime = static_cast<int>(initialWaitTime * std::pow(2.0, attempt));
|
||||
int waitTime = static_cast<int>(initialWaitTime * std::pow(1.25, attempt));
|
||||
if (waitTime > maxWaitTime) {
|
||||
waitTime = maxWaitTime;
|
||||
}
|
||||
|
||||
std::cout << "[WEBVIEW]: Web Page attempted at " << attempt << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(waitTime));
|
||||
std::cout << "[WEBVIEW]: Checking Web Page state... (Attempt " << (attempt + 1) << "), waited " << waitTime << " seconds\n";
|
||||
std::cout << "[WEBVIEW]: Checking Web Page state... (Attempt " << (attempt + 1) << "), waited " << waitTime << " seconds\n" << std::endl;
|
||||
|
||||
|
||||
if (g_isAppReady) {
|
||||
std::cout << "[WEBVIEW]: Web Page ready!" << std::endl;
|
||||
g_waitStarted.store(false);
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "[WEBVIEW]: Web Page not ready... Refreshing..." << std::endl;
|
||||
refreshWeb(true);
|
||||
refreshWeb(false);
|
||||
}
|
||||
|
||||
if (!g_isAppReady) {
|
||||
|
|
@ -1735,6 +1776,8 @@ static void WaitAndRefreshIfNeeded() {
|
|||
L"WebView2 Page load fail",
|
||||
MB_ICONERROR | MB_OK
|
||||
);
|
||||
PostQuitMessage(1);
|
||||
exit(1);
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
|
@ -1750,7 +1793,7 @@ static void SetupWebMessageHandler()
|
|||
args->get_IsSuccess(&isSuccess);
|
||||
if (isSuccess) {
|
||||
std::cout << "[WEBVIEW]: Navigation Complete - Success\n";
|
||||
sender->ExecuteScript(L"initShellComm();", nullptr);
|
||||
sender->ExecuteScript(EXEC_SHELL_SCRIPT, nullptr);
|
||||
} else {
|
||||
std::cout << "[WEBVIEW]: Navigation failed\n";
|
||||
if (g_hSplash && !g_waitStarted.exchange(true)) {
|
||||
|
|
@ -1763,6 +1806,29 @@ static void SetupWebMessageHandler()
|
|||
&navToken
|
||||
);
|
||||
|
||||
EventRegistrationToken contentToken;
|
||||
g_webview->add_ContentLoading(
|
||||
Callback<ICoreWebView2ContentLoadingEventHandler>(
|
||||
[](ICoreWebView2* sender, ICoreWebView2ContentLoadingEventArgs* args) -> HRESULT {
|
||||
std::cout<<"[WEBVIEW]: Content loaded\n";
|
||||
sender->ExecuteScript(EXEC_SHELL_SCRIPT, nullptr);
|
||||
return S_OK;
|
||||
}
|
||||
).Get(),
|
||||
&contentToken
|
||||
);
|
||||
|
||||
EventRegistrationToken domToken;
|
||||
g_webview->add_DOMContentLoaded(
|
||||
Callback<ICoreWebView2DOMContentLoadedEventHandler>(
|
||||
[](ICoreWebView2* sender, ICoreWebView2DOMContentLoadedEventArgs* args) -> HRESULT {
|
||||
std::cout<<"[WEBVIEW]: DOM content loaded\n";
|
||||
sender->ExecuteScript(EXEC_SHELL_SCRIPT, nullptr);
|
||||
return S_OK;
|
||||
}
|
||||
).Get(),
|
||||
&domToken
|
||||
);
|
||||
|
||||
EventRegistrationToken contextMenuToken;
|
||||
g_webview->add_ContextMenuRequested(
|
||||
|
|
@ -2099,7 +2165,7 @@ static void InitWebView2(HWND hWnd)
|
|||
SetupWebMessageHandler();
|
||||
std::cout << "[WEBVIEW]: WebView started navigating to web ui." << std::endl;
|
||||
g_webview->Navigate(g_webuiUrl.c_str());
|
||||
|
||||
std::cout << "[WEBVIEW]: WebView navigated...." << std::endl;
|
||||
return S_OK;
|
||||
}
|
||||
).Get()
|
||||
|
|
@ -2873,23 +2939,6 @@ int main(int argc, char* argv[])
|
|||
|
||||
// Show splash screen
|
||||
CreateSplashScreen(g_hWnd);
|
||||
// Timeout for Splashscreen
|
||||
std::thread([]() {
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(60s);
|
||||
|
||||
if (g_hSplash) {
|
||||
std::wstring error = L"[WEBVIEW]: Failed to create Web View in time, make sure WebView2 runtime is installed or provide a portable WebView2 runtime exe in portable_config/EdgeWebView. Check for potential errors in portable_config/errors-{date}.txt";
|
||||
std::cout << WStringToUtf8(error) << std::endl;
|
||||
AppendToCrashLog(error);
|
||||
MessageBoxW(
|
||||
nullptr,
|
||||
error.c_str(),
|
||||
L"WebView2 Initialization Timeout",
|
||||
MB_ICONERROR | MB_OK
|
||||
);
|
||||
}
|
||||
}).detach();
|
||||
|
||||
// mpv init
|
||||
if(!InitMPV(g_hWnd)){
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>stremio-desktop-v5</id>
|
||||
<version>5.0.13</version>
|
||||
<version>5.0.14</version>
|
||||
<title>Stremio Desktop v5</title>
|
||||
<authors>Zarg</authors>
|
||||
<owners>Zarg</owners>
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ $packageArgs = @{
|
|||
|
||||
|
||||
if ([Environment]::Is64BitOperatingSystem) {
|
||||
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.13/Stremio.5.0.13-x64.exe'
|
||||
$packageArgs['checksum'] = 'eec67b8979528ad78784012c35725d9930d88802cefb6a5338911aaa7658e5a5'
|
||||
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.14/Stremio.5.0.14-x64.exe'
|
||||
$packageArgs['checksum'] = '2d206f6e5d7ce22be968211ef445fa5febdeaf4cae8223945d7602296f03effe'
|
||||
$packageArgs['checksumType'] = 'sha256'
|
||||
} else {
|
||||
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.13/Stremio.5.0.13-x86.exe'
|
||||
$packageArgs['checksum'] = 'a0263a7238dc9a7b8868c30467fea0190e6855a397b3f8b72bc4b675cd496e65'
|
||||
$packageArgs['url'] = 'https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.14/Stremio.5.0.14-x86.exe'
|
||||
$packageArgs['checksum'] = '2a8caede355650a6f018c53ab3b3fcd25c2fb264aa06c190ee007f0bf7d90f80'
|
||||
$packageArgs['checksumType'] = 'sha256'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"version": "5.0.13",
|
||||
"version": "5.0.14",
|
||||
"description": "Stremio Desktop v5 Community",
|
||||
"homepage": "https://github.com/Zaarrg/stremio-desktop-v5",
|
||||
"license": "GPL-3.0",
|
||||
"architecture": {
|
||||
"64bit": {
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.13/Stremio.5.0.13-x64.exe",
|
||||
"hash": "eec67b8979528ad78784012c35725d9930d88802cefb6a5338911aaa7658e5a5",
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.14/Stremio.5.0.14-x64.exe",
|
||||
"hash": "2d206f6e5d7ce22be968211ef445fa5febdeaf4cae8223945d7602296f03effe",
|
||||
"installer": {
|
||||
"args": [
|
||||
"/S"
|
||||
|
|
@ -24,8 +24,8 @@
|
|||
}
|
||||
},
|
||||
"32bit": {
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.13/Stremio.5.0.13-x86.exe",
|
||||
"hash": "a0263a7238dc9a7b8868c30467fea0190e6855a397b3f8b72bc4b675cd496e65",
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.14/Stremio.5.0.14-x86.exe",
|
||||
"hash": "2a8caede355650a6f018c53ab3b3fcd25c2fb264aa06c190ee007f0bf7d90f80",
|
||||
"installer": {
|
||||
"args": [
|
||||
"/S"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"shellVersion": "5.0.13",
|
||||
"shellVersion": "5.0.14",
|
||||
"files": {
|
||||
"windows-x64": {
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.13/Stremio.5.0.13-x64.exe",
|
||||
"checksum": "eec67b8979528ad78784012c35725d9930d88802cefb6a5338911aaa7658e5a5"
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.14/Stremio.5.0.14-x64.exe",
|
||||
"checksum": "2d206f6e5d7ce22be968211ef445fa5febdeaf4cae8223945d7602296f03effe"
|
||||
},
|
||||
"windows-x86": {
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.13/Stremio.5.0.13-x86.exe",
|
||||
"checksum": "a0263a7238dc9a7b8868c30467fea0190e6855a397b3f8b72bc4b675cd496e65"
|
||||
"url": "https://github.com/Zaarrg/stremio-desktop-v5/releases/download/5.0.0-beta.14/Stremio.5.0.14-x86.exe",
|
||||
"checksum": "2a8caede355650a6f018c53ab3b3fcd25c2fb264aa06c190ee007f0bf7d90f80"
|
||||
},
|
||||
"server.js": {
|
||||
"url": "https://dl.strem.io/server/v4.20.11/desktop/server.js",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"upToDate": false,
|
||||
"versionDesc": "https://raw.githubusercontent.com/Zaarrg/stremio-desktop-v5/refs/heads/webview-windows/version/version-details.json",
|
||||
"signature": "Zy5iEufXlZduSj2+T88YVfB3zKP2ezSm8o7trUKD5MyBiMO0tcMJsOUD4a9F34AjMOZzDeoHvqHtG/twfdRXiVN8ZclN4enYumbXthoDaOGl4kAEnGcwfqpbSbqiE+QVVFmVpALKnRj3aHjw5mARYC7M6FWOFRmX/sAZfHURAjtg1j6jfWQJt50Vmd5BacpVjWMXVlIxhwNRArBkSPjIojNE3ksEHvga29tKb05mP6iR9eM8yKtCoWcmZ/SMQ1TzqsAk+4jofLeQLFWVScdJYfW/dZg10elovRaB9WHTzsaj2Baqrpg3CUYduYqGCbQm/pUQuP4xApYtPIZ+FFDj9g=="
|
||||
"signature": "oGOLS4I+H0nFe2r8V3sa7NeU0yZvgt/PmGfD5ZVqRFeSYPdFIgGE7Ptqps1EOJs8djyRo8WnncWrKKCnMzvh2wjUsoMLIsXT0e7YizOVgS/kiEBYOnSsPccHkHCW4FUNuzwsvNRUwPSmqFSLQVs677B1hgPt0w9Y0sv7H9zThpJNqJaXz/Pb1ioV+gnNT2Tbi3xfBDmsg6c84xX2DPALmQU4VzEgmskDPOKjaeu3ZHxyFnzc1l6NEGUMd+bjnRoRTPfM71kOJ4DcCD1vrJpN6R3MUnkkMrjrZqO8uGtRQrqViM8Yb97H0nwZtXeDQGEbtRp+HALBlGMj8SOrhE+Ebg=="
|
||||
}
|
||||
Loading…
Reference in a new issue