diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8eadad4140c..38907881d2c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -398,8 +398,6 @@ jobs: mkdir -p build mkdir -p artifacts - npm install - cd build cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ @@ -527,8 +525,6 @@ jobs: BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }} COMMIT: ${{ github.event.pull_request.head.sha || github.sha }} run: | - npm install - mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release \ @@ -719,8 +715,9 @@ jobs: mingw-w64-x86_64-boost mingw-w64-x86_64-cmake mingw-w64-x86_64-curl - mingw-w64-x86_64-onevpl + mingw-w64-x86_64-nodejs mingw-w64-x86_64-nsis + mingw-w64-x86_64-onevpl mingw-w64-x86_64-openssl mingw-w64-x86_64-opus mingw-w64-x86_64-toolchain @@ -728,10 +725,6 @@ jobs: wget yasm - - name: Install npm packages - run: | - npm install - - name: Build Windows shell: msys2 {0} env: diff --git a/cmake/dependencies/common.cmake b/cmake/dependencies/common.cmake index 9bc7c56ceee..34ea09f7a3a 100644 --- a/cmake/dependencies/common.cmake +++ b/cmake/dependencies/common.cmake @@ -84,3 +84,4 @@ elseif(UNIX) include(${CMAKE_MODULE_PATH}/dependencies/linux.cmake) endif() endif() + diff --git a/cmake/packaging/common.cmake b/cmake/packaging/common.cmake index 0b41524f6cb..ad3f9bc0682 100644 --- a/cmake/packaging/common.cmake +++ b/cmake/packaging/common.cmake @@ -12,9 +12,14 @@ set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/sunshine.png) set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}") set(CPACK_STRIP_FILES YES) -# install npm modules -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/node_modules" - DESTINATION "${SUNSHINE_ASSETS_DIR}/web") +#install common assets +install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" + DESTINATION "${SUNSHINE_ASSETS_DIR}" + PATTERN "web" EXCLUDE) + +# install built vite assets +install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/assets/web" + DESTINATION "${SUNSHINE_ASSETS_DIR}") # platform specific packaging if(WIN32) diff --git a/cmake/packaging/linux.cmake b/cmake/packaging/linux.cmake index 842277b9d27..8106345ffe8 100644 --- a/cmake/packaging/linux.cmake +++ b/cmake/packaging/linux.cmake @@ -70,11 +70,11 @@ if(${SUNSHINE_TRAY} STREQUAL 1) install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status" RENAME "sunshine-tray.svg") - install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/images/sunshine-playing.svg" + install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-playing.svg" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status") - install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/images/sunshine-pausing.svg" + install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-pausing.svg" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status") - install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/images/sunshine-locked.svg" + install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-locked.svg" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/status") set(CPACK_DEBIAN_PACKAGE_DEPENDS "\ diff --git a/cmake/packaging/macos.cmake b/cmake/packaging/macos.cmake index 2b173393bbf..f7c3a518c97 100644 --- a/cmake/packaging/macos.cmake +++ b/cmake/packaging/macos.cmake @@ -10,8 +10,6 @@ if(SUNSHINE_PACKAGE_MACOS) # todo set(MAC_PREFIX "${CMAKE_PROJECT_NAME}.app/Contents") set(INSTALL_RUNTIME_DIR "${MAC_PREFIX}/MacOS") - install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" - DESTINATION "${SUNSHINE_ASSETS_DIR}") install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") diff --git a/cmake/packaging/unix.cmake b/cmake/packaging/unix.cmake index 660811f3b33..bacbfc910de 100644 --- a/cmake/packaging/unix.cmake +++ b/cmake/packaging/unix.cmake @@ -13,6 +13,3 @@ if(NOT CMAKE_INSTALL_PREFIX) endif() install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - -install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" - DESTINATION "${SUNSHINE_ASSETS_DIR}") diff --git a/cmake/packaging/windows.cmake b/cmake/packaging/windows.cmake index 3231d761f8c..dc2add19854 100644 --- a/cmake/packaging/windows.cmake +++ b/cmake/packaging/windows.cmake @@ -36,9 +36,6 @@ install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/gamepad/" COMPONENT gamepad) # Sunshine assets -install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" - DESTINATION "${SUNSHINE_ASSETS_DIR}" - COMPONENT assets) install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}" COMPONENT assets) diff --git a/cmake/targets/common.cmake b/cmake/targets/common.cmake index 72f89bf5182..7c446e466df 100644 --- a/cmake/targets/common.cmake +++ b/cmake/targets/common.cmake @@ -33,3 +33,9 @@ foreach(flag IN LISTS SUNSHINE_COMPILE_OPTIONS) endforeach() target_compile_options(sunshine PRIVATE $<$:${SUNSHINE_COMPILE_OPTIONS}>;$<$:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>) # cmake-lint: disable=C0301 + +#WebUI build +add_custom_target(web-ui ALL + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Installing NPM Dependencies and Building the Web UI" + COMMAND bash -c \"npm install && SUNSHINE_SOURCE_ASSETS_DIR=${SUNSHINE_SOURCE_ASSETS_DIR} SUNSHINE_ASSETS_DIR=${CMAKE_BINARY_DIR} npm run build\") # cmake-lint: disable=C0301 diff --git a/docker/debian-bookworm.dockerfile b/docker/debian-bookworm.dockerfile index 1172d35a5e9..c9d4fccdede 100644 --- a/docker/debian-bookworm.dockerfile +++ b/docker/debian-bookworm.dockerfile @@ -95,9 +95,6 @@ _INSTALL_CUDA WORKDIR /build/sunshine/ COPY --link .. . -# setup npm dependencies -RUN npm install - # setup build directory WORKDIR /build/sunshine/build diff --git a/docker/debian-bullseye.dockerfile b/docker/debian-bullseye.dockerfile index 6d7ebdd30af..3e602105cb2 100644 --- a/docker/debian-bullseye.dockerfile +++ b/docker/debian-bullseye.dockerfile @@ -31,6 +31,7 @@ set -e apt-get update -y apt-get install -y --no-install-recommends \ build-essential \ + ca-certificates \ cmake=3.18.* \ git \ libavdevice-dev \ @@ -58,8 +59,6 @@ apt-get install -y --no-install-recommends \ libxfixes-dev \ libxrandr-dev \ libxtst-dev \ - nodejs \ - npm \ wget if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then apt-get install -y --no-install-recommends \ @@ -69,6 +68,17 @@ apt-get clean rm -rf /var/lib/apt/lists/* _DEPS +#Install Node +# hadolint ignore=SC1091 +RUN <<_INSTALL_NODE +#!/bin/bash +set -e +wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash +source "$HOME/.nvm/nvm.sh" +nvm install 20.9.0 +nvm use 20.9.0 +_INSTALL_NODE + # install cuda WORKDIR /build/cuda # versions: https://developer.nvidia.com/cuda-toolkit-archive @@ -95,16 +105,17 @@ _INSTALL_CUDA WORKDIR /build/sunshine/ COPY --link .. . -# setup npm dependencies -RUN npm install - # setup build directory WORKDIR /build/sunshine/build # cmake and cpack +# hadolint ignore=SC1091 RUN <<_MAKE #!/bin/bash set -e +#Set Node version +source "$HOME/.nvm/nvm.sh" +nvm use 20.9.0 cmake \ -DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/docker/fedora-38.dockerfile b/docker/fedora-38.dockerfile index 2245ba9b9aa..9f836fb889a 100644 --- a/docker/fedora-38.dockerfile +++ b/docker/fedora-38.dockerfile @@ -52,7 +52,7 @@ dnf -y install \ libXrandr-devel \ libXtst-devel \ mesa-libGL-devel \ - nodejs-npm \ + nodejs \ numactl-devel \ openssl-devel \ opus-devel \ @@ -94,9 +94,6 @@ _DEPS WORKDIR /build/sunshine/ COPY --link .. . -# setup npm dependencies -RUN npm install - # setup build directory WORKDIR /build/sunshine/build diff --git a/docker/fedora-39.dockerfile b/docker/fedora-39.dockerfile index 6c6db891bbf..26b10f4b004 100644 --- a/docker/fedora-39.dockerfile +++ b/docker/fedora-39.dockerfile @@ -52,7 +52,7 @@ dnf -y install \ libXrandr-devel \ libXtst-devel \ mesa-libGL-devel \ - nodejs-npm \ + nodejs \ numactl-devel \ openssl-devel \ opus-devel \ @@ -94,9 +94,6 @@ _DEPS WORKDIR /build/sunshine/ COPY --link .. . -# setup npm dependencies -RUN npm install - # setup build directory WORKDIR /build/sunshine/build diff --git a/docker/ubuntu-20.04.dockerfile b/docker/ubuntu-20.04.dockerfile index 5634d48e0c0..bad8285d648 100644 --- a/docker/ubuntu-20.04.dockerfile +++ b/docker/ubuntu-20.04.dockerfile @@ -31,6 +31,7 @@ set -e apt-get update -y apt-get install -y --no-install-recommends \ build-essential \ + ca-certificates \ gcc-10=10.5.* \ g++-10=10.5.* \ git \ @@ -59,8 +60,6 @@ apt-get install -y --no-install-recommends \ libxfixes-dev \ libxrandr-dev \ libxtst-dev \ - nodejs \ - npm \ wget if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then apt-get install -y --no-install-recommends \ @@ -70,6 +69,17 @@ apt-get clean rm -rf /var/lib/apt/lists/* _DEPS +#Install Node +# hadolint ignore=SC1091 +RUN <<_INSTALL_NODE +#!/bin/bash +set -e +wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash +source "$HOME/.nvm/nvm.sh" +nvm install 20.9.0 +nvm use 20.9.0 +_INSTALL_NODE + # Update gcc alias # https://stackoverflow.com/a/70653945/11214013 RUN <<_GCC_ALIAS @@ -131,16 +141,17 @@ _INSTALL_CUDA WORKDIR /build/sunshine/ COPY --link .. . -# setup npm dependencies -RUN npm install - # setup build directory WORKDIR /build/sunshine/build # cmake and cpack +# hadolint ignore=SC1091 RUN <<_MAKE #!/bin/bash set -e +#Set Node version +source "$HOME/.nvm/nvm.sh" +nvm use 20.9.0 cmake \ -DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/docker/ubuntu-22.04.dockerfile b/docker/ubuntu-22.04.dockerfile index c9c6b70db89..2f37a691bc7 100644 --- a/docker/ubuntu-22.04.dockerfile +++ b/docker/ubuntu-22.04.dockerfile @@ -32,6 +32,7 @@ apt-get update -y apt-get install -y --no-install-recommends \ build-essential \ cmake=3.22.* \ + ca-certificates \ git \ libayatana-appindicator3-dev \ libavdevice-dev \ @@ -58,8 +59,6 @@ apt-get install -y --no-install-recommends \ libxfixes-dev \ libxrandr-dev \ libxtst-dev \ - nodejs \ - npm \ wget if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then apt-get install -y --no-install-recommends \ @@ -69,6 +68,17 @@ apt-get clean rm -rf /var/lib/apt/lists/* _DEPS +#Install Node +# hadolint ignore=SC1091 +RUN <<_INSTALL_NODE +#!/bin/bash +set -e +wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash +source "$HOME/.nvm/nvm.sh" +nvm install 20.9.0 +nvm use 20.9.0 +_INSTALL_NODE + # install cuda WORKDIR /build/cuda # versions: https://developer.nvidia.com/cuda-toolkit-archive @@ -95,16 +105,18 @@ _INSTALL_CUDA WORKDIR /build/sunshine/ COPY --link .. . -# setup npm dependencies -RUN npm install - # setup build directory WORKDIR /build/sunshine/build # cmake and cpack +# hadolint ignore=SC1091 RUN <<_MAKE #!/bin/bash set -e +#Set Node version +source "$HOME/.nvm/nvm.sh" +nvm use 20.9.0 +#Actually build cmake \ -DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/docs/source/building/linux.rst b/docs/source/building/linux.rst index 0ac90079e39..eab0aaab607 100644 --- a/docs/source/building/linux.rst +++ b/docs/source/building/linux.rst @@ -192,13 +192,6 @@ If the version of CUDA available from your distro is not adequate, manually inst ./cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm rm ./cuda.run -npm dependencies ----------------- -Install npm dependencies. - .. code-block:: bash - - npm install - Build ----- .. Attention:: Ensure you are in the build directory created during the clone step earlier before continuing. diff --git a/docs/source/building/macos.rst b/docs/source/building/macos.rst index 2d39ec17951..6bfa2c7061e 100644 --- a/docs/source/building/macos.rst +++ b/docs/source/building/macos.rst @@ -24,13 +24,6 @@ Install Requirements cd /usr/local/include ln -s ../opt/openssl/include/openssl . -npm dependencies ----------------- -Install npm dependencies. - .. code-block:: bash - - npm install - Build ----- .. Attention:: Ensure you are in the build directory created during the clone step earlier before continuing. diff --git a/docs/source/building/windows.rst b/docs/source/building/windows.rst index 623bd16a409..a8164d3cb20 100644 --- a/docs/source/building/windows.rst +++ b/docs/source/building/windows.rst @@ -16,17 +16,8 @@ Install dependencies: pacman -S base-devel cmake diffutils gcc git make mingw-w64-x86_64-binutils \ mingw-w64-x86_64-boost mingw-w64-x86_64-cmake mingw-w64-x86_64-curl \ - mingw-w64-x86_64-onevpl mingw-w64-x86_64-openssl mingw-w64-x86_64-opus \ - mingw-w64-x86_64-toolchain - -npm dependencies ----------------- -Install nodejs and npm. Downloads available `here `__. - -Install npm dependencies. - .. code-block:: bash - - npm install + mingw-w64-x86_64-nodejs mingw-w64-x86_64-onevpl mingw-w64-x86_64-openssl \ + mingw-w64-x86_64-opus mingw-w64-x86_64-toolchain Build ----- diff --git a/docs/source/conf.py b/docs/source/conf.py index 3c9e338bb07..c2b66a56635 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -69,7 +69,7 @@ # -- Options for HTML output ------------------------------------------------- # images -html_favicon = os.path.join(root_dir, 'src_assets', 'common', 'assets', 'web', 'images', 'sunshine.ico') +html_favicon = os.path.join(root_dir, 'src_assets', 'common', 'assets', 'web', 'public', 'images', 'sunshine.ico') html_logo = os.path.join(root_dir, 'sunshine.png') # Add any paths that contain custom static files (such as style sheets) here, diff --git a/docs/source/contributing/contributing.rst b/docs/source/contributing/contributing.rst index a50300d2327..ab85e13deee 100644 --- a/docs/source/contributing/contributing.rst +++ b/docs/source/contributing/contributing.rst @@ -3,3 +3,23 @@ Contributing Read our contribution guide in our organization level `docs `__. + +Web UI +------ +The Web UI uses `Vite `__ as its build system, to handle the integration of the NPM libraries. + +The HTML pages used by the Web UI are found in ``src_assets/common/assets/web``. + +`EJS `__ is used as a templating system for the pages (check ``template_header.html`` and ``template_header_main.html``). + +The Style System is provided by `Bootstrap `__. + +The JS framework used by the more interactive pages is `Vue `__. + +Building +^^^^^^^^ +Sunshine already builds the UI as part of its build process, but you can make faster changes by starting vite manually. + +.. code-block:: bash + + npm run dev \ No newline at end of file diff --git a/package.json b/package.json index f5152b6a54a..8ed5b32d933 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,15 @@ { + "scripts": { + "build": "vite build --debug", + "dev": "vite build --watch" + }, "dependencies": { "@fortawesome/fontawesome-free": "6.4.2", + "@popperjs/core": "2.11.8", + "@vitejs/plugin-vue": "4.3.4", "bootstrap": "5.3.2", - "vue": "2.6.12" + "vite": "4.4.9", + "vite-plugin-ejs": "1.6.4", + "vue": "3.2.25" } } diff --git a/packaging/linux/Arch/PKGBUILD b/packaging/linux/Arch/PKGBUILD index cfd760653df..68cbecb872b 100644 --- a/packaging/linux/Arch/PKGBUILD +++ b/packaging/linux/Arch/PKGBUILD @@ -70,10 +70,6 @@ prepare() { } build() { - pushd "$pkgname" - npm install - popd - export BRANCH="@GITHUB_BRANCH@" export BUILD_VERSION="@GITHUB_BUILD_VERSION@" export COMMIT="@GITHUB_COMMIT@" diff --git a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml index be1ae8adbf2..d4f0c164753 100644 --- a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml +++ b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml @@ -312,9 +312,6 @@ modules: env: npm_config_nodedir: /usr/lib/sdk/node18 NPM_CONFIG_LOGLEVEL: info - build-commands: - # Install npm dependencies - - cd ${FLATPAK_BUILDER_BUILDDIR} && npm install config-opts: - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/app diff --git a/packaging/macos/Portfile b/packaging/macos/Portfile index c22c1cb9dca..73a775a1dc5 100644 --- a/packaging/macos/Portfile +++ b/packaging/macos/Portfile @@ -55,10 +55,6 @@ platform darwin { } } -pre-build { - system -W ${worksrcpath} "npm install" -} - notes-append "Run @PROJECT_NAME@ by executing 'sunshine ', e.g. 'sunshine ~/sunshine.conf' " notes-append "The config file will be created if it doesn't exist." notes-append "It is recommended to set a location for the apps file in the config." diff --git a/scripts/icons/convert_and_pack.sh b/scripts/icons/convert_and_pack.sh index dd1183b9992..950effc98d6 100644 --- a/scripts/icons/convert_and_pack.sh +++ b/scripts/icons/convert_and_pack.sh @@ -37,9 +37,9 @@ icon_sizes=${!icon_sizes_keys[@]} echo "using icon sizes:" echo ${icon_sizes[@]} -src_vectors=("../../src_assets/common/assets/web/images/sunshine-locked.svg" - "../../src_assets/common/assets/web/images/sunshine-pausing.svg" - "../../src_assets/common/assets/web/images/sunshine-playing.svg" +src_vectors=("../../src_assets/common/assets/web/public/images/sunshine-locked.svg" + "../../src_assets/common/assets/web/public/images/sunshine-pausing.svg" + "../../src_assets/common/assets/web/public/images/sunshine-playing.svg" "../../sunshine.svg") echo "using sources vectors:" diff --git a/src/confighttp.cpp b/src/confighttp.cpp index 0de9cfb90c6..50bd87d3df4 100644 --- a/src/confighttp.cpp +++ b/src/confighttp.cpp @@ -161,11 +161,10 @@ namespace confighttp { print_req(request); - std::string header = read_file(WEB_DIR "header.html"); std::string content = read_file(WEB_DIR "index.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -174,11 +173,10 @@ namespace confighttp { print_req(request); - std::string header = read_file(WEB_DIR "header.html"); std::string content = read_file(WEB_DIR "pin.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -187,12 +185,11 @@ namespace confighttp { print_req(request); - std::string header = read_file(WEB_DIR "header.html"); std::string content = read_file(WEB_DIR "apps.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); headers.emplace("Access-Control-Allow-Origin", "https://images.igdb.com/"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -201,11 +198,10 @@ namespace confighttp { print_req(request); - std::string header = read_file(WEB_DIR "header.html"); std::string content = read_file(WEB_DIR "clients.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -214,11 +210,10 @@ namespace confighttp { print_req(request); - std::string header = read_file(WEB_DIR "header.html"); std::string content = read_file(WEB_DIR "config.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -227,11 +222,10 @@ namespace confighttp { print_req(request); - std::string header = read_file(WEB_DIR "header.html"); std::string content = read_file(WEB_DIR "password.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -241,11 +235,10 @@ namespace confighttp { send_redirect(response, request, "/"); return; } - std::string header = read_file(WEB_DIR "header-no-nav.html"); std::string content = read_file(WEB_DIR "welcome.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -254,11 +247,10 @@ namespace confighttp { print_req(request); - std::string header = read_file(WEB_DIR "header.html"); std::string content = read_file(WEB_DIR "troubleshooting.html"); SimpleWeb::CaseInsensitiveMultimap headers; headers.emplace("Content-Type", "text/html; charset=utf-8"); - response->write(header + content, headers); + response->write(content, headers); } void @@ -295,14 +287,14 @@ namespace confighttp { getNodeModules(resp_https_t response, req_https_t request) { print_req(request); fs::path webDirPath(WEB_DIR); - fs::path nodeModulesPath(webDirPath / "node_modules"); + fs::path nodeModulesPath(webDirPath / "assets"); // .relative_path is needed to shed any leading slash that might exist in the request path auto filePath = fs::weakly_canonical(webDirPath / fs::path(request->path).relative_path()); - // Don't do anything if file does not exist or is outside the node_modules directory + // Don't do anything if file does not exist or is outside the assets directory if (!isChildPath(filePath, nodeModulesPath)) { - BOOST_LOG(warning) << "Someone requested a path " << filePath << " that is outside the node_modules folder"; + BOOST_LOG(warning) << "Someone requested a path " << filePath << " that is outside the assets folder"; response->write(SimpleWeb::StatusCode::client_error_bad_request, "Bad Request"); } else if (!fs::exists(filePath)) { @@ -757,7 +749,7 @@ namespace confighttp { server.resource["^/api/covers/upload$"]["POST"] = uploadCover; server.resource["^/images/sunshine.ico$"]["GET"] = getFaviconImage; server.resource["^/images/logo-sunshine-45.png$"]["GET"] = getSunshineLogoImage; - server.resource["^/node_modules\\/.+$"]["GET"] = getNodeModules; + server.resource["^/assets\\/.+$"]["GET"] = getNodeModules; server.config.reuse_address = true; server.config.address = net::af_to_any_address_string(address_family); server.config.port = port_https; diff --git a/src_assets/common/assets/web/Navbar.vue b/src_assets/common/assets/web/Navbar.vue new file mode 100644 index 00000000000..948fb4d7244 --- /dev/null +++ b/src_assets/common/assets/web/Navbar.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src_assets/common/assets/web/ResourceCard.vue b/src_assets/common/assets/web/ResourceCard.vue new file mode 100644 index 00000000000..8bdfb5f9311 --- /dev/null +++ b/src_assets/common/assets/web/ResourceCard.vue @@ -0,0 +1,36 @@ + diff --git a/src_assets/common/assets/web/apps.html b/src_assets/common/assets/web/apps.html index bd09051d669..c9131440340 100644 --- a/src_assets/common/assets/web/apps.html +++ b/src_assets/common/assets/web/apps.html @@ -1,370 +1,383 @@ -
-
-

