Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ca3bab3
fix typo
360sym Oct 31, 2022
447a009
Merge pull request #466 from bananaman2020/patch-1
ReenigneArcher Nov 1, 2022
bea78dd
Fix credentials command typo in docs
CrazyStevenz Nov 1, 2022
b310436
Merge pull request #469 from CrazyStevenz/patch-1
ReenigneArcher Nov 2, 2022
6a2a485
Bump babel from 2.10.3 to 2.11.0
dependabot[bot] Nov 2, 2022
cf2de6e
Merge pull request #470 from LizardByte/dependabot/pip/nightly/babel-…
ReenigneArcher Nov 2, 2022
89a0109
fix winget release
ReenigneArcher Nov 2, 2022
92f5c49
Merge pull request #472 from LizardByte/fix/CI-winget-releaser
ReenigneArcher Nov 2, 2022
0bdb887
add linux/arm64/v8 docker platform
ReenigneArcher Nov 2, 2022
4190667
Merge pull request #473 from LizardByte/add/docker-platform-arm64
ReenigneArcher Nov 2, 2022
e924e2e
Bump sphinx-copybutton from 0.5.0 to 0.5.1
dependabot[bot] Nov 16, 2022
66615a0
Merge pull request #500 from LizardByte/dependabot/pip/nightly/sphinx…
ReenigneArcher Nov 16, 2022
01b8ba3
Cover Finder (#216)
Nov 18, 2022
390c664
Bump KSXGitHub/github-actions-deploy-aur from 2.5.0 to 2.6.0
dependabot[bot] Nov 18, 2022
4a924ac
Merge pull request #498 from LizardByte/dependabot/github_actions/nig…
ReenigneArcher Nov 18, 2022
8132c82
ci: update global workflows (#501)
LizardByte-bot Nov 18, 2022
4cbf8c0
ci: update global docker (#502)
LizardByte-bot Nov 18, 2022
9af770e
ci: update global workflows (#505)
LizardByte-bot Nov 18, 2022
4c1371a
Add install scripts (Flatpak) (#471)
istori1 Nov 18, 2022
981d878
use npm dependencies
ReenigneArcher Nov 18, 2022
67a569c
Merge branch 'nightly' into update/use-npm-dependencies
ReenigneArcher Nov 19, 2022
f0cfc4a
update build instructions
ReenigneArcher Nov 19, 2022
fbd6807
Merge pull request #504 from LizardByte/update/use-npm-dependencies
ReenigneArcher Nov 20, 2022
d912cce
Update moonlight-common-c to pick up new input structures
cgutman Nov 23, 2022
e39d9bc
Add support for Unicode input messages on Windows
cgutman Nov 23, 2022
5ed17fb
Merge pull request #511 from cgutman/utf8_events
ReenigneArcher Dec 8, 2022
7648496
CMake: win32: fix linker errors with mingw boost 1.80.0-2
psyke83 Dec 7, 2022
97716fa
fix aur build
ReenigneArcher Dec 3, 2022
ed5ee24
Merge pull request #530 from psyke83/restrict_boost_ver
ReenigneArcher Dec 10, 2022
dbe56ee
ci: update global cpp (#533)
LizardByte-bot Dec 10, 2022
a6e47ff
ci: update global workflows (#532)
LizardByte-bot Dec 10, 2022
a7b19f4
ci: update release notifier (#534)
LizardByte-bot Dec 10, 2022
e8aa749
Sunshine prebuilts (#510)
brad-richardson Dec 11, 2022
84fdc7e
change linux build matrix (#468)
ReenigneArcher Dec 12, 2022
6f36939
Bump furo from 2022.9.29 to 2022.12.7 (#531)
dependabot[bot] Dec 12, 2022
c60ebb7
ci: update global workflows (#547)
LizardByte-bot Dec 13, 2022
5b239c1
prepare v0.16.0
ReenigneArcher Dec 13, 2022
fe1321f
Merge pull request #548 from LizardByte/prepare/v0.16.0
ReenigneArcher Dec 13, 2022
37c0f79
CMake: Linux: use standard FreeDesktop udev/systemd paths (#550)
psyke83 Dec 14, 2022
8c8a7bb
update ffmpeg submodules (#552)
ReenigneArcher Dec 14, 2022
12f1ec6
update issue template (#554)
ReenigneArcher Dec 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .docker_platforms
Original file line number Diff line number Diff line change
@@ -1 +1 @@
linux/amd64
linux/amd64,linux/arm64/v8
8 changes: 5 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ jobs:

- name: Publish AUR package
if: ${{ env.aur_publish == 'true' }}
uses: KSXGitHub/github-actions-deploy-aur@v2.5.0
uses: KSXGitHub/github-actions-deploy-aur@v2.6.0
with:
pkgname: ${{ env.aur_pkg }}
pkgbuild: ./artifacts/PKGBUILD
Expand Down Expand Up @@ -383,6 +383,7 @@ jobs:
libboost-log-dev \
libboost-thread-dev \
libcap-dev \
libcurl4-openssl-dev \
libdrm-dev \
libevdev-dev \
libpulse-dev \
Expand Down Expand Up @@ -548,7 +549,7 @@ jobs:
- name: Setup Dependencies MacOS
run: |
# install dependencies using homebrew
brew install boost cmake ffmpeg opus
brew install boost cmake curl ffmpeg opus

# fix openssl header not found
ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl
Expand Down Expand Up @@ -846,6 +847,7 @@ jobs:
mingw-w64-x86_64-binutils
mingw-w64-x86_64-boost
mingw-w64-x86_64-cmake
mingw-w64-x86_64-curl
mingw-w64-x86_64-nsis
mingw-w64-x86_64-openssl
mingw-w64-x86_64-opus
Expand Down Expand Up @@ -901,7 +903,7 @@ jobs:

release-winget:
name: Release to WinGet
needs: build_win
needs: [setup_release, build_win]
if: ${{ needs.setup_release.outputs.create_release == 'true' && github.ref == 'refs/heads/master' }}
runs-on: windows-latest # the required action can only be run on Windows
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

- name: Hadolint
id: hadolint
uses: hadolint/hadolint-action@v2.1.0
uses: hadolint/hadolint-action@v3.0.0
with:
dockerfile: ./Dockerfile
ignore: DL3008,DL3013,DL3016,DL3018,DL3028,DL3059
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/yaml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,5 @@ jobs:
file_or_dir: . ${{ steps.find-files.outputs.found }}

- name: Log
if: failure()
run: |
cat "${{ steps.yaml-lint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ include_directories(third-party/miniupnp)

find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules (CURL REQUIRED libcurl)

if(NOT APPLE)
set(Boost_USE_STATIC_LIBS ON)
endif()
Expand All @@ -88,6 +91,7 @@ if(WIN32)
INPUT "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pre-compiled)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CURL_STATIC_LDFLAGS} ${CURL_STATIC_CFLAGS}")

if(NOT DEFINED SUNSHINE_PREPARED_BINARIES)
set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled/windows")
Expand Down Expand Up @@ -149,6 +153,7 @@ if(WIN32)
d3d11 dxgi D3DCompiler
setupapi
dwmapi
${CURL_STATIC_LIBRARIES}
)

set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650")
Expand Down Expand Up @@ -451,13 +456,19 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${FFMPEG_LIBRARIES}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${CURL_LIBRARIES}
${PLATFORM_LIBRARIES})

if(NOT WIN32)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES Boost::log)
endif()

add_executable(sunshine ${SUNSHINE_TARGET_FILES})

if(WIN32)
set_target_properties(sunshine PROPERTIES LINK_SEARCH_START_STATIC 1)
endif()

target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES} ${EXTRA_LIBS})
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
set_target_properties(sunshine PROPERTIES CXX_STANDARD 17
Expand Down Expand Up @@ -647,8 +658,8 @@ elseif(UNIX)

# Dependencies
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2")
set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.1, libavdevice >= 4.3, boost-thread >= 1.67.0, boost-filesystem >= 1.67.0, boost-log >= 1.67.0, pulseaudio-libs >= 10.0, libopusenc >= 0.2.1, libxcb >= 1.13, libXtst >= 1.2.3, libevdev >= 1.5.6, libdrm >= 2.4.97, libcap >= 2.22")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libcurl4, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2")
set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.1, libavdevice >= 4.3, boost-thread >= 1.67.0, boost-filesystem >= 1.67.0, boost-log >= 1.67.0, libcurl >= 7.0, pulseaudio-libs >= 10.0, libopusenc >= 0.2.1, libxcb >= 1.13, libXtst >= 1.2.3, libevdev >= 1.5.6, libdrm >= 2.4.97, libcap >= 2.22")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # This should automatically figure out dependencies, doesn't work with the current config
endif()
endif()
Expand Down
12 changes: 12 additions & 0 deletions DOCKER_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,15 @@ uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
```

If you want to change the PUID or PGID after the image has been built, it will require rebuilding the image.

## Supported Architectures

Specifying `lizardbyte/sunshine:latest` or `ghcr.io/lizardbyte/sunshine:latest` should retrieve the correct
image for your architecture.

The architectures supported by this image are:

| Architecture | Available |
|:------------:|:---------:|
| x86-64 | ✅ |
| arm64 | ✅ |
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN apt-get update -y \
libboost-log-dev=1.74.0* \
libboost-thread-dev=1.74.0* \
libcap-dev=1:2.44* \
libcurl4-openssl-dev=7.81.0* \
libdrm-dev=2.4.110* \
libevdev-dev=1.12.1* \
libpulse-dev=1:15.99.1* \
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
furo==2022.9.29
m2r2==0.3.3
Sphinx==5.3.0
sphinx-copybutton==0.5.0
sphinx-copybutton==0.5.1
4 changes: 2 additions & 2 deletions docs/source/troubleshooting/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ General
If you forgot your credentials to the web UI, try this.
.. code-block:: bash

sunshine -creds <new username> <new password>
sunshine --creds <new username> <new password>

Can't access the web UI?
#. Check firefall rules.
#. Check firewall rules.

NvFBC, NvENC, or general issues with Nvidia graphics card.
- Consumer grade Nvidia cards are software limited to a specific number of encodes. See
Expand Down
2 changes: 1 addition & 1 deletion packaging/linux/aur/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ arch=('x86_64' 'i686')
url=@PROJECT_HOMEPAGE_URL@
license=('GPL3')

depends=('avahi' 'boost-libs' 'ffmpeg4.4' 'libevdev' 'libpulse' 'libx11' 'libxcb' 'libxfixes' 'libxrandr' 'libxtst' 'openssl' 'opus' 'udev')
depends=('avahi' 'boost-libs' 'curl' 'ffmpeg4.4' 'libevdev' 'libpulse' 'libx11' 'libxcb' 'libxfixes' 'libxrandr' 'libxtst' 'openssl' 'opus' 'udev')
makedepends=('boost' 'cmake' 'git' 'make')
optdepends=('cuda' 'libcap' 'libdrm')

Expand Down
1 change: 1 addition & 0 deletions packaging/macos/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ post-fetch {
}

depends_lib port:avahi \
port:curl \
port:ffmpeg \
port:libopus

Expand Down
2 changes: 1 addition & 1 deletion scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Babel==2.10.3
Babel==2.11.0
69 changes: 68 additions & 1 deletion src/confighttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include <boost/asio/ssl/context.hpp>

#include <boost/filesystem.hpp>

#include <Simple-Web-Server/crypto.hpp>
#include <Simple-Web-Server/server_https.hpp>
#include <boost/asio/ssl/context_base.hpp>
Expand Down Expand Up @@ -164,9 +166,12 @@ void getAppsPage(resp_https_t response, req_https_t request) {

print_req(request);

SimpleWeb::CaseInsensitiveMultimap headers;
headers.emplace("Access-Control-Allow-Origin", "https://images.igdb.com/");

std::string header = read_file(WEB_DIR "header.html");
std::string content = read_file(WEB_DIR "apps.html");
response->write(header + content);
response->write(header + content, headers);
}

void getClientsPage(resp_https_t response, req_https_t request) {
Expand Down Expand Up @@ -411,6 +416,67 @@ void deleteApp(resp_https_t response, req_https_t request) {
proc::refresh(config::stream.file_apps);
}

void uploadCover(resp_https_t response, req_https_t request) {
if(!authenticate(response, request)) return;

std::stringstream ss;
std::stringstream configStream;
ss << request->content.rdbuf();
pt::ptree outputTree;
auto g = util::fail_guard([&]() {
std::ostringstream data;

SimpleWeb::StatusCode code = SimpleWeb::StatusCode::success_ok;
if(outputTree.get_child_optional("error").has_value()) {
code = SimpleWeb::StatusCode::client_error_bad_request;
}

pt::write_json(data, outputTree);
response->write(code, data.str());
});
pt::ptree inputTree;
try {
pt::read_json(ss, inputTree);
}
catch(std::exception &e) {
BOOST_LOG(warning) << "UploadCover: "sv << e.what();
outputTree.put("status", "false");
outputTree.put("error", e.what());
return;
}

auto key = inputTree.get("key", "");
if(key.empty()) {
outputTree.put("error", "Cover key is required");
return;
}
auto url = inputTree.get("url", "");

const std::string coverdir = platf::appdata().string() + "/covers/";
if(!boost::filesystem::exists(coverdir)) {
boost::filesystem::create_directory(coverdir);
}

std::basic_string path = coverdir + http::url_escape(key) + ".png";
if(!url.empty()) {
if(http::url_get_host(url) != "images.igdb.com") {
outputTree.put("error", "Only images.igdb.com is allowed");
return;
}
if(!http::download_file(url, path)) {
outputTree.put("error", "Failed to download cover");
return;
}
}
else {
auto data = SimpleWeb::Crypto::Base64::decode(inputTree.get<std::string>("data"));

std::ofstream imgfile(path);
imgfile.write(data.data(), (int)data.size());
}
outputTree.put("path", path);
}

void getConfig(resp_https_t response, req_https_t request) {
if(!authenticate(response, request)) return;

Expand Down Expand Up @@ -616,6 +682,7 @@ void start() {
server.resource["^/api/apps/([0-9]+)$"]["DELETE"] = deleteApp;
server.resource["^/api/clients/unpair$"]["POST"] = unpairAll;
server.resource["^/api/apps/close"]["POST"] = closeApp;
server.resource["^/api/covers/upload$"]["POST"] = uploadCover;
server.resource["^/images/favicon.ico$"]["GET"] = getFaviconImage;
server.resource["^/images/logo-sunshine-45.png$"]["GET"] = getSunshineLogoImage;
server.resource["^/third_party/bootstrap.min.css$"]["GET"] = getBootstrapCss;
Expand Down
52 changes: 52 additions & 0 deletions src/httpcommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <Simple-Web-Server/server_http.hpp>
#include <Simple-Web-Server/server_https.hpp>
#include <boost/asio/ssl/context_base.hpp>
#include <curl/curl.h>

#include "config.h"
#include "crypto.h"
Expand Down Expand Up @@ -180,4 +181,55 @@ int create_creds(const std::string &pkey, const std::string &cert) {

return 0;
}

bool download_file(const std::string &url, const std::string &file) {
CURL *curl = curl_easy_init();
if(!curl) {
BOOST_LOG(error) << "Couldn't create CURL instance";
return false;
}
FILE *fp = fopen(file.c_str(), "wb");
if(!fp) {
BOOST_LOG(error) << "Couldn't open ["sv << file << ']';
curl_easy_cleanup(curl);
return false;
}
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 << ']';
}
curl_easy_cleanup(curl);
fclose(fp);
return result == CURLE_OK;
}

std::string url_escape(const std::string &url) {
CURL *curl = curl_easy_init();
char *string = curl_easy_escape(curl, url.c_str(), url.length());
std::string result(string);
curl_free(string);
curl_easy_cleanup(curl);
return result;
}

std::string url_get_host(const std::string &url) {
CURLU *curlu = curl_url();
curl_url_set(curlu, CURLUPART_URL, url.c_str(), url.length());
char *host;
if(curl_url_get(curlu, CURLUPART_HOST, &host, 0) != CURLUE_OK) {
curl_url_cleanup(curlu);
return "";
}
std::string result(host);
curl_free(host);
curl_url_cleanup(curlu);
return result;
}

} // namespace http
4 changes: 4 additions & 0 deletions src/httpcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ int save_user_creds(
bool run_our_mouth = false);

int reload_user_creds(const std::string &file);
bool download_file(const std::string &url, const std::string &file);
std::string url_escape(const std::string &url);
std::string url_get_host(const std::string &url);

extern std::string unique_id;
extern net::net_e origin_pin_allowed;
extern net::net_e origin_web_ui_allowed;
Expand Down
Loading