Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Cover Finder - #216

Merged
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder
Nov 18, 2022
Merged

Cover Finder#216
ReenigneArcher merged 22 commits into
LizardByte:nightlyfrom
mariotaku:feature/cover-finder

Conversation

@mariotaku

Copy link
Copy Markdown

Description

This PR adds functionality to search game cover image, collected from IGDB.com.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

@github-actions
github-actionsBot changed the base branch from master to nightlyJune 19, 2022 15:34
@github-actions

Copy link
Copy Markdown

Your PR was set to master, PRs should be sent to nightly
The base branch of this PR has been automatically changed to nightly, please check that there are no merge conflicts

@TheElixZammutoTheElixZammuto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I'm not able to test this yet, but I have a couple feedback while skimming the code

Comment threadsunshine/confighttp.cpp Outdated
Comment threadsrc_assets/common/assets/web/apps.html Outdated
key escape
url host check
@mariotaku
mariotaku marked this pull request as ready for review June 27, 2022 16:22
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

Comment threadpackaging/linux/flatpak/com.github.sunshinestream.sunshine.yml Outdated
@ReenigneArcher

This comment was marked as resolved.

@mariotaku
mariotakuforce-pushed the feature/cover-finder branch from 08a8319 to 3489bd4CompareAugust 24, 2022 13:43
@ReenigneArcher

This comment was marked as resolved.

@mariotaku

This comment was marked as resolved.

@ReenigneArcher

Copy link
Copy Markdown
Member

Hi. Sorry I've gotten busy these days. Is it possible to ask you to make some changes if you have clues to fix the above issues?

I will see what I can do, as well as check with some other developers.

These are some references for the missing dll issue.

It appears that we need to place the dll next to sunshine.exe or statically linking curl.

@psyke83

Copy link
Copy Markdown
Contributor

Hi,

It seems there was a problem with static linking that affected libcurl.
If you cherry-pick this commit, it should work ok: psyke83@92b90cd

With the above commit:

# ldd sunshine.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff87ecf0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff87db50000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff87c3f0000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff87e250000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff87da10000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff87dc70000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff87e050000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff87c6d0000)
CRYPT32.dll => /c/Windows/System32/CRYPT32.dll (0x7ff87cbe0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff87cae0000)
ole32.dll => /c/Windows/System32/ole32.dll (0x7ff87de90000)
d3d11.dll => /c/Windows/SYSTEM32/d3d11.dll (0x7ff878100000)
D3DCOMPILER_47.dll => /c/Windows/SYSTEM32/D3DCOMPILER_47.dll (0x7ff878370000)
combase.dll => /c/Windows/System32/combase.dll (0x7ff87e300000)
dwmapi.dll => /c/Windows/SYSTEM32/dwmapi.dll (0x7ff87a0f0000)
win32u.dll => /c/Windows/System32/win32u.dll (0x7ff87c910000)
win32u.dll => /c/Windows/System32/win32u.dll (0x1cb6d9e0000)
GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ff87d1c0000)
dxgi.dll => /c/Windows/SYSTEM32/dxgi.dll (0x7ff87acb0000)
USER32.dll => /c/Windows/System32/USER32.dll (0x7ff87eb10000)
gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ff87c9d0000)
IPHLPAPI.DLL => /c/Windows/SYSTEM32/IPHLPAPI.DLL (0x7ff87b7c0000)
msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ff87c7c0000)
CRYPTSP.dll => /c/Windows/SYSTEM32/CRYPTSP.dll (0x7ff87bda0000)
SETUPAPI.dll => /c/Windows/System32/SETUPAPI.dll (0x7ff87e660000)
cfgmgr32.dll => /c/Windows/System32/cfgmgr32.dll (0x7ff87c770000)
WLDAP32.dll => /c/Windows/System32/WLDAP32.dll (0x7ff87e1e0000)
WINMM.dll => /c/Windows/SYSTEM32/WINMM.dll (0x7ff872930000)
WS2_32.dll => /c/Windows/System32/WS2_32.dll (0x7ff87d9a0000)
WSOCK32.dll => /c/Windows/SYSTEM32/WSOCK32.dll (0x7ff86dc00000)
MSWSOCK.DLL => /c/Windows/SYSTEM32/MSWSOCK.DLL (0x7ff87bb40000)

I did a quick test and the cover finder feature seems to retrieve images correctly on Windows 10.

@mariotaku

Copy link
Copy Markdown
Author

@psyke83 Very awesome change!

@ReenigneArcher

Copy link
Copy Markdown
Member

@psyke83 Thank you so much!