Applications

-
Applications are refreshed only when Client is restarted
-
-
- - - - - - - - - - - - - -
NameActions
{{app.name}} - - -
-
-
-
- -
- - -
- Application Name, as shown on Moonlight -
-
- -
- - -
- The file where the output of the command is stored, if it is not - specified, the output is ignored -
-
- -
- - -
- Enable/Disable the execution of Global Prep Commands for this - application. -
-
-
- -
- A list of commands to be run before/after this application.
- If any of the prep-commands fail, starting the application is aborted. + + + + + <%- header %> + + + + + +
+
+

Applications

+
Applications are refreshed only when Client is restarted
+
+
+ + + + + + + + + + + + + +
NameActions
{{app.name}} + + +
+
+
+
+ +
+ + +
+ Application Name, as shown on Moonlight +
-
- + +
+ + +
+ The file where the output of the command is stored, if it is not + specified, the output is ignored +
- - - - - - - - - - - - - - - - - -
Do Command Undo Command - Run as Admin -
- - - - -
- - -
-
- - -
-
- -
- -
-
{{c}}
- + +
+ + +
+ Enable/Disable the execution of Global Prep Commands for this + application. +
-
- - +
+ +
+ A list of commands to be run before/after this application.
+ If any of the prep-commands fail, starting the application is aborted. +
+
+ +
+ + + + + + + + + + + + + + + + + +
Do Command Undo Command + Run as Admin +
+ + + + +
+ + +
+
+ + +
-
- A list of commands to be run and forgotten about + +
+ +
+ + +
+
+ +
+
+ A list of commands to be run and forgotten about +
-
- -
- - -
- The main application, if it is not specified, a process is started - that sleeps indefinitely + +
+ + +
+ The main application, if it is not specified, a process is started + that sleeps indefinitely +
-
- -
- - -
- The working directory that should be passed to the process. For - example, some applications use the working directory to search for - configuration files. If not set, Sunshine will default to the parent - directory of the command + +
+ + +
+ The working directory that should be passed to the process. For + example, some applications use the working directory to search for + configuration files. If not set, Sunshine will default to the parent + directory of the command +
-
- -
- - -
- This can be necessary for some applications that require administrator - permissions to run properly. + +
+ + +
+ This can be necessary for some applications that require administrator + permissions to run properly. +
-
- -
- - -
- This will attempt to automatically detect launcher-type apps that close - quickly after launching another program or instance of themselves. When - a launcher-type app is detected, it is treated as a detached app. + +
+ + +
+ This will attempt to automatically detect launcher-type apps that close + quickly after launching another program or instance of themselves. When + a launcher-type app is detected, it is treated as a detached app. +
-
- -
- -
- - -