@mariotaku looks like a couple of failures, should be easy to resolve.

  1. clang reports an extra space
  2. docker build failing... missing a dependency per https://github.com/LizardByte/Sunshine/actions/runs/3488506314/jobs/5837582884#step:9:3163
#15 1.895 CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):#15 1.895 A required package was not found

Should just be a matter of adding the dependency here: https://github.com/mariotaku/Sunshine/blob/6806ae2335565f61b1629502d23ceed3eb2c004f/Dockerfile#L17

libcurl4-openssl-dev if I'm not mistaken.

@ReenigneArcher

ReenigneArcher commented Nov 17, 2022

Copy link
Copy Markdown
Member
#0 4.498 Reading package lists...#0 5.230 Building dependency tree...#0 5.357 Reading state information...#0 5.362 Package libcurl4-openssl-dev is not available, but is referred to by another package.#0 5.362 This may mean that the package is missing, has been obsoleted, or#0 5.362 is only available from another source#0 5.362 However the following packages replace it:#0 5.363 libcurl4-doc#0 5.363 #0 5.365 E: Version '7.68.0*' for 'libcurl4-openssl-dev' was not found

Perhaps this is just a version issue. https://packages.ubuntu.com/jammy/libcurl4-openssl-dev

Flatpak failure is likely just an intermittent failure. It happens from time to time.

@mariotaku

Copy link
Copy Markdown
Author

@ReenigneArcher Oh! I thought 22.04 is focal.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for working on this everyone! I will test it in Windows 11 and 10 tonight. If it's all working, I'll assume we're good to merge, since it worked in Linux before.

@ReenigneArcher

ReenigneArcher commented Nov 18, 2022

Copy link
Copy Markdown
Member

Unfortunately, with Windows 11 I am still not able to upload the cover.

image

I can at least start Sunshine in Windows 10 now though. I couldn't get any further than that since my test machine doesn't have a display connected. I can test Windows 10 further tomorrow.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

I saw this on Sunshine's log output:

[2022:11:18:01:51:29]: Error: Couldn't download [https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co4rjc.png, code:77]

Code 77 is related to the certificate store; presumably curl is not able to find it in the expected format on a Windows system. I feel that instead of copying the certificate store, it would be better to use Windows' own internal store instead.

To that effect, changing the build system to install mingw-w64-x86_64-curl-winssl (instead of mingw-w64-x86_64-curl, as they are in conflict), it seems that it will work. I might have had the -winssl variant installed when I tested, which is why I didn't catch the problem.

@psyke83

Copy link
Copy Markdown
Contributor

Just to add some more context:

The winssl library seems to be included on Windows 10 or later only, so older versions may not work. Another alternative is to configure OpenSSL to use the Windows native store during compile time; see: https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html with the CURLSSLOPT_NATIVE_CA bitmask.

That might be worth investigating, but I'm not sure if it's worth the trouble? Windows 8.1 will be EOL in January 2023, and you'd have to be crazy to run Windows 7 in a networked environment.

@ReenigneArcher

Copy link
Copy Markdown
Member

The winssl library seems to be included on Windows 10 or later only, so older versions may not work.

Probably fine since Sunshine won't work in Windows 7 anyway. I've also yet to see a user report an issue and indicate they are using Windows 8.

@psyke83

psyke83 commented Nov 18, 2022

Copy link
Copy Markdown
Contributor

Well, either way seems to work on my system. Here's the OpenSSL workaround:

diff --git a/src/httpcommon.cpp b/src/httpcommon.cpp
index 092c2dc..e4747e3 100644
--- a/src/httpcommon.cpp
+++ b/src/httpcommon.cpp
@@ -197,6 +197,9 @@ bool download_file(const std::string &url, const std::string &file) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+#ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+#endif
CURLcode result = curl_easy_perform(curl);
if(result != CURLE_OK) {
BOOST_LOG(error) << "Couldn't download ["sv << url << ", code:" << result << ']';

Edit: given that Sunshine already uses OpenSSL for crypto functions elsewhere in the code, it might make better sense to use the above workaround, as it may technically keep memory/library bloat to a minimum.

@ReenigneArcher

Copy link
Copy Markdown
Member

The workaround you provided seems logical to me. Let's go with that direction.

@mariotaku

Copy link
Copy Markdown
Author

I've applied @psyke83's patch. Really appreciate your suggestions!

@ReenigneArcher
ReenigneArcher merged commit 01b8ba3 into LizardByte:nightlyNov 18, 2022
@psyke83psyke83 mentioned this pull request Nov 18, 2022
12 tasks
@mariotaku
mariotaku deleted the feature/cover-finder branch December 13, 2022 02:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wantedExtra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mariotaku@ReenigneArcher@CLAassistant@psyke83@TheElixZammuto@LizardByte-bot