text
stringlengths
2
104M
meta
dict
# 16 If the CEO's car is worth more than the entire IT budget, look elsewhere We will all find ourselves in a situation where money is being spent, but not on IT. It is worth attempting to prove the value of investing in IT, but sometimes the people in power have no interest in investment. Don't be afraid to look elsewhere.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
# 9 Don't be afraid to promote your value There's an old adage in IT: When IT runs smoothly, the boss says "Why are we even paying you?" When IT is in shambles, the boss says "Why are we even paying you?" The thought being that management doesn't see the value in IT. And that's true. When you are used to things running well, you may take it for granted. So part of your job is to prove you and your team's value to the company. Produce reports. Document everything. Insist users create tickets. All of that adds up to make sure management and executives know your value. ## Sub Rules ### 9.1 Don't be rude We all know that without computers modern society wouldn't exist. We all know that it is our skill that keeps those computers running smoothly. Screaming and demanding wont change minds. Bring data and use buzzwords. Speak to managers and execs on their terms and you will get much better results.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
# 17 Nobody buys a company to leave it alone Companies are purchased for a reason. Sometimes it is because a competitor believes that they can combine their strengths and provide a better service. However, more often than not a company is being bought because value can be extracted. Changes will follow, whether they are good or bad, plan for and expect them. ## Sub Rules ### 17.1 Private equity spells doom When a company is bought by a Private equity firm, they are going to expect a rapid return on investment. This means short sighted changes to maximize profitability in the short term. After partner relationships start taking a massive nosedive, they might start reverting changes if you are lucky.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
# 21 Be kind Life is not a competition. Ask your peers how they are doing, invest in relationships. Share knowledge without expecting anything in return. ## Sub Rules ### 21.1 Users are people too We all have bad days. We all have a lot on our plate. Remember that users have the same stuff going on, but when their computers fail them, they don't understand why. They may be frustrated, annoyed, and confused by the time they talk to you. Try to be patient and give them the benefit of the doubt.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
# 12 Don't let perfect be the enemy of good Sometimes you need to get the job done. Don't worry about getting everything exactly perfect.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
# 1 Users lie, even when they don't mean to Don't trust what the user said on face value. Their description of the problem will be incorrect. You will spend a lot of time chasing your tail on problems that don't exist. They don't always mean to lie, but if they knew what they needed, they probably wouldn't be coming to you in the first place. ## Sub Rules ### 1.1 When a user says "Everyone", they mean "one or more person" The scope of the problem is probably not what the user is telling you. Verify it for yourself.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
# 14 If you are always on call, something is wrong On call and overtime shouldn't be constants. If you are on call all the time, you are missing man power.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
# 13 Don't take it home with you IT shouldn't be your life. Don't be afraid to turn work off after hours. Relax, and remember rule 14.
{ "repo_name": "dbeta/RulesofIT", "stars": "37", "repo_language": "None", "file_name": "13.md", "mime_type": "text/plain" }
cmake_minimum_required(VERSION 3.14) project(tl-expected HOMEPAGE_URL https://tl.tartanllama.xyz DESCRIPTION "C++11/14/17 std::expected with functional-style extensions" VERSION 1.0.1 LANGUAGES CXX) include(CMakePackageConfigHelpers) include(CMakeDependentOption) include(GNUInstallDirs) include(FetchContent) include(CTest) if (NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() option(EXPECTED_BUILD_PACKAGE "Build package files as well" ON) cmake_dependent_option(EXPECTED_BUILD_TESTS "Enable tl::expected tests" ON "BUILD_TESTING" OFF) cmake_dependent_option(EXPECTED_BUILD_PACKAGE_DEB "Create a DEB" ON "EXPECTED_BUILD_PACKAGE" OFF) add_library(expected INTERFACE) target_include_directories(expected INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) if (NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) add_library(tl::expected ALIAS expected) endif() # Installation help configure_package_config_file( "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" INSTALL_DESTINATION "share/cmake/${PROJECT_NAME}") write_basic_package_version_file( "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT) install(TARGETS expected EXPORT ${PROJECT_NAME}-targets INCLUDES DESTINATION "${CMAKE_INSTALL_DATADIR}") install(EXPORT ${PROJECT_NAME}-targets DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" NAMESPACE tl:: FILE "${PROJECT_NAME}-targets.cmake") install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}") install(DIRECTORY "include/" TYPE INCLUDE) if(EXPECTED_BUILD_TESTS) set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(CATCH_INSTALL_HELPERS OFF) set(CATCH_BUILD_TESTING OFF) set(CATCH_INSTALL_DOCS OFF) FetchContent_Declare(Catch2 URL https://github.com/catchorg/Catch2/archive/v2.13.10.zip) FetchContent_MakeAvailable(Catch2) file(GLOB test-sources CONFIGURE_DEPENDS tests/*.cpp) list(FILTER test-sources EXCLUDE REGEX "tests/test.cpp") add_executable(${PROJECT_NAME}-tests "${test-sources}") target_compile_options(${PROJECT_NAME}-tests PRIVATE $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra>) target_link_libraries(${PROJECT_NAME}-tests PRIVATE Catch2::Catch2 expected) add_test(NAME tl::expected::tests COMMAND ${PROJECT_NAME}-tests) endif() if (NOT EXPECTED_BUILD_PACKAGE) return() endif() list(APPEND source-generators TBZ2 TGZ TXZ ZIP) if (CMAKE_HOST_WIN32) list(APPEND binary-generators "WIX") endif() if (EXPECTED_BUILD_PACKAGE_DEB) list(APPEND binary-generators "DEB") endif() if (EXPECTED_BUILD_RPM) list(APPEND binary-generators "RPM") endif() set(CPACK_SOURCE_GENERATOR ${source-generators}) set(CPACK_GENERATOR ${binary-generators}) set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Sy Brand") list(APPEND CPACK_SOURCE_IGNORE_FILES /.git/ /build/ .gitignore .DS_Store) include(CPack)
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
Creative Commons Legal Code CC0 1.0 Universal CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. Statement of Purpose The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. 1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; ii. moral rights retained by the original author(s) and/or performer(s); iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; v. rights protecting the extraction, dissemination, use and reuse of data in a Work; vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. 2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. 3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. 4. Limitations and Disclaimers. a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
# expected Single header implementation of `std::expected` with functional-style extensions. [![Documentation Status](https://readthedocs.org/projects/tl-docs/badge/?version=latest)](https://tl.tartanllama.xyz/en/latest/?badge=latest) Clang + GCC: [![Linux Build Status](https://github.com/TartanLlama/expected/actions/workflows/cmake.yml/badge.svg)](https://github.com/TartanLlama/expected/actions/workflows/cmake.yml) MSVC: [![Windows Build Status](https://ci.appveyor.com/api/projects/status/k5x00xa11y3s5wsg?svg=true)](https://ci.appveyor.com/project/TartanLlama/expected) Available on [Vcpkg](https://github.com/microsoft/vcpkg/tree/master/ports/tl-expected) and [Conan](https://github.com/yipdw/conan-tl-expected). [`std::expected`](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0323r3.pdf) is proposed as the preferred way to represent object which will either have an expected value, or an unexpected value giving information about why something failed. Unfortunately, chaining together many computations which may fail can be verbose, as error-checking code will be mixed in with the actual programming logic. This implementation provides a number of utilities to make coding with `expected` cleaner. For example, instead of writing this code: ```cpp std::expected<image,fail_reason> get_cute_cat (const image& img) { auto cropped = crop_to_cat(img); if (!cropped) { return cropped; } auto with_tie = add_bow_tie(*cropped); if (!with_tie) { return with_tie; } auto with_sparkles = make_eyes_sparkle(*with_tie); if (!with_sparkles) { return with_sparkles; } return add_rainbow(make_smaller(*with_sparkles)); } ``` You can do this: ```cpp tl::expected<image,fail_reason> get_cute_cat (const image& img) { return crop_to_cat(img) .and_then(add_bow_tie) .and_then(make_eyes_sparkle) .map(make_smaller) .map(add_rainbow); } ``` The interface is the same as `std::expected` as proposed in [p0323r3](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0323r3.pdf), but the following member functions are also defined. Explicit types are for clarity. - `map`: carries out some operation on the stored object if there is one. * `tl::expected<std::size_t,std::error_code> s = exp_string.map(&std::string::size);` - `map_error`: carries out some operation on the unexpected object if there is one. * `my_error_code translate_error (std::error_code);` * `tl::expected<int,my_error_code> s = exp_int.map_error(translate_error);` - `and_then`: like `map`, but for operations which return a `tl::expected`. * `tl::expected<ast, fail_reason> parse (const std::string& s);` * `tl::expected<ast, fail_reason> exp_ast = exp_string.and_then(parse);` - `or_else`: calls some function if there is no value stored. * `exp.or_else([] { throw std::runtime_error{"oh no"}; });` p0323r3 specifies calling `.error()` on an expected value, or using the `*` or `->` operators on an unexpected value, to be undefined behaviour. In this implementation it causes an assertion failure. The implementation of assertions can be overridden by defining the macro `TL_ASSERT(boolean_condition)` before #including <tl/expected.hpp>; by default, `assert(boolean_condition)` from the `<cassert>` header is used. Note that correct code would not rely on these assertions. ### Compiler support Tested on: - Linux * clang++ 3.5, 3.6, 3.7, 3.8, 3.9, 4, 5, 6, 7, 8, 9, 10, 11 * g++ 4.8, 4.9, 5.5, 6.4, 7.5, 8, 9, 10 - Windows * MSVC 2015, 2017, 2019, 2022 ---------- [![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)]("http://creativecommons.org/publicdomain/zero/1.0/") To the extent possible under law, [Sy Brand](https://twitter.com/TartanLlama) has waived all copyright and related or neighboring rights to the `expected` library. This work is published from: United Kingdom.
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
name: CMake on: push: branches: [ "master" ] pull_request: branches: [ "master" ] jobs: build: runs-on: ubuntu-20.04 strategy: matrix: std: [11, 14] cxx: [g++-4.8, g++-4.9, g++-5, g++-6, g++-7, g++-8, g++-9, g++-10, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, clang++-5.0, clang++-6.0, clang++-7, clang++-8, clang++-9, clang++-10, clang++-11] exclude: - cxx: g++-4.8 std: 14 - cxx: g++4.9 std: 14 include: - cxx: g++-4.8 install: sudo apt install g++-4.8 - cxx: g++-4.9 install: sudo apt install g++-4.9 - cxx: g++-5 install: sudo apt install g++-5 - cxx: g++-6 install: sudo apt install g++-6 - cxx: g++-7 install: sudo apt install g++-7 - cxx: g++-8 std: 11 install: sudo apt install g++-8 - cxx: g++-8 std: 14 install: sudo apt install g++-8 - cxx: g++-8 std: 17 install: sudo apt install g++-8 - cxx: g++-9 std: 14 - cxx: g++-9 std: 17 - cxx: g++-10 std: 14 - cxx: g++-10 std: 17 - cxx: g++-11 std: 14 install: sudo apt install g++-11 - cxx: g++-11 std: 17 install: sudo apt install g++-11 - cxx: g++-11 std: 20 install: sudo apt install g++-11 - cxx: clang++-3.5 install: sudo apt install clang-3.5 - cxx: clang++-3.6 install: sudo apt install clang-3.6 - cxx: clang++-3.7 install: sudo apt install clang-3.7 - cxx: clang++-3.8 install: sudo apt install clang-3.8 - cxx: clang++-3.9 install: sudo apt install clang-3.9 - cxx: clang++-4.0 install: sudo apt install clang-4.0 - cxx: clang++-5.0 install: sudo apt install clang-5.0 - cxx: clang++-6.0 install: sudo apt install clang-6.0 - cxx: clang++-7 install: sudo apt install clang-7 - cxx: clang++-8 install: sudo apt install clang-8 - cxx: clang++-9 install: sudo apt install clang-9 - cxx: clang++-10 install: sudo apt install clang-10 - cxx: clang++-11 install: sudo apt install clang-11 - cxx: clang++-6.0 std: 17 install: sudo apt install clang-6.0 - cxx: clang++-7 std: 17 install: sudo apt install clang-7 - cxx: clang++-8 std: 17 install: sudo apt install clang-8 - cxx: clang++-9 std: 17 install: sudo apt install clang-9 - cxx: clang++-10 std: 17 install: sudo apt install clang-10 - cxx: clang++-11 std: 17 install: sudo apt install clang-11 steps: - uses: actions/checkout@v3 - name: Setup Toolchain run: | sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ xenial main' sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ xenial universe' sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic main' sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe' ${{matrix.install}} - name: Configure CMake env: CXX: ${{matrix.cxx}} run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.std}} - name: Build run: cmake --build ${{github.workspace}}/build - name: Test working-directory: ${{github.workspace}}/build run: cmake --build ${{github.workspace}}/build --target test
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
@PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/tl-expected-targets.cmake")
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> #include <memory> #include <vector> #include <tuple> namespace { struct takes_init_and_variadic { std::vector<int> v; std::tuple<int, int> t; template <class... Args> takes_init_and_variadic(std::initializer_list<int> l, Args &&... args) : v(l), t(std::forward<Args>(args)...) {} }; } TEST_CASE("Emplace", "[emplace]") { { tl::expected<std::unique_ptr<int>,int> e; e.emplace(new int{42}); REQUIRE(e); REQUIRE(**e == 42); } { tl::expected<std::vector<int>,int> e; e.emplace({0,1}); REQUIRE(e); REQUIRE((*e)[0] == 0); REQUIRE((*e)[1] == 1); } { tl::expected<std::tuple<int,int>,int> e; e.emplace(2,3); REQUIRE(e); REQUIRE(std::get<0>(*e) == 2); REQUIRE(std::get<1>(*e) == 3); } { tl::expected<takes_init_and_variadic,int> e = tl::make_unexpected(0); e.emplace({0,1}, 2, 3); REQUIRE(e); REQUIRE(e->v[0] == 0); REQUIRE(e->v[1] == 1); REQUIRE(std::get<0>(e->t) == 2); REQUIRE(std::get<1>(e->t) == 3); } }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> struct move_detector { move_detector() = default; move_detector(move_detector &&rhs) { rhs.been_moved = true; } bool been_moved = false; }; TEST_CASE("Observers", "[observers]") { tl::expected<int,int> o1 = 42; tl::expected<int,int> o2 {tl::unexpect, 0}; const tl::expected<int,int> o3 = 42; REQUIRE(*o1 == 42); REQUIRE(*o1 == o1.value()); REQUIRE(o2.value_or(42) == 42); REQUIRE(o2.error() == 0); REQUIRE(o3.value() == 42); auto success = std::is_same<decltype(o1.value()), int &>::value; REQUIRE(success); success = std::is_same<decltype(o3.value()), const int &>::value; REQUIRE(success); success = std::is_same<decltype(std::move(o1).value()), int &&>::value; REQUIRE(success); #ifndef TL_EXPECTED_NO_CONSTRR success = std::is_same<decltype(std::move(o3).value()), const int &&>::value; REQUIRE(success); #endif tl::expected<move_detector,int> o4{tl::in_place}; move_detector o5 = std::move(o4).value(); REQUIRE(o4->been_moved); REQUIRE(!o5.been_moved); }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> TEST_CASE("Constexpr", "[constexpr]") { //TODO }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> TEST_CASE("Simple assignment", "[assignment.simple]") { tl::expected<int, int> e1 = 42; tl::expected<int, int> e2 = 17; tl::expected<int, int> e3 = 21; tl::expected<int, int> e4 = tl::make_unexpected(42); tl::expected<int, int> e5 = tl::make_unexpected(17); tl::expected<int, int> e6 = tl::make_unexpected(21); e1 = e2; REQUIRE(e1); REQUIRE(*e1 == 17); REQUIRE(e2); REQUIRE(*e2 == 17); e1 = std::move(e2); REQUIRE(e1); REQUIRE(*e1 == 17); REQUIRE(e2); REQUIRE(*e2 == 17); e1 = 42; REQUIRE(e1); REQUIRE(*e1 == 42); auto unex = tl::make_unexpected(12); e1 = unex; REQUIRE(!e1); REQUIRE(e1.error() == 12); e1 = tl::make_unexpected(42); REQUIRE(!e1); REQUIRE(e1.error() == 42); e1 = e3; REQUIRE(e1); REQUIRE(*e1 == 21); e4 = e5; REQUIRE(!e4); REQUIRE(e4.error() == 17); e4 = std::move(e6); REQUIRE(!e4); REQUIRE(e4.error() == 21); e4 = e1; REQUIRE(e4); REQUIRE(*e4 == 21); } TEST_CASE("Assignment deletion", "[assignment.deletion]") { struct has_all { has_all() = default; has_all(const has_all &) = default; has_all(has_all &&) noexcept = default; has_all &operator=(const has_all &) = default; }; tl::expected<has_all, has_all> e1 = {}; tl::expected<has_all, has_all> e2 = {}; e1 = e2; struct except_move { except_move() = default; except_move(const except_move &) = default; except_move(except_move &&) noexcept(false){}; except_move &operator=(const except_move &) = default; }; tl::expected<except_move, except_move> e3 = {}; tl::expected<except_move, except_move> e4 = {}; // e3 = e4; should not compile }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> #include <string> // Old versions of GCC don't have the correct trait names. Could fix them up if needs be. #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ !defined(__clang__)) // nothing for now #else TEST_CASE("Triviality", "[bases.triviality]") { REQUIRE(std::is_trivially_copy_constructible<tl::expected<int,int>>::value); REQUIRE(std::is_trivially_copy_assignable<tl::expected<int,int>>::value); REQUIRE(std::is_trivially_move_constructible<tl::expected<int,int>>::value); REQUIRE(std::is_trivially_move_assignable<tl::expected<int,int>>::value); REQUIRE(std::is_trivially_destructible<tl::expected<int,int>>::value); REQUIRE(std::is_trivially_copy_constructible<tl::expected<void,int>>::value); REQUIRE(std::is_trivially_move_constructible<tl::expected<void,int>>::value); REQUIRE(std::is_trivially_destructible<tl::expected<void,int>>::value); { struct T { T(const T&) = default; T(T&&) = default; T& operator=(const T&) = default; T& operator=(T&&) = default; ~T() = default; }; REQUIRE(std::is_trivially_copy_constructible<tl::expected<T,int>>::value); REQUIRE(std::is_trivially_copy_assignable<tl::expected<T,int>>::value); REQUIRE(std::is_trivially_move_constructible<tl::expected<T,int>>::value); REQUIRE(std::is_trivially_move_assignable<tl::expected<T,int>>::value); REQUIRE(std::is_trivially_destructible<tl::expected<T,int>>::value); } { struct T { T(const T&){} T(T&&) {} T& operator=(const T&) { return *this; } T& operator=(T&&) { return *this; } ~T(){} }; REQUIRE(!std::is_trivially_copy_constructible<tl::expected<T,int>>::value); REQUIRE(!std::is_trivially_copy_assignable<tl::expected<T,int>>::value); REQUIRE(!std::is_trivially_move_constructible<tl::expected<T,int>>::value); REQUIRE(!std::is_trivially_move_assignable<tl::expected<T,int>>::value); REQUIRE(!std::is_trivially_destructible<tl::expected<T,int>>::value); } } TEST_CASE("Deletion", "[bases.deletion]") { REQUIRE(std::is_copy_constructible<tl::expected<int,int>>::value); REQUIRE(std::is_copy_assignable<tl::expected<int,int>>::value); REQUIRE(std::is_move_constructible<tl::expected<int,int>>::value); REQUIRE(std::is_move_assignable<tl::expected<int,int>>::value); REQUIRE(std::is_destructible<tl::expected<int,int>>::value); { struct T { T()=default; }; REQUIRE(std::is_default_constructible<tl::expected<T,int>>::value); } { struct T { T(int){} }; REQUIRE(!std::is_default_constructible<tl::expected<T,int>>::value); } { struct T { T(const T&) = default; T(T&&) = default; T& operator=(const T&) = default; T& operator=(T&&) = default; ~T() = default; }; REQUIRE(std::is_copy_constructible<tl::expected<T,int>>::value); REQUIRE(std::is_copy_assignable<tl::expected<T,int>>::value); REQUIRE(std::is_move_constructible<tl::expected<T,int>>::value); REQUIRE(std::is_move_assignable<tl::expected<T,int>>::value); REQUIRE(std::is_destructible<tl::expected<T,int>>::value); } { struct T { T(const T&)=delete; T(T&&)=delete; T& operator=(const T&)=delete; T& operator=(T&&)=delete; }; REQUIRE(!std::is_copy_constructible<tl::expected<T,int>>::value); REQUIRE(!std::is_copy_assignable<tl::expected<T,int>>::value); REQUIRE(!std::is_move_constructible<tl::expected<T,int>>::value); REQUIRE(!std::is_move_assignable<tl::expected<T,int>>::value); } { struct T { T(const T&)=delete; T(T&&)=default; T& operator=(const T&)=delete; T& operator=(T&&)=default; }; REQUIRE(!std::is_copy_constructible<tl::expected<T,int>>::value); REQUIRE(!std::is_copy_assignable<tl::expected<T,int>>::value); REQUIRE(std::is_move_constructible<tl::expected<T,int>>::value); REQUIRE(std::is_move_assignable<tl::expected<T,int>>::value); } { struct T { T(const T&)=default; T(T&&)=delete; T& operator=(const T&)=default; T& operator=(T&&)=delete; }; REQUIRE(std::is_copy_constructible<tl::expected<T,int>>::value); REQUIRE(std::is_copy_assignable<tl::expected<T,int>>::value); } { tl::expected<int, int> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(std::is_trivially_move_assignable<decltype(e)>::value); # endif } { tl::expected<int, std::string> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(!std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value); # endif } { tl::expected<std::string, int> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(!std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value); # endif } { tl::expected<std::string, std::string> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(!std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value); # endif } } #endif
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> #include <type_traits> #include <vector> #include <string> struct takes_init_and_variadic { std::vector<int> v; std::tuple<int, int> t; template <class... Args> takes_init_and_variadic(std::initializer_list<int> l, Args &&... args) : v(l), t(std::forward<Args>(args)...) {} }; TEST_CASE("Constructors", "[constructors]") { { tl::expected<int,int> e; REQUIRE(e); REQUIRE(e == 0); } { tl::expected<int,int> e = tl::make_unexpected(0); REQUIRE(!e); REQUIRE(e.error() == 0); } { tl::expected<int,int> e (tl::unexpect, 0); REQUIRE(!e); REQUIRE(e.error() == 0); } { tl::expected<int,int> e (tl::in_place, 42); REQUIRE(e); REQUIRE(e == 42); } { tl::expected<std::vector<int>,int> e (tl::in_place, {0,1}); REQUIRE(e); REQUIRE((*e)[0] == 0); REQUIRE((*e)[1] == 1); } { tl::expected<std::tuple<int,int>,int> e (tl::in_place, 0, 1); REQUIRE(e); REQUIRE(std::get<0>(*e) == 0); REQUIRE(std::get<1>(*e) == 1); } { tl::expected<takes_init_and_variadic,int> e (tl::in_place, {0,1}, 2, 3); REQUIRE(e); REQUIRE(e->v[0] == 0); REQUIRE(e->v[1] == 1); REQUIRE(std::get<0>(e->t) == 2); REQUIRE(std::get<1>(e->t) == 3); } { tl::expected<int, int> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(std::is_trivially_move_assignable<decltype(e)>::value); # endif } { tl::expected<int, std::string> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(!std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value); # endif } { tl::expected<std::string, int> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(!std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value); # endif } { tl::expected<std::string, std::string> e; REQUIRE(std::is_default_constructible<decltype(e)>::value); REQUIRE(std::is_copy_constructible<decltype(e)>::value); REQUIRE(std::is_move_constructible<decltype(e)>::value); REQUIRE(std::is_copy_assignable<decltype(e)>::value); REQUIRE(std::is_move_assignable<decltype(e)>::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(decltype(e))::value); REQUIRE(!TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(decltype(e))::value); # if !defined(TL_EXPECTED_GCC49) REQUIRE(!std::is_trivially_move_constructible<decltype(e)>::value); REQUIRE(!std::is_trivially_move_assignable<decltype(e)>::value); # endif } { tl::expected<void,int> e; REQUIRE(e); } { tl::expected<void,int> e (tl::unexpect, 42); REQUIRE(!e); REQUIRE(e.error() == 42); } }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> #include <string> #include <memory> using std::string; tl::expected<int, string> getInt3(int val) { return val; } tl::expected<int, string> getInt2(int val) { return val; } tl::expected<int, string> getInt1() { return getInt2(5).and_then(getInt3); } TEST_CASE("Issue 1", "[issues.1]") { getInt1(); } tl::expected<int, int> operation1() { return 42; } tl::expected<std::string, int> operation2(int const val) { (void)val; return "Bananas"; } TEST_CASE("Issue 17", "[issues.17]") { auto const intermediate_result = operation1(); intermediate_result.and_then(operation2); } struct a {}; struct b : a {}; auto doit() -> tl::expected<std::unique_ptr<b>, int> { return tl::make_unexpected(0); } TEST_CASE("Issue 23", "[issues.23]") { tl::expected<std::unique_ptr<a>, int> msg = doit(); REQUIRE(!msg.has_value()); } TEST_CASE("Issue 26", "[issues.26]") { tl::expected<a, int> exp = tl::expected<b, int>(tl::unexpect, 0); REQUIRE(!exp.has_value()); } struct foo { foo() = default; foo(foo &) = delete; foo(foo &&){}; }; TEST_CASE("Issue 29", "[issues.29]") { std::vector<foo> v; v.emplace_back(); tl::expected<std::vector<foo>, int> ov = std::move(v); REQUIRE(ov->size() == 1); } tl::expected<int, std::string> error() { return tl::make_unexpected(std::string("error1 ")); } std::string maperror(std::string s) { return s + "maperror "; } TEST_CASE("Issue 30", "[issues.30]") { error().map_error(maperror); } struct i31{ int i; }; TEST_CASE("Issue 31", "[issues.31]") { const tl::expected<i31, int> a = i31{42}; (void)a->i; tl::expected< void, std::string > result; tl::expected< void, std::string > result2 = result; result2 = result; } TEST_CASE("Issue 33", "[issues.33]") { tl::expected<void, int> res {tl::unexpect, 0}; REQUIRE(!res); res = res.map_error([](int i) { (void)i; return 42; }); REQUIRE(res.error() == 42); } tl::expected<void, std::string> voidWork() { return {}; } tl::expected<int, std::string> work2() { return 42; } void errorhandling(std::string){} TEST_CASE("Issue 34", "[issues.34]") { tl::expected <int, std::string> result = voidWork () .and_then (work2); result.map_error ([&] (std::string result) {errorhandling (result);}); } struct non_copyable { non_copyable(non_copyable&&) = default; non_copyable(non_copyable const&) = delete; non_copyable() = default; }; TEST_CASE("Issue 42", "[issues.42]") { tl::expected<non_copyable,int>{}.map([](non_copyable) {}); } TEST_CASE("Issue 43", "[issues.43]") { auto result = tl::expected<void, std::string>{}; result = tl::make_unexpected(std::string{ "foo" }); } #if !(__GNUC__ <= 5) #include <memory> using MaybeDataPtr = tl::expected<int, std::unique_ptr<int>>; MaybeDataPtr test(int i) noexcept { return std::move(i); } MaybeDataPtr test2(int i) noexcept { return std::move(i); } TEST_CASE("Issue 49", "[issues.49]") { auto m = test(10) .and_then(test2); } #endif tl::expected<int, std::unique_ptr<std::string>> func() { return 1; } TEST_CASE("Issue 61", "[issues.61]") { REQUIRE(func().value() == 1); } struct move_tracker { int moved = 0; move_tracker() = default; move_tracker(move_tracker const &other) noexcept {}; move_tracker(move_tracker &&orig) noexcept : moved(orig.moved + 1) {} move_tracker & operator=(move_tracker const &other) noexcept {}; move_tracker &operator=(move_tracker &&orig) noexcept { moved = orig.moved + 1; return *this; } }; TEST_CASE("Issue 122", "[issues.122]") { tl::expected<move_tracker, int> res; res.emplace(); REQUIRE(res.value().moved == 0); } #ifdef __cpp_deduction_guides TEST_CASE("Issue 89", "[issues.89]") { auto s = tl::unexpected("Some string"); REQUIRE(s.value() == std::string("Some string")); } #endif struct S { int i = 0; int j = 0; S(int i) : i(i) {} S(int i, int j) : i(i), j(j) {} }; TEST_CASE("Issue 107", "[issues.107]") { tl::expected<int, S> ex1(tl::unexpect, 2); tl::expected<int, S> ex2(tl::unexpect, 2, 2); REQUIRE(ex1.error().i == 2); REQUIRE(ex1.error().j == 0); REQUIRE(ex2.error().i == 2); REQUIRE(ex2.error().j == 2); } TEST_CASE("Issue 129", "[issues.129]") { tl::expected<std::unique_ptr<int>, int> x1 {std::unique_ptr<int>(new int(4))}; tl::expected<std::unique_ptr<int>, int> y1 {std::unique_ptr<int>(new int(2))}; x1 = std::move(y1); REQUIRE(**x1 == 2); }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> TEST_CASE("Noexcept", "[noexcept]") { //TODO }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#define CATCH_CONFIG_MAIN #include <catch2/catch.hpp>
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> TEST_CASE("Relational operators", "[relops]") { tl::expected<int, int> o1 = 42; tl::expected<int, int> o2{tl::unexpect, 0}; const tl::expected<int, int> o3 = 42; REQUIRE(o1 == o1); REQUIRE(o1 != o2); REQUIRE(o1 == o3); REQUIRE(o3 == o3); tl::expected<void, int> o6; REQUIRE(o6 == o6); }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> struct no_throw { no_throw(std::string i) : i(i) {} std::string i; }; struct canthrow_move { canthrow_move(std::string i) : i(i) {} canthrow_move(canthrow_move const &) = default; canthrow_move(canthrow_move &&other) noexcept(false) : i(other.i) {} canthrow_move &operator=(canthrow_move &&) = default; std::string i; }; bool should_throw = false; #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED struct willthrow_move { willthrow_move(std::string i) : i(i) {} willthrow_move(willthrow_move const &) = default; willthrow_move(willthrow_move &&other) : i(other.i) { if (should_throw) throw 0; } willthrow_move &operator=(willthrow_move &&) = default; std::string i; }; #endif // TL_EXPECTED_EXCEPTIONS_ENABLED static_assert(tl::detail::is_swappable<no_throw>::value, ""); template <class T1, class T2> void swap_test() { std::string s1 = "abcdefghijklmnopqrstuvwxyz"; std::string s2 = "zyxwvutsrqponmlkjihgfedcba"; tl::expected<T1, T2> a{s1}; tl::expected<T1, T2> b{s2}; swap(a, b); REQUIRE(a->i == s2); REQUIRE(b->i == s1); a = s1; b = tl::unexpected<T2>(s2); swap(a, b); REQUIRE(a.error().i == s2); REQUIRE(b->i == s1); a = tl::unexpected<T2>(s1); b = s2; swap(a, b); REQUIRE(a->i == s2); REQUIRE(b.error().i == s1); a = tl::unexpected<T2>(s1); b = tl::unexpected<T2>(s2); swap(a, b); REQUIRE(a.error().i == s2); REQUIRE(b.error().i == s1); a = s1; b = s2; a.swap(b); REQUIRE(a->i == s2); REQUIRE(b->i == s1); a = s1; b = tl::unexpected<T2>(s2); a.swap(b); REQUIRE(a.error().i == s2); REQUIRE(b->i == s1); a = tl::unexpected<T2>(s1); b = s2; a.swap(b); REQUIRE(a->i == s2); REQUIRE(b.error().i == s1); a = tl::unexpected<T2>(s1); b = tl::unexpected<T2>(s2); a.swap(b); REQUIRE(a.error().i == s2); REQUIRE(b.error().i == s1); } #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED TEST_CASE("swap") { swap_test<no_throw, no_throw>(); swap_test<no_throw, canthrow_move>(); swap_test<canthrow_move, no_throw>(); std::string s1 = "abcdefghijklmnopqrstuvwxyz"; std::string s2 = "zyxwvutsrqponmlkjihgfedcbaxxx"; tl::expected<no_throw, willthrow_move> a{s1}; tl::expected<no_throw, willthrow_move> b{tl::unexpect, s2}; should_throw = 1; #ifdef _MSC_VER //this seems to break catch on GCC and Clang REQUIRE_THROWS(swap(a, b)); #endif REQUIRE(a->i == s1); REQUIRE(b.error().i == s2); } #endif // TL_EXPECTED_EXCEPTIONS_ENABLED
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <tl/expected.hpp> #define TOKENPASTE(x, y) x##y #define TOKENPASTE2(x, y) TOKENPASTE(x, y) #undef STATIC_REQUIRE #define STATIC_REQUIRE(e) \ constexpr bool TOKENPASTE2(rqure, __LINE__) = e; \ (void)TOKENPASTE2(rqure, __LINE__); \ REQUIRE(e); TEST_CASE("Map extensions", "[extensions.map]") { auto mul2 = [](int a) { return a * 2; }; auto ret_void = [](int a) { (void)a; }; { tl::expected<int, int> e = 21; auto ret = e.map(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e = 21; auto ret = e.map(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e = 21; auto ret = std::move(e).map(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).map(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e = 21; auto ret = e.map(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e = 21; auto ret = e.map(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { tl::expected<int, int> e = 21; auto ret = std::move(e).map(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).map(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } // mapping functions which return references { tl::expected<int, int> e(42); auto ret = e.map([](int& i) -> int& { return i; }); REQUIRE(ret); REQUIRE(ret == 42); } } TEST_CASE("Map error extensions", "[extensions.map_error]") { auto mul2 = [](int a) { return a * 2; }; auto ret_void = [](int a) { (void)a; }; { tl::expected<int, int> e = 21; auto ret = e.map_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { const tl::expected<int, int> e = 21; auto ret = e.map_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e = 21; auto ret = std::move(e).map_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).map_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { tl::expected<int, int> e = 21; auto ret = e.map_error(ret_void); REQUIRE(ret); } { const tl::expected<int, int> e = 21; auto ret = e.map_error(ret_void); REQUIRE(ret); } { tl::expected<int, int> e = 21; auto ret = std::move(e).map_error(ret_void); REQUIRE(ret); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).map_error(ret_void); REQUIRE(ret); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map_error(ret_void); REQUIRE(!ret); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.map_error(ret_void); REQUIRE(!ret); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map_error(ret_void); REQUIRE(!ret); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).map_error(ret_void); REQUIRE(!ret); } } TEST_CASE("And then extensions", "[extensions.and_then]") { auto succeed = [](int a) { (void)a; return tl::expected<int, int>(21 * 2); }; auto fail = [](int a) { (void)a; return tl::expected<int, int>(tl::unexpect, 17); }; { tl::expected<int, int> e = 21; auto ret = e.and_then(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e = 21; auto ret = e.and_then(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e = 21; auto ret = std::move(e).and_then(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).and_then(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e = 21; auto ret = e.and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { const tl::expected<int, int> e = 21; auto ret = e.and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { tl::expected<int, int> e = 21; auto ret = std::move(e).and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.and_then(succeed); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.and_then(succeed); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).and_then(succeed); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).and_then(succeed); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).and_then(fail); REQUIRE(!ret); REQUIRE(ret.error() == 21); } } TEST_CASE("or_else", "[extensions.or_else]") { using eptr = std::unique_ptr<int>; auto succeed = [](int a) { (void)a; return tl::expected<int, int>(21 * 2); }; auto succeedptr = [](eptr e) { (void)e; return tl::expected<int,eptr>(21*2);}; auto fail = [](int a) { (void)a; return tl::expected<int,int>(tl::unexpect, 17);}; auto failptr = [](eptr e) { *e = 17;return tl::expected<int,eptr>(tl::unexpect, std::move(e));}; auto failvoid = [](int) {}; auto failvoidptr = [](const eptr&) { /* don't consume */}; auto consumeptr = [](eptr) {}; auto make_u_int = [](int n) { return std::unique_ptr<int>(new int(n));}; { tl::expected<int, int> e = 21; auto ret = e.or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 21); } { const tl::expected<int, int> e = 21; auto ret = e.or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e = 21; auto ret = std::move(e).or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, eptr> e = 21; auto ret = std::move(e).or_else(succeedptr); REQUIRE(ret); REQUIRE(*ret == 21); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e = 21; auto ret = e.or_else(fail); REQUIRE(ret); REQUIRE(*ret == 21); } { const tl::expected<int, int> e = 21; auto ret = e.or_else(fail); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e = 21; auto ret = std::move(e).or_else(fail); REQUIRE(ret); REQUIRE(ret == 21); } { tl::expected<int, eptr> e = 21; auto ret = std::move(e).or_else(failptr); REQUIRE(ret); REQUIRE(ret == 21); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).or_else(fail); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, eptr> e(tl::unexpect, make_u_int(21)); auto ret = std::move(e).or_else(succeedptr); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).or_else(succeed); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.or_else(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.or_else(failvoid); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.or_else(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.or_else(failvoid); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).or_else(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).or_else(failvoid); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, eptr> e(tl::unexpect, make_u_int(21)); auto ret = std::move(e).or_else(failvoidptr); REQUIRE(!ret); REQUIRE(*ret.error() == 21); } { tl::expected<int, eptr> e(tl::unexpect, make_u_int(21)); auto ret = std::move(e).or_else(consumeptr); REQUIRE(!ret); REQUIRE(ret.error() == nullptr); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).or_else(fail); REQUIRE(!ret); REQUIRE(ret.error() == 17); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).or_else(failvoid); REQUIRE(!ret); REQUIRE(ret.error() == 21); } } TEST_CASE("Transform extensions", "[extensions.tronsfarm]") { auto mul2 = [](int a) { return a * 2; }; auto ret_void = [](int a) { (void)a; }; { tl::expected<int, int> e = 21; auto ret = e.transform(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e = 21; auto ret = e.transform(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e = 21; auto ret = std::move(e).transform(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).transform(mul2); REQUIRE(ret); REQUIRE(*ret == 42); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 21); } { tl::expected<int, int> e = 21; auto ret = e.transform(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e = 21; auto ret = e.transform(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { tl::expected<int, int> e = 21; auto ret = std::move(e).transform(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).transform(ret_void); REQUIRE(ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform(ret_void); REQUIRE(!ret); STATIC_REQUIRE( (std::is_same<decltype(ret), tl::expected<void, int>>::value)); } // mapping functions which return references { tl::expected<int, int> e(42); auto ret = e.transform([](int& i) -> int& { return i; }); REQUIRE(ret); REQUIRE(ret == 42); } } TEST_CASE("Transform error extensions", "[extensions.transform_error]") { auto mul2 = [](int a) { return a * 2; }; auto ret_void = [](int a) { (void)a; }; { tl::expected<int, int> e = 21; auto ret = e.transform_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { const tl::expected<int, int> e = 21; auto ret = e.transform_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e = 21; auto ret = std::move(e).transform_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).transform_error(mul2); REQUIRE(ret); REQUIRE(*ret == 21); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform_error(mul2); REQUIRE(!ret); REQUIRE(ret.error() == 42); } { tl::expected<int, int> e = 21; auto ret = e.transform_error(ret_void); REQUIRE(ret); } { const tl::expected<int, int> e = 21; auto ret = e.transform_error(ret_void); REQUIRE(ret); } { tl::expected<int, int> e = 21; auto ret = std::move(e).transform_error(ret_void); REQUIRE(ret); } { const tl::expected<int, int> e = 21; auto ret = std::move(e).transform_error(ret_void); REQUIRE(ret); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform_error(ret_void); REQUIRE(!ret); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = e.transform_error(ret_void); REQUIRE(!ret); } { tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform_error(ret_void); REQUIRE(!ret); } { const tl::expected<int, int> e(tl::unexpect, 21); auto ret = std::move(e).transform_error(ret_void); REQUIRE(!ret); } } struct S { int x; }; struct F { int x; }; TEST_CASE("14", "[issue.14]") { auto res = tl::expected<S,F>{tl::unexpect, F{}}; res.map_error([](F f) { (void)f; }); } TEST_CASE("32", "[issue.32]") { int i = 0; tl::expected<void, int> a; a.map([&i]{i = 42;}); REQUIRE(i == 42); auto x = a.map([]{return 42;}); REQUIRE(*x == 42); }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
#include <catch2/catch.hpp> #include <stdexcept> #define TL_ASSERT(cond) if (!(cond)) { throw std::runtime_error(std::string("assertion failure")); } #include <tl/expected.hpp> TEST_CASE("Assertions", "[assertions]") { tl::expected<int,int> o1 = 42; REQUIRE_THROWS_WITH(o1.error(), "assertion failure"); tl::expected<int,int> o2 {tl::unexpect, 0}; REQUIRE_THROWS_WITH(*o2, "assertion failure"); struct foo { int bar; }; tl::expected<struct foo,int> o3 {tl::unexpect, 0}; REQUIRE_THROWS_WITH(o3->bar, "assertion failure"); }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
struct no_throw { no_throw(std::string i) : i(i) {} std::string i; }; struct canthrow_move { canthrow_move(std::string i) : i(i) {} canthrow_move(canthrow_move const &) = default; canthrow_move(canthrow_move &&other) noexcept(false) : i(other.i) {} canthrow_move &operator=(canthrow_move &&) = default; std::string i; }; bool should_throw = false; struct willthrow_move { willthrow_move(std::string i) : i(i) {} willthrow_move(willthrow_move const &) = default; willthrow_move(willthrow_move &&other) : i(other.i) { if (should_throw) throw 0; } willthrow_move &operator=(willthrow_move &&) = default; std::string i; }; int main() { std::string s1 = "abcdefghijklmnopqrstuvwxyz"; std::string s2 = "zyxwvutsrqponmlkjihgfedcbaxxx"; tl::expected<no_throw, willthrow_move> a{s1}; tl::expected<no_throw, willthrow_move> b{tl::unexpect, s2}; should_throw = 1; swap(a, b); }
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
/// // expected - An implementation of std::expected with extensions // Written in 2017 by Sy Brand ([email protected], @TartanLlama) // // Documentation available at http://tl.tartanllama.xyz/ // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to the // public domain worldwide. This software is distributed without any warranty. // // You should have received a copy of the CC0 Public Domain Dedication // along with this software. If not, see // <http://creativecommons.org/publicdomain/zero/1.0/>. /// #ifndef TL_EXPECTED_HPP #define TL_EXPECTED_HPP #define TL_EXPECTED_VERSION_MAJOR 1 #define TL_EXPECTED_VERSION_MINOR 1 #define TL_EXPECTED_VERSION_PATCH 0 #include <exception> #include <functional> #include <type_traits> #include <utility> #if defined(__EXCEPTIONS) || defined(_CPPUNWIND) #define TL_EXPECTED_EXCEPTIONS_ENABLED #endif #if (defined(_MSC_VER) && _MSC_VER == 1900) #define TL_EXPECTED_MSVC2015 #define TL_EXPECTED_MSVC2015_CONSTEXPR #else #define TL_EXPECTED_MSVC2015_CONSTEXPR constexpr #endif #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ !defined(__clang__)) #define TL_EXPECTED_GCC49 #endif #if (defined(__GNUC__) && __GNUC__ == 5 && __GNUC_MINOR__ <= 4 && \ !defined(__clang__)) #define TL_EXPECTED_GCC54 #endif #if (defined(__GNUC__) && __GNUC__ == 5 && __GNUC_MINOR__ <= 5 && \ !defined(__clang__)) #define TL_EXPECTED_GCC55 #endif #if !defined(TL_ASSERT) //can't have assert in constexpr in C++11 and GCC 4.9 has a compiler bug #if (__cplusplus > 201103L) && !defined(TL_EXPECTED_GCC49) #include <cassert> #define TL_ASSERT(x) assert(x) #else #define TL_ASSERT(x) #endif #endif #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ !defined(__clang__)) // GCC < 5 doesn't support overloading on const&& for member functions #define TL_EXPECTED_NO_CONSTRR // GCC < 5 doesn't support some standard C++11 type traits #define TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \ std::has_trivial_copy_constructor<T> #define TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T) \ std::has_trivial_copy_assign<T> // This one will be different for GCC 5.7 if it's ever supported #define TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T) \ std::is_trivially_destructible<T> // GCC 5 < v < 8 has a bug in is_trivially_copy_constructible which breaks // std::vector for non-copyable types #elif (defined(__GNUC__) && __GNUC__ < 8 && !defined(__clang__)) #ifndef TL_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX #define TL_GCC_LESS_8_TRIVIALLY_COPY_CONSTRUCTIBLE_MUTEX namespace tl { namespace detail { template <class T> struct is_trivially_copy_constructible : std::is_trivially_copy_constructible<T> {}; #ifdef _GLIBCXX_VECTOR template <class T, class A> struct is_trivially_copy_constructible<std::vector<T, A>> : std::false_type {}; #endif } // namespace detail } // namespace tl #endif #define TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \ tl::detail::is_trivially_copy_constructible<T> #define TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T) \ std::is_trivially_copy_assignable<T> #define TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T) \ std::is_trivially_destructible<T> #else #define TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \ std::is_trivially_copy_constructible<T> #define TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T) \ std::is_trivially_copy_assignable<T> #define TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T) \ std::is_trivially_destructible<T> #endif #if __cplusplus > 201103L #define TL_EXPECTED_CXX14 #endif #ifdef TL_EXPECTED_GCC49 #define TL_EXPECTED_GCC49_CONSTEXPR #else #define TL_EXPECTED_GCC49_CONSTEXPR constexpr #endif #if (__cplusplus == 201103L || defined(TL_EXPECTED_MSVC2015) || \ defined(TL_EXPECTED_GCC49)) #define TL_EXPECTED_11_CONSTEXPR #else #define TL_EXPECTED_11_CONSTEXPR constexpr #endif namespace tl { template <class T, class E> class expected; #ifndef TL_MONOSTATE_INPLACE_MUTEX #define TL_MONOSTATE_INPLACE_MUTEX class monostate {}; struct in_place_t { explicit in_place_t() = default; }; static constexpr in_place_t in_place{}; #endif template <class E> class unexpected { public: static_assert(!std::is_same<E, void>::value, "E must not be void"); unexpected() = delete; constexpr explicit unexpected(const E &e) : m_val(e) {} constexpr explicit unexpected(E &&e) : m_val(std::move(e)) {} template <class... Args, typename std::enable_if<std::is_constructible< E, Args &&...>::value>::type * = nullptr> constexpr explicit unexpected(Args &&...args) : m_val(std::forward<Args>(args)...) {} template < class U, class... Args, typename std::enable_if<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value>::type * = nullptr> constexpr explicit unexpected(std::initializer_list<U> l, Args &&...args) : m_val(l, std::forward<Args>(args)...) {} constexpr const E &value() const & { return m_val; } TL_EXPECTED_11_CONSTEXPR E &value() & { return m_val; } TL_EXPECTED_11_CONSTEXPR E &&value() && { return std::move(m_val); } constexpr const E &&value() const && { return std::move(m_val); } private: E m_val; }; #ifdef __cpp_deduction_guides template <class E> unexpected(E) -> unexpected<E>; #endif template <class E> constexpr bool operator==(const unexpected<E> &lhs, const unexpected<E> &rhs) { return lhs.value() == rhs.value(); } template <class E> constexpr bool operator!=(const unexpected<E> &lhs, const unexpected<E> &rhs) { return lhs.value() != rhs.value(); } template <class E> constexpr bool operator<(const unexpected<E> &lhs, const unexpected<E> &rhs) { return lhs.value() < rhs.value(); } template <class E> constexpr bool operator<=(const unexpected<E> &lhs, const unexpected<E> &rhs) { return lhs.value() <= rhs.value(); } template <class E> constexpr bool operator>(const unexpected<E> &lhs, const unexpected<E> &rhs) { return lhs.value() > rhs.value(); } template <class E> constexpr bool operator>=(const unexpected<E> &lhs, const unexpected<E> &rhs) { return lhs.value() >= rhs.value(); } template <class E> unexpected<typename std::decay<E>::type> make_unexpected(E &&e) { return unexpected<typename std::decay<E>::type>(std::forward<E>(e)); } struct unexpect_t { unexpect_t() = default; }; static constexpr unexpect_t unexpect{}; namespace detail { template <typename E> [[noreturn]] TL_EXPECTED_11_CONSTEXPR void throw_exception(E &&e) { #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED throw std::forward<E>(e); #else (void)e; #ifdef _MSC_VER __assume(0); #else __builtin_unreachable(); #endif #endif } #ifndef TL_TRAITS_MUTEX #define TL_TRAITS_MUTEX // C++14-style aliases for brevity template <class T> using remove_const_t = typename std::remove_const<T>::type; template <class T> using remove_reference_t = typename std::remove_reference<T>::type; template <class T> using decay_t = typename std::decay<T>::type; template <bool E, class T = void> using enable_if_t = typename std::enable_if<E, T>::type; template <bool B, class T, class F> using conditional_t = typename std::conditional<B, T, F>::type; // std::conjunction from C++17 template <class...> struct conjunction : std::true_type {}; template <class B> struct conjunction<B> : B {}; template <class B, class... Bs> struct conjunction<B, Bs...> : std::conditional<bool(B::value), conjunction<Bs...>, B>::type {}; #if defined(_LIBCPP_VERSION) && __cplusplus == 201103L #define TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND #endif // In C++11 mode, there's an issue in libc++'s std::mem_fn // which results in a hard-error when using it in a noexcept expression // in some cases. This is a check to workaround the common failing case. #ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND template <class T> struct is_pointer_to_non_const_member_func : std::false_type {}; template <class T, class Ret, class... Args> struct is_pointer_to_non_const_member_func<Ret (T::*)(Args...)> : std::true_type {}; template <class T, class Ret, class... Args> struct is_pointer_to_non_const_member_func<Ret (T::*)(Args...) &> : std::true_type {}; template <class T, class Ret, class... Args> struct is_pointer_to_non_const_member_func<Ret (T::*)(Args...) &&> : std::true_type {}; template <class T, class Ret, class... Args> struct is_pointer_to_non_const_member_func<Ret (T::*)(Args...) volatile> : std::true_type {}; template <class T, class Ret, class... Args> struct is_pointer_to_non_const_member_func<Ret (T::*)(Args...) volatile &> : std::true_type {}; template <class T, class Ret, class... Args> struct is_pointer_to_non_const_member_func<Ret (T::*)(Args...) volatile &&> : std::true_type {}; template <class T> struct is_const_or_const_ref : std::false_type {}; template <class T> struct is_const_or_const_ref<T const &> : std::true_type {}; template <class T> struct is_const_or_const_ref<T const> : std::true_type {}; #endif // std::invoke from C++17 // https://stackoverflow.com/questions/38288042/c11-14-invoke-workaround template < typename Fn, typename... Args, #ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND typename = enable_if_t<!(is_pointer_to_non_const_member_func<Fn>::value && is_const_or_const_ref<Args...>::value)>, #endif typename = enable_if_t<std::is_member_pointer<decay_t<Fn>>::value>, int = 0> constexpr auto invoke(Fn &&f, Args &&...args) noexcept( noexcept(std::mem_fn(f)(std::forward<Args>(args)...))) -> decltype(std::mem_fn(f)(std::forward<Args>(args)...)) { return std::mem_fn(f)(std::forward<Args>(args)...); } template <typename Fn, typename... Args, typename = enable_if_t<!std::is_member_pointer<decay_t<Fn>>::value>> constexpr auto invoke(Fn &&f, Args &&...args) noexcept( noexcept(std::forward<Fn>(f)(std::forward<Args>(args)...))) -> decltype(std::forward<Fn>(f)(std::forward<Args>(args)...)) { return std::forward<Fn>(f)(std::forward<Args>(args)...); } // std::invoke_result from C++17 template <class F, class, class... Us> struct invoke_result_impl; template <class F, class... Us> struct invoke_result_impl< F, decltype(detail::invoke(std::declval<F>(), std::declval<Us>()...), void()), Us...> { using type = decltype(detail::invoke(std::declval<F>(), std::declval<Us>()...)); }; template <class F, class... Us> using invoke_result = invoke_result_impl<F, void, Us...>; template <class F, class... Us> using invoke_result_t = typename invoke_result<F, Us...>::type; #if defined(_MSC_VER) && _MSC_VER <= 1900 // TODO make a version which works with MSVC 2015 template <class T, class U = T> struct is_swappable : std::true_type {}; template <class T, class U = T> struct is_nothrow_swappable : std::true_type {}; #else // https://stackoverflow.com/questions/26744589/what-is-a-proper-way-to-implement-is-swappable-to-test-for-the-swappable-concept namespace swap_adl_tests { // if swap ADL finds this then it would call std::swap otherwise (same // signature) struct tag {}; template <class T> tag swap(T &, T &); template <class T, std::size_t N> tag swap(T (&a)[N], T (&b)[N]); // helper functions to test if an unqualified swap is possible, and if it // becomes std::swap template <class, class> std::false_type can_swap(...) noexcept(false); template <class T, class U, class = decltype(swap(std::declval<T &>(), std::declval<U &>()))> std::true_type can_swap(int) noexcept(noexcept(swap(std::declval<T &>(), std::declval<U &>()))); template <class, class> std::false_type uses_std(...); template <class T, class U> std::is_same<decltype(swap(std::declval<T &>(), std::declval<U &>())), tag> uses_std(int); template <class T> struct is_std_swap_noexcept : std::integral_constant<bool, std::is_nothrow_move_constructible<T>::value && std::is_nothrow_move_assignable<T>::value> {}; template <class T, std::size_t N> struct is_std_swap_noexcept<T[N]> : is_std_swap_noexcept<T> {}; template <class T, class U> struct is_adl_swap_noexcept : std::integral_constant<bool, noexcept(can_swap<T, U>(0))> {}; } // namespace swap_adl_tests template <class T, class U = T> struct is_swappable : std::integral_constant< bool, decltype(detail::swap_adl_tests::can_swap<T, U>(0))::value && (!decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value || (std::is_move_assignable<T>::value && std::is_move_constructible<T>::value))> {}; template <class T, std::size_t N> struct is_swappable<T[N], T[N]> : std::integral_constant< bool, decltype(detail::swap_adl_tests::can_swap<T[N], T[N]>(0))::value && (!decltype(detail::swap_adl_tests::uses_std<T[N], T[N]>( 0))::value || is_swappable<T, T>::value)> {}; template <class T, class U = T> struct is_nothrow_swappable : std::integral_constant< bool, is_swappable<T, U>::value && ((decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value && detail::swap_adl_tests::is_std_swap_noexcept<T>::value) || (!decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value && detail::swap_adl_tests::is_adl_swap_noexcept<T, U>::value))> {}; #endif #endif // Trait for checking if a type is a tl::expected template <class T> struct is_expected_impl : std::false_type {}; template <class T, class E> struct is_expected_impl<expected<T, E>> : std::true_type {}; template <class T> using is_expected = is_expected_impl<decay_t<T>>; template <class T, class E, class U> using expected_enable_forward_value = detail::enable_if_t< std::is_constructible<T, U &&>::value && !std::is_same<detail::decay_t<U>, in_place_t>::value && !std::is_same<expected<T, E>, detail::decay_t<U>>::value && !std::is_same<unexpected<E>, detail::decay_t<U>>::value>; template <class T, class E, class U, class G, class UR, class GR> using expected_enable_from_other = detail::enable_if_t< std::is_constructible<T, UR>::value && std::is_constructible<E, GR>::value && !std::is_constructible<T, expected<U, G> &>::value && !std::is_constructible<T, expected<U, G> &&>::value && !std::is_constructible<T, const expected<U, G> &>::value && !std::is_constructible<T, const expected<U, G> &&>::value && !std::is_convertible<expected<U, G> &, T>::value && !std::is_convertible<expected<U, G> &&, T>::value && !std::is_convertible<const expected<U, G> &, T>::value && !std::is_convertible<const expected<U, G> &&, T>::value>; template <class T, class U> using is_void_or = conditional_t<std::is_void<T>::value, std::true_type, U>; template <class T> using is_copy_constructible_or_void = is_void_or<T, std::is_copy_constructible<T>>; template <class T> using is_move_constructible_or_void = is_void_or<T, std::is_move_constructible<T>>; template <class T> using is_copy_assignable_or_void = is_void_or<T, std::is_copy_assignable<T>>; template <class T> using is_move_assignable_or_void = is_void_or<T, std::is_move_assignable<T>>; } // namespace detail namespace detail { struct no_init_t {}; static constexpr no_init_t no_init{}; // Implements the storage of the values, and ensures that the destructor is // trivial if it can be. // // This specialization is for where neither `T` or `E` is trivially // destructible, so the destructors must be called on destruction of the // `expected` template <class T, class E, bool = std::is_trivially_destructible<T>::value, bool = std::is_trivially_destructible<E>::value> struct expected_storage_base { constexpr expected_storage_base() : m_val(T{}), m_has_val(true) {} constexpr expected_storage_base(no_init_t) : m_no_init(), m_has_val(false) {} template <class... Args, detail::enable_if_t<std::is_constructible<T, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, Args &&...args) : m_val(std::forward<Args>(args)...), m_has_val(true) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< T, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args &&...args) : m_val(il, std::forward<Args>(args)...), m_has_val(true) {} template <class... Args, detail::enable_if_t<std::is_constructible<E, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, Args &&...args) : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args &&...args) : m_unexpect(il, std::forward<Args>(args)...), m_has_val(false) {} ~expected_storage_base() { if (m_has_val) { m_val.~T(); } else { m_unexpect.~unexpected<E>(); } } union { T m_val; unexpected<E> m_unexpect; char m_no_init; }; bool m_has_val; }; // This specialization is for when both `T` and `E` are trivially-destructible, // so the destructor of the `expected` can be trivial. template <class T, class E> struct expected_storage_base<T, E, true, true> { constexpr expected_storage_base() : m_val(T{}), m_has_val(true) {} constexpr expected_storage_base(no_init_t) : m_no_init(), m_has_val(false) {} template <class... Args, detail::enable_if_t<std::is_constructible<T, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, Args &&...args) : m_val(std::forward<Args>(args)...), m_has_val(true) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< T, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args &&...args) : m_val(il, std::forward<Args>(args)...), m_has_val(true) {} template <class... Args, detail::enable_if_t<std::is_constructible<E, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, Args &&...args) : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args &&...args) : m_unexpect(il, std::forward<Args>(args)...), m_has_val(false) {} ~expected_storage_base() = default; union { T m_val; unexpected<E> m_unexpect; char m_no_init; }; bool m_has_val; }; // T is trivial, E is not. template <class T, class E> struct expected_storage_base<T, E, true, false> { constexpr expected_storage_base() : m_val(T{}), m_has_val(true) {} TL_EXPECTED_MSVC2015_CONSTEXPR expected_storage_base(no_init_t) : m_no_init(), m_has_val(false) {} template <class... Args, detail::enable_if_t<std::is_constructible<T, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, Args &&...args) : m_val(std::forward<Args>(args)...), m_has_val(true) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< T, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args &&...args) : m_val(il, std::forward<Args>(args)...), m_has_val(true) {} template <class... Args, detail::enable_if_t<std::is_constructible<E, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, Args &&...args) : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args &&...args) : m_unexpect(il, std::forward<Args>(args)...), m_has_val(false) {} ~expected_storage_base() { if (!m_has_val) { m_unexpect.~unexpected<E>(); } } union { T m_val; unexpected<E> m_unexpect; char m_no_init; }; bool m_has_val; }; // E is trivial, T is not. template <class T, class E> struct expected_storage_base<T, E, false, true> { constexpr expected_storage_base() : m_val(T{}), m_has_val(true) {} constexpr expected_storage_base(no_init_t) : m_no_init(), m_has_val(false) {} template <class... Args, detail::enable_if_t<std::is_constructible<T, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, Args &&...args) : m_val(std::forward<Args>(args)...), m_has_val(true) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< T, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args &&...args) : m_val(il, std::forward<Args>(args)...), m_has_val(true) {} template <class... Args, detail::enable_if_t<std::is_constructible<E, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, Args &&...args) : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args &&...args) : m_unexpect(il, std::forward<Args>(args)...), m_has_val(false) {} ~expected_storage_base() { if (m_has_val) { m_val.~T(); } } union { T m_val; unexpected<E> m_unexpect; char m_no_init; }; bool m_has_val; }; // `T` is `void`, `E` is trivially-destructible template <class E> struct expected_storage_base<void, E, false, true> { #if __GNUC__ <= 5 //no constexpr for GCC 4/5 bug #else TL_EXPECTED_MSVC2015_CONSTEXPR #endif expected_storage_base() : m_has_val(true) {} constexpr expected_storage_base(no_init_t) : m_val(), m_has_val(false) {} constexpr expected_storage_base(in_place_t) : m_has_val(true) {} template <class... Args, detail::enable_if_t<std::is_constructible<E, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, Args &&...args) : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args &&...args) : m_unexpect(il, std::forward<Args>(args)...), m_has_val(false) {} ~expected_storage_base() = default; struct dummy {}; union { unexpected<E> m_unexpect; dummy m_val; }; bool m_has_val; }; // `T` is `void`, `E` is not trivially-destructible template <class E> struct expected_storage_base<void, E, false, false> { constexpr expected_storage_base() : m_dummy(), m_has_val(true) {} constexpr expected_storage_base(no_init_t) : m_dummy(), m_has_val(false) {} constexpr expected_storage_base(in_place_t) : m_dummy(), m_has_val(true) {} template <class... Args, detail::enable_if_t<std::is_constructible<E, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, Args &&...args) : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args &&...args) : m_unexpect(il, std::forward<Args>(args)...), m_has_val(false) {} ~expected_storage_base() { if (!m_has_val) { m_unexpect.~unexpected<E>(); } } union { unexpected<E> m_unexpect; char m_dummy; }; bool m_has_val; }; // This base class provides some handy member functions which can be used in // further derived classes template <class T, class E> struct expected_operations_base : expected_storage_base<T, E> { using expected_storage_base<T, E>::expected_storage_base; template <class... Args> void construct(Args &&...args) noexcept { new (std::addressof(this->m_val)) T(std::forward<Args>(args)...); this->m_has_val = true; } template <class Rhs> void construct_with(Rhs &&rhs) noexcept { new (std::addressof(this->m_val)) T(std::forward<Rhs>(rhs).get()); this->m_has_val = true; } template <class... Args> void construct_error(Args &&...args) noexcept { new (std::addressof(this->m_unexpect)) unexpected<E>(std::forward<Args>(args)...); this->m_has_val = false; } #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED // These assign overloads ensure that the most efficient assignment // implementation is used while maintaining the strong exception guarantee. // The problematic case is where rhs has a value, but *this does not. // // This overload handles the case where we can just copy-construct `T` // directly into place without throwing. template <class U = T, detail::enable_if_t<std::is_nothrow_copy_constructible<U>::value> * = nullptr> void assign(const expected_operations_base &rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { geterr().~unexpected<E>(); construct(rhs.get()); } else { assign_common(rhs); } } // This overload handles the case where we can attempt to create a copy of // `T`, then no-throw move it into place if the copy was successful. template <class U = T, detail::enable_if_t<!std::is_nothrow_copy_constructible<U>::value && std::is_nothrow_move_constructible<U>::value> * = nullptr> void assign(const expected_operations_base &rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { T tmp = rhs.get(); geterr().~unexpected<E>(); construct(std::move(tmp)); } else { assign_common(rhs); } } // This overload is the worst-case, where we have to move-construct the // unexpected value into temporary storage, then try to copy the T into place. // If the construction succeeds, then everything is fine, but if it throws, // then we move the old unexpected value back into place before rethrowing the // exception. template <class U = T, detail::enable_if_t<!std::is_nothrow_copy_constructible<U>::value && !std::is_nothrow_move_constructible<U>::value> * = nullptr> void assign(const expected_operations_base &rhs) { if (!this->m_has_val && rhs.m_has_val) { auto tmp = std::move(geterr()); geterr().~unexpected<E>(); #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED try { construct(rhs.get()); } catch (...) { geterr() = std::move(tmp); throw; } #else construct(rhs.get()); #endif } else { assign_common(rhs); } } // These overloads do the same as above, but for rvalues template <class U = T, detail::enable_if_t<std::is_nothrow_move_constructible<U>::value> * = nullptr> void assign(expected_operations_base &&rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { geterr().~unexpected<E>(); construct(std::move(rhs).get()); } else { assign_common(std::move(rhs)); } } template <class U = T, detail::enable_if_t<!std::is_nothrow_move_constructible<U>::value> * = nullptr> void assign(expected_operations_base &&rhs) { if (!this->m_has_val && rhs.m_has_val) { auto tmp = std::move(geterr()); geterr().~unexpected<E>(); #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED try { construct(std::move(rhs).get()); } catch (...) { geterr() = std::move(tmp); throw; } #else construct(std::move(rhs).get()); #endif } else { assign_common(std::move(rhs)); } } #else // If exceptions are disabled then we can just copy-construct void assign(const expected_operations_base &rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { geterr().~unexpected<E>(); construct(rhs.get()); } else { assign_common(rhs); } } void assign(expected_operations_base &&rhs) noexcept { if (!this->m_has_val && rhs.m_has_val) { geterr().~unexpected<E>(); construct(std::move(rhs).get()); } else { assign_common(std::move(rhs)); } } #endif // The common part of move/copy assigning template <class Rhs> void assign_common(Rhs &&rhs) { if (this->m_has_val) { if (rhs.m_has_val) { get() = std::forward<Rhs>(rhs).get(); } else { destroy_val(); construct_error(std::forward<Rhs>(rhs).geterr()); } } else { if (!rhs.m_has_val) { geterr() = std::forward<Rhs>(rhs).geterr(); } } } bool has_value() const { return this->m_has_val; } TL_EXPECTED_11_CONSTEXPR T &get() & { return this->m_val; } constexpr const T &get() const & { return this->m_val; } TL_EXPECTED_11_CONSTEXPR T &&get() && { return std::move(this->m_val); } #ifndef TL_EXPECTED_NO_CONSTRR constexpr const T &&get() const && { return std::move(this->m_val); } #endif TL_EXPECTED_11_CONSTEXPR unexpected<E> &geterr() & { return this->m_unexpect; } constexpr const unexpected<E> &geterr() const & { return this->m_unexpect; } TL_EXPECTED_11_CONSTEXPR unexpected<E> &&geterr() && { return std::move(this->m_unexpect); } #ifndef TL_EXPECTED_NO_CONSTRR constexpr const unexpected<E> &&geterr() const && { return std::move(this->m_unexpect); } #endif TL_EXPECTED_11_CONSTEXPR void destroy_val() { get().~T(); } }; // This base class provides some handy member functions which can be used in // further derived classes template <class E> struct expected_operations_base<void, E> : expected_storage_base<void, E> { using expected_storage_base<void, E>::expected_storage_base; template <class... Args> void construct() noexcept { this->m_has_val = true; } // This function doesn't use its argument, but needs it so that code in // levels above this can work independently of whether T is void template <class Rhs> void construct_with(Rhs &&) noexcept { this->m_has_val = true; } template <class... Args> void construct_error(Args &&...args) noexcept { new (std::addressof(this->m_unexpect)) unexpected<E>(std::forward<Args>(args)...); this->m_has_val = false; } template <class Rhs> void assign(Rhs &&rhs) noexcept { if (!this->m_has_val) { if (rhs.m_has_val) { geterr().~unexpected<E>(); construct(); } else { geterr() = std::forward<Rhs>(rhs).geterr(); } } else { if (!rhs.m_has_val) { construct_error(std::forward<Rhs>(rhs).geterr()); } } } bool has_value() const { return this->m_has_val; } TL_EXPECTED_11_CONSTEXPR unexpected<E> &geterr() & { return this->m_unexpect; } constexpr const unexpected<E> &geterr() const & { return this->m_unexpect; } TL_EXPECTED_11_CONSTEXPR unexpected<E> &&geterr() && { return std::move(this->m_unexpect); } #ifndef TL_EXPECTED_NO_CONSTRR constexpr const unexpected<E> &&geterr() const && { return std::move(this->m_unexpect); } #endif TL_EXPECTED_11_CONSTEXPR void destroy_val() { // no-op } }; // This class manages conditionally having a trivial copy constructor // This specialization is for when T and E are trivially copy constructible template <class T, class E, bool = is_void_or<T, TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)>:: value &&TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value> struct expected_copy_base : expected_operations_base<T, E> { using expected_operations_base<T, E>::expected_operations_base; }; // This specialization is for when T or E are not trivially copy constructible template <class T, class E> struct expected_copy_base<T, E, false> : expected_operations_base<T, E> { using expected_operations_base<T, E>::expected_operations_base; expected_copy_base() = default; expected_copy_base(const expected_copy_base &rhs) : expected_operations_base<T, E>(no_init) { if (rhs.has_value()) { this->construct_with(rhs); } else { this->construct_error(rhs.geterr()); } } expected_copy_base(expected_copy_base &&rhs) = default; expected_copy_base &operator=(const expected_copy_base &rhs) = default; expected_copy_base &operator=(expected_copy_base &&rhs) = default; }; // This class manages conditionally having a trivial move constructor // Unfortunately there's no way to achieve this in GCC < 5 AFAIK, since it // doesn't implement an analogue to std::is_trivially_move_constructible. We // have to make do with a non-trivial move constructor even if T is trivially // move constructible #ifndef TL_EXPECTED_GCC49 template <class T, class E, bool = is_void_or<T, std::is_trivially_move_constructible<T>>::value &&std::is_trivially_move_constructible<E>::value> struct expected_move_base : expected_copy_base<T, E> { using expected_copy_base<T, E>::expected_copy_base; }; #else template <class T, class E, bool = false> struct expected_move_base; #endif template <class T, class E> struct expected_move_base<T, E, false> : expected_copy_base<T, E> { using expected_copy_base<T, E>::expected_copy_base; expected_move_base() = default; expected_move_base(const expected_move_base &rhs) = default; expected_move_base(expected_move_base &&rhs) noexcept( std::is_nothrow_move_constructible<T>::value) : expected_copy_base<T, E>(no_init) { if (rhs.has_value()) { this->construct_with(std::move(rhs)); } else { this->construct_error(std::move(rhs.geterr())); } } expected_move_base &operator=(const expected_move_base &rhs) = default; expected_move_base &operator=(expected_move_base &&rhs) = default; }; // This class manages conditionally having a trivial copy assignment operator template <class T, class E, bool = is_void_or< T, conjunction<TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T), TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T), TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T)>>::value &&TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(E)::value &&TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value &&TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(E)::value> struct expected_copy_assign_base : expected_move_base<T, E> { using expected_move_base<T, E>::expected_move_base; }; template <class T, class E> struct expected_copy_assign_base<T, E, false> : expected_move_base<T, E> { using expected_move_base<T, E>::expected_move_base; expected_copy_assign_base() = default; expected_copy_assign_base(const expected_copy_assign_base &rhs) = default; expected_copy_assign_base(expected_copy_assign_base &&rhs) = default; expected_copy_assign_base &operator=(const expected_copy_assign_base &rhs) { this->assign(rhs); return *this; } expected_copy_assign_base & operator=(expected_copy_assign_base &&rhs) = default; }; // This class manages conditionally having a trivial move assignment operator // Unfortunately there's no way to achieve this in GCC < 5 AFAIK, since it // doesn't implement an analogue to std::is_trivially_move_assignable. We have // to make do with a non-trivial move assignment operator even if T is trivially // move assignable #ifndef TL_EXPECTED_GCC49 template <class T, class E, bool = is_void_or<T, conjunction<std::is_trivially_destructible<T>, std::is_trivially_move_constructible<T>, std::is_trivially_move_assignable<T>>>:: value &&std::is_trivially_destructible<E>::value &&std::is_trivially_move_constructible<E>::value &&std::is_trivially_move_assignable<E>::value> struct expected_move_assign_base : expected_copy_assign_base<T, E> { using expected_copy_assign_base<T, E>::expected_copy_assign_base; }; #else template <class T, class E, bool = false> struct expected_move_assign_base; #endif template <class T, class E> struct expected_move_assign_base<T, E, false> : expected_copy_assign_base<T, E> { using expected_copy_assign_base<T, E>::expected_copy_assign_base; expected_move_assign_base() = default; expected_move_assign_base(const expected_move_assign_base &rhs) = default; expected_move_assign_base(expected_move_assign_base &&rhs) = default; expected_move_assign_base & operator=(const expected_move_assign_base &rhs) = default; expected_move_assign_base & operator=(expected_move_assign_base &&rhs) noexcept( std::is_nothrow_move_constructible<T>::value &&std::is_nothrow_move_assignable<T>::value) { this->assign(std::move(rhs)); return *this; } }; // expected_delete_ctor_base will conditionally delete copy and move // constructors depending on whether T is copy/move constructible template <class T, class E, bool EnableCopy = (is_copy_constructible_or_void<T>::value && std::is_copy_constructible<E>::value), bool EnableMove = (is_move_constructible_or_void<T>::value && std::is_move_constructible<E>::value)> struct expected_delete_ctor_base { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base &) = default; expected_delete_ctor_base(expected_delete_ctor_base &&) noexcept = default; expected_delete_ctor_base & operator=(const expected_delete_ctor_base &) = default; expected_delete_ctor_base & operator=(expected_delete_ctor_base &&) noexcept = default; }; template <class T, class E> struct expected_delete_ctor_base<T, E, true, false> { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base &) = default; expected_delete_ctor_base(expected_delete_ctor_base &&) noexcept = delete; expected_delete_ctor_base & operator=(const expected_delete_ctor_base &) = default; expected_delete_ctor_base & operator=(expected_delete_ctor_base &&) noexcept = default; }; template <class T, class E> struct expected_delete_ctor_base<T, E, false, true> { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base &) = delete; expected_delete_ctor_base(expected_delete_ctor_base &&) noexcept = default; expected_delete_ctor_base & operator=(const expected_delete_ctor_base &) = default; expected_delete_ctor_base & operator=(expected_delete_ctor_base &&) noexcept = default; }; template <class T, class E> struct expected_delete_ctor_base<T, E, false, false> { expected_delete_ctor_base() = default; expected_delete_ctor_base(const expected_delete_ctor_base &) = delete; expected_delete_ctor_base(expected_delete_ctor_base &&) noexcept = delete; expected_delete_ctor_base & operator=(const expected_delete_ctor_base &) = default; expected_delete_ctor_base & operator=(expected_delete_ctor_base &&) noexcept = default; }; // expected_delete_assign_base will conditionally delete copy and move // constructors depending on whether T and E are copy/move constructible + // assignable template <class T, class E, bool EnableCopy = (is_copy_constructible_or_void<T>::value && std::is_copy_constructible<E>::value && is_copy_assignable_or_void<T>::value && std::is_copy_assignable<E>::value), bool EnableMove = (is_move_constructible_or_void<T>::value && std::is_move_constructible<E>::value && is_move_assignable_or_void<T>::value && std::is_move_assignable<E>::value)> struct expected_delete_assign_base { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base &) = default; expected_delete_assign_base(expected_delete_assign_base &&) noexcept = default; expected_delete_assign_base & operator=(const expected_delete_assign_base &) = default; expected_delete_assign_base & operator=(expected_delete_assign_base &&) noexcept = default; }; template <class T, class E> struct expected_delete_assign_base<T, E, true, false> { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base &) = default; expected_delete_assign_base(expected_delete_assign_base &&) noexcept = default; expected_delete_assign_base & operator=(const expected_delete_assign_base &) = default; expected_delete_assign_base & operator=(expected_delete_assign_base &&) noexcept = delete; }; template <class T, class E> struct expected_delete_assign_base<T, E, false, true> { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base &) = default; expected_delete_assign_base(expected_delete_assign_base &&) noexcept = default; expected_delete_assign_base & operator=(const expected_delete_assign_base &) = delete; expected_delete_assign_base & operator=(expected_delete_assign_base &&) noexcept = default; }; template <class T, class E> struct expected_delete_assign_base<T, E, false, false> { expected_delete_assign_base() = default; expected_delete_assign_base(const expected_delete_assign_base &) = default; expected_delete_assign_base(expected_delete_assign_base &&) noexcept = default; expected_delete_assign_base & operator=(const expected_delete_assign_base &) = delete; expected_delete_assign_base & operator=(expected_delete_assign_base &&) noexcept = delete; }; // This is needed to be able to construct the expected_default_ctor_base which // follows, while still conditionally deleting the default constructor. struct default_constructor_tag { explicit constexpr default_constructor_tag() = default; }; // expected_default_ctor_base will ensure that expected has a deleted default // consturctor if T is not default constructible. // This specialization is for when T is default constructible template <class T, class E, bool Enable = std::is_default_constructible<T>::value || std::is_void<T>::value> struct expected_default_ctor_base { constexpr expected_default_ctor_base() noexcept = default; constexpr expected_default_ctor_base( expected_default_ctor_base const &) noexcept = default; constexpr expected_default_ctor_base(expected_default_ctor_base &&) noexcept = default; expected_default_ctor_base & operator=(expected_default_ctor_base const &) noexcept = default; expected_default_ctor_base & operator=(expected_default_ctor_base &&) noexcept = default; constexpr explicit expected_default_ctor_base(default_constructor_tag) {} }; // This specialization is for when T is not default constructible template <class T, class E> struct expected_default_ctor_base<T, E, false> { constexpr expected_default_ctor_base() noexcept = delete; constexpr expected_default_ctor_base( expected_default_ctor_base const &) noexcept = default; constexpr expected_default_ctor_base(expected_default_ctor_base &&) noexcept = default; expected_default_ctor_base & operator=(expected_default_ctor_base const &) noexcept = default; expected_default_ctor_base & operator=(expected_default_ctor_base &&) noexcept = default; constexpr explicit expected_default_ctor_base(default_constructor_tag) {} }; } // namespace detail template <class E> class bad_expected_access : public std::exception { public: explicit bad_expected_access(E e) : m_val(std::move(e)) {} virtual const char *what() const noexcept override { return "Bad expected access"; } const E &error() const & { return m_val; } E &error() & { return m_val; } const E &&error() const && { return std::move(m_val); } E &&error() && { return std::move(m_val); } private: E m_val; }; /// An `expected<T, E>` object is an object that contains the storage for /// another object and manages the lifetime of this contained object `T`. /// Alternatively it could contain the storage for another unexpected object /// `E`. The contained object may not be initialized after the expected object /// has been initialized, and may not be destroyed before the expected object /// has been destroyed. The initialization state of the contained object is /// tracked by the expected object. template <class T, class E> class expected : private detail::expected_move_assign_base<T, E>, private detail::expected_delete_ctor_base<T, E>, private detail::expected_delete_assign_base<T, E>, private detail::expected_default_ctor_base<T, E> { static_assert(!std::is_reference<T>::value, "T must not be a reference"); static_assert(!std::is_same<T, std::remove_cv<in_place_t>::type>::value, "T must not be in_place_t"); static_assert(!std::is_same<T, std::remove_cv<unexpect_t>::type>::value, "T must not be unexpect_t"); static_assert( !std::is_same<T, typename std::remove_cv<unexpected<E>>::type>::value, "T must not be unexpected<E>"); static_assert(!std::is_reference<E>::value, "E must not be a reference"); T *valptr() { return std::addressof(this->m_val); } const T *valptr() const { return std::addressof(this->m_val); } unexpected<E> *errptr() { return std::addressof(this->m_unexpect); } const unexpected<E> *errptr() const { return std::addressof(this->m_unexpect); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &val() { return this->m_val; } TL_EXPECTED_11_CONSTEXPR unexpected<E> &err() { return this->m_unexpect; } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> constexpr const U &val() const { return this->m_val; } constexpr const unexpected<E> &err() const { return this->m_unexpect; } using impl_base = detail::expected_move_assign_base<T, E>; using ctor_base = detail::expected_default_ctor_base<T, E>; public: typedef T value_type; typedef E error_type; typedef unexpected<E> unexpected_type; #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) template <class F> TL_EXPECTED_11_CONSTEXPR auto and_then(F &&f) & { return and_then_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR auto and_then(F &&f) && { return and_then_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr auto and_then(F &&f) const & { return and_then_impl(*this, std::forward<F>(f)); } #ifndef TL_EXPECTED_NO_CONSTRR template <class F> constexpr auto and_then(F &&f) const && { return and_then_impl(std::move(*this), std::forward<F>(f)); } #endif #else template <class F> TL_EXPECTED_11_CONSTEXPR auto and_then(F &&f) & -> decltype(and_then_impl(std::declval<expected &>(), std::forward<F>(f))) { return and_then_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR auto and_then(F &&f) && -> decltype(and_then_impl(std::declval<expected &&>(), std::forward<F>(f))) { return and_then_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr auto and_then(F &&f) const & -> decltype(and_then_impl( std::declval<expected const &>(), std::forward<F>(f))) { return and_then_impl(*this, std::forward<F>(f)); } #ifndef TL_EXPECTED_NO_CONSTRR template <class F> constexpr auto and_then(F &&f) const && -> decltype(and_then_impl( std::declval<expected const &&>(), std::forward<F>(f))) { return and_then_impl(std::move(*this), std::forward<F>(f)); } #endif #endif #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) template <class F> TL_EXPECTED_11_CONSTEXPR auto map(F &&f) & { return expected_map_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR auto map(F &&f) && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr auto map(F &&f) const & { return expected_map_impl(*this, std::forward<F>(f)); } template <class F> constexpr auto map(F &&f) const && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } #else template <class F> TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl( std::declval<expected &>(), std::declval<F &&>())) map(F &&f) & { return expected_map_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected>(), std::declval<F &&>())) map(F &&f) && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr decltype(expected_map_impl(std::declval<const expected &>(), std::declval<F &&>())) map(F &&f) const & { return expected_map_impl(*this, std::forward<F>(f)); } #ifndef TL_EXPECTED_NO_CONSTRR template <class F> constexpr decltype(expected_map_impl(std::declval<const expected &&>(), std::declval<F &&>())) map(F &&f) const && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } #endif #endif #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) template <class F> TL_EXPECTED_11_CONSTEXPR auto transform(F &&f) & { return expected_map_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR auto transform(F &&f) && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr auto transform(F &&f) const & { return expected_map_impl(*this, std::forward<F>(f)); } template <class F> constexpr auto transform(F &&f) const && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } #else template <class F> TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl( std::declval<expected &>(), std::declval<F &&>())) transform(F &&f) & { return expected_map_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected>(), std::declval<F &&>())) transform(F &&f) && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr decltype(expected_map_impl(std::declval<const expected &>(), std::declval<F &&>())) transform(F &&f) const & { return expected_map_impl(*this, std::forward<F>(f)); } #ifndef TL_EXPECTED_NO_CONSTRR template <class F> constexpr decltype(expected_map_impl(std::declval<const expected &&>(), std::declval<F &&>())) transform(F &&f) const && { return expected_map_impl(std::move(*this), std::forward<F>(f)); } #endif #endif #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) template <class F> TL_EXPECTED_11_CONSTEXPR auto map_error(F &&f) & { return map_error_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR auto map_error(F &&f) && { return map_error_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr auto map_error(F &&f) const & { return map_error_impl(*this, std::forward<F>(f)); } template <class F> constexpr auto map_error(F &&f) const && { return map_error_impl(std::move(*this), std::forward<F>(f)); } #else template <class F> TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &>(), std::declval<F &&>())) map_error(F &&f) & { return map_error_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &&>(), std::declval<F &&>())) map_error(F &&f) && { return map_error_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr decltype(map_error_impl(std::declval<const expected &>(), std::declval<F &&>())) map_error(F &&f) const & { return map_error_impl(*this, std::forward<F>(f)); } #ifndef TL_EXPECTED_NO_CONSTRR template <class F> constexpr decltype(map_error_impl(std::declval<const expected &&>(), std::declval<F &&>())) map_error(F &&f) const && { return map_error_impl(std::move(*this), std::forward<F>(f)); } #endif #endif #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) template <class F> TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) & { return map_error_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) && { return map_error_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr auto transform_error(F &&f) const & { return map_error_impl(*this, std::forward<F>(f)); } template <class F> constexpr auto transform_error(F &&f) const && { return map_error_impl(std::move(*this), std::forward<F>(f)); } #else template <class F> TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &>(), std::declval<F &&>())) transform_error(F &&f) & { return map_error_impl(*this, std::forward<F>(f)); } template <class F> TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &&>(), std::declval<F &&>())) transform_error(F &&f) && { return map_error_impl(std::move(*this), std::forward<F>(f)); } template <class F> constexpr decltype(map_error_impl(std::declval<const expected &>(), std::declval<F &&>())) transform_error(F &&f) const & { return map_error_impl(*this, std::forward<F>(f)); } #ifndef TL_EXPECTED_NO_CONSTRR template <class F> constexpr decltype(map_error_impl(std::declval<const expected &&>(), std::declval<F &&>())) transform_error(F &&f) const && { return map_error_impl(std::move(*this), std::forward<F>(f)); } #endif #endif template <class F> expected TL_EXPECTED_11_CONSTEXPR or_else(F &&f) & { return or_else_impl(*this, std::forward<F>(f)); } template <class F> expected TL_EXPECTED_11_CONSTEXPR or_else(F &&f) && { return or_else_impl(std::move(*this), std::forward<F>(f)); } template <class F> expected constexpr or_else(F &&f) const & { return or_else_impl(*this, std::forward<F>(f)); } #ifndef TL_EXPECTED_NO_CONSTRR template <class F> expected constexpr or_else(F &&f) const && { return or_else_impl(std::move(*this), std::forward<F>(f)); } #endif constexpr expected() = default; constexpr expected(const expected &rhs) = default; constexpr expected(expected &&rhs) = default; expected &operator=(const expected &rhs) = default; expected &operator=(expected &&rhs) = default; template <class... Args, detail::enable_if_t<std::is_constructible<T, Args &&...>::value> * = nullptr> constexpr expected(in_place_t, Args &&...args) : impl_base(in_place, std::forward<Args>(args)...), ctor_base(detail::default_constructor_tag{}) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< T, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr expected(in_place_t, std::initializer_list<U> il, Args &&...args) : impl_base(in_place, il, std::forward<Args>(args)...), ctor_base(detail::default_constructor_tag{}) {} template <class G = E, detail::enable_if_t<std::is_constructible<E, const G &>::value> * = nullptr, detail::enable_if_t<!std::is_convertible<const G &, E>::value> * = nullptr> explicit constexpr expected(const unexpected<G> &e) : impl_base(unexpect, e.value()), ctor_base(detail::default_constructor_tag{}) {} template < class G = E, detail::enable_if_t<std::is_constructible<E, const G &>::value> * = nullptr, detail::enable_if_t<std::is_convertible<const G &, E>::value> * = nullptr> constexpr expected(unexpected<G> const &e) : impl_base(unexpect, e.value()), ctor_base(detail::default_constructor_tag{}) {} template < class G = E, detail::enable_if_t<std::is_constructible<E, G &&>::value> * = nullptr, detail::enable_if_t<!std::is_convertible<G &&, E>::value> * = nullptr> explicit constexpr expected(unexpected<G> &&e) noexcept( std::is_nothrow_constructible<E, G &&>::value) : impl_base(unexpect, std::move(e.value())), ctor_base(detail::default_constructor_tag{}) {} template < class G = E, detail::enable_if_t<std::is_constructible<E, G &&>::value> * = nullptr, detail::enable_if_t<std::is_convertible<G &&, E>::value> * = nullptr> constexpr expected(unexpected<G> &&e) noexcept( std::is_nothrow_constructible<E, G &&>::value) : impl_base(unexpect, std::move(e.value())), ctor_base(detail::default_constructor_tag{}) {} template <class... Args, detail::enable_if_t<std::is_constructible<E, Args &&...>::value> * = nullptr> constexpr explicit expected(unexpect_t, Args &&...args) : impl_base(unexpect, std::forward<Args>(args)...), ctor_base(detail::default_constructor_tag{}) {} template <class U, class... Args, detail::enable_if_t<std::is_constructible< E, std::initializer_list<U> &, Args &&...>::value> * = nullptr> constexpr explicit expected(unexpect_t, std::initializer_list<U> il, Args &&...args) : impl_base(unexpect, il, std::forward<Args>(args)...), ctor_base(detail::default_constructor_tag{}) {} template <class U, class G, detail::enable_if_t<!(std::is_convertible<U const &, T>::value && std::is_convertible<G const &, E>::value)> * = nullptr, detail::expected_enable_from_other<T, E, U, G, const U &, const G &> * = nullptr> explicit TL_EXPECTED_11_CONSTEXPR expected(const expected<U, G> &rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { this->construct(*rhs); } else { this->construct_error(rhs.error()); } } template <class U, class G, detail::enable_if_t<(std::is_convertible<U const &, T>::value && std::is_convertible<G const &, E>::value)> * = nullptr, detail::expected_enable_from_other<T, E, U, G, const U &, const G &> * = nullptr> TL_EXPECTED_11_CONSTEXPR expected(const expected<U, G> &rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { this->construct(*rhs); } else { this->construct_error(rhs.error()); } } template < class U, class G, detail::enable_if_t<!(std::is_convertible<U &&, T>::value && std::is_convertible<G &&, E>::value)> * = nullptr, detail::expected_enable_from_other<T, E, U, G, U &&, G &&> * = nullptr> explicit TL_EXPECTED_11_CONSTEXPR expected(expected<U, G> &&rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { this->construct(std::move(*rhs)); } else { this->construct_error(std::move(rhs.error())); } } template < class U, class G, detail::enable_if_t<(std::is_convertible<U &&, T>::value && std::is_convertible<G &&, E>::value)> * = nullptr, detail::expected_enable_from_other<T, E, U, G, U &&, G &&> * = nullptr> TL_EXPECTED_11_CONSTEXPR expected(expected<U, G> &&rhs) : ctor_base(detail::default_constructor_tag{}) { if (rhs.has_value()) { this->construct(std::move(*rhs)); } else { this->construct_error(std::move(rhs.error())); } } template < class U = T, detail::enable_if_t<!std::is_convertible<U &&, T>::value> * = nullptr, detail::expected_enable_forward_value<T, E, U> * = nullptr> explicit TL_EXPECTED_MSVC2015_CONSTEXPR expected(U &&v) : expected(in_place, std::forward<U>(v)) {} template < class U = T, detail::enable_if_t<std::is_convertible<U &&, T>::value> * = nullptr, detail::expected_enable_forward_value<T, E, U> * = nullptr> TL_EXPECTED_MSVC2015_CONSTEXPR expected(U &&v) : expected(in_place, std::forward<U>(v)) {} template < class U = T, class G = T, detail::enable_if_t<std::is_nothrow_constructible<T, U &&>::value> * = nullptr, detail::enable_if_t<!std::is_void<G>::value> * = nullptr, detail::enable_if_t< (!std::is_same<expected<T, E>, detail::decay_t<U>>::value && !detail::conjunction<std::is_scalar<T>, std::is_same<T, detail::decay_t<U>>>::value && std::is_constructible<T, U>::value && std::is_assignable<G &, U>::value && std::is_nothrow_move_constructible<E>::value)> * = nullptr> expected &operator=(U &&v) { if (has_value()) { val() = std::forward<U>(v); } else { err().~unexpected<E>(); ::new (valptr()) T(std::forward<U>(v)); this->m_has_val = true; } return *this; } template < class U = T, class G = T, detail::enable_if_t<!std::is_nothrow_constructible<T, U &&>::value> * = nullptr, detail::enable_if_t<!std::is_void<U>::value> * = nullptr, detail::enable_if_t< (!std::is_same<expected<T, E>, detail::decay_t<U>>::value && !detail::conjunction<std::is_scalar<T>, std::is_same<T, detail::decay_t<U>>>::value && std::is_constructible<T, U>::value && std::is_assignable<G &, U>::value && std::is_nothrow_move_constructible<E>::value)> * = nullptr> expected &operator=(U &&v) { if (has_value()) { val() = std::forward<U>(v); } else { auto tmp = std::move(err()); err().~unexpected<E>(); #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED try { ::new (valptr()) T(std::forward<U>(v)); this->m_has_val = true; } catch (...) { err() = std::move(tmp); throw; } #else ::new (valptr()) T(std::forward<U>(v)); this->m_has_val = true; #endif } return *this; } template <class G = E, detail::enable_if_t<std::is_nothrow_copy_constructible<G>::value && std::is_assignable<G &, G>::value> * = nullptr> expected &operator=(const unexpected<G> &rhs) { if (!has_value()) { err() = rhs; } else { this->destroy_val(); ::new (errptr()) unexpected<E>(rhs); this->m_has_val = false; } return *this; } template <class G = E, detail::enable_if_t<std::is_nothrow_move_constructible<G>::value && std::is_move_assignable<G>::value> * = nullptr> expected &operator=(unexpected<G> &&rhs) noexcept { if (!has_value()) { err() = std::move(rhs); } else { this->destroy_val(); ::new (errptr()) unexpected<E>(std::move(rhs)); this->m_has_val = false; } return *this; } template <class... Args, detail::enable_if_t<std::is_nothrow_constructible< T, Args &&...>::value> * = nullptr> void emplace(Args &&...args) { if (has_value()) { val().~T(); } else { err().~unexpected<E>(); this->m_has_val = true; } ::new (valptr()) T(std::forward<Args>(args)...); } template <class... Args, detail::enable_if_t<!std::is_nothrow_constructible< T, Args &&...>::value> * = nullptr> void emplace(Args &&...args) { if (has_value()) { val().~T(); ::new (valptr()) T(std::forward<Args>(args)...); } else { auto tmp = std::move(err()); err().~unexpected<E>(); #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED try { ::new (valptr()) T(std::forward<Args>(args)...); this->m_has_val = true; } catch (...) { err() = std::move(tmp); throw; } #else ::new (valptr()) T(std::forward<Args>(args)...); this->m_has_val = true; #endif } } template <class U, class... Args, detail::enable_if_t<std::is_nothrow_constructible< T, std::initializer_list<U> &, Args &&...>::value> * = nullptr> void emplace(std::initializer_list<U> il, Args &&...args) { if (has_value()) { T t(il, std::forward<Args>(args)...); val() = std::move(t); } else { err().~unexpected<E>(); ::new (valptr()) T(il, std::forward<Args>(args)...); this->m_has_val = true; } } template <class U, class... Args, detail::enable_if_t<!std::is_nothrow_constructible< T, std::initializer_list<U> &, Args &&...>::value> * = nullptr> void emplace(std::initializer_list<U> il, Args &&...args) { if (has_value()) { T t(il, std::forward<Args>(args)...); val() = std::move(t); } else { auto tmp = std::move(err()); err().~unexpected<E>(); #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED try { ::new (valptr()) T(il, std::forward<Args>(args)...); this->m_has_val = true; } catch (...) { err() = std::move(tmp); throw; } #else ::new (valptr()) T(il, std::forward<Args>(args)...); this->m_has_val = true; #endif } } private: using t_is_void = std::true_type; using t_is_not_void = std::false_type; using t_is_nothrow_move_constructible = std::true_type; using move_constructing_t_can_throw = std::false_type; using e_is_nothrow_move_constructible = std::true_type; using move_constructing_e_can_throw = std::false_type; void swap_where_both_have_value(expected & /*rhs*/, t_is_void) noexcept { // swapping void is a no-op } void swap_where_both_have_value(expected &rhs, t_is_not_void) { using std::swap; swap(val(), rhs.val()); } void swap_where_only_one_has_value(expected &rhs, t_is_void) noexcept( std::is_nothrow_move_constructible<E>::value) { ::new (errptr()) unexpected_type(std::move(rhs.err())); rhs.err().~unexpected_type(); std::swap(this->m_has_val, rhs.m_has_val); } void swap_where_only_one_has_value(expected &rhs, t_is_not_void) { swap_where_only_one_has_value_and_t_is_not_void( rhs, typename std::is_nothrow_move_constructible<T>::type{}, typename std::is_nothrow_move_constructible<E>::type{}); } void swap_where_only_one_has_value_and_t_is_not_void( expected &rhs, t_is_nothrow_move_constructible, e_is_nothrow_move_constructible) noexcept { auto temp = std::move(val()); val().~T(); ::new (errptr()) unexpected_type(std::move(rhs.err())); rhs.err().~unexpected_type(); ::new (rhs.valptr()) T(std::move(temp)); std::swap(this->m_has_val, rhs.m_has_val); } void swap_where_only_one_has_value_and_t_is_not_void( expected &rhs, t_is_nothrow_move_constructible, move_constructing_e_can_throw) { auto temp = std::move(val()); val().~T(); #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED try { ::new (errptr()) unexpected_type(std::move(rhs.err())); rhs.err().~unexpected_type(); ::new (rhs.valptr()) T(std::move(temp)); std::swap(this->m_has_val, rhs.m_has_val); } catch (...) { val() = std::move(temp); throw; } #else ::new (errptr()) unexpected_type(std::move(rhs.err())); rhs.err().~unexpected_type(); ::new (rhs.valptr()) T(std::move(temp)); std::swap(this->m_has_val, rhs.m_has_val); #endif } void swap_where_only_one_has_value_and_t_is_not_void( expected &rhs, move_constructing_t_can_throw, e_is_nothrow_move_constructible) { auto temp = std::move(rhs.err()); rhs.err().~unexpected_type(); #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED try { ::new (rhs.valptr()) T(std::move(val())); val().~T(); ::new (errptr()) unexpected_type(std::move(temp)); std::swap(this->m_has_val, rhs.m_has_val); } catch (...) { rhs.err() = std::move(temp); throw; } #else ::new (rhs.valptr()) T(std::move(val())); val().~T(); ::new (errptr()) unexpected_type(std::move(temp)); std::swap(this->m_has_val, rhs.m_has_val); #endif } public: template <class OT = T, class OE = E> detail::enable_if_t<detail::is_swappable<OT>::value && detail::is_swappable<OE>::value && (std::is_nothrow_move_constructible<OT>::value || std::is_nothrow_move_constructible<OE>::value)> swap(expected &rhs) noexcept( std::is_nothrow_move_constructible<T>::value &&detail::is_nothrow_swappable<T>::value &&std::is_nothrow_move_constructible<E>::value &&detail::is_nothrow_swappable<E>::value) { if (has_value() && rhs.has_value()) { swap_where_both_have_value(rhs, typename std::is_void<T>::type{}); } else if (!has_value() && rhs.has_value()) { rhs.swap(*this); } else if (has_value()) { swap_where_only_one_has_value(rhs, typename std::is_void<T>::type{}); } else { using std::swap; swap(err(), rhs.err()); } } constexpr const T *operator->() const { TL_ASSERT(has_value()); return valptr(); } TL_EXPECTED_11_CONSTEXPR T *operator->() { TL_ASSERT(has_value()); return valptr(); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> constexpr const U &operator*() const & { TL_ASSERT(has_value()); return val(); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &operator*() & { TL_ASSERT(has_value()); return val(); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> constexpr const U &&operator*() const && { TL_ASSERT(has_value()); return std::move(val()); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &&operator*() && { TL_ASSERT(has_value()); return std::move(val()); } constexpr bool has_value() const noexcept { return this->m_has_val; } constexpr explicit operator bool() const noexcept { return this->m_has_val; } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR const U &value() const & { if (!has_value()) detail::throw_exception(bad_expected_access<E>(err().value())); return val(); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &value() & { if (!has_value()) detail::throw_exception(bad_expected_access<E>(err().value())); return val(); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR const U &&value() const && { if (!has_value()) detail::throw_exception(bad_expected_access<E>(std::move(err()).value())); return std::move(val()); } template <class U = T, detail::enable_if_t<!std::is_void<U>::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &&value() && { if (!has_value()) detail::throw_exception(bad_expected_access<E>(std::move(err()).value())); return std::move(val()); } constexpr const E &error() const & { TL_ASSERT(!has_value()); return err().value(); } TL_EXPECTED_11_CONSTEXPR E &error() & { TL_ASSERT(!has_value()); return err().value(); } constexpr const E &&error() const && { TL_ASSERT(!has_value()); return std::move(err().value()); } TL_EXPECTED_11_CONSTEXPR E &&error() && { TL_ASSERT(!has_value()); return std::move(err().value()); } template <class U> constexpr T value_or(U &&v) const & { static_assert(std::is_copy_constructible<T>::value && std::is_convertible<U &&, T>::value, "T must be copy-constructible and convertible to from U&&"); return bool(*this) ? **this : static_cast<T>(std::forward<U>(v)); } template <class U> TL_EXPECTED_11_CONSTEXPR T value_or(U &&v) && { static_assert(std::is_move_constructible<T>::value && std::is_convertible<U &&, T>::value, "T must be move-constructible and convertible to from U&&"); return bool(*this) ? std::move(**this) : static_cast<T>(std::forward<U>(v)); } }; namespace detail { template <class Exp> using exp_t = typename detail::decay_t<Exp>::value_type; template <class Exp> using err_t = typename detail::decay_t<Exp>::error_type; template <class Exp, class Ret> using ret_t = expected<Ret, err_t<Exp>>; #ifdef TL_EXPECTED_CXX14 template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>()))> constexpr auto and_then_impl(Exp &&exp, F &&f) { static_assert(detail::is_expected<Ret>::value, "F must return an expected"); return exp.has_value() ? detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)) : Ret(unexpect, std::forward<Exp>(exp).error()); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>()))> constexpr auto and_then_impl(Exp &&exp, F &&f) { static_assert(detail::is_expected<Ret>::value, "F must return an expected"); return exp.has_value() ? detail::invoke(std::forward<F>(f)) : Ret(unexpect, std::forward<Exp>(exp).error()); } #else template <class> struct TC; template <class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr> auto and_then_impl(Exp &&exp, F &&f) -> Ret { static_assert(detail::is_expected<Ret>::value, "F must return an expected"); return exp.has_value() ? detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)) : Ret(unexpect, std::forward<Exp>(exp).error()); } template <class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr> constexpr auto and_then_impl(Exp &&exp, F &&f) -> Ret { static_assert(detail::is_expected<Ret>::value, "F must return an expected"); return exp.has_value() ? detail::invoke(std::forward<F>(f)) : Ret(unexpect, std::forward<Exp>(exp).error()); } #endif #ifdef TL_EXPECTED_CXX14 template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto expected_map_impl(Exp &&exp, F &&f) { using result = ret_t<Exp, detail::decay_t<Ret>>; return exp.has_value() ? result(detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp))) : result(unexpect, std::forward<Exp>(exp).error()); } template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto expected_map_impl(Exp &&exp, F &&f) { using result = expected<void, err_t<Exp>>; if (exp.has_value()) { detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)); return result(); } return result(unexpect, std::forward<Exp>(exp).error()); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto expected_map_impl(Exp &&exp, F &&f) { using result = ret_t<Exp, detail::decay_t<Ret>>; return exp.has_value() ? result(detail::invoke(std::forward<F>(f))) : result(unexpect, std::forward<Exp>(exp).error()); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto expected_map_impl(Exp &&exp, F &&f) { using result = expected<void, err_t<Exp>>; if (exp.has_value()) { detail::invoke(std::forward<F>(f)); return result(); } return result(unexpect, std::forward<Exp>(exp).error()); } #else template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto expected_map_impl(Exp &&exp, F &&f) -> ret_t<Exp, detail::decay_t<Ret>> { using result = ret_t<Exp, detail::decay_t<Ret>>; return exp.has_value() ? result(detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp))) : result(unexpect, std::forward<Exp>(exp).error()); } template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto expected_map_impl(Exp &&exp, F &&f) -> expected<void, err_t<Exp>> { if (exp.has_value()) { detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)); return {}; } return unexpected<err_t<Exp>>(std::forward<Exp>(exp).error()); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto expected_map_impl(Exp &&exp, F &&f) -> ret_t<Exp, detail::decay_t<Ret>> { using result = ret_t<Exp, detail::decay_t<Ret>>; return exp.has_value() ? result(detail::invoke(std::forward<F>(f))) : result(unexpect, std::forward<Exp>(exp).error()); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto expected_map_impl(Exp &&exp, F &&f) -> expected<void, err_t<Exp>> { if (exp.has_value()) { detail::invoke(std::forward<F>(f)); return {}; } return unexpected<err_t<Exp>>(std::forward<Exp>(exp).error()); } #endif #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto map_error_impl(Exp &&exp, F &&f) { using result = expected<exp_t<Exp>, detail::decay_t<Ret>>; return exp.has_value() ? result(*std::forward<Exp>(exp)) : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error())); } template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto map_error_impl(Exp &&exp, F &&f) { using result = expected<exp_t<Exp>, monostate>; if (exp.has_value()) { return result(*std::forward<Exp>(exp)); } detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()); return result(unexpect, monostate{}); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto map_error_impl(Exp &&exp, F &&f) { using result = expected<exp_t<Exp>, detail::decay_t<Ret>>; return exp.has_value() ? result() : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error())); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto map_error_impl(Exp &&exp, F &&f) { using result = expected<exp_t<Exp>, monostate>; if (exp.has_value()) { return result(); } detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()); return result(unexpect, monostate{}); } #else template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto map_error_impl(Exp &&exp, F &&f) -> expected<exp_t<Exp>, detail::decay_t<Ret>> { using result = expected<exp_t<Exp>, detail::decay_t<Ret>>; return exp.has_value() ? result(*std::forward<Exp>(exp)) : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error())); } template <class Exp, class F, detail::enable_if_t<!std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto map_error_impl(Exp &&exp, F &&f) -> expected<exp_t<Exp>, monostate> { using result = expected<exp_t<Exp>, monostate>; if (exp.has_value()) { return result(*std::forward<Exp>(exp)); } detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()); return result(unexpect, monostate{}); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto map_error_impl(Exp &&exp, F &&f) -> expected<exp_t<Exp>, detail::decay_t<Ret>> { using result = expected<exp_t<Exp>, detail::decay_t<Ret>>; return exp.has_value() ? result() : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error())); } template <class Exp, class F, detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> auto map_error_impl(Exp &&exp, F &&f) -> expected<exp_t<Exp>, monostate> { using result = expected<exp_t<Exp>, monostate>; if (exp.has_value()) { return result(); } detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()); return result(unexpect, monostate{}); } #endif #ifdef TL_EXPECTED_CXX14 template <class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> constexpr auto or_else_impl(Exp &&exp, F &&f) { static_assert(detail::is_expected<Ret>::value, "F must return an expected"); return exp.has_value() ? std::forward<Exp>(exp) : detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()); } template <class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> detail::decay_t<Exp> or_else_impl(Exp &&exp, F &&f) { return exp.has_value() ? std::forward<Exp>(exp) : (detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()), std::forward<Exp>(exp)); } #else template <class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr> auto or_else_impl(Exp &&exp, F &&f) -> Ret { static_assert(detail::is_expected<Ret>::value, "F must return an expected"); return exp.has_value() ? std::forward<Exp>(exp) : detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()); } template <class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<std::is_void<Ret>::value> * = nullptr> detail::decay_t<Exp> or_else_impl(Exp &&exp, F &&f) { return exp.has_value() ? std::forward<Exp>(exp) : (detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()), std::forward<Exp>(exp)); } #endif } // namespace detail template <class T, class E, class U, class F> constexpr bool operator==(const expected<T, E> &lhs, const expected<U, F> &rhs) { return (lhs.has_value() != rhs.has_value()) ? false : (!lhs.has_value() ? lhs.error() == rhs.error() : *lhs == *rhs); } template <class T, class E, class U, class F> constexpr bool operator!=(const expected<T, E> &lhs, const expected<U, F> &rhs) { return (lhs.has_value() != rhs.has_value()) ? true : (!lhs.has_value() ? lhs.error() != rhs.error() : *lhs != *rhs); } template <class E, class F> constexpr bool operator==(const expected<void, E> &lhs, const expected<void, F> &rhs) { return (lhs.has_value() != rhs.has_value()) ? false : (!lhs.has_value() ? lhs.error() == rhs.error() : true); } template <class E, class F> constexpr bool operator!=(const expected<void, E> &lhs, const expected<void, F> &rhs) { return (lhs.has_value() != rhs.has_value()) ? true : (!lhs.has_value() ? lhs.error() == rhs.error() : false); } template <class T, class E, class U> constexpr bool operator==(const expected<T, E> &x, const U &v) { return x.has_value() ? *x == v : false; } template <class T, class E, class U> constexpr bool operator==(const U &v, const expected<T, E> &x) { return x.has_value() ? *x == v : false; } template <class T, class E, class U> constexpr bool operator!=(const expected<T, E> &x, const U &v) { return x.has_value() ? *x != v : true; } template <class T, class E, class U> constexpr bool operator!=(const U &v, const expected<T, E> &x) { return x.has_value() ? *x != v : true; } template <class T, class E> constexpr bool operator==(const expected<T, E> &x, const unexpected<E> &e) { return x.has_value() ? false : x.error() == e.value(); } template <class T, class E> constexpr bool operator==(const unexpected<E> &e, const expected<T, E> &x) { return x.has_value() ? false : x.error() == e.value(); } template <class T, class E> constexpr bool operator!=(const expected<T, E> &x, const unexpected<E> &e) { return x.has_value() ? true : x.error() != e.value(); } template <class T, class E> constexpr bool operator!=(const unexpected<E> &e, const expected<T, E> &x) { return x.has_value() ? true : x.error() != e.value(); } template <class T, class E, detail::enable_if_t<(std::is_void<T>::value || std::is_move_constructible<T>::value) && detail::is_swappable<T>::value && std::is_move_constructible<E>::value && detail::is_swappable<E>::value> * = nullptr> void swap(expected<T, E> &lhs, expected<T, E> &rhs) noexcept(noexcept(lhs.swap(rhs))) { lhs.swap(rhs); } } // namespace tl #endif
{ "repo_name": "TartanLlama/expected", "stars": "1219", "repo_language": "C++", "file_name": "expected.hpp", "mime_type": "text/x-c++" }
version: 0.0 os: linux files: - source: / destination: /var/www/snapshot hooks: BeforeInstall: - location: scripts/deregister_from_elb.sh timeout: 400 AfterInstall: - location: scripts/finish_install.sh ApplicationStart: - location: scripts/bind_app.sh timeout: 120 runas: root - location: scripts/register_with_elb.sh timeout: 120
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
#!/bin/bash HASH=`git rev-parse --short HEAD` BUNDLE=bundle-$HASH.tar.gz S3ENDPOINT="s3://XXX/bundles/" echo "[!] Removing any previous bundles..." rm -rf bundle-*.tar.gz echo "[*] Done!" echo "[*] Creating bundle for commit $HASH..." echo "[*] This operation may take several minutes..." tar --exclude='*.git*' --exclude='*.DS_Store*' --exclude='storage/logs/*' -zcf $BUNDLE -T bundle.conf > /dev/null 2>&1 echo "[*] Done!" echo "[*] Uploading bundle to S3..." aws s3 cp $BUNDLE $S3ENDPOINT > /dev/null 2>&1 echo "[*] Done!" echo "[-] Your CodeDeploy S3 endpoint will be: $S3ENDPOINT$BUNDLE"
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
app/ bootstrap/ config/ database/ node_modules/ public/ resources/ routes/ storage/ vendor/ appspec.yml artisan server.php
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
#!/bin/bash # Add Ruby2.0 respository add-apt-repository -y ppa:brightbox/ruby-ng-experimental # Add node source respository curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - # Update APT apt update # Install dependencies apt install -y php7.0 php7.0-mbstring php7.0-xml php7.0-zip php7.0-mysql git nginx software-properties-common python-software-properties python-pip wget nodejs ruby2.0 # Upgrade dependencies apt upgrade -y # Composer php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php -- --install-dir=/usr/bin --filename=composer rm composer-setup.php # Install AWS CLI pip install awscli # Install AWS codedeploy agent wget https://aws-codedeploy-ap-southeast-2.s3.amazonaws.com/latest/install chmod +x ./install ./install auto service codedeploy-agent start rm -rf install # Set cgi.fix_pathinfo=0 in php.ini sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.0/fpm/php.ini # Create nginx default config echo "server {" > /etc/nginx/sites-available/default echo " listen 80 default_server;" >> /etc/nginx/sites-available/default echo " listen [::]:80 default_server;" >> /etc/nginx/sites-available/default echo "" >> /etc/nginx/sites-available/default echo " root /var/www/public;" >> /etc/nginx/sites-available/default echo "" >> /etc/nginx/sites-available/default echo " index index.php index.html;" >> /etc/nginx/sites-available/default echo "" >> /etc/nginx/sites-available/default echo " server_name _;" >> /etc/nginx/sites-available/default echo "" >> /etc/nginx/sites-available/default echo " location / {" >> /etc/nginx/sites-available/default echo " try_files \$uri \$uri/ /index.php;" >> /etc/nginx/sites-available/default echo " }" >> /etc/nginx/sites-available/default echo "" >> /etc/nginx/sites-available/default echo " location ~* (index)\.php\$ {" >> /etc/nginx/sites-available/default echo " include snippets/fastcgi-php.conf;" >> /etc/nginx/sites-available/default echo "" >> /etc/nginx/sites-available/default echo " fastcgi_pass unix:/run/php/php7.0-fpm.sock;" >> /etc/nginx/sites-available/default echo " }" >> /etc/nginx/sites-available/default echo "" >> /etc/nginx/sites-available/default echo " location ~ /\.ht {" >> /etc/nginx/sites-available/default echo " deny all;" >> /etc/nginx/sites-available/default echo " }" >> /etc/nginx/sites-available/default echo "}" >> /etc/nginx/sites-available/default # Restart php and nginx service php7.0-fpm reload service nginx reload # Remove default web directory rm -rf /var/www/html
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
# Laravel CodeDeploy Template A template for deploying Laravel applications with AWS CodeDeploy across an autoscaling group. ## IAM Roles The following roles should be created **BEFORE** any launch configurations, autoscaling groups or CodeDeploy applications are created as they'll be needed during that creation process. `code-deploy-role` - Requires the pre-baked policy **AWSCodeDeployRole** `code-deploy-ec2-instance-role` - Requires the pre-baked policy **AmazonEC2FullAccess** - Requires a custom policy **code-deploy-ec2-permissions** with the following: ```json { "Version": "2012-10-17", "Statement": [ { "Action": [ "s3:Get*", "s3:List*" ], "Effect": "Allow", "Resource": "*" } ] } ``` ## Requirements - A compatible **Ubuntu 16.04** AMI (use the provided **provision.sh** script on a fresh instance and save an AMI image from that) - A classic load balancer (preferably with sticky connections [5mins+]) - An AWS launch configuration (using the aforementioned AMI) and an autoscaling group - A CodeDeploy application and deployment group that references the aforementioned autoscaling group - A S3 bucket for your application with two folders contained within: `bundles` and `env` ## Setup - Copy the `scripts` directory into the root of your Laravel application, as well as the `bundle.sh` and `appspec.yml` files - Replace the `XXX` placeholder inside of `bundle.sh` and `scripts/finish_install.sh` with your S3 bucket name - Inside of the S3 bucket folder `env` place a `production.env` file that contains your production settings. This will be copied to each instance as a `.env` file during each deployment cycle ## Usage - Make sure `composer` and `npm` have been run and all dependencies are up to date and that the application works as expected locally and on staging - Use `bundle.sh` to automatically create a `tar.gz` archive of your Laravel application and upload it to the S3 bucket folder `bundles` - The `bundle.sh` will tar only the directories and files listed in `bundle.conf` - Create a new CodeDeploy revision deployment using S3 as the source and point the endpoint to the one provided by the `bundle.sh` script ## Provisioner overview The provided `provision.sh` script used to generate the instance needed for the AMI does the following: - Installs **NGINX**, **PHP7.0-FPM**, **Composer**, **NPM**, the **CodeDeploy Agent**, the **AWS CLI** and a bunch of related/required dependencies - Configures NGINX to serve content out of the `/var/www/public` directory - Only allows `index.php` to be executed via `PHP7.0-FPM`
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
#!/bin/bash # # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://aws.amazon.com/apache2.0 # # or in the "license" file accompanying this file. This file is distributed # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. See the License for the specific language governing # permissions and limitations under the License. # ELB_LIST defines which Elastic Load Balancers this instance should be part of. # The elements in ELB_LIST should be separated by space. Safe default is "". # Set to "_all_" to automatically find all load balancers the instance is registered to. # Set to "_any_" will work as "_all_" but will not fail if instance is not attached to # any ASG or ELB, giving flexibility. ELB_LIST="_all_" # Under normal circumstances, you shouldn't need to change anything below this line. # ----------------------------------------------------------------------------- export PATH="$PATH:/usr/bin:/usr/local/bin" # If true, all messages will be printed. If false, only fatal errors are printed. DEBUG=true # Number of times to check for a resouce to be in the desired state. WAITER_ATTEMPTS=60 # Number of seconds to wait between attempts for resource to be in a state. WAITER_INTERVAL=1 # AutoScaling Standby features at minimum require this version to work. MIN_CLI_VERSION='1.3.25' # Create a flagfile for each deployment FLAGFILE="/tmp/asg_codedeploy_flags-$DEPLOYMENT_GROUP_ID-$DEPLOYMENT_ID" # Handle ASG processes HANDLE_PROCS=true # Usage: get_instance_region # # Writes to STDOUT the AWS region as known by the local instance. get_instance_region() { if [ -z "$AWS_REGION" ]; then AWS_REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document \ | grep -i region \ | awk -F\" '{print $4}') fi echo $AWS_REGION } AWS_CLI="aws --region $(get_instance_region)" # Usage: set_flag <flag> <value> # # Writes <flag>=<value> to FLAGFILE set_flag() { if echo "$1=$2" >> $FLAGFILE; then return 0 else error_exit "Unable to write flag \"$1=$2\" to $FLAGFILE" fi } # Usage: get_flag <flag> # # Checks for <flag> in FLAGFILE. Echoes it's value and returns 0 on success or non-zero if it fails to read the file. get_flag() { if [ -r $FLAGFILE ]; then local result=$(awk -F= -v flag="$1" '{if ( $1 == flag ) {print $2}}' $FLAGFILE) echo "${result}" return 0 else # FLAGFILE doesn't exist return 1 fi } # Usage: check_suspended_processes # # Checks processes suspended on the ASG before beginning and store them in # the FLAGFILE to avoid resuming afterwards. Also abort if Launch process # is suspended. check_suspended_processes() { # Get suspended processes in an array local suspended=($($AWS_CLI autoscaling describe-auto-scaling-groups \ --auto-scaling-group-name "${asg_name}" \ --query 'AutoScalingGroups[].SuspendedProcesses' \ --output text | awk '{printf $1" "}')) if [ ${#suspended[@]} -eq 0 ]; then msg "No processes were suspended on the ASG before starting." else msg "This processes were suspended on the ASG before starting: ${suspended[*]}" fi # If "Launch" process is suspended abort because we will not be able to recover from StandBy. Note the "[[ ... =~" bashism. if [[ "${suspended[@]}" =~ "Launch" ]]; then error_exit "'Launch' process of AutoScaling is suspended which will not allow us to recover the instance from StandBy. Aborting." fi for process in ${suspended[@]}; do set_flag "$process" "true" done } # Usage: suspend_processes # # Suspend processes known to cause problems during deployments. # The API call is idempotent so it doesn't matter if any were previously suspended. suspend_processes() { local -a processes=(AZRebalance AlarmNotification ScheduledActions ReplaceUnhealthy) msg "Suspending ${processes[*]} processes" $AWS_CLI autoscaling suspend-processes \ --auto-scaling-group-name "${asg_name}" \ --scaling-processes ${processes[@]} if [ $? != 0 ]; then error_exit "Failed to suspend ${processes[*]} processes for ASG ${asg_name}. Aborting as this may cause issues." fi } # Usage: resume_processes # # Resume processes suspended, except for the one suspended before deployment. resume_processes() { local -a processes=(AZRebalance AlarmNotification ScheduledActions ReplaceUnhealthy) local -a to_resume for p in ${processes[@]}; do if ! local tmp_flag_value=$(get_flag "$p"); then error_exit "$FLAGFILE doesn't exist or is unreadable" elif [ ! "$tmp_flag_value" = "true" ] ; then to_resume=("${to_resume[@]}" "$p") fi done msg "Resuming ${to_resume[*]} processes" $AWS_CLI autoscaling resume-processes \ --auto-scaling-group-name "${asg_name}" \ --scaling-processes ${to_resume[@]} if [ $? != 0 ]; then error_exit "Failed to resume ${to_resume[*]} processes for ASG ${asg_name}. Aborting as this may cause issues." fi } # Usage: remove_flagfile # # Removes FLAGFILE. Returns non-zero if failure. remove_flagfile() { if rm $FLAGFILE; then msg "Successfully removed flagfile $FLAGFILE" return 0 else msg "WARNING: Failed to remove flagfile $FLAGFILE." fi } # Usage: finish_msg # # Prints some finishing statistics finish_msg() { msg "Finished $(basename $0) at $(/bin/date "+%F %T")" end_sec=$(/bin/date +%s.%N) elapsed_seconds=$(echo "$end_sec" "$start_sec" | awk '{ print $1 - $2 }') msg "Elapsed time: $elapsed_seconds" } # Usage: autoscaling_group_name <EC2 instance ID> # # Prints to STDOUT the name of the AutoScaling group this instance is a part of and returns 0. If # it is not part of any groups, then it prints nothing. On error calling autoscaling, returns # non-zero. autoscaling_group_name() { local instance_id=$1 # This operates under the assumption that instances are only ever part of a single ASG. local autoscaling_name=$($AWS_CLI autoscaling describe-auto-scaling-instances \ --instance-ids $instance_id \ --output text \ --query AutoScalingInstances[0].AutoScalingGroupName) if [ $? != 0 ]; then return 1 elif [ "$autoscaling_name" == "None" ]; then echo "" else echo "${autoscaling_name}" fi return 0 } # Usage: autoscaling_enter_standby <EC2 instance ID> <ASG name> # # Move <EC2 instance ID> into the Standby state in AutoScaling group <ASG name>. Doing so will # pull it out of any Elastic Load Balancer that might be in front of the group. # # Returns 0 if the instance was successfully moved to standby. Non-zero otherwise. autoscaling_enter_standby() { local instance_id=$1 local asg_name=${2} msg "Checking if this instance has already been moved in the Standby state" local instance_state=$(get_instance_state_asg $instance_id) if [ $? != 0 ]; then msg "Unable to get this instance's lifecycle state." return 1 fi if [ "$instance_state" == "Standby" ]; then msg "Instance is already in Standby; nothing to do." return 0 fi if [ "$instance_state" == "Pending:Wait" ]; then msg "Instance is Pending:Wait; nothing to do." return 0 fi if [ "$HANDLE_PROCS" = "true" ]; then msg "Checking ASG ${asg_name} suspended processes" check_suspended_processes # Suspend troublesome processes while deploying suspend_processes fi msg "Checking to see if ASG ${asg_name} will let us decrease desired capacity" local min_desired=$($AWS_CLI autoscaling describe-auto-scaling-groups \ --auto-scaling-group-name "${asg_name}" \ --query 'AutoScalingGroups[0].[MinSize, DesiredCapacity]' \ --output text) local min_cap=$(echo $min_desired | awk '{print $1}') local desired_cap=$(echo $min_desired | awk '{print $2}') if [ -z "$min_cap" -o -z "$desired_cap" ]; then msg "Unable to determine minimum and desired capacity for ASG ${asg_name}." msg "Attempting to put this instance into standby regardless." set_flag "asgmindecremented" "false" elif [ $min_cap == $desired_cap -a $min_cap -gt 0 ]; then local new_min=$(($min_cap - 1)) msg "Decrementing ASG ${asg_name}'s minimum size to $new_min" msg $($AWS_CLI autoscaling update-auto-scaling-group \ --auto-scaling-group-name "${asg_name}" \ --min-size $new_min) if [ $? != 0 ]; then msg "Failed to reduce ASG ${asg_name}'s minimum size to $new_min. Cannot put this instance into Standby." return 1 else msg "ASG ${asg_name}'s minimum size has been decremented, creating flag in file $FLAGFILE" # Create a "flag" denote that the ASG min has been decremented set_flag "asgmindecremented" "true" fi else msg "No need to decrement ASG ${asg_name}'s minimum size" set_flag "asgmindecremented" "false" fi msg "Putting instance $instance_id into Standby" $AWS_CLI autoscaling enter-standby \ --instance-ids $instance_id \ --auto-scaling-group-name "${asg_name}" \ --should-decrement-desired-capacity if [ $? != 0 ]; then msg "Failed to put instance $instance_id into Standby for ASG ${asg_name}." return 1 fi msg "Waiting for move to Standby to finish" wait_for_state "autoscaling" $instance_id "Standby" if [ $? != 0 ]; then local wait_timeout=$(($WAITER_INTERVAL * $WAITER_ATTEMPTS)) msg "Instance $instance_id did not make it to standby after $wait_timeout seconds" return 1 fi return 0 } # Usage: autoscaling_exit_standby <EC2 instance ID> <ASG name> # # Attempts to move instance <EC2 instance ID> out of Standby and into InService. Returns 0 if # successful. autoscaling_exit_standby() { local instance_id=$1 local asg_name=${2} msg "Checking if this instance has already been moved out of Standby state" local instance_state=$(get_instance_state_asg $instance_id) if [ $? != 0 ]; then msg "Unable to get this instance's lifecycle state." return 1 fi if [ "$instance_state" == "InService" ]; then msg "Instance is already InService; nothing to do." return 0 fi if [ "$instance_state" == "Pending:Wait" ]; then msg "Instance is Pending:Wait; nothing to do." return 0 fi msg "Moving instance $instance_id out of Standby" $AWS_CLI autoscaling exit-standby \ --instance-ids $instance_id \ --auto-scaling-group-name "${asg_name}" if [ $? != 0 ]; then msg "Failed to put instance $instance_id back into InService for ASG ${asg_name}." return 1 fi msg "Waiting for exit-standby to finish" wait_for_state "autoscaling" $instance_id "InService" if [ $? != 0 ]; then local wait_timeout=$(($WAITER_INTERVAL * $WAITER_ATTEMPTS)) msg "Instance $instance_id did not make it to InService after $wait_timeout seconds" return 1 fi if ! local tmp_flag_value=$(get_flag "asgmindecremented"); then error_exit "$FLAGFILE doesn't exist or is unreadable" elif [ "$tmp_flag_value" = "true" ]; then local min_desired=$($AWS_CLI autoscaling describe-auto-scaling-groups \ --auto-scaling-group-name "${asg_name}" \ --query 'AutoScalingGroups[0].[MinSize, DesiredCapacity]' \ --output text) local min_cap=$(echo $min_desired | awk '{print $1}') local new_min=$(($min_cap + 1)) msg "Incrementing ASG ${asg_name}'s minimum size to $new_min" msg $($AWS_CLI autoscaling update-auto-scaling-group \ --auto-scaling-group-name "${asg_name}" \ --min-size $new_min) if [ $? != 0 ]; then msg "Failed to increase ASG ${asg_name}'s minimum size to $new_min." remove_flagfile return 1 else msg "Successfully incremented ASG ${asg_name}'s minimum size" fi else msg "Auto scaling group was not decremented previously, not incrementing min value" fi if [ "$HANDLE_PROCS" = "true" ]; then # Resume processes, except for the ones suspended before deployment resume_processes fi # Clean up the FLAGFILE remove_flagfile return 0 } # Usage: get_instance_state_asg <EC2 instance ID> # # Gets the state of the given <EC2 instance ID> as known by the AutoScaling group it's a part of. # Health is printed to STDOUT and the function returns 0. Otherwise, no output and return is # non-zero. get_instance_state_asg() { local instance_id=$1 local state=$($AWS_CLI autoscaling describe-auto-scaling-instances \ --instance-ids $instance_id \ --query "AutoScalingInstances[?InstanceId == \`$instance_id\`].LifecycleState | [0]" \ --output text) if [ $? != 0 ]; then return 1 else echo $state return 0 fi } # Usage: reset_waiter_timeout <ELB name> <state name> # # Resets the timeout value to account for the ELB timeout and also connection draining. reset_waiter_timeout() { local elb=$1 local state_name=$2 if [ "$state_name" == "InService" ]; then # Wait for a health check to succeed local timeout=$($AWS_CLI elb describe-load-balancers \ --load-balancer-name $elb \ --query 'LoadBalancerDescriptions[0].HealthCheck.Timeout') elif [ "$state_name" == "OutOfService" ]; then # If connection draining is enabled, wait for connections to drain local draining_values=$($AWS_CLI elb describe-load-balancer-attributes \ --load-balancer-name $elb \ --query 'LoadBalancerAttributes.ConnectionDraining.[Enabled,Timeout]' \ --output text) local draining_enabled=$(echo $draining_values | awk '{print $1}') local timeout=$(echo $draining_values | awk '{print $2}') if [ "$draining_enabled" != "True" ]; then timeout=0 fi else msg "Unknown state name, '$state_name'"; return 1; fi # Base register/deregister action may take up to about 30 seconds timeout=$((timeout + 30)) WAITER_ATTEMPTS=$((timeout / WAITER_INTERVAL)) } # Usage: wait_for_state <service> <EC2 instance ID> <state name> [ELB name] # # Waits for the state of <EC2 instance ID> to be in <state> as seen by <service>. Returns 0 if # it successfully made it to that state; non-zero if not. By default, checks $WAITER_ATTEMPTS # times, every $WAITER_INTERVAL seconds. If giving an [ELB name] to check under, these are reset # to that ELB's timeout values. wait_for_state() { local service=$1 local instance_id=$2 local state_name=$3 local elb=$4 local instance_state_cmd if [ "$service" == "elb" ]; then instance_state_cmd="get_instance_health_elb $instance_id $elb" reset_waiter_timeout $elb $state_name if [ $? != 0 ]; then error_exit "Failed resetting waiter timeout for $elb" fi elif [ "$service" == "autoscaling" ]; then instance_state_cmd="get_instance_state_asg $instance_id" else msg "Cannot wait for instance state; unknown service type, '$service'" return 1 fi msg "Checking $WAITER_ATTEMPTS times, every $WAITER_INTERVAL seconds, for instance $instance_id to be in state $state_name" local instance_state=$($instance_state_cmd) local count=1 msg "Instance is currently in state: $instance_state" while [ "$instance_state" != "$state_name" ]; do if [ $count -ge $WAITER_ATTEMPTS ]; then local timeout=$(($WAITER_ATTEMPTS * $WAITER_INTERVAL)) msg "Instance failed to reach state, $state_name within $timeout seconds" return 1 fi sleep $WAITER_INTERVAL instance_state=$($instance_state_cmd) count=$(($count + 1)) msg "Instance is currently in state: $instance_state" done return 0 } # Usage: get_instance_health_elb <EC2 instance ID> <ELB name> # # Gets the health of the given <EC2 instance ID> as known by <ELB name>. If it's a valid health # status (one of InService|OutOfService|Unknown), then the health is printed to STDOUT and the # function returns 0. Otherwise, no output and return is non-zero. get_instance_health_elb() { local instance_id=$1 local elb_name=$2 msg "Checking status of instance '$instance_id' in load balancer '$elb_name'" # If describe-instance-health for this instance returns an error, then it's not part of # this ELB. But, if the call was successful let's still double check that the status is # valid. local instance_status=$($AWS_CLI elb describe-instance-health \ --load-balancer-name $elb_name \ --instances $instance_id \ --query 'InstanceStates[].State' \ --output text 2>/dev/null) if [ $? == 0 ]; then case "$instance_status" in InService|OutOfService|Unknown) echo -n $instance_status return 0 ;; *) msg "Instance '$instance_id' not part of ELB '$elb_name'" return 1 esac fi } # Usage: validate_elb <EC2 instance ID> <ELB name> # # Validates that the Elastic Load Balancer with name <ELB name> exists, is describable, and # contains <EC2 instance ID> as one of its instances. # # If any of these checks are false, the function returns non-zero. validate_elb() { local instance_id=$1 local elb_name=$2 # Get the list of active instances for this LB. local elb_instances=$($AWS_CLI elb describe-load-balancers \ --load-balancer-name $elb_name \ --query 'LoadBalancerDescriptions[*].Instances[*].InstanceId' \ --output text) if [ $? != 0 ]; then msg "Couldn't describe ELB instance named '$elb_name'" return 1 fi msg "Checking health of '$instance_id' as known by ELB '$elb_name'" local instance_health=$(get_instance_health_elb $instance_id $elb_name) if [ $? != 0 ]; then return 1 fi return 0 } # Usage: get_elb_list <EC2 instance ID> # # Finds all the ELBs that this instance is registered to. After execution, the variable # "ELB_LIST" will contain the list of load balancers for the given instance. # # If the given instance ID isn't found registered to any ELBs, the function returns non-zero get_elb_list() { local instance_id=$1 local elb_list="" elb_list=$($AWS_CLI elb describe-load-balancers \ --query $'LoadBalancerDescriptions[].[join(`,`,Instances[?InstanceId==`'$instance_id'`].InstanceId),LoadBalancerName]' \ --output text | grep $instance_id | awk '{ORS=" ";print $2}') if [ -z "$elb_list" ]; then return 1 else msg "Got load balancer list of: $elb_list" ELB_LIST=$elb_list return 0 fi } # Usage: deregister_instance <EC2 instance ID> <ELB name> # # Deregisters <EC2 instance ID> from <ELB name>. deregister_instance() { local instance_id=$1 local elb_name=$2 $AWS_CLI elb deregister-instances-from-load-balancer \ --load-balancer-name $elb_name \ --instances $instance_id 1> /dev/null return $? } # Usage: register_instance <EC2 instance ID> <ELB name> # # Registers <EC2 instance ID> to <ELB name>. register_instance() { local instance_id=$1 local elb_name=$2 $AWS_CLI elb register-instances-with-load-balancer \ --load-balancer-name $elb_name \ --instances $instance_id 1> /dev/null return $? } # Usage: check_cli_version [version-to-check] [desired version] # # Without any arguments, checks that the installed version of the AWS CLI is at least at version # $MIN_CLI_VERSION. Returns non-zero if the version is not high enough. check_cli_version() { if [ -z $1 ]; then version=$($AWS_CLI --version 2>&1 | cut -f1 -d' ' | cut -f2 -d/) else version=$1 fi if [ -z "$2" ]; then min_version=$MIN_CLI_VERSION else min_version=$2 fi x=$(echo $version | cut -f1 -d.) y=$(echo $version | cut -f2 -d.) z=$(echo $version | cut -f3 -d.) min_x=$(echo $min_version | cut -f1 -d.) min_y=$(echo $min_version | cut -f2 -d.) min_z=$(echo $min_version | cut -f3 -d.) msg "Checking minimum required CLI version (${min_version}) against installed version ($version)" if [ $x -lt $min_x ]; then return 1 elif [ $y -lt $min_y ]; then return 1 elif [ $y -gt $min_y ]; then return 0 elif [ $z -ge $min_z ]; then return 0 else return 1 fi } # Usage: msg <message> # # Writes <message> to STDERR only if $DEBUG is true, otherwise has no effect. msg() { local message=$1 $DEBUG && echo $message 1>&2 } # Usage: error_exit <message> # # Writes <message> to STDERR as a "fatal" and immediately exits the currently running script. error_exit() { local message=$1 echo "[FATAL] $message" 1>&2 exit 1 } # Usage: get_instance_id # # Writes to STDOUT the EC2 instance ID for the local instance. Returns non-zero if the local # instance metadata URL is inaccessible. get_instance_id() { curl -s http://169.254.169.254/latest/meta-data/instance-id return $? }
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
#!/bin/bash # # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://aws.amazon.com/apache2.0 # # or in the "license" file accompanying this file. This file is distributed # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. See the License for the specific language governing # permissions and limitations under the License. . $(dirname $0)/common_functions.sh msg "Running AWS CLI with region: $(get_instance_region)" # get this instance's ID INSTANCE_ID=$(get_instance_id) if [ $? != 0 -o -z "$INSTANCE_ID" ]; then error_exit "Unable to get this instance's ID; cannot continue." fi # Get current time msg "Started $(basename $0) at $(/bin/date "+%F %T")" start_sec=$(/bin/date +%s.%N) msg "Checking if instance $INSTANCE_ID is part of an AutoScaling group" asg=$(autoscaling_group_name $INSTANCE_ID) if [ $? == 0 -a -n "${asg}" ]; then msg "Found AutoScaling group for instance $INSTANCE_ID: ${asg}" msg "Checking that installed CLI version is at least at version required for AutoScaling Standby" check_cli_version if [ $? != 0 ]; then error_exit "CLI must be at least version ${MIN_CLI_X}.${MIN_CLI_Y}.${MIN_CLI_Z} to work with AutoScaling Standby" fi msg "Attempting to put instance into Standby" autoscaling_enter_standby $INSTANCE_ID "${asg}" if [ $? != 0 ]; then error_exit "Failed to move instance into standby" else msg "Instance is in standby" finish_msg exit 0 fi fi msg "Instance is not part of an ASG, trying with ELB..." set_flag "dereg" "true" if [ -z "$ELB_LIST" ]; then error_exit "ELB_LIST is empty. Must have at least one load balancer to deregister from, or \"_all_\", \"_any_\" values." elif [ "${ELB_LIST}" = "_all_" ]; then msg "Automatically finding all the ELBs that this instance is registered to..." get_elb_list $INSTANCE_ID if [ $? != 0 ]; then error_exit "Couldn't find any. Must have at least one load balancer to deregister from." fi set_flag "ELBs" "$ELB_LIST" elif [ "${ELB_LIST}" = "_any_" ]; then msg "Automatically finding all the ELBs that this instance is registered to..." get_elb_list $INSTANCE_ID if [ $? != 0 ]; then msg "Couldn't find any, but ELB_LIST=any so finishing successfully without deregistering." set_flag "ELBs" "" finish_msg exit 0 fi set_flag "ELBs" "$ELB_LIST" fi # Loop through all LBs the user set, and attempt to deregister this instance from them. for elb in $ELB_LIST; do msg "Checking validity of load balancer named '$elb'" validate_elb $INSTANCE_ID $elb if [ $? != 0 ]; then msg "Error validating $elb; cannot continue with this LB" continue fi msg "Deregistering $INSTANCE_ID from $elb" deregister_instance $INSTANCE_ID $elb if [ $? != 0 ]; then error_exit "Failed to deregister instance $INSTANCE_ID from ELB $elb" fi done # Wait for all deregistrations to finish msg "Waiting for instance to de-register from its load balancers" for elb in $ELB_LIST; do wait_for_state "elb" $INSTANCE_ID "OutOfService" $elb if [ $? != 0 ]; then error_exit "Failed waiting for $INSTANCE_ID to leave $elb" fi done finish_msg
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
#!/bin/bash # # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://aws.amazon.com/apache2.0 # # or in the "license" file accompanying this file. This file is distributed # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. See the License for the specific language governing # permissions and limitations under the License. . $(dirname $0)/common_functions.sh msg "Running AWS CLI with region: $(get_instance_region)" # get this instance's ID INSTANCE_ID=$(get_instance_id) if [ $? != 0 -o -z "$INSTANCE_ID" ]; then error_exit "Unable to get this instance's ID; cannot continue." fi # Get current time msg "Started $(basename $0) at $(/bin/date "+%F %T")" start_sec=$(/bin/date +%s.%N) msg "Checking if instance $INSTANCE_ID is part of an AutoScaling group" asg=$(autoscaling_group_name $INSTANCE_ID) if [ $? == 0 -a -n "${asg}" ]; then msg "Found AutoScaling group for instance $INSTANCE_ID: ${asg}" msg "Checking that installed CLI version is at least at version required for AutoScaling Standby" check_cli_version if [ $? != 0 ]; then error_exit "CLI must be at least version ${MIN_CLI_X}.${MIN_CLI_Y}.${MIN_CLI_Z} to work with AutoScaling Standby" fi msg "Attempting to move instance out of Standby" autoscaling_exit_standby $INSTANCE_ID "${asg}" if [ $? != 0 ]; then error_exit "Failed to move instance out of standby" else msg "Instance is no longer in Standby" finish_msg exit 0 fi fi msg "Instance is not part of an ASG, continuing with ELB" if [ -z "$ELB_LIST" ]; then error_exit "ELB_LIST is empty. Must have at least one load balancer to register to, or \"_all_\", \"_any_\" values." elif [ "${ELB_LIST}" = "_all_" ]; then if [ "$(get_flag "dereg")" = "true" ]; then msg "Finding all the ELBs that this instance was previously registered to" if ! ELB_LIST=$(get_flag "ELBs"); then error_exit "$FLAGFILE doesn't exist or is unreadble" elif [ -z $ELB_LIST ]; then error_exit "Couldn't find any. Must have at least one load balancer to register to." fi else msg "Assuming this is the first deployment and ELB_LIST=_all_ so finishing successfully without registering." finish_msg exit 0 fi elif [ "${ELB_LIST}" = "_any_" ]; then if [ "$(get_flag "dereg")" = "true" ]; then msg "Finding all the ELBs that this instance was previously registered to" if ! ELB_LIST=$(get_flag "ELBs"); then error_exit "$FLAGFILE doesn't exist or is unreadble" elif [ -z $ELB_LIST ]; then msg "Couldn't find any, but ELB_LIST=_any_ so finishing successfully without registering." remove_flagfile finish_msg exit 0 fi else msg "Assuming this is the first deployment and ELB_LIST=_any_ so finishing successfully without registering." finish_msg exit 0 fi fi # Loop through all LBs the user set, and attempt to register this instance to them. for elb in $ELB_LIST; do msg "Checking validity of load balancer named '$elb'" validate_elb $INSTANCE_ID $elb if [ $? != 0 ]; then msg "Error validating $elb; cannot continue with this LB" continue fi msg "Registering $INSTANCE_ID to $elb" register_instance $INSTANCE_ID $elb if [ $? != 0 ]; then error_exit "Failed to register instance $INSTANCE_ID from ELB $elb" fi done # Wait for all registrations to finish msg "Waiting for instance to register to its load balancers" for elb in $ELB_LIST; do wait_for_state "elb" $INSTANCE_ID "InService" $elb if [ $? != 0 ]; then error_exit "Failed waiting for $INSTANCE_ID to return to $elb" fi done remove_flagfile finish_msg
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
#!/bin/bash # Copy the production environment file from S3 to the local installation aws s3 cp s3://XXX/env/production.env /var/www/snapshot/.env # Setup the various file and folder permissions for Laravel chown -R ubuntu:www-data /var/www/snapshot find /var/www/snapshot -type d -exec chmod 755 {} + find /var/www/snapshot -type f -exec chmod 644 {} + chgrp -R www-data /var/www/snapshot/storage /var/www/snapshot/bootstrap/cache chmod -R ug+rwx /var/www/snapshot/storage /var/www/snapshot/bootstrap/cache # Clear any previous cached views and optimize the application php /var/www/snapshot/artisan cache:clear php /var/www/snapshot/artisan view:clear php /var/www/snapshot/artisan config:cache php /var/www/snapshot/artisan optimize php /var/www/snapshot/artisan route:cache # Reload PHP-FPM so that any cached code is subsequently refreshed service php7.0-fpm reload
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
#!/bin/bash # Refresh the public html symlink. rm -rf /var/www/public ln -s /var/www/snapshot/public /var/www/public
{ "repo_name": "enzyme-ops/laravel-code-deploy-template", "stars": "44", "repo_language": "Shell", "file_name": "bind_app.sh", "mime_type": "text/x-shellscript" }
# __Awesome Proxmox VE__ ![Proxmox VE|300](https://www.proxmox.com/images/proxmox/Proxmox-logo-800.png) This repo is a collection of **AWESOME** [Proxmox VE](https://pve.proxmox.com) documentation, tools, and resources for **any user or developer**. Feel free to **contribute** / **star** / **fork** / **pull request** . Any **recommendations** and **suggestions** are welcome. ## Table of Contents - [API](#api) - [Articles](#articles) - [Blogs](#blogs) - [Documentation](#documentation) - [Community](#community) - [Tools](#tools) - [Videos](#videos) ## API - [Proxmox API](https://pve.proxmox.com/wiki/Proxmox_VE_API) Proxmox Documentation API - Go - [proxmox-api-go](https://github.com/Telmate/proxmox-api-go) Using the Proxmox API in golang - .Net - [cv4pve-api-dotnet](https://github.com/Corsinvest/cv4pve-api-dotnet) Proxmox VE Client API .Net C# - [ProxmoxSharp](https://github.com/ionelanton/ProxmoxSharp) Proxmox C# API client - PHP - [cv4pve-api-php](https://github.com/Corsinvest/cv4pve-api-php) Proxmox VE Client API PHP - [ProxmoxVE](https://github.com/ZzAntares/ProxmoxVE) This PHP 5.5+ library allows you to interact with your Proxmox server API - [pve2-api-php-client](https://github.com/CpuID/pve2-api-php-client) Proxmox 2.0 API Client for PHP - Java - [cv4pve-api-java](https://github.com/Corsinvest/cv4pve-api-java) Proxmox VE Client API Java - [pve2-api-java](https://github.com/Elbandi/pve2-api-java) Proxmox 2.0 API Client for Java - Python - [Proxmoxer](https://pypi.org/project/proxmoxer/) Python Wrapper for the Proxmox 2.x API (HTTP and SSH) - [pyproxmox](https://pypi.org/project/pyproxmox/) Python Wrapper for the Proxmox 2.x API - [Proxmoxia](https://github.com/baseblack/Proxmoxia) Yet another Python wrapper for the Proxmox REST API. - Perl - [Net-Proxmox-VE-0.006](https://metacpan.org/release/DJZORT/Net-Proxmox-VE-0.006) Pure perl API for Proxmox virtualization - Ruby - [Proxmox](https://github.com/nledez/proxmox) Need to manage a proxmox host with Ruby? This library is for you. - Node.js - [Proxmox](https://www.npmjs.com/package/proxmox) Node.js Proxmox client - [cv4pve-api-javascript](https://github.com/Corsinvest/cv4pve-api-javascript) Proxmox VE Client API Javascript - PowerShell - [cv4pve-api-powershell](https://github.com/Corsinvest/cv4pve-api-powershell) ProxmoxVE PowerShell module for accessing API ## Articles - [Setup Docker on Proxmox VE Using ZFS Storage](https://www.servethehome.com/setup-docker-on-proxmox-ve-using-zfs-storage/) - [Recommended settings for Windows 10 and 2019 Server on Proxmox](https://davejansen.com/recommended-settings-windows-10-2016-2018-2019-vm-proxmox/) - [Proxmox Training](https://github.com/ondrejsika/proxmox-training) - [Proxmox: Automatische Snapshots einrichten](https://techlr.de/proxmox-automatische-snapshots-einrichten/) - [Installing macOS 12 “Monterey” on Proxmox 7](https://www.nicksherlock.com/2021/10/installing-macos-12-monterey-on-proxmox-7/) - [Proxmox VE 7 Corosync QDevice in a Docker container](https://raymii.org/s/tutorials/Proxmox_VE_7_Corosync_QDevice_in_Docker.html) ## Monitoring - [Monitoring Proxmox with InfluxDB and Grafana in 4 Easy steps](https://www.linuxsysadmins.com/monitoring-proxmox-with-grafana/) - [Efficient Proxmox monitoring with Checkmk](https://checkmk.com/blog/proxmox-monitoring) - [Proxmox VE Monitoring](https://pandorafms.com/blog/proxmox-ve-monitoring/) - [SNMP Scripts to monitor Proxmox VE](https://github.com/in-famous-raccoon/proxmox-snmp) ## Blogs - [pveCLI](https://pvecli.xuan2host.com/) article Proxmox VE - [servethehome](https://www.servethehome.com/tag/proxmox-ve/) article Proxmox VE - [Techno Tim](https://docs.technotim.live/tags/proxmox/) Techno Tim - Proxmox VE ## Documentation - [Official Wiki](https://pve.proxmox.com) Index Wiki - [Official Docs](https://pve.proxmox.com/pve-docs/) Index official documentation ## Community - [Official Forum](https://forum.proxmox.com/) Official Forum - [Git Developer](https://git.proxmox.com/?o=age) Git Developer Proxmox VE - [Bugzilla](https://bugzilla.proxmox.com/) Bugzilla Proxmox VE - [pve-devel](https://www.mail-archive.com/[email protected]/index.html) Mailing List Developer Proxmox VE - [pve-user](https://www.mail-archive.com/[email protected]/) Mailing List User Proxmox VE - [cv4pve-tools](https://www.cv4pve-tools.com) cv4pve-tools Utility for Proxmox VE - [cv4pve-metrics](https://metrics.cv4pve-tools.com) Metrics cloud for Proxmox VE - [Reddit Proxmox](https://www.reddit.com/r/Proxmox/) Reddit - [Reddit Proxmox VE](https://www.reddit.com/r/ProxmoxVE/) Reddit - [Facebook Group](https://www.facebook.com/groups/proxmox/) Facebook Group ## Tools - [cv4pve-admin](https://github.com/Corsinvest/cv4pve-admin) Admin Web for Proxmox VE - [cv4pve-autosnap](https://github.com/Corsinvest/cv4pve-autosnap) Automatic snapshot tool for Proxmox VE - [cv4pve-barc](https://github.com/Corsinvest/cv4pve-barc) Backup And Restore Ceph for Proxmox VE - [cv4pve-cli](https://github.com/Corsinvest/cv4pve-cli) Cli for Proxmox VE (Command Line Interfaces) - [cv4pve-botgram](https://github.com/Corsinvest/cv4pve-botgram) Telegram Bot for Proxmox VE - [cv4pve-diag](https://github.com/Corsinvest/cv4pve-diag) Diagnostic tool for Proxmox VE - [cv4pve-node-protect](https://github.com/Corsinvest/cv4pve-node-protect) Proxmox VE protect configuration file nodes - [cv4pve-pepper](https://github.com/Corsinvest/cv4pve-pepper) Launching SPICE remote-viewer having access VM running on Proxmox VE - [cv4pve-metric](https://github.com/Corsinvest/cv4pve-metric) Metrics for Proxmox VE - [cv4pve-metrics-exporter](https://github.com/Corsinvest/cv4pve-metrics-exporter) Metric exporter Prometheus for Proxmox VE - [cv4pve-api-pwsh](https://github.com/Corsinvest/cv4pve-api-powershell) Power Shell for Proxmox VE - [pve-cli-utils](https://github.com/aheahe/pve-cli-utils) ProxmoxVE Command Line Interface Utilities - [proxmox-utils](https://github.com/remofritzsche/proxmox-utils) Useful shell (python) scripts for managing proxmox virtual environment. - [proxmove](https://github.com/ossobv/proxmove) Migrate virtual machines between different Proxmox VE clusters - [pvekclean](https://github.com/jordanhillis/pvekclean) Easily remove old/unused PVE kernels on your Proxmox VE system - [xshok-proxmox](https://github.com/extremeshok/xshok-proxmox) proxmox post installation scripts - [pve-patches](https://github.com/ayufan/pve-patches) Incremental backup - [proxmox-pci-switcher](https://github.com/rosineygp/proxmox-pci-switcher) Switch among Guest VMs organized by Resource Pool - [proxmox-tools](https://github.com/marrobHD/proxmox-tools) 📦 A collection of stuff that I wrote for Proxmox 📦 - [Proxmox-Launcher](https://github.com/domingoruiz/Proxmox-Launcher) Proxmox Launcher - [Proxmox Helper Scripts](https://github.com/tteck/Proxmox) - [pbs-exporter](https://github.com/rare-magma/pbs-exporter) Bash script that uploads proxmox backup server API info to prometheus' pushgateway. - [Proxmox-WoL](https://github.com/Aizen-Barbaros/Proxmox-WoL) A script to enable Wake on LAN on Proxmox - [tteck](https://github.com/tteck/Proxmox) tteck - Proxmox Helper Scripts ## Videos - [Resizing Virtual Hard Drives in Proxmox](https://www.youtube.com/watch?v=hRP7u3QPNOM) - [Creating a Ubuntu LXC in Proxmox for Docker](https://www.youtube.com/watch?v=1EYAGl96dZY&t) - [Proxmox 6.1 and 6.2 PCIe Passthrough](https://www.youtube.com/watch?v=_fkKIMF3HZw) - [Proxmox Monitoring Tools: InfluxDB2 + Grafana](https://www.youtube.com/watch?v=f2eyVfCTLi0) # License [![CC0](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/) This project is not affiliated with Proxmox, which is free software distributed under the [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) (aGPLv3).
{ "repo_name": "Corsinvest/awesome-proxmox-ve", "stars": "332", "repo_language": "None", "file_name": "README.md", "mime_type": "text/plain" }
# For Rehike Contributors **Hello! Thanks for checking out Rehike.** Rehike is a project that attempts to restore the classic YouTube layout, known as Hitchhiker. We welcome whatever help we can get. ## What can I help with? As the project grows, it becomes harder for a single person to maintain everything. We encourage you to help contributing however you can. We don't bite and we'll assist with changes rather than sharply reject changes that we have issues with, so please don't be shy! ### **I don't know how to code.** That's okay! You can still make valuable contributions to the project. For example, if you speak multiple languages, you can contribute to our internationalisation (i18n) and translate the project's strings to your language. Just as you can report a bug through the issues tab, you can also make a suggestion that the developers can consider. ### **I want to contribute code.** There are many things you can help with in code contribution. - **Search for `TODO`'s or `BUG`'s.** We consider this an important chore to do, as these things tend to be left for months without being touched. If something needs to be done, don't be afraid to help do it. - ```php // TODO(author): Example of a TODO notice. // BUG(author): Example of a BUG notice. ``` - **Look at the issues.** We value community feedback on the project and use this system to report bugs or recommendations. This oughta give you an idea on what can be done. - **Add documentation.** If you see any of our code as difficult to understand or confusing, it can be valuable to add clarification in comments. ## Code standards There are a few standards that we wish for all contributors to abide by to ensure clean, readable, maintainable, flexible, and stable code. Here are the main points: - **Rehike is a multi-paradigm project.** We don't enforce a procedural or object-oriented code style, as we believe both work better in tandem. - However, for **procedural code**—code that operates without creating object instances—**we do require that classes are still used to wrap the code.** This is due to a PHP limitation; the autoloader cannot be used for non-class structures. This is also why a majority of our classes consist solely of static functions. - **There is no strict style guide to adhere to**, however, please try to imitate preexisting code and don't go too crazy. - Though we do like to use `BUG` in comments to mark code that needs to be fixed. `FIXME` may not be checked for as much, so please stay away from using it. - **Understand the separation of worlds.** - For example, data should seldom be modified in HTML templates. This helps maintain structured and easy to understand code. While it may be tempting to get it done with in one place, misuse of an environment can create a maintenance nightmare down the line. - **Modules** implement the backend of Rehike. Anything that doesn't directly influence a page's construction (i.e. anything global) should be implemented as a module. - **Controllers** are used to coordinate general behaviour of a page. - **Models** are used to (re)structure data for sending to the HTML templater. Separating the structuring of data (models) from the representation of data (HTML) helps keep both clean. - **Templates** are used to represent data in HTML documents; to convert a model to HTML. These are written in Twig, rather than directly implemented in PHP. - **Update the `.version` file before you leave.** Fortunately, you don't need to do this manually! - We've included a `.git-hooks` folder in the project. This contains a `pre-push` file. Just copy this to your `.git/hooks` folder in this project and it will automatically increment the version number when you push an update. Thank you for reading this! Should you choose to contribute to this project, your work will be appreciated. The Rehike Team
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<?php use YukisCoffee\CoffeeRequest\CoffeeRequest; CoffeeRequest::setResolve([ Rehike\Util\Nameserver\Nameserver::get("www.youtube.com", "1.1.1.1", 443) ->serialize() ]); use Rehike\ControllerV2\Core as ControllerV2; use Rehike\TemplateManager; TemplateManager::registerGlobalState($yt); // Pass resource constants to the templater TemplateManager::addGlobal("ytConstants", $ytConstants); TemplateManager::addGlobal("PIXEL", $ytConstants->pixelGif); // Load general i18n files use Rehike\i18n; i18n::setDefaultLanguage("en"); i18n::newNamespace("main/regex")->registerFromFolder("i18n/regex"); i18n::newNamespace("main/misc")->registerFromFolder("i18n/misc"); i18n::newNamespace("main/guide")->registerFromFolder("i18n/guide"); // i18n for templates $msgs = i18n::newNamespace("main/global")->registerFromFolder("i18n/global"); $yt->msgs = $msgs->getStrings()[$msgs->getLanguage()]; // Controller V2 init ControllerV2::registerStateVariable($yt); ControllerV2::setRedirectHandler(require "includes/spf_redirect_handler.php"); // Player init use \Rehike\Player\PlayerCore; PlayerCore::configure([ "cacheMaxTime" => 18000, // 5 hours in seconds "cacheDestDir" => "cache", "cacheDestName" => "player_cache" // .json ]); // Parse user preferences as stored by the YouTube application. if (isset($_COOKIE["PREF"])) { $PREF = explode("&", $_COOKIE["PREF"]); $yt->PREF = (object) []; for ($i = 0; $i < count($PREF); $i++) { $option = explode("=", $PREF[$i]); $title = $option[0]; if (isset($option[1])) { $yt->PREF->$title = $option[1]; } } } else { $yt->PREF = (object) [ "f5" => "20030" ]; } // Import all template functions foreach (glob("includes/template_functions/*.php") as $file) include $file;
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<?php // , // ,,,,, // ,,,,,,,,,. // ,,,,,,,,,,,,,, // ,,,,,,,,,,,,,,,,,, // ,,,,,,,,,,,,,,,,,,,,,,, // ,,,,,,,,,,,##,,,,,,,,,,,,,, // ,,,,,,,,,@@@@@%,,,,,,,,,,,,,,,,. // ,,,,,,,,,,*&&*,,,,,,,,,,,,,,,,,,,,,, // ,,,,,,,,,,,@@@@@%,,,,@@*,,,,,,,,,,,,,,,, // ,,,,,,@@@,,@@@@@@@@@@@@@@,,,,,,,,,,,,,,,,,,,. // ,,,,,&@@@@,,@@@@@*,,,,,,@@,,,,,,,,,,,,,,,,,,,,,,. // ,,,,,,@@@@&,*@@@@@@@#*,,,%@@,,,,,,,,,,,,,,,,,,,, // ,,,,,,,@@@@(,(@@@&@@@@@,,,,@@,,,,,,,,,,,,,,, // ,,,,,,,,,,,,,,%@@%,,,#@@#,,,%@&,,,,,,,,. // ,,,,,,,,,,,,,,,&@@*,,,,@@@,,,,,,,,, // ,,,,,,,,,,,,,,,,@@@,,,,,#,,,,,, // ,,,,,,,,,,,,,,,,,@@@,,,,,,. // ,,,,,,,,,,,,,,,,,,,,,, // ,,,,,,,,,,,,,,,,,, // ,,,,,,,,,,,,,. // ,,,,,,,,, // ,,,,, // // // Rehike: // // A classic YouTube server emulator written in PHP. // See the README.md file for installation instructions and more. // // If you wish to contribute, please see CONTRIBUTING.md. // // And check out some of the cool people that brought it to you! // - Taniko Yamamoto (@kirasicecreamm or @YukisCoffee on everything) // - Aubrey Pankow (@aubymori on Twitter and YouTube) // - Daylin Cooper (@ephemeralViolette on GitHub) // //----------------------------------------------------------------------------- // // This file is the insertion point for the Rehike server. Every request // to YouTube should go through this file. // // This is responsible for early imports and starting the Rehike session. // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ob_start(); set_include_path($_SERVER['DOCUMENT_ROOT']); (include "integrity_check.php") or die( "<h1>Rehike fatal error</h1> " . "Failed to run integrity check. Something is desperately wrong. " . "Verify your server configuration and try again. Try chmod on Unix (Linux, macOS, etc.) " . "as file system permissions can be hard to debug. " . "<a href=\"//github.com/Rehike/Rehike/wiki/Common_errors#Failed_to_run_integrity_check\">" . "For more information, please see our wiki page on this error message." . "</a>" ); require "includes/fatal_handler.php"; // PHP < 8.2 IDE fix include "includes/polyfill/AllowDynamicProperties.php"; require "includes/constants.php"; // Include the Composer and Rehike autoloaders, respectively. require "vendor/autoload.php"; require "includes/rehike_autoloader.php"; foreach (glob('includes/template_functions/*.php') as $file) include $file; \Rehike\Boot\Bootloader::startSession();
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<?php // Performs some quick integrity checks to verify that Rehike is even able to // run in the first place. This helps users catch early mistakes more easily. // Minimum PHP version: if (PHP_VERSION_ID < 80000) { require "includes/fatal_templates/version_too_old_page.html.php"; exit(); }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<?php use Rehike\ControllerV2\Router; use Rehike\SimpleFunnel; // ?enable_polymer can be used as a passthrough to Polymer. This allows the // user to bypass Rehike without disabling the Rehike server. if ( isset($_GET["enable_polymer"]) && ( $_GET["enable_polymer"] == "1" || strtolower($_GET["enable_polymer"]) == "true" ) ) { SimpleFunnel::funnelCurrentPage()->then(fn($r) => $r->output()); } // Passed through the Rehike server. These simply request the YouTube server // directly. Router::funnel([ "/api/*", "/youtubei/*", "/s/*", "/embed/*", "/yts/*", "/favicon.ico", "/subscribe_embed", "/login", "/logout", "/signin", "/upload", "/t/*", "/howyoutubeworks/*", "/create_channel", "/new", "/supported_browsers", "/getAccountSwitcherEndpoint", "/channel_image_upload/*", "/account", "/account_notifications", "/account_playback", "/account_privacy", "/account_sharing", "/account_billing", "/account_advanced", "/account_transfer_channel", "/features", "/testtube", "/t/terms", "/iframe_api", "/signin_prompt", "/post/*", "/feeds/*" ]); Router::redirect([ "/watch/(*)" => "/watch?v=$1", "/shorts/(*)" => "/watch?v=$1", "/live/(*)" => "/watch?v=$1", "/hashtag/(*)" => "/results?search_query=$1", "/feed/what_to_watch/**" => "/", "/source/(*)" => function($request) { if (isset($request->path[1])) return "/attribution?v=" . $request->path[1]; else return "/attribution"; }, "/redirect(/|?)*" => function($request) { if (isset($request->params->q)) return urldecode($request->params->q); }, "/feed/library" => "/profile", "/subscription_manager" => "/feed/channels", "/rehike/settings" => "/rehike/config", "/subscription_center?(*)" => function($request) { if ($user = @$request->params->add_user) return "/user/$user?sub_confirmation=1"; else if ($user = @$request->params->add_user_id) return "/channel/$user?sub_confirmation=1"; } ]); Router::get([ "/" => "feed", "/feed/**" => "feed", "/watch" => "watch", "/user/**" => "channel", "/channel/**" => "channel", "/c/**" => "channel", "/live_chat" => "special/get_live_chat", "/live_chat_replay" => "special/get_live_chat", "/feed_ajax" => "ajax/feed", "/results" => "results", "/playlist" => "playlist", "/oops" => "oops", "/related_ajax" => "ajax/related", "/browse_ajax" => "ajax/browse", "/addto_ajax" => "ajax/addto", "/rehike/version" => "rehike/version", "/rehike/static/**" => "rehike/static_router", "/share_ajax" => "ajax/share", "/attribution" => "attribution", "/profile" => "profile", "/channel_switcher" => "channel_switcher", "/rehike/config" => "rehike/config", "/rehike/config/**" => "rehike/config", "/all_comments" => "all_comments", "default" => "channel" ]); Router::post([ "/feed_ajax" => "ajax/feed", "/browse_ajax" => "ajax/browse", "/watch_fragments2_ajax" => "ajax/watch_fragments2", "/related_ajax" => "ajax/related", "/playlist_video_ajax" => "ajax/playlist_video", "/playlist_ajax" => "ajax/playlist", "/subscription_ajax" => "ajax/subscription", "/service_ajax" => "ajax/service", "/comment_service_ajax" => "ajax/comment_service", "/addto_ajax" => "ajax/addto", "/live_events_reminders_ajax" => "ajax/live_events_reminders", "/delegate_account_ajax" => "ajax/delegate_account", "/rehike/update_config" => "rehike/update_config", "default" => "channel" ]);
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
# Rehike <p align="center"> <img src="branding/banner.png" alt="Rehike branding image"> </p> Rehike is a custom web frontend server for YouTube. We use it to accurately restore the old YouTube layout and feel, which is known as Hitchhiker. This version of YouTube existed from 2013 to 2020 and is preferred by us due to its speed and simplicity. **Rehike is not a browser extension, nor does it intend to function as one.** Rather, it works over the browser, offering more freedom to what it is allowed to do and greater portability. This makes Rehike browser-independent and, to an extent, system independent. ## How do I do this? FAQs? etc. See [the Rehike wiki](https://github.com/Rehike/Rehike/wiki). ## I want to contribute! See [CONTRIBUTING.md](CONTRIBUTING.md). ## Installation ***Rehike is early in development. You should not expect a perfect user experience, should you choose to use it.*** If you encounter any problems while using Rehike, [please make an issue](//github.com/Rehike/Rehike/issues) so that we can track them easily. We currently do not support an automated install. If you wish to use Rehike, you must set it up manually. Fortunately, that isn't too hard! [See this page for manual installation instructions.](//github.com/Rehike/Rehike/wiki/Installation) ## Configuration [See this page for configuration details.](//github.com/Rehike/Rehike/wiki/Configuration) ## Acknowledgements Rehike makes use of the following software or services: - [Composer](//getcomposer.org) - [Twig](//twig.symfony.com) - [SpfPhp](//github.com/Rehike/SpfPhp) - [YukisCoffee/simple_html_dom](//github.com/YukisCoffee/simple_html_dom) fork of [voku/simple_html_dom](//github.com/voku/simple_html_dom) - [Protocol Buffers](//developers.google.com/protocol-buffers/) - [Return YouTube Dislike API](https://www.returnyoutubedislike.com/) Use of these third party services is governed by their respective licenses. Where possible, their application will be optional. ## Licence It is the belief of the team that code should generally be open and unrestricted. As such, we license all of our original code under the Unlicense; **you are free to do whatever you want with any code in the project that is authored by The Rehike Maintainers, Taniko Yamamoto, Daylin Cooper, or Aubrey Pankow, unless otherwise stated.** This licence is not applicable to the third party software we incorporate in the project. Please see their respective `LICENSE` files for more information on each. ## Thank you! Whether or not you choose to contribute to or use Rehike, we appreciate you checking out our project!
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<?php return [ "getFormattedDate" => function($date = 0) { return date("F j, Y, h:i", $date); }, "brandName" => "Rehike", "versionHeader" => "Wersja %s", "nightly" => "Nightly", "nightlyInfoTooltip" => "To wydanie jest na granicy wytrzymałości i może zawierać nieregularne błędy.", "subheaderNightlyInfo" => "Obecne informacje o gałęzi", "nonGitNotice" => "To wydanie Rehike nie zawiera informacji o Git.", "nonGitExtended" => "Może to nastąpić, jeśli pobrałeś repozytorium bezpośrednio z GitHub, " . "na przykład z funkcji \"Download ZIP\". Niektóre informacje o wersji mogą zostać utracone lub " . "niedostępne.", "syncGithubButton" => "Synchronizuj z GitHubem", "failedNotice" => "Nie udało się uzyskać informacji o wersji.", "remoteFailedNotice" => "Nie udało się uzyskać informacji o wersji zdalnej.", "remoteFailedExtended" => "Informacje o wersji są ograniczone.", "noDotVersionNotice" => "Brakuje pliku .version lub jest on uszkodzony.", "noNewVersions" => "Brak dostępnych nowych wersji.", "oneNewVersion" => "Dostępna 1 nowa wersja.", "varNewVersions" => "Dostępne %s nowych wersji.", "unknownNewVersions" => "Ta wersja jest krytycznie przestarzała.", "headingVersionInfo" => "Informacje o wersji", "viewOnGithub" => "Zobacz na GitHubie", "extraInfo" => "Dodatkowe informacje", "operatingSystem" => "System operacyjny", "phpVersion" => "Wersja PHP" ];
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<?php return [ "getFormattedDate" => function($date = 0) { return date("F j, Y, h:i", $date); }, "brandName" => "Rehike", "versionHeader" => "Version %s", "nightly" => "Nightly", "nightlyInfoTooltip" => "This release is bleeding edge and may contain irregular bugs.", "subheaderNightlyInfo" => "Current branch information", "nonGitNotice" => "This release of Rehike lacks Git information.", "nonGitExtended" => "This may occur if you downloaded the repository directly from GitHub, " . "such as from the \"Download ZIP\" feature. Some version information may be lost or " . "unavailable.", "syncGithubButton" => "Synchronize with GitHub", "failedNotice" => "Failed to get version information.", "remoteFailedNotice" => "Failed to get remote version information.", "remoteFailedExtended" => "Version information is limited.", "noDotVersionNotice" => "The .version file is missing or corrupted.", "noNewVersions" => "No new versions available.", "oneNewVersion" => "1 new version available.", "varNewVersions" => "%s new versions available.", "unknownNewVersions" => "This version is critically out of date.", "headingVersionInfo" => "Version information", "viewOnGithub" => "View on GitHub", "extraInfo" => "Extra information", "operatingSystem" => "Operating system", "phpVersion" => "PHP version" ];
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
name: Bug report description: Something isn't working right. labels: [bug] body: - type: markdown attributes: value: | Thanks for reporting a bug in Rehike! However, before you continue, you must make sure of all of these things. 1. You are running at least **PHP 8.0**. 2. The bug is not related to Fiddler, or any other proxy. Please see [this guide](https://github.com/Rehike/Rehike/issues/226) for the new method of installing Rehike. 3. This bug has not been reported before. **Also check closed issues.** 4. Make sure Rehike is fully up to date! [How do I update Rehike?](https://github.com/Rehike/Rehike/wiki/Update-Rehike) - type: dropdown attributes: label: Rehike version description: What version of Rehike are you using? multiple: false options: - 0.7 validations: required: true - type: input attributes: label: Operating system description: What operating system and what version of it are you using? placeholder: e.g. Windows NT 6.3 build 9600 (Windows 8.1 Professional Edition) AMD64 validations: required: true - type: input attributes: label: PHP version description: What version of PHP is Rehike running on? placeholder: e.g. 8.2.0 validations: required: true - type: textarea attributes: label: What's going on? description: Describe the bug. Be sure to include any screenshots, videos, stack traces, whatever details you can. Be sure to enclose your stack traces in two sets of three backticks, as to not mention other issues. placeholder: Describe the bug validations: required: true
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
name: Feature request description: Request a new or missing feature for Rehike. labels: [enhancement] body: - type: markdown attributes: value: | Thanks for requesting a feature in Rehike! However, before you continue, please make sure of all these things. 1. You are running the latest version of Rehike. You don't want to request a feature that already exists! 2. This feature has not been requested before. 3. It doesn't use any shady third-party API. We use Return YouTube Dislike because it used and trusted by many. 4. It doesn't stray too far from the vanilla Hitchhiker experience. 5. It isn't a stylistic change that can be done with CSS. - type: textarea attributes: label: Describe the feature description: Describe the feature you would like to be added to Rehike. Please attach images and archive links if you have any. placeholder: Describe
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
#!/bin/sh while IFS= read -r -d $'\0' ARG; do if test "$ARG" == '--no-verify'; then exit 0 fi done < /proc/$PPID/cmdline if git config --get custom.ignorePostCommitHook > /dev/null; then exit 0 fi previous_hash=$(git rev-list HEAD^1 --max-count=1) current_rev_id=$(git rev-list --count HEAD) subject=$(git log -1 --pretty="%s") body=$(git log -1 --pretty="%s") branch=$(git rev-parse --abbrev-ref HEAD) committer_name=$(git log -1 --pretty="%cn") committer_email=$(git log -1 --pretty="%ce") time=$(git log -1 --pretty="%ct") cat <<EOL > .version { "previousHash": "$previous_hash", "currentRevisionId": $current_rev_id, "subject": "$subject", "body": "$body", "branch": "$branch", "committerName": "$committer_name", "committerEmail": "$committer_email", "time": $time } EOL git add .version # Ignore next run git config custom.ignorePostCommitHook "true" git commit --no-verify --amend --no-edit # Stop ignoring git config --unset custom.ignorePostCommitHook
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the insertion point for feed templates. All feed pages are loaded using this as the insertion point. #} {% extends "core.twig" %} {% import 'core/macros.twig' as core %} {% import 'common/appbar/appbar_nav.twig' as appbar_nav %} {% set pageType = 'feed' %} {% set pageName = 'feed' %} {% set appbarEnabled = true %} {% set defaultGuideVisibility = true %} {% set defaultAppbarVisibility = not yt.appbar.nav is empty %} {% set enableSnapScaling = true %} {%- block title -%} {%- if yt.page.title -%} {{ yt.page.title }} - {{ parent() }} {%- else -%} {{ parent() }} {%- endif -%} {% endblock %} {% block foot_scripts %} <script> yt.setConfig('ANGULAR_JS', "\/yts\/jslib\/angular.min-vflWkvD5q.js"); yt.setConfig('TRANSLATIONEDITOR_JS', "\/yts\/jsbin\/www-translationeditor-vflugm3V9\/www-translationeditor.js"); yt.setMsg('UNSAVED_CHANGES_WARNING', "Some of the changes you have made to channel settings have not been saved and will be lost if you navigate away from this page."); yt.setConfig( 'JS_PAGE_MODULES', [ 'www/feed', 'www/ypc_bootstrap' ]); yt.setConfig('DISMISS_THROUGH_IT', true); yt.setConfig({ 'GUIDE_SELECTED_ITEM': "{{ serialiseEndpoint(yt.currentEndpoint) }}" }); yt.setConfig({ 'GUIDED_HELP_LOCALE': "en_US", 'GUIDED_HELP_ENVIRONMENT': "prod" }); </script> {% endblock %} {%- block appbarContent -%} {%- if not yt.appbar.nav is empty -%} {{ appbar_nav.render(yt.appbar.nav) }} {%- endif -%} {% endblock %} {%- block head_css -%} {{ core.css('www-home-c4') }} {% endblock %} {% block content %} {% embed 'common/channels4/branded_page_v2.twig' %} {% set brandedPageConfig = { 'baseBoldTitles': true, 'containerFlexWidth': true, 'hasTopRow': true, 'secondaryColumnHidden': true } %} {% block branded_page_primary_column_content %} {% from "common/browse/main.twig" import render as browse %} {{ browse(yt.page.content) }} {% endblock %} {% endembed %} {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements an all comments viewer page. #} {% extends "core.twig" %} {% import "core/macros.twig" as core %} {% set pageType = 'watch' %} {% set appbarEnabled = true %} {% set defaultGuideVisibility = true %} {% set defaultApbarVisibility = false %} {% set enableSnapScaling = true %} {%- block title -%} {% if yt.page.title %} {{ yt.page.title }} - YouTube {% else %} YouTube {% endif %} {%- endblock -%} {%- block head_css -%} {{ core.css("www-home-c4") }} {%- endblock -%} {% block foot_scripts %} <script> yt.setConfig({ 'VIDEO_ID': "{{ yt.videoId }}", 'WAIT_TO_DELAYLOAD_FRAME_CSS': false, 'IS_UNAVAILABLE_PAGE': false, 'DROPDOWN_ARROW_URL': "\/yts\/img\/pixel-vfl3z5WfW.gif", 'AUTONAV_EXTRA_CHECK': false, 'JS_PAGE_MODULES': [ 'www/watch', 'www/watch_speedyg', 'www/watch_autoplayrenderer', 'www/watch_transcript' ], 'REPORTVIDEO_JS': "\/yts\/jsbin\/www-reportvideo-vflidisXQ\/www-reportvideo.js", 'REPORTVIDEO_CSS': "\/yts\/cssbin\/www-watch-reportvideo-vflhkISaX.css", 'TIMING_AFT_KEYS': ['pbp', 'pbs'], 'YPC_CAN_RATE_VIDEO': true, 'BG_P': "bKC0\/NOxKGI+KHSHYpCbpgrSuGlLA4kdUzK9lA7NaKmFls\/XkEyaOXc+qT1JM4KcCZ8nTnWwipplN9hJuq\/xrAb2pExdzZ1QRxYo2CP\/qDU1K9Y\/biuxqS\/StgNg804OU+omPoLJzZYPC4YWeNyoFjwXty+BjuY2k30E9+0\/VpIJVhcWDgF1GnBgp5eRhhSdxtR7uQEsgfg2XEAKYCrTVTec3RUNyih8SzZ8jtmLrq8Wik5jJHbvcFfUNhn7aFMg5D4+JQ+w4elWvTow7rjeqXef5TFEYzr87uVqlkv2GNhu\/hi2pU4v6VLKY1GJgDTUELf2aGfME9JGC8apW7khT\/uWwKYiG0kh1LghvTPg3484naYdZnl1mEb88BHGdFld7GRtEv5iplFhSFHj1WpMHoFSxuQ6Xx6xo4CC8YRCNr+O86RbpGIuP3S3uzTSmPXJBL1QlGMrTe4dlAPbh5\/tHo4jLADsve+t6WYGd2Fg1OKcJoFJKg\/2U4iB+Kaxe9th4Jry37CBjOG52Pya+JzNUKihoZUdGLHYwR6uwiLU+TKhmX5uU+VdMALZs0f6\/8LfLITelK\/RIjPzD89Ht6H9BUvrdcnwPDYmWv3WhcOTmLlIi+QjRPnRv6U5+2dVChwheyC0AO7p1kCahmN4YzjrgHwoToXPzrVfpZGX25sxtSNcVnc+wRzJWdGy4gOAP7KF4vrRnFpNZ9BB1EaQxPZyvizPOtKIfjWjV8rzA6mlIE1D7Xf1z9i+NeAZCRO5w0\/SIVp0u4tkHdsxeWqFM7kjNxvE74LIpavLhIGWnMAb\/RAIi0trs27ub\/s4jLc3yf7WHvGAgd7V8R+3MuvtRRQf9PpoVKS5bNHz1F4Ie+lNHk6PmN1+6YRYqRa8757rMbWEmEoGwzW1cROYe583HyC3E8K1Zf0D2qRmZMBGm1nr5qgzKKj5TQFSwFhv9J+u9AzV74XEYDXZiUWQtveV1XzeUYCXnuuH1rlYZkS3gELp1eVBnzFhhSMIRfLw\/CiofnM2o7PvctcnkuqZMUyiMIhTVKQl1dpDplZOfWgjFx2Xo9GGFeVmgYB9Yumq9Kzx2Q\/M7XOKHtFxA3uVNmPrskbrq7N74aZuZEMNGyhoPy\/V+is6xekkEqWRDxUhL36i7Za91YWFhhO2EXhUwRawFQekeFODynhsR9zJWLi7Izcbi0LuX2bCfEkH0d0TmUJAXMSQN7zklVeiNCOmSaaY\/qp8wnoPCB6XLNiSG7c9hIsAP+ITQWAo0k\/aafA\/Zv5YpIHaFcYIpW2YRNvLAda7EJPph1T4ua8rKT84w2naEWvGckVY7Kxeq72bx8zZ6n\/zbLMBuZBAu3M+5tKOPxDhe+b6MX2zKLrzRlZYWeoeH612dJRRd0XuFX2iL\/dkqmrX0KrLqQ0znX\/hXyvpVzMYiz44KHf30MR\/ZK4TzhFKVp0QUBuvvuJ9+DKIsIOUmhlhFT3YGnwCu0\/yyCFoSYruXFtyJhUDoKH60vm0IFaDF\/XegNKn5\/2e4ojjI2pxzuaU3ric1bv7j\/fXDKlJY0x+IVFUS3LOQghVXgzWSbNjuv8zkXHICwPxrj40+aoV6VY5+CmPyXEjvnNydp9UTd3y6bZzllOj+z6hSRROP+gp8GJf+YBfmggShkDEqQThAnOUkVfTMxzfFW2GeGLOj5kubPD37wBTiNpMk7mVNm8qHxnC0XrCNlkzwugVL8mxMk2rCXGBEHS02lNoySiEum0RtgvGF3bGUAOOwEZC5mugjfqWi4vmU9FXcjAXF3bnw0Y29JKJbWyHWQtk224kwu76UKuca2ub4ADqnhCEVkwXoN\/YhzoyaSspl0wyeaJvnTB+OVPmNqaI7Xm6kyNdvrVvXozLCSY1PvgBxkqP6n0uGROpaCRRw+c8kx2URgb8ze0WY8wk413tB0qWAtJ3\/EzV2faCbryGmWMU6trTVIFrfY9JQgMEZj\/x8ViRCvajdmt1+byKjuGQwUvKjKdlDf3p833UAMvHNzfr3yfyY3oAM8rW2Gs5N7QIZi3jV7tyxYeCHRDZP865I0RaSnZvcUWogFaPDfnaJ542MdZGp\/7h1M5aATKCyFUUuGrry9ZpsEyTyFAD495pjT0tOUl9Z66zsiWJniruMLZorCpeCWQagP2V3rzQbqcQTwoqClBIn9bJvr54FI7WZoJkeCRS2pGi451Ytlno+H0tuMModViKw5EA+bCTleSDfNiJ2MWZUGgJiN1GMJGlC8TH2W7l3nZRBlPSLVyvacKbBUnyFNB58XTrcApFTMxSFEvgNt4yWqYep3NwnOi47rEFnYB5e\/aLCuIMWNVX7zf8rPOYNVQQsmVjC1jW0WS\/3oN4lvs6I7fkqMCbl5jTTPIuAEtMXiVPH6V8ujIBmEcfJHz7UJwwEnvm7UmVum5LY2LwTe3dSG73UpC8Lr8SJahgqYLf+nuxf3+5roaNTVNMcFIFY+vjABlWbDWB\/hXuhb+LHv2NpECFx2bAkZId9dZb6pAtaDeNLEttrIU8T41FUfa7z7ejG1NIT7ISJtY2F+WdPb6qh6wBLFfvrlZBfNDn1FbTVW5ae3WLsghjW5F7KLqS5+2oIN32Wg+Q4xlpbJ4k\/XkUImcWpLgG66\/Rx4YFmDRa2\/pGNE7WUcDlLMKd8tL+mnPpMRL43SmDmigJx8u5nDu1SRrV1ASm7gCt3natu4d6Htv53\/TiCdxELI6BjtvVqWVEJP+4WrhKgX4BJFdHBIElaK866XbSAbl8pUajzb9\/cKdGVs35Z2xy5ExGSKsWJvHopMsgpv0moHHah3VElZGXuPcKsJ8d59mA1pzfgqniGvIsifXQb89729ls+PGLvGPj5rCVgg6hCZDaHvLi0qH500qoHgzOX5PZ+JjQ+WKR2abcvdvPSNJmwUkuBWcuXQATqkfKO+g1sDND6yEG3bn7MzUkisDz8SeSOnxtZEIb8sdyTf4kZoHH+KBzyFDQonn8PvZnedCWjnyZfl4P0jhorVU\/Lbie5eZ6wyw3Baabc3kg8Kz8EKuLjLenGI6FOkCY9D6XnIYb+S5psyGbPzPOaAP2nsDOImToxQlhRYGplNT8XIM0Tb0x5ZB7j1Xb282qcukSjMBlrYcR7zXJtC5V3R6yD\/71gp+6VYfdVWOvKmKm6fa0rvAzNpAbp4f3URAXIrRp5tp1fXLh95YXnxwDv9ecS6NpbVwGXKRqO2Rps7RlX7+xbAQxJm\/Y5rl4wAvpZrVtd2C5GMuy3S7HRhavj3ruBLm1nYhwmMAP+ok4r3mP+grNz1nj0vrjgIHUx2EgBdARUUlfgp+QLwHGQsVL9sQ13ku\/jzYr2NS2CPYRXwG+mNFRnrREkVBy\/mMfTQy0GPMBn\/qofmSKspJil6WQQeCjRUWsRlNVifY04A+EE7jQFrYhyAeCtOY\/l183eQWC+JY\/9Ss5D2HsTxjm7gP8W0XVCX1aDAEQTU+JEUiQjbGO+oj4NVGtC7IttzWfqDAs7U0Zljp0J3d5hLppm8KIAOwS\/Zg0wHjE3J0UdiVoY1nO8xL7+jATzmM8EvlQP1UAOp9w+7g7lzb7bw6SWaKyw8ZHwesBy5\/1UEjcujFUHM5pNp0qBwa1WVKEhQoFy2+a5YsDvJ\/h1FbyQGeKNz8B+b7jLBiQpqMdInoaVwevdQrHPspYKAI0IlkxG9L0H+NqubVDCUGlBoZrpyk8+vtrfmag0U0MvK9L5N8MaRZeo7P2bVq5eo0kj1CuYFT2t1ygOWgjeh+cjKhmz+2jpl3s1v9DTZ9FUs4JD2oAJZ03ZhUKT7ngU2KlCTAez9j6eC+hqNvy8w9r60HM5+Sg\/POn1EZ63SE2OJbVgy6gTI9e+eKH957J4d4Cyd59IFYoby9LD6C4HUamu4x+wN1fWD3QkfvDn8YgvQ1FcoAVOkkz4L9WP8e++dWEzgHRNggoJBggzSa1TjNVasAzjRTerr2PAKgn3ZkaGux+Z6iMX57UbwkhjddQuAATJVlIo5co+lGWZUECof7gfZJBVv\/qSUG2w6c5Tak6RZVUE6tnC5jqCD7Qe8qlxhm3WIDk05PIK3FaGS5vXqXo9mczFEMjbPBTNeLXGSPq7AjEwxJZ5tt7xBu\/\/JnNgoV8YCo9nRrAfT7EyhrEZSWiO4QFJokZN0mTw+fCp475BQk6LCyHGvEOdcvbErwNAMQpNVJVLhUo5vL4ynnVpRX8CKy0TaEpIksvuBOadBU7xoV5RVuE\/9k7h2hlK9e6osrX1Rr2\/22+0LbfUQsn0LAtMWuw\/7C8kBMos3jegS27F1TXxxrIKG+uKkOr8yHafsgxdQPBanjNwbRfzAZ9jAZm09pXyfD4v78VhRIiT0mFyQcTGglAx9zIneMgqMhi39ZyMpG33cuuui0Nzs2WB6yQ0kjz\/GSlx4JTDeliEch1ZO6hTvWGovbvlDc4nPVjIrHsdQ66xkTjf67h6Qx27pou3ji26StJ173a9FZdnvHANaNtLM7Yr8oAyNMIEiECL2nyhUcStinXaxnftgwMOFObdfdXwvvhmoEkDlvNDUfefrmeS9em1PvwhLU4x99E2COI992wxOHKR8nzjBmXQgs+UX8o9iR4KRLCQkNTGBh4BHtxHTr6d2X0LXUHwMcO1YZkdPkeozdHsiiuthCEeLV8oojIVZEeqnt22inVYmnXXBt6aSKY8odYSOnMMI3Cfai09ARhTI7yJbydR7inCAxYdr2N5HemvhPOyLtUsTu9hFoyyxUh1sShdm1MPmLv9SHL2QN54DNcj+HXlV0uTk24joAY\/InKxVgbv6GRxh3lsIWDVEZ2cG5mNoVcR0JzXaeAw+hATRlitWwmedFGV0jL7iKkfs7H2yCl9KtotcZzrhjsPqeyPUcEICXeIjYnAEDAj6metg\/nIDvHdUQfmQ9hcdT5ebn\/j1l+Pqcr69YmXhCbuhWsP43k+6zu1QXZkvp\/2mOpD3TcPWD77UGvRNUV7IS\/ZN1pDs76yiR78y3MetdXmXplPCTPZm43YzzW2p3vLLH5piJ7jSVddkF4OJhzEIA1XRmAjZhiN9P\/qar1nTZBX\/\/buSM4MLA6amCCbSHJG3cB2Dp3kez0PrEetALMQVIjxTHCJyU3jFi\/BDhWjyuAyIbRFuTdicZePe+R\/xLTsqQAwzOWl1mAsVztX+Akj4mrNrBUciZOBLQQorBZNC46fduizIGBgBrvxlFyLpo8RdipX1UCgf3NVk0MOcm8zTXr27RiaxX3TgE50EHLdU\/GeYteHoMcG0U5LRa4hGG3XsOmrbw0nkpdBh6IU3\/m4QizTQMATRtdtBXosmc7YIIFLuUoHW78dgdVnd+ZXzVU6sAO6gNG2PVEmqfjW0OiETHJ+Fg8w9cDdhumq8fWeDmSdSbGQtzJxDpxDBDjdIzw+J9s3TB3NLcCBl0Ll3fK0De+0OPcxnWipFTbwh3TMXl\/Id2bjoZ7Bgk4Lr4expkuJ0DAYil4oKu8NA3icPcg9TZ9Jwj8yAQzk1\/S3D1p+knKZPWrOR+rAAOFe2t1pEcJAaq2QloYgtBk+2KGOn23O62c6P6spPCSNkUf2zrQKY+dvqYTRSutnpTLE+\/P4W1XKbL9UGzgxAbCzjm\/KY5gd8PHzzDIPA+JzSBSwJZitnxJlMdDOX9810gFO1b1dZRejevI76w4jioYP\/ZgJ8\/esmqOq5GJm3qggqhRT7oaDeLDLISL3pOXHf8J6Yv42fYqiM5KYEuCF33Ms6KUsNrjuhZdpa79s3h0lrRYNBl16ij9cAX1\/6789qk3S7yS2\/lB4pfQOEVXSDKUt\/HExThlvxO8IvJTU5xOGTMo8d4Xkde9Xvic3jR9s8133cUSiht4HN6ER+mXy9+VRVPGAhj6DSit9qeogP4pdXjVYJnU9YN0d0Ne3Z1CTN7iKCWhWjYmf+LHD+Lpf3Kq1fifnp+6O5C755+158\/er5c1o7QtU7XJR8dBMtkcBgue0hSzCSPlfmjOOJPIAcNtNm1GopnmIwPWyy+ItCgIsiLVB40DLxHRN\/cY83DVKoz7XfgcBsXK\/zb2CSibDiWRMnOiJ8BNu+NwDyCXNLJHahBXLM4m5T6384MCKPbkmCOdWLZIZ2A\/z7D1Wu0Ws5YIrABPS8IksdLgashG\/FO2LIFC902Rr0jgZgVnVGQsaQWLalx3ySMNwYO96VP3IkKIFE7Ntheh82Mm42oVCCKyKP4t8y\/PmthJBC+h7mZ6iqAs0I5YrBAWogxPudOn70Hhc\/sDVocLV4MKEApkF2ptlONZTM87VtLZ+fRJ17KLjpGsWr0EylGAPQaIjyaEDCet05Bsrh45ZrhsoXKKErMostymHe+qaIg8mdOyk8QMeZDcz+PMjBNLkg0zNCn6+xpsy5p4UNmiCxZvK7ZLDNSSwkq8N\/HJw6tya2lxoOqoQ==", 'BG_IU': "\/\/www.google.com\/js\/bg\/1KUtCLBFZQ_JFefvknMO8_wNfNZDIBfWr9x-gjgyf-k.js", {% if yt.commentsToken %} 'COMMENTS_TOKEN': "{{ yt.commentsToken }}", {% endif %} 'GET_PLAYER_EVENT_ID': "23PrWrDCHMvF-gPPu7LAAQ", 'HL_LOCALE': "en_US", 'TTS_URL': "", 'JS_DELAY_LOAD': 0, 'LIST_AUTO_PLAY_VALUE': 1, 'SHUFFLE_VALUE': 0, 'SKIP_RELATED_ADS': false, 'SKIP_TO_NEXT_VIDEO': false, 'CONVERSION_CONFIG_DICT': {"baseUrl":"https:\/\/www.youtube.com\/pagead\/viewthroughconversion\/962985656\/","vid":"dQw4w9WgXcQ","focEnabled":true,"uid":"38IQsAvIsxxjztdMZQtwHA","rmktEnabled":true}, 'RESOLUTION_TRACKING_ENABLED': false, 'WATCH_LEGAL_TEXT_ENABLE_AUTOSCROLL': false, 'PLAYBACK_ID': "AAVrUziaGLGwlrLT", 'IS_DISTILLER': true, 'SHARE_CAPTION': null, 'SHARE_REFERER': "", 'PLAYLIST_INDEX': null }); yt.pushConfigArray('TIMING_WAIT', 'parn'); yt.setMsg({ 'EDITOR_AJAX_REQUEST_FAILED': "Something went wrong trying to get data from the server. Try again, or reload the page.", 'EDITOR_AJAX_REQUEST_503': "This functionality is not available right now. Please try again later.", 'LOADING': "{{ yt.msgs.loading }}" }); yt.setMsg('SPEEDYG_INFO', "Experiencing interruptions?"); {% if yt.page.isLive %} yt.setConfig({ 'LIVESTREAMING_NO_SHARE_TIME': true }); yt.setConfig({ 'LIVESTREAMING_CARDIO_ENABLED': true, 'LIVESTREAMING_CARDIO_POLLING_INTERVAL': 30000, 'LIVESTREAMING_CARDIO_CONCURRENTS_METRIC': "viewership" }); yt.setMsg({ 'LIVE_WATCHING_NOW': {"case1": "1 watching now", "case0": "0 watching now", "other": "# watching now"} }); {% endif %} yt.setConfig({ 'GUIDED_HELP_LOCALE': "en_US", 'GUIDED_HELP_ENVIRONMENT': "prod" }); </script> {% endblock %} {%- block content -%} {%- embed "common/channels4/branded_page_v2.twig" -%} {%- set brandedPageConfig = { baseBoldTitles: true, containerFlexWidth: true, secondaryColumnHidden: true } -%} {%- block branded_page_primary_column_content -%} {% import "common/uix/lockup.twig" as lockup %} <div id="watch-response" class="clearfix"> <div class="branded-page-box"> {{ lockup.tile(yt.page.video) }} </div> {% import '/common/watch/watch7/action_panel/base.twig' as action_panel %} <div id="watch-discussion scrolldetect" class="branded-page-box" data-scrolldetect-callback="comments-delay-load"> {% from "/common/comments/comment_section_renderer.twig" import render as comment_section_renderer %} {{ comment_section_renderer(yt.page.comments)}} </div> </div> {%- endblock -%} {%- endembed -%} {%- endblock -%}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the insertion point for the Video Attribution Information page. This page technically doesn't even exist anymore, but it's included in Rehike in part as a homage to it being the last general Hitchhiker page to be available, and in part because it can be functionally imitated with a new Shorts attribution feature. #} {% extends "core.twig" %} {% import "core/macros.twig" as core %} {% from "core/html/img.twig" import img %} {% from "common/uix/watch_later_button.twig" import render as watch_later %} {% block head_css %} {{ core.css("www-attribution")}} {% endblock %} {% block content %} <div id="debug" class="hid">{{ yt.page|json_encode }}</div> <div id="attribution-container" class="ytg-base"> {%- if yt.page.header -%} <h2>{{ yt.page.header.title }}</h2> <div class="video-details"> <div class="video-entry"> <div> <span class="ux-thumb-wrap contains-addto"> <a href="/watch?v={{ yt.page.videoId }}" aria-hidden="true"> <span class="video-thumb yt-thumb yt-thumb-288"> <span class="yt-thumb-default"> <span class="yt-thumb-clip"> {{ img({ src: yt.page.header.video.thumbnail, onload: ";window.__ytRIL && __ytRIL(this)", ytImg: 1, width: 288, delayLoad: false }) }} <span class="vertical-align"></span> </span> </span> </span> </a> {{ watch_later(yt.page.header.video.watchLater, yt.page.videoId) }} </span> </div> <p> <span class="video-title">{{ rehike.getText(yt.page.header.video.title) }}</span> </p> </div> </div> {%- endif -%} {%- if yt.page.contents -%} <div class="source-videos"> <div class="section-header"> <h3>{{ yt.page.contents.title }}</h3> <span>{{ yt.page.contents.subtitle }}</span> </div> <div class="video-list"> {%- for video in yt.page.contents.items -%} <div class="video-entry"> <div> <span class="ux-thumb-wrap contains-addto"> <a href="/watch?v={{ video.videoId }}" aria-hidden="true"> <span class="video-thumb yt-thumb yt-thumb-138"> <span class="yt-thumb-default"> <span class="yt-thumb-clip"> {{ img({ src: video.thumbnail, onload: ";window.__ytRIL && __ytRIL(this)", ytImg: 1, width: 138, delayLoad: false }) }} <span class="vertical-align"></span> </span> </span> </span> </a> {{ watch_later(video.watchLater, video.videoId) }} </span> </div> <p> <a href="/watch?v={{ video.videoId }}" class="video-title">{{ rehike.getText(video.title) }}</a> <span class="video-username"> {%- if rehike.config.appearance.usernamePrepends -%} <span class="username-prepend">{{ yt.msgs.usernamePrepend }}</span> {%- endif -%} <a href="{{ rehike.getUrl(video.author) }}" class="yt-user-name" aria-label="{{ video.authorA11yLabel }}">{{ rehike.getText(video.author) }}</a> </span> <a href="{{ rehike.getUrl(video.attrLink) }}" class="attribution-link">{{ rehike.getText(video.attrLink) }}</a> </p> </div> {%- endfor -%} </div> </div> {%- endif -%} </div> {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the insertion point for the search results page. #} {% extends "core.twig" %} {% import "core/macros.twig" as core %} {% set pageType = 'search' %} {% set appbarEnabled = true %} {% set defaultGuideVisibility = true %} {% set defaultAppbarVisibility = false %} {% set enableSnapScaling = false %} {%- block title -%} {{ yt.masthead.searchbox.query }} - {{ parent() }} {%- endblock -%} {%- block head_css -%} {{ core.css("www-results") }} {{ core.css("www-home-c4") }} {% endblock %} {% block content %} <div id="debug" class="hid"> {{ yt.page.header|json_encode() }} </div> {% embed 'common/channels4/branded_page_v2.twig' %} {% set brandedPageConfig = { baseBoldTitles: true, containerFlexWidth: true } %} {% block branded_page_primary_column_content %} {% import "common/uix/lockup.twig" as lockup %} {% import "common/uix/button.twig" as button %} {% from "common/results/search_submenu.twig" import render as search_submenu %} {% from "common/uix/button.twig" import render as button %} <div id="results"> <ol id="section-list-{{ generateRid() }}" class="section-list"> {%- if yt.page.content.subMenu -%} <li class="branded-page-v2-subnav-container branded-page-gutter-padding"> {{ search_submenu(yt.page.content.subMenu.searchSubMenuRenderer) }} </li> {%- endif -%} {# We cannot use the item section template because of large search thumbs #} {%- for section in yt.page.content.contents -%} {%- if section.itemSectionRenderer -%} {%- set this = section.itemSectionRenderer -%} <li> <ol id="item-section-{{ generateRid() }}" class="item-section"> {%- if yt.page.content.header.textHeaderRenderer -%} <li class="safety-mode-message"> {{ rehike.getText(yt.page.content.header.textHeaderRenderer.title) }} </li> {%- endif -%} {%- for item in this.contents -%} {%- if item.videoRenderer or item.playlistRenderer or item.radioRenderer or item.channelRenderer -%} <li> {{ rehike.config.appearance.largeSearchResults ? lockup.tile(item, 246, 138) : lockup.tile(item) }} </li> {%- elseif item.shelfRenderer -%} {%- set shelf = item.shelfRenderer -%} <li> <div class="feed-item-container browse-list-item-container yt-section-hover-contaner compact-shelf shelf-item branded-page-box clearfix"> <div class="feed-item-dismissible"> <div class="shelf-title-table"> <div class="shelf-title-row"> <h2 class="branded-page-module-title shelf-title-cell">{{ rehike.getText(shelf.title) }}</h2> </div> </div> <div class="vertical-shelf"> <div class="yt-uix-expander yt-uix-expander-collapsed"> <ul class="shelf-content"> {%- set list = shelf.content.verticalListRenderer -%} {%- for video in list.items -%} {# sic lmao #} <li{{ loop.index > list.collapsedItemCount ? ' class="collapsable"' }}> {{ rehike.config.appearance.largeSearchResults ? lockup.tile(video, 246, 138) : lockup.tile(video) }} </li> {%- endfor -%} </ul> <div class="yt-uix-expander-head yt-uix-expander-collapsed-body"> {{ button({ style: "STYLE_LINK", size: "SIZE_DEFAULT", icon: true, tooltip: yt.msgs.showMore, class: ["vertical-shelf-expander"] }) }} </div> </div> </div> </div> <div class="feed-item-dismissal-notices"></div> </div> </li> {%- elseif item.horizontalCardListRenderer -%} {%- set list = item.horizontalCardListRenderer -%} <li> <div class="search-refinements"> <h3>{{ rehike.getText(list.header.richListHeaderRenderer.title) }}</h3> {%- for refinement in list.cards -%} <div class="search-refinement"> <a href="{{ rehike.getUrl(refinement.searchRefinementCardRenderer.searchEndpoint) }}" class="spf-link">{{ rehike.getText(refinement.searchRefinementCardRenderer.query) }}</a> </div> {%- endfor -%} </div> </li> {%- elseif item.didYouMeanRenderer -%} {%- set dym = item.didYouMeanRenderer -%} <li class="spell-correction spell-correction-dym"> <span class="spell-correction-corrected"> {{ rehike.getText(dym.didYouMean) }} </span> <a href="{{ rehike.getUrl(dym.correctedQueryEndpoint) }}" class="spell-correction-corrected-query spf-link"> {%- for run in dym.correctedQuery.runs -%} {{ run.italics ? "<i>" }}{{ run.text }}{{ run.italics ? "</i>" }} {%- endfor -%} </a> </li> {%- elseif item.showingResultsForRenderer -%} {%- set srf = item.showingResultsForRenderer -%} <li class="spell-correction"> <span class="spell-correction-corrected"> {{ rehike.getText(srf.showingResultsFor) }} </span> <a href="{{ rehike.getUrl(srf.correctedQueryEndpoint) }}" class="spell-correction-corrected-query spf-link"> {%- for run in srf.correctedQuery.runs -%} {{ run.italics ? "<i>" }}{{ run.text }}{{ run.italics ? "</i>" }} {%- endfor -%} </a> <span>{{ rehike.getText(srf.searchInsteadFor) }}</span> <a href="{{ rehike.getUrl(srf.originalQueryEndpoint) }}" class="spf-link"> {{ rehike.getText(srf.originalQuery) }} </a> </li> {%- elseif item.backgroundPromoRenderer -%} <p class="display-message"> {{ rehike.getText(item.backgroundPromoRenderer.title) }} </p> {%- endif -%} {%- endfor -%} </ol> </li> {%- endif -%} {%- endfor -%} </ol> </div> {% if yt.page.paginator %} <div class="branded-page-box search-pager spf-link "> {% for btn in yt.page.paginator.items %} {{ button.render(btn) }} {% endfor %} </div> {% endif %} {% endblock %} {% endembed %} {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# This is used as the base template for most Rehike pages. Pages should extend this, rather than core/core.twig. This is used as a router for more specific page extension. Each core template provides a type of the YouTube layout. - core.twig provides appbar (aka Nirvana) - core_legacy.twig provides no-appbar (like hitchhiker in 2013) #} {% extends appbarEnabled ? "core/core.twig" : "core/core_legacy.twig" %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the insertion point for playlist pages. Playlists are common with channels, so they reuse the channel header component. #} {% extends "core.twig" %} {% import "core/macros.twig" as core %} {% set pageType = '' %} {% set pageName = 'playlist' %} {% set appbarEnabled = true %} {% set defaultGuideVisibility = true %} {% if yt.page.channelHeader %} {% set defaultAppbarVisibility = true %} {% else %} {% set defaultAppbarVisibility = false %} {% endif %} {% set enableSnapScaling = true %} {%- block title -%} {%- if yt.page.header.title -%} {{ rehike.getText(yt.page.header.title) }} - {{ parent() }} {%- else -%} {{ parent() }} {%- endif -%} {%- endblock -%} {% block foot_scripts %} <script> yt.setConfig('ANGULAR_JS', "\/\/s.ytimg.com\/yts\/jslib\/angular.min-vfl8oYsy-.js"); yt.setConfig('TRANSLATIONEDITOR_JS', "\/\/s.ytimg.com\/yts\/jsbin\/www-translationeditor-vfl6AQtCI\/www-translationeditor.js"); yt.setMsg('UNSAVED_CHANGES_WARNING', "Some of the changes you have made to channel settings have not been saved and will be lost if you navigate away from this page."); yt.setConfig('JS_PAGE_MODULES', ["www\/channels","www\/ypc_bootstrap"]); yt.setConfig('CHANNEL_ID', {{ yt.ucid }}); yt.setConfig('CHANNEL_TAB', "playlist"); (function() { var channelHeaderEl = document.querySelector('.channel-header'); if (!channelHeaderEl) { return; } if (!/channel-header-auto-hide/.test(channelHeaderEl.className)) { return; } var brandedPageContainer = document.querySelector('.branded-page-v2-container'); var originalHeight = brandedPageContainer.clientHeight; channelHeaderEl.className = channelHeaderEl.className.replace(/\bhid\b/); var height = brandedPageContainer.clientHeight; var scrollDistance = height - originalHeight; document.body.style.minHeight = 0; var bodyScrollHeight = document.body.scrollHeight; var bodyClientHeight = document.body.clientHeight; var heightToIncrease = scrollDistance - (bodyScrollHeight - bodyClientHeight); if (heightToIncrease > 0) { document.body.style.minHeight = bodyScrollHeight + heightToIncrease + 'px'; } document.body.scrollTop = document.documentElement.scrollTop = scrollDistance; }()); yt.setConfig('DISMISS_THROUGH_IT', true); yt.setConfig({ 'GUIDE_SELECTED_ITEM': "{{ serialiseEndpoint(yt.currentEndpoint) }}" }); yt.setConfig({ 'GUIDED_HELP_LOCALE': "en_US", 'GUIDED_HELP_ENVIRONMENT': "prod" }); </script> {% endblock %} {%- block head_css -%} {{ core.css('www-home-c4') }} {% if yt.page.secondaryHeader %} {{ core.css("www-channels4edit") }} {% endif %} {% endblock %} {%- block page_class -%} not-fixed-width-tab-widescreen {% endblock %} {% import 'common/appbar/appbar_nav.twig' as appbar_nav %} {%- block appbarContent -%} {{ appbar_nav.render(yt.appbar.nav) }} {% endblock %} {%- block content -%} <div id="debug" class="hid"> {{ yt.page.raw|json_encode|raw }} </div> {%- embed "common/channels4/branded_page_v2.twig" -%} {%- set brandedPageConfig = { 'baseBoldTitles': true, 'containerFlexWidth': true, 'hasTopRow': true, 'secondaryColumnHidden': yt.page.secondaryContent ? false : true } -%} {%- block branded_page_top_row -%} {% from "/common/channels4/channel_header.twig" import render as channel_header %} {% if yt.page.channelHeader %} {{ channel_header(yt.page.channelHeader, yt.page.secondaryHeader) }} {% endif %} {% endblock %} {%- block branded_page_primary_column_content -%} {%- from "core/html/img.twig" import img as img -%} {%- from "common/uix/button.twig" import render as button -%} {%- if yt.page.header -%} {%- set header = yt.page.header -%} <div id="pl-header" class="branded-page-box clearfix" data-all-playlists-url="{{ header.thumbnail.allPlaylistsUrl }}"> {% if header.thumbnail %} <div class="pl-header-thumb" style="height: 126px;"> <img src="{{ header.thumbnail.thumbnail }}" height="126px"> <a href="{{ header.thumbnail.url }}" class="pl-header-play-all-overlay yt-valign spf-link">► {{ header.thumbnail.playAllText }}</a> </div> {% endif %} <div class="pl-header-content"> <h1 class="pl-header-title" tabindex="0">{{ header.title }}</h1> <ul class="pl-header-details"> {% for detail in header.details %} <li> {% if detail.navigationEndpoint %} <a class="spf-link" href="{{ rehike.getUrl(detail) }}"> {% endif %} {{ getText(detail) }} {% if detail.navigationEndpoint %} </a> {% endif %} </li> {% endfor %} </ul> <div class="playlist-actions"> {% for action in header.actions %} {{ button(action) }} {% endfor %} </div> </div> </div> {%- endif -%} {%- if yt.page.videoList -%} {%- import "common/uix/watch_later_button.twig" as wlBtn -%} {%- from "common/uix/load_more_button.twig" import render as load_more -%} <ul id="browse-items-primary"> <li> <div id="pl-video-list" class="pl-video-list"> <table id="pl-video-table" class="pl-video-table"> <tbody id="pl-load-more-destination"> {%- from "common/playlist/pl_video.twig" import render as pl_video -%} {%- for video in yt.page.videoList -%} {{ pl_video(video) }} {%- endfor -%} </tbody> </table> {%- set last = yt.page.videoList|last -%} {%- if last.continuationItemRenderer -%} {{ load_more( last.continuationItemRenderer.continuationEndpoint.continuationCommand.token, "pl-load-more-destination" ) }} {%- endif -%} </div> </li> </ul> {%- endif -%} {%- endblock -%} {%- endembed -%} {%- endblock -%}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% extends "core.twig" %} {% import "core/macros.twig" as core %} {% block head_css %} {{ core.css("www-channelswitcher")}} {% endblock %} {% set leftAlignPage = true %} {% block content %} <div id="channel-switcher-content"> <div class="channel-switcher-header"> <p> <span class="channel-switcher-caption"><b>{{ yt.page.headerTextPrefix }}</b>{{ yt.page.email }}</span> </p> <p class="channel-switcher-brand-account-info"> <a href="https://support.google.com/youtube/?p=manage_channels&amp;hl=en" target="_blank"> {{ yt.page.learnMoreLinkText }} </a> </p> </div> <div> <ul id="ytcc-existing-channels" class="channels-container"> {%- for item in yt.page.channels -%} {% if item.createChannelItemRenderer %} {% set this = item.createChannelItemRenderer %} <li class="channel-switcher-button"> <a href="https://www.youtube.com/create_channel?action_create_new_channel_redirect=true" class="yt-uix-button yt-uix-sessionlink yt-uix-button-default yt-uix-button-size-default" data-sessionlink="ei=tnxJX_yECoLDiwSr6ajwDQ"> <span class="yt-uix-button-content"> <div class="yt-valign-container"> <div class="page-picture create-channel-icon"></div> <div class="create-channel-text"> {{ this.text }} </div> </div> </span> </a> </li> {% elseif item.accountItemRenderer %} {% set this = item.accountItemRenderer %} <li class="channel-switcher-button {{ this.selected ? "selected" }}" data-uchannelId="{{ this.ucid }}"> <div class="highlight"> <a href="{{ this.url }}" class="yt-uix-button yt-uix-sessionlink yt-uix-button-default yt-uix-button-size-default" data-sessionlink="ei=tnxJX_yECoLDiwSr6ajwDQ"> <span class="yt-uix-button-content"> <div class="yt-valign-container"> <div class="page-picture"> <span class="video-thumb yt-thumb yt-thumb-56"> <span class="yt-thumb-square"> <span class="yt-thumb-clip"> <img alt="" aria-hidden="true" data-ytimg="1" height="56" onload=";window.__ytRIL &amp;&amp; __ytRIL(this)" src="{{ this.avatar }}" width="56"> <span class="vertical-align"></span> </span> </span> </span> </div> <div class="page-info"> <div class="page-info-name"> {{ this.title }} </div> <div class="page-info-text"> {{ this.subscriberCountText }} </div> <div class="page-info-text"> </div> </div> </div> </span> </a> </div> </li> {% endif %} {%- endfor -%} </ul> </div> </div> <div class="yt-dialog hid" id="add-new-channel-lb"> <div class="yt-dialog-base"> <span class="yt-dialog-align"></span> <div class="yt-dialog-fg" role="dialog"> <div class="yt-dialog-fg-content"> <div class="yt-dialog-header"> <button class="yt-uix-button yt-uix-button-size-default yt-uix-button-default yt-dialog-dismiss yt-dialog-close" type="button" onclick="return!1" data-action="close"><span class="yt-uix-button-content">Close</span></button> <h2 class="yt-dialog-title" role="alert">__title__</h2> </div> <div class="yt-dialog-loading"> <div class="yt-dialog-waiting-content"> <p class="yt-spinner"><span class="yt-spinner-img yt-sprite" title="Loading icon"></span><span class="yt-spinner-message">Loading...</span></p> </div> </div> <div class="yt-dialog-content"> <div id="add-new-channel-dialog"></div> </div> <div class="yt-dialog-working"> <div class="yt-dialog-working-overlay"></div> <div class="yt-dialog-working-bubble"> <div class="yt-dialog-waiting-content"> <p class="yt-spinner"><span class="yt-spinner-img yt-sprite" title="Loading icon"></span><span class="yt-spinner-message">Working...</span></p> </div> </div> </div> </div> <div class="yt-dialog-focus-trap" tabindex="0"></div> </div> </div> </div> {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the insertion point for all channels pages. Channels and feeds are very similar, but these were split early in development and it's too much effort to change things now. #} {% extends "core.twig" %} {% import 'core/macros.twig' as core %} {% import 'common/appbar/appbar_nav.twig' as appbar_nav %} {% set pageType = 'channel' %} {% set appbarEnabled = true %} {% set defaultGuideVisibility = true %} {% set defaultAppbarVisibility = true %} {% set enableSnapScaling = true %} {% block foot_scripts %} <script> yt.setConfig('ANGULAR_JS', "\/\/s.ytimg.com\/yts\/jslib\/angular.min-vfl8oYsy-.js"); yt.setConfig('TRANSLATIONEDITOR_JS', "\/\/s.ytimg.com\/yts\/jsbin\/www-translationeditor-vfl6AQtCI\/www-translationeditor.js"); yt.setMsg('UNSAVED_CHANGES_WARNING', "Some of the changes you have made to channel settings have not been saved and will be lost if you navigate away from this page."); yt.setConfig('JS_PAGE_MODULES', ["www\/channels","www\/ypc_bootstrap"]); yt.setConfig('CHANNEL_ID', "{{ yt.ucid }}"); yt.setConfig('CHANNEL_TAB', "{{ yt.tab }}"); (function() { var channelHeaderEl = document.querySelector('.channel-header'); if (!channelHeaderEl) { return; } if (!/channel-header-auto-hide/.test(channelHeaderEl.className)) { return; } var brandedPageContainer = document.querySelector('.branded-page-v2-container'); var originalHeight = brandedPageContainer.clientHeight; channelHeaderEl.className = channelHeaderEl.className.replace(/\bhid\b/); var height = brandedPageContainer.clientHeight; var scrollDistance = height - originalHeight; document.body.style.minHeight = 0; var bodyScrollHeight = document.body.scrollHeight; var bodyClientHeight = document.body.clientHeight; var heightToIncrease = scrollDistance - (bodyScrollHeight - bodyClientHeight); if (heightToIncrease > 0) { document.body.style.minHeight = bodyScrollHeight + heightToIncrease + 'px'; } document.body.scrollTop = document.documentElement.scrollTop = scrollDistance; }()); yt.setConfig('DISMISS_THROUGH_IT', true); yt.setConfig({ 'GUIDE_SELECTED_ITEM': "{{ serialiseEndpoint(yt.currentEndpoint) }}" }); yt.setConfig({ 'GUIDED_HELP_LOCALE': "en_US", 'GUIDED_HELP_ENVIRONMENT': "prod" }); </script> {% endblock %} {%- block title -%} {{ yt.page.title ? yt.page.title ~ ' - ' }}{{ parent() }} {% endblock %} {%- block head_css -%} {{ core.css('www-home-c4') }} {% if yt.page.secondaryHeader %} {{ core.css("www-channels4edit") }} {% endif %} {% endblock %} {%- block appbarContent -%} {% if yt.appbar.nav %} {{ appbar_nav.render(yt.appbar.nav) }} {% endif %} {% endblock %} {%- block page_class -%} not-fixed-width-tab-widescreen {% endblock %} {% block content %} {% embed '/common/channels4/branded_page_v2.twig' %} {% set brandedPageConfig = { 'baseBoldTitles': true, 'containerFlexWidth': true, 'hasTopRow': true, 'secondaryColumnHidden': yt.page.secondaryContent ? false : true } %} {%- block branded_page_top_row -%} {% from "/common/channels4/channel_header.twig" import render as channel_header %} {% if yt.page.header %} {{ channel_header(yt.page.header, yt.page.secondaryHeader) }} {% endif %} {% endblock %} {%- block branded_page_primary_column_content -%} {% from "common/uix/button.twig" import render as button %} {% from "common/browse/main.twig" import render as browse %} {% from "common/thumb.twig" import render as thumb %} {% from "common/uix/subscription_button.twig" import render as subscription_button %} {{ browse(yt.page.content) }} {% if yt.page.subConfirmationDialog %} {% set dialog = yt.page.subConfirmationDialog %} <div class="yt-uix-overlay"> <div class="yt-dialog hid"> <div class="yt-dialog-base"> <span class="yt-dialog-align"></span> <div class="yt-dialog-fg" role="dialog"> <div class="yt-dialog-fg-content"> <div class="yt-dialog-header"> {{ button(dialog.closeButton) }} <h2 class="yt-dialog-title" role="alert">{{ dialog.header }}</h2> </div> <div class="yt-dialog-content"> <div class="subscription-confirmation-dialog"> <span class="subscription-confirmation-thumb"> {{ thumb({ type: "square", width: 60, height: 60, image: dialog.avatar }) }} </span> <span class="subscription-confirmation-display-name"> {{ dialog.displayName }} </span> <br> {{ subscription_button(dialog.subscribeButton) }} </div> </div> </div> </div> </div> </div> </div> {% endif %} {%- endblock -%} {%- block branded_page_secondary_column_content -%} {% from "common/channels4/sidebar/related_channels.twig" import render as related_channels %} {%- for item in yt.page.secondaryContent.items -%} {%- if item.relatedChannelsRenderer -%} {{ related_channels(item.relatedChannelsRenderer) }} {%- endif -%} {%- endfor -%} {%- endblock -%} {% endembed %} {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="robots" content="noindex"> {% include "core/roboto.twig" %} <link rel="stylesheet" href="{{ yt.playerConfig.baseCssUrl }}" name="www-player"> <style> html { overflow: hidden; } body { font: 12px Roboto, Arial, sans-serif; background-color: #000; color: #fff; height: 100%; width: 100%; overflow: hidden; position: absolute; margin: 0; padding: 0; } #player { width: 100%; height: 100%; } h1 { text-align: center; color: #fff; } h3 { margin-top: 6px; margin-bottom: 3px; } .player-unavailable { position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 25px; font-size: 13px; background: url(/img/meh7.png) 50% 65% no-repeat; } .player-unavailable .message { text-align: left; margin: 0 -5px 15px; padding: 0 5px 14px; border-bottom: 1px solid #888; font-size: 19px; font-weight: normal; } .player-unavailable a { color: #167ac6; text-decoration: none; } </style> <script> var ytcsi = { gt: function(n) { n = (n || "") + "data_"; return ytcsi[n] || (ytcsi[n] = { tick: {}, info: {} }) }, now: window.performance && window.performance.timing && window.performance.now && window.performance.timing.navigationStart ? function() { return window.performance.timing.navigationStart + window.performance.now() } : function() { return (new Date).getTime() }, tick: function(l, t, n) { var ticks = ytcsi.gt(n).tick; var v = t || ytcsi.now(); if (ticks[l]) { ticks["_" + l] = ticks["_" + l] || [ticks[l]]; ticks["_" + l].push(v) } ticks[l] = v }, info: function(k, v, n) { ytcsi.gt(n).info[k] = v }, setStart: function(t, n) { ytcsi.tick("_start", t, n) } }; (function(w, d) { ytcsi.setStart(w.performance ? w.performance.timing.responseStart : null); var isPrerender = (d.visibilityState || d.webkitVisibilityState) == "prerender"; var vName = !d.visibilityState && d.webkitVisibilityState ? "webkitvisibilitychange" : "visibilitychange"; if (isPrerender) { var startTick = function() { ytcsi.setStart(); d.removeEventListener(vName, startTick) }; d.addEventListener(vName, startTick, false) } if (d.addEventListener) d.addEventListener(vName, function() { ytcsi.tick("vc") }, false); function isGecko() { if (!w.navigator) return false; try { if (w.navigator.userAgentData && w.navigator.userAgentData.brands && w.navigator.userAgentData.brands.length) { var brands = w.navigator.userAgentData.brands; for (var i = 0; i < brands.length; i++) if (brands[i] && brands[i].brand === "Firefox") return true; return false } } catch (e) { setTimeout(function() { throw e; }) } if (!w.navigator.userAgent) return false; var ua = w.navigator.userAgent; return ua.indexOf("Gecko") > 0 && ua.toLowerCase().indexOf("webkit") < 0 && ua.indexOf("Edge") < 0 && ua.indexOf("Trident") < 0 && ua.indexOf("MSIE") < 0 } if (isGecko()) { var isHidden = (d.visibilityState || d.webkitVisibilityState) == "hidden"; if (isHidden) ytcsi.tick("vc") } var slt = function(el, t) { setTimeout(function() { var n = ytcsi.now(); el.loadTime = n; if (el.slt) el.slt() }, t) }; w.__ytRIL = function(el) { if (!el.getAttribute("data-thumb")) if (w.requestAnimationFrame) w.requestAnimationFrame(function() { slt(el, 0) }); else slt(el, 16) } })(window, document); </script> <script> var ytcfg = { d: function() { return window.yt && yt.config_ || ytcfg.data_ || (ytcfg.data_ = {}) }, get: function(k, o) { return k in ytcfg.d() ? ytcfg.d()[k] : o }, set: function() { var a = arguments; if (a.length > 1) ytcfg.d()[a[0]] = a[1]; else for (var k in a[0]) ytcfg.d()[k] = a[0][k] } }; ytcfg.set({ "EVENT_ID": "BOKUY9D5G8OBir4PpqGE-AE", "EXPERIMENT_FLAGS": { "allow_music_base_url": true, "allow_skip_networkless": true, "always_send_and_write": true, "autoescape_tempdata_url": true, "background_thread_flush_logs_due_to_batch_limit": true, "cancel_pending_navs": true, "change_ad_badge_to_stark": true, "clear_user_partitioned_ls": true, "csi_on_gel": true, "deprecate_csi_has_info": true, "deprecate_pair_servlet_enabled": true, "deprecate_two_way_binding_child": true, "deprecate_two_way_binding_parent": true, "desktop_client_release": true, "desktop_image_cta_no_background": true, "desktop_log_img_click_location": true, "desktop_notification_high_priority_ignore_push": true, "desktop_notification_set_title_bar": true, "desktop_sparkles_light_cta_button": true, "disable_child_node_auto_formatted_strings": true, "disable_pacf_logging_for_memory_limited_tv": true, "disable_simple_mixed_direction_formatted_strings": true, "disable_thumbnail_preloading": true, "embeds_web_disable_ads_for_pfl": true, "embeds_web_enable_iframe_src_with_intent": true, "embeds_web_enable_replace_unload_w_pagehide": true, "embeds_web_nwl_disable_nocookie": true, "enable_docked_chat_messages": true, "enable_mixed_direction_formatted_strings": true, "enable_pacf_through_ybfe_web_logging_for_page_top": true, "enable_skip_ad_guidance_prompt": true, "enable_skippable_ads_for_unplugged_ad_pod": true, "enable_sli_flush": true, "enable_watch_next_pause_autoplay_lact": true, "enable_ypc_spinners": true, "export_networkless_options": true, "forward_domain_admin_state_on_embeds": true, "gfeedback_for_signed_out_users_enabled": true, "gpa_sparkles_ten_percent_layer": true, "h5_companion_enable_adcpn_macro_substitution_for_click_pings": true, "h5_inplayer_enable_adcpn_macro_substitution_for_click_pings": true, "h5_set_masthead_ads_asynchronously": true, "hide_endpoint_overflow_on_ytd_display_ad_renderer": true, "html5_control_flow_include_trigger_logging_in_tmp_logs": true, "html5_enable_ads_client_monitoring_log_tv": true, "html5_enable_single_video_vod_ivar_on_pacf": true, "html5_log_trigger_events_with_debug_data": true, "html5_web_enable_halftime_preroll": true, "il_use_view_model_logging_context": true, "is_browser_support_for_webcam_streaming": true, "json_condensed_response": true, "kevlar_dropdown_fix": true, "kevlar_gel_error_routing": true, "kevlar_guide_refresh": true, "live_chat_increased_min_height": true, "live_chat_use_new_emoji_picker": true, "log_errors_through_nwl_on_retry": true, "log_vis_on_tab_change": true, "log_web_endpoint_to_layer": true, "mdx_enable_privacy_disclosure_ui": true, "mdx_load_cast_api_bootstrap_script": true, "migrate_events_to_ts": true, "networkless_logging": true, "no_sub_count_on_sub_button": true, "pageid_as_header_web": true, "parse_query_data_from_url": true, "polymer_bad_build_labels": true, "polymer_verifiy_app_state": true, "qoe_send_and_write": true, "scheduler_use_raf_by_default": true, "service_worker_enabled": true, "service_worker_push_enabled": true, "service_worker_push_home_page_prompt": true, "service_worker_push_watch_page_prompt": true, "shorten_initial_gel_batch_timeout": true, "skip_invalid_ytcsi_ticks": true, "super_sticker_emoji_picker_category_button_icon_filled": true, "suppress_error_204_logging": true, "use_new_nwl_initialization": true, "use_new_nwl_saw": true, "use_new_nwl_stw": true, "use_new_nwl_wts": true, "use_player_abuse_bg_library": true, "use_request_time_ms_header": true, "use_session_based_sampling": true, "use_shared_nsm": true, "use_shared_nsm_and_keep_yt_online_updated": true, "use_watch_fragments2": true, "verify_ads_itag_early": true, "vss_final_ping_send_and_write": true, "vss_playback_use_send_and_write": true, "warm_load_nav_start_web": true, "web_always_load_chat_support": true, "web_api_url": true, "web_dedupe_ve_grafting": true, "web_enable_voz_audio_feedback": true, "web_gel_timeout_cap": true, "web_one_platform_error_handling": true, "web_prefetch_preload_video": true, "web_yt_config_context": true, "ytidb_clear_embedded_player": true, "H5_async_logging_delay_ms": 1000.0, "addto_ajax_log_warning_fraction": 0.1, "autoplay_pause_by_lact_sampling_fraction": 0.0, "log_window_onerror_fraction": 0.1, "tv_pacf_logging_sample_rate": 0.01, "web_system_health_fraction": 0.01, "ytidb_transaction_ended_event_rate_limit": 0.02, "ytidb_transaction_ended_event_rate_limit_session": 0.2, "ytidb_transaction_ended_event_rate_limit_transaction": 0.1, "autoplay_pause_by_lact_sec": 0, "botguard_async_snapshot_timeout_ms": 3000, "check_navigator_accuracy_timeout_ms": 0, "initial_gel_batch_timeout": 2000, "log_web_meta_interval_ms": 0, "max_prefetch_window_sec_for_livestream_optimization": 0, "min_prefetch_offset_sec_for_livestream_optimization": 10, "network_polling_interval": 30000, "polymer_log_prop_change_observer_percent": 0, "prefetch_comments_ms_after_video": 0, "service_worker_push_logged_out_prompt_watches": -1, "service_worker_push_prompt_cap": -1, "service_worker_push_prompt_delay_microseconds": 3888000000000, "watch_next_pause_autoplay_lact_sec": 4500, "web_foreground_heartbeat_interval_ms": 28000, "web_gel_debounce_ms": 10000, "web_logging_max_batch": 100, "ytidb_remake_db_retries": 1, "ytidb_reopen_db_retries": 0, "embeds_web_synth_ch_headers_banned_urls_regex": "", "live_chat_unicode_emoji_json_url": "https://www.gstatic.com/youtube/img/emojis/emojis-svg-9.json", "service_worker_push_force_notification_prompt_tag": "1", "service_worker_scope": "/", "web_client_version_override": "", "kevlar_command_handler_command_banlist": [], "web_op_signal_type_banlist": [] }, "GAPI_HINT_PARAMS": "m;/_/scs/abc-static/_/js/k\u003dgapi.gapi.en.PlpnwD4HYro.O/d\u003d1/rs\u003dAHpOoo-D4573md5GmdJHX15d0lc3SoObhA/m\u003d__features__", "GAPI_HOST": "https://apis.google.com", "GAPI_LOCALE": "en_US", "GL": "US", "HL": "en", "HTML_LANG": "en", "INNERTUBE_API_KEY": "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", "INNERTUBE_API_VERSION": "v1", "INNERTUBE_CLIENT_NAME": "WEB", "INNERTUBE_CLIENT_VERSION": "2.20221104.02.00", "INNERTUBE_CONTEXT": { {{ yt.page.innertubeContext|json_encode|raw }} }, "INNERTUBE_CONTEXT_CLIENT_NAME": 56, "INNERTUBE_CONTEXT_CLIENT_VERSION": "1.20221206.01.00", "INNERTUBE_CONTEXT_GL": "US", "INNERTUBE_CONTEXT_HL": "en", "LATEST_ECATCHER_SERVICE_TRACKING_PARAMS": { "client.name": "WEB_EMBEDDED_PLAYER" }, "SERVER_NAME": "WebFE", "SESSION_INDEX": "0", "VISITOR_DATA": "CgtjR3M3NTUzeTBaVSiExNOcBg%3D%3D", "WEB_PLAYER_CONTEXT_CONFIGS": { "WEB_PLAYER_CONTEXT_CONFIG_ID_EMBEDDED_PLAYER": { "rootElementId": "movie_player", "jsUrl": "{{ yt.playerConfig.baseJsUrl }}", "cssUrl": "{{ yt.playerConfig.baseCssUrl }}", "contextId": "WEB_PLAYER_CONTEXT_CONFIG_ID_EMBEDDED_PLAYER", "eventLabel": "embedded", "contentRegion": "US", "hl": "en_US", "hostLanguage": "en", "innertubeApiKey": "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", "innertubeApiVersion": "v1", "innertubeContextClientVersion": "2.20221104.02.00", "device": { "brand": "", "model": "", "browser": "Firefox", "browserVersion": "102.0", "os": "Windows", "osVersion": "10.0", "platform": "DESKTOP", "interfaceName": "WEB_EMBEDDED_PLAYER", "interfaceVersion": "1.20221206.01.00" }, "serializedExperimentIds": "23983296,24001373,24002022,24002025,24004644,24007246,24080738,24135310,24169501,24255165,24292955,24407200,24408610,24411032,24415864,24416291,24423887,24434209", "serializedExperimentFlags": "{% include "player/flags.twig" %}", "startMuted": false, "enableMutedAutoplay": false, "mobileIphoneSupportsInlinePlayback": true, "isMobileDevice": false, "cspNonce": "FT3bKhDbemIwaFwrm5Wm4A", "canaryState": "none", "enableCsiLogging": true, "disableAutonav": false, "authorizedUserIndex": 0, "isEmbed": true, "embedOptOutDeprecation": false, "disableCastApi": false, "disableMdxCast": false, "datasyncId": "116362474172410783029||", "embedsEnablePfpImaIntegration": false, "embedsEnableAppendUtmParams": false, "embedsDisableInfoPanels": false } }, "XSRF_FIELD_NAME": "session_token", "XSRF_TOKEN": "QUFFLUhqbUpFTnN1V3ZESm00NkpLb0s1NU9OczZPT0NXd3xBQ3Jtc0tudUZGUDZ3UDVjTWYxSThCUldWSDNPcXhBbGkzaXdZQ245YlJaU2RuUTBOYUJBdDhWTmFHekpvODdUVWJzOUJZYjMta2RiYWhlTWlwU1Y2dmhHTlZULTlQTjA5MlZ0emJ1akNYaVJuTm5fUXBsY21OSQ\u003d\u003d", "SERVER_VERSION": "control", "DATASYNC_ID": "116362474172410783029||", "SERIALIZED_CLIENT_CONFIG_DATA": "CITE05wGEIjdrgUQ_Jb-EhC4i64FEIeR_hIQg92uBRC4kP4SELKI_hIQ2L6tBQ%3D%3D", "ROOT_VE_TYPE": 16623, "CLIENT_PROTOCOL": "h2", "CLIENT_TRANSPORT": "tcp", "PLAYER_VARS": { "embedded_player_response": "{{ yt.page.playerResponse|json_encode }}", "video_id": "{{ yt.page.videoId }}", "user_display_name": "", "user_display_image": "", "user_display_email": "" }, "POST_MESSAGE_ORIGIN": "*", "VIDEO_ID": "{{ yt.page.videoId }}", "DOMAIN_ADMIN_STATE": "" }); window.ytcfg.obfuscatedData_ = []; </script> <script> var yterr = yterr || true; </script> <script src="{{ yt.playerConfig.embedJsUrl }}"></script> <script src="{{ yt.playerConfig.baseJsUrl }}"></script> </head> <body class="date-{{ yt.rehikeVersion.time|date("Ymd") }} en_US ltr site-center-aligned site-as-giant-card"> <div id="player"></div> <script>writeEmbed();</script> <script nonce="FT3bKhDbemIwaFwrm5Wm4A">ytcsi.info('st', 56.0);</script> <noscript> <div class="player-unavailable"> <h1 class="message">An error occurred.</h1> <div class="submessage">Unable to execute JavaScript.</div> </div> </noscript> </body> </html>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the insertion point for the watch page. #} {% extends "core.twig" %} {% set pageType = 'watch' %} {% set appbarEnabled = true %} {% set defaultGuideVisibility = false %} {% set defaultAppbarVisibility = false %} {% set enableSnapScaling = true %} {% set playerType = 'content-alignment watch-small' %} {%- block title -%} {{ yt.page.title ? yt.page.title|raw ~ ' - ' }}{{ parent() }} {% endblock %} {%- block page_class -%} video-{{ yt.videoId }} {{ (yt.theaterMode) ? 'watch-wide watch-stage-mode' }} {% endblock %} {% block header %} {% endblock %} {%- block appbarContent -%} {% endblock %} {%- block head_css -%} {% import 'core/macros.twig' as core %} {% if yt.page.isOwner %} {{ core.css("www-watch-inlineedit") }} {% endif %} {{ core.css("www-watch-transcript") }} {% endblock %} {% block foot_scripts %} <script> yt.setConfig({ 'VIDEO_ID': "{{ yt.videoId }}", {% if yt.playlistId and yt.page.playlist %} 'LIST_ID': "{{ yt.playlistId }}", {% endif %} 'WAIT_TO_DELAYLOAD_FRAME_CSS': false, 'IS_UNAVAILABLE_PAGE': false, 'DROPDOWN_ARROW_URL': "\/yts\/img\/pixel-vfl3z5WfW.gif", 'AUTONAV_EXTRA_CHECK': false, 'JS_PAGE_MODULES': [ 'www/watch', 'www/watch_speedyg', 'www/watch_autoplayrenderer', 'www/watch_transcript' ], 'REPORTVIDEO_JS': "\/yts\/jsbin\/www-reportvideo-vflidisXQ\/www-reportvideo.js", 'REPORTVIDEO_CSS': "\/yts\/cssbin\/www-watch-reportvideo-vflhkISaX.css", 'TIMING_AFT_KEYS': ['pbp', 'pbs'], 'YPC_CAN_RATE_VIDEO': true, {# 'RELATED_PLAYER_ARGS': {"rvs":"title=a-ha+-+Take+On+Me+%28Official+Video%29\u0026session_data=itct%3DCBgQvU4YACITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdjV11Xbc914%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLAIObBK454k6ctzA817tauyW9rHyA\u0026short_view_count_text=630M+views\u0026endscreen_autoplay_session_data=autonav%3D1%26playnext%3D1%26itct%3DCBkQ4ZIBIhMI8JvexLPq2gIVy6J-Ch3PnQwYKPgdMgxyZWxhdGVkLWF1dG9IxLuBrb2YjoZ1\u0026author=RHINO\u0026id=djV11Xbc914\u0026length_seconds=228\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdjV11Xbc914%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLAIObBK454k6ctzA817tauyW9rHyA,session_data=itct%3DCBcQvk4YASITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026list=RDdQw4w9WgXcQ\u0026playlist_iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdQw4w9WgXcQ%2Fhqdefault.jpg\u0026playlist_length=0\u0026playlist_title=Mix+-+Rick+Astley+-+Never+Gonna+Give+You+Up+%28Video%29\u0026video_id=djV11Xbc914\u0026thumbnail_ids=djV11Xbc914\u0026playlist_iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdQw4w9WgXcQ%2Fmqdefault.jpg,title=Rick+Astley+-+Together+Forever+%28Video%29\u0026session_data=itct%3DCBYQvU4YAiITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyPYZpwSpKmA%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLAkUWeHEvBOX6nimDu8c-pZQqDTRA\u0026short_view_count_text=52M+views\u0026author=RickAstleyVEVO\u0026id=yPYZpwSpKmA\u0026length_seconds=205\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyPYZpwSpKmA%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLAkUWeHEvBOX6nimDu8c-pZQqDTRA,title=Guardians+of+the+Galaxy%3A+Awesome+Mix+Vol.+1+%26+Vol.+2+%28Full+Soundtrack%29\u0026session_data=itct%3DCBUQvU4YAyITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcMtaFMZxOjk%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLB2tmoSLIa02CgDhpOHsW7cMWlNdw\u0026short_view_count_text=2.4M+views\u0026author=Library+Music\u0026id=cMtaFMZxOjk\u0026length_seconds=5676\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcMtaFMZxOjk%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLB2tmoSLIa02CgDhpOHsW7cMWlNdw,title=Wham%21+-+Wake+Me+Up+Before+You+Go-Go+%28Official+Video%29\u0026session_data=itct%3DCBQQvU4YBCITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FpIgZ7gMze7A%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLAj9KfRoDCT0RNEtMuOIJMN855pHw\u0026short_view_count_text=209M+views\u0026author=WhamVEVO\u0026id=pIgZ7gMze7A\u0026length_seconds=231\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FpIgZ7gMze7A%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLAj9KfRoDCT0RNEtMuOIJMN855pHw,session_data=itct%3DCBMQvk4YBSITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj\u0026playlist_iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOPf0YbXqDm0%2Fhqdefault.jpg\u0026playlist_length=197\u0026playlist_title=Pop+Music+Playlist%3A+Timeless+Pop+Hits+%28Updated+Weekly+2018%29\u0026video_id=OPf0YbXqDm0\u0026thumbnail_ids=OPf0YbXqDm0\u0026playlist_iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOPf0YbXqDm0%2Fmqdefault.jpg,title=Michael+Jackson+-+Smooth+Criminal+%28Single+Version%29+HD\u0026session_data=itct%3DCBIQvU4YBiITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fq8w1d01Y2vY%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLBSNx-bTKHmJeCVk8dDtsPnldRJwA\u0026short_view_count_text=10M+views\u0026author=moogl3s\u0026id=q8w1d01Y2vY\u0026length_seconds=241\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fq8w1d01Y2vY%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLBSNx-bTKHmJeCVk8dDtsPnldRJwA,title=Vanilla+Ice+-+Ice+Ice+Baby\u0026session_data=itct%3DCBEQvU4YByITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2Frog8ou-ZepE%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLA865lpL0-es4QJ8PUN83rPTmmjOQ\u0026short_view_count_text=229M+views\u0026author=vanillaiceVEVO\u0026id=rog8ou-ZepE\u0026length_seconds=241\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2Frog8ou-ZepE%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLA865lpL0-es4QJ8PUN83rPTmmjOQ,title=Earth%2C+Wind+%26+Fire+-+September\u0026session_data=itct%3DCBAQvU4YCCITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGs069dndIYk%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLA97cYvlaLdmOWal9wR5H-wipzbTg\u0026short_view_count_text=190M+views\u0026author=EarthWindandFireVEVO\u0026id=Gs069dndIYk\u0026length_seconds=216\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGs069dndIYk%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLA97cYvlaLdmOWal9wR5H-wipzbTg,title=Michael+Jackson+-+Beat+It+%28Official+Video%29\u0026session_data=itct%3DCA8QvU4YCSITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FoRdxUFDoQe0%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLD6PJbqXe4JOhN0WMDFkjGfPtbq-w\u0026short_view_count_text=351M+views\u0026author=michaeljacksonVEVO\u0026id=oRdxUFDoQe0\u0026length_seconds=299\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FoRdxUFDoQe0%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLD6PJbqXe4JOhN0WMDFkjGfPtbq-w,title=Greatest+Hits+Of+The+80%27s+-+80s+Music+Hits+-+Best+Songs+of+The+80s\u0026session_data=itct%3DCA4QvU4YCiITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FggALN-UkQ88%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLD5J6D8X5_If_pWa8R27Ovsv9ikrg\u0026short_view_count_text=5.6M+views\u0026author=Time+Music\u0026id=ggALN-UkQ88\u0026length_seconds=9007\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FggALN-UkQ88%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLD5J6D8X5_If_pWa8R27Ovsv9ikrg,title=Toto+-+Africa+%28Video%29\u0026session_data=itct%3DCA0QvU4YCyITCPCb3sSz6toCFcuifgodz50MGCj4HTIJZW5kc2NyZWVuSMS7ga29mI6GdQ%253D%253D\u0026iurlmq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFTQbiNvZqaY%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLALOsCPxqN1IxcZEfZJCu8rqi4tFw\u0026short_view_count_text=310M+views\u0026author=TotoVEVO\u0026id=FTQbiNvZqaY\u0026length_seconds=275\u0026iurlhq=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFTQbiNvZqaY%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLALOsCPxqN1IxcZEfZJCu8rqi4tFw"}, #} 'BG_P': "bKC0\/NOxKGI+KHSHYpCbpgrSuGlLA4kdUzK9lA7NaKmFls\/XkEyaOXc+qT1JM4KcCZ8nTnWwipplN9hJuq\/xrAb2pExdzZ1QRxYo2CP\/qDU1K9Y\/biuxqS\/StgNg804OU+omPoLJzZYPC4YWeNyoFjwXty+BjuY2k30E9+0\/VpIJVhcWDgF1GnBgp5eRhhSdxtR7uQEsgfg2XEAKYCrTVTec3RUNyih8SzZ8jtmLrq8Wik5jJHbvcFfUNhn7aFMg5D4+JQ+w4elWvTow7rjeqXef5TFEYzr87uVqlkv2GNhu\/hi2pU4v6VLKY1GJgDTUELf2aGfME9JGC8apW7khT\/uWwKYiG0kh1LghvTPg3484naYdZnl1mEb88BHGdFld7GRtEv5iplFhSFHj1WpMHoFSxuQ6Xx6xo4CC8YRCNr+O86RbpGIuP3S3uzTSmPXJBL1QlGMrTe4dlAPbh5\/tHo4jLADsve+t6WYGd2Fg1OKcJoFJKg\/2U4iB+Kaxe9th4Jry37CBjOG52Pya+JzNUKihoZUdGLHYwR6uwiLU+TKhmX5uU+VdMALZs0f6\/8LfLITelK\/RIjPzD89Ht6H9BUvrdcnwPDYmWv3WhcOTmLlIi+QjRPnRv6U5+2dVChwheyC0AO7p1kCahmN4YzjrgHwoToXPzrVfpZGX25sxtSNcVnc+wRzJWdGy4gOAP7KF4vrRnFpNZ9BB1EaQxPZyvizPOtKIfjWjV8rzA6mlIE1D7Xf1z9i+NeAZCRO5w0\/SIVp0u4tkHdsxeWqFM7kjNxvE74LIpavLhIGWnMAb\/RAIi0trs27ub\/s4jLc3yf7WHvGAgd7V8R+3MuvtRRQf9PpoVKS5bNHz1F4Ie+lNHk6PmN1+6YRYqRa8757rMbWEmEoGwzW1cROYe583HyC3E8K1Zf0D2qRmZMBGm1nr5qgzKKj5TQFSwFhv9J+u9AzV74XEYDXZiUWQtveV1XzeUYCXnuuH1rlYZkS3gELp1eVBnzFhhSMIRfLw\/CiofnM2o7PvctcnkuqZMUyiMIhTVKQl1dpDplZOfWgjFx2Xo9GGFeVmgYB9Yumq9Kzx2Q\/M7XOKHtFxA3uVNmPrskbrq7N74aZuZEMNGyhoPy\/V+is6xekkEqWRDxUhL36i7Za91YWFhhO2EXhUwRawFQekeFODynhsR9zJWLi7Izcbi0LuX2bCfEkH0d0TmUJAXMSQN7zklVeiNCOmSaaY\/qp8wnoPCB6XLNiSG7c9hIsAP+ITQWAo0k\/aafA\/Zv5YpIHaFcYIpW2YRNvLAda7EJPph1T4ua8rKT84w2naEWvGckVY7Kxeq72bx8zZ6n\/zbLMBuZBAu3M+5tKOPxDhe+b6MX2zKLrzRlZYWeoeH612dJRRd0XuFX2iL\/dkqmrX0KrLqQ0znX\/hXyvpVzMYiz44KHf30MR\/ZK4TzhFKVp0QUBuvvuJ9+DKIsIOUmhlhFT3YGnwCu0\/yyCFoSYruXFtyJhUDoKH60vm0IFaDF\/XegNKn5\/2e4ojjI2pxzuaU3ric1bv7j\/fXDKlJY0x+IVFUS3LOQghVXgzWSbNjuv8zkXHICwPxrj40+aoV6VY5+CmPyXEjvnNydp9UTd3y6bZzllOj+z6hSRROP+gp8GJf+YBfmggShkDEqQThAnOUkVfTMxzfFW2GeGLOj5kubPD37wBTiNpMk7mVNm8qHxnC0XrCNlkzwugVL8mxMk2rCXGBEHS02lNoySiEum0RtgvGF3bGUAOOwEZC5mugjfqWi4vmU9FXcjAXF3bnw0Y29JKJbWyHWQtk224kwu76UKuca2ub4ADqnhCEVkwXoN\/YhzoyaSspl0wyeaJvnTB+OVPmNqaI7Xm6kyNdvrVvXozLCSY1PvgBxkqP6n0uGROpaCRRw+c8kx2URgb8ze0WY8wk413tB0qWAtJ3\/EzV2faCbryGmWMU6trTVIFrfY9JQgMEZj\/x8ViRCvajdmt1+byKjuGQwUvKjKdlDf3p833UAMvHNzfr3yfyY3oAM8rW2Gs5N7QIZi3jV7tyxYeCHRDZP865I0RaSnZvcUWogFaPDfnaJ542MdZGp\/7h1M5aATKCyFUUuGrry9ZpsEyTyFAD495pjT0tOUl9Z66zsiWJniruMLZorCpeCWQagP2V3rzQbqcQTwoqClBIn9bJvr54FI7WZoJkeCRS2pGi451Ytlno+H0tuMModViKw5EA+bCTleSDfNiJ2MWZUGgJiN1GMJGlC8TH2W7l3nZRBlPSLVyvacKbBUnyFNB58XTrcApFTMxSFEvgNt4yWqYep3NwnOi47rEFnYB5e\/aLCuIMWNVX7zf8rPOYNVQQsmVjC1jW0WS\/3oN4lvs6I7fkqMCbl5jTTPIuAEtMXiVPH6V8ujIBmEcfJHz7UJwwEnvm7UmVum5LY2LwTe3dSG73UpC8Lr8SJahgqYLf+nuxf3+5roaNTVNMcFIFY+vjABlWbDWB\/hXuhb+LHv2NpECFx2bAkZId9dZb6pAtaDeNLEttrIU8T41FUfa7z7ejG1NIT7ISJtY2F+WdPb6qh6wBLFfvrlZBfNDn1FbTVW5ae3WLsghjW5F7KLqS5+2oIN32Wg+Q4xlpbJ4k\/XkUImcWpLgG66\/Rx4YFmDRa2\/pGNE7WUcDlLMKd8tL+mnPpMRL43SmDmigJx8u5nDu1SRrV1ASm7gCt3natu4d6Htv53\/TiCdxELI6BjtvVqWVEJP+4WrhKgX4BJFdHBIElaK866XbSAbl8pUajzb9\/cKdGVs35Z2xy5ExGSKsWJvHopMsgpv0moHHah3VElZGXuPcKsJ8d59mA1pzfgqniGvIsifXQb89729ls+PGLvGPj5rCVgg6hCZDaHvLi0qH500qoHgzOX5PZ+JjQ+WKR2abcvdvPSNJmwUkuBWcuXQATqkfKO+g1sDND6yEG3bn7MzUkisDz8SeSOnxtZEIb8sdyTf4kZoHH+KBzyFDQonn8PvZnedCWjnyZfl4P0jhorVU\/Lbie5eZ6wyw3Baabc3kg8Kz8EKuLjLenGI6FOkCY9D6XnIYb+S5psyGbPzPOaAP2nsDOImToxQlhRYGplNT8XIM0Tb0x5ZB7j1Xb282qcukSjMBlrYcR7zXJtC5V3R6yD\/71gp+6VYfdVWOvKmKm6fa0rvAzNpAbp4f3URAXIrRp5tp1fXLh95YXnxwDv9ecS6NpbVwGXKRqO2Rps7RlX7+xbAQxJm\/Y5rl4wAvpZrVtd2C5GMuy3S7HRhavj3ruBLm1nYhwmMAP+ok4r3mP+grNz1nj0vrjgIHUx2EgBdARUUlfgp+QLwHGQsVL9sQ13ku\/jzYr2NS2CPYRXwG+mNFRnrREkVBy\/mMfTQy0GPMBn\/qofmSKspJil6WQQeCjRUWsRlNVifY04A+EE7jQFrYhyAeCtOY\/l183eQWC+JY\/9Ss5D2HsTxjm7gP8W0XVCX1aDAEQTU+JEUiQjbGO+oj4NVGtC7IttzWfqDAs7U0Zljp0J3d5hLppm8KIAOwS\/Zg0wHjE3J0UdiVoY1nO8xL7+jATzmM8EvlQP1UAOp9w+7g7lzb7bw6SWaKyw8ZHwesBy5\/1UEjcujFUHM5pNp0qBwa1WVKEhQoFy2+a5YsDvJ\/h1FbyQGeKNz8B+b7jLBiQpqMdInoaVwevdQrHPspYKAI0IlkxG9L0H+NqubVDCUGlBoZrpyk8+vtrfmag0U0MvK9L5N8MaRZeo7P2bVq5eo0kj1CuYFT2t1ygOWgjeh+cjKhmz+2jpl3s1v9DTZ9FUs4JD2oAJZ03ZhUKT7ngU2KlCTAez9j6eC+hqNvy8w9r60HM5+Sg\/POn1EZ63SE2OJbVgy6gTI9e+eKH957J4d4Cyd59IFYoby9LD6C4HUamu4x+wN1fWD3QkfvDn8YgvQ1FcoAVOkkz4L9WP8e++dWEzgHRNggoJBggzSa1TjNVasAzjRTerr2PAKgn3ZkaGux+Z6iMX57UbwkhjddQuAATJVlIo5co+lGWZUECof7gfZJBVv\/qSUG2w6c5Tak6RZVUE6tnC5jqCD7Qe8qlxhm3WIDk05PIK3FaGS5vXqXo9mczFEMjbPBTNeLXGSPq7AjEwxJZ5tt7xBu\/\/JnNgoV8YCo9nRrAfT7EyhrEZSWiO4QFJokZN0mTw+fCp475BQk6LCyHGvEOdcvbErwNAMQpNVJVLhUo5vL4ynnVpRX8CKy0TaEpIksvuBOadBU7xoV5RVuE\/9k7h2hlK9e6osrX1Rr2\/22+0LbfUQsn0LAtMWuw\/7C8kBMos3jegS27F1TXxxrIKG+uKkOr8yHafsgxdQPBanjNwbRfzAZ9jAZm09pXyfD4v78VhRIiT0mFyQcTGglAx9zIneMgqMhi39ZyMpG33cuuui0Nzs2WB6yQ0kjz\/GSlx4JTDeliEch1ZO6hTvWGovbvlDc4nPVjIrHsdQ66xkTjf67h6Qx27pou3ji26StJ173a9FZdnvHANaNtLM7Yr8oAyNMIEiECL2nyhUcStinXaxnftgwMOFObdfdXwvvhmoEkDlvNDUfefrmeS9em1PvwhLU4x99E2COI992wxOHKR8nzjBmXQgs+UX8o9iR4KRLCQkNTGBh4BHtxHTr6d2X0LXUHwMcO1YZkdPkeozdHsiiuthCEeLV8oojIVZEeqnt22inVYmnXXBt6aSKY8odYSOnMMI3Cfai09ARhTI7yJbydR7inCAxYdr2N5HemvhPOyLtUsTu9hFoyyxUh1sShdm1MPmLv9SHL2QN54DNcj+HXlV0uTk24joAY\/InKxVgbv6GRxh3lsIWDVEZ2cG5mNoVcR0JzXaeAw+hATRlitWwmedFGV0jL7iKkfs7H2yCl9KtotcZzrhjsPqeyPUcEICXeIjYnAEDAj6metg\/nIDvHdUQfmQ9hcdT5ebn\/j1l+Pqcr69YmXhCbuhWsP43k+6zu1QXZkvp\/2mOpD3TcPWD77UGvRNUV7IS\/ZN1pDs76yiR78y3MetdXmXplPCTPZm43YzzW2p3vLLH5piJ7jSVddkF4OJhzEIA1XRmAjZhiN9P\/qar1nTZBX\/\/buSM4MLA6amCCbSHJG3cB2Dp3kez0PrEetALMQVIjxTHCJyU3jFi\/BDhWjyuAyIbRFuTdicZePe+R\/xLTsqQAwzOWl1mAsVztX+Akj4mrNrBUciZOBLQQorBZNC46fduizIGBgBrvxlFyLpo8RdipX1UCgf3NVk0MOcm8zTXr27RiaxX3TgE50EHLdU\/GeYteHoMcG0U5LRa4hGG3XsOmrbw0nkpdBh6IU3\/m4QizTQMATRtdtBXosmc7YIIFLuUoHW78dgdVnd+ZXzVU6sAO6gNG2PVEmqfjW0OiETHJ+Fg8w9cDdhumq8fWeDmSdSbGQtzJxDpxDBDjdIzw+J9s3TB3NLcCBl0Ll3fK0De+0OPcxnWipFTbwh3TMXl\/Id2bjoZ7Bgk4Lr4expkuJ0DAYil4oKu8NA3icPcg9TZ9Jwj8yAQzk1\/S3D1p+knKZPWrOR+rAAOFe2t1pEcJAaq2QloYgtBk+2KGOn23O62c6P6spPCSNkUf2zrQKY+dvqYTRSutnpTLE+\/P4W1XKbL9UGzgxAbCzjm\/KY5gd8PHzzDIPA+JzSBSwJZitnxJlMdDOX9810gFO1b1dZRejevI76w4jioYP\/ZgJ8\/esmqOq5GJm3qggqhRT7oaDeLDLISL3pOXHf8J6Yv42fYqiM5KYEuCF33Ms6KUsNrjuhZdpa79s3h0lrRYNBl16ij9cAX1\/6789qk3S7yS2\/lB4pfQOEVXSDKUt\/HExThlvxO8IvJTU5xOGTMo8d4Xkde9Xvic3jR9s8133cUSiht4HN6ER+mXy9+VRVPGAhj6DSit9qeogP4pdXjVYJnU9YN0d0Ne3Z1CTN7iKCWhWjYmf+LHD+Lpf3Kq1fifnp+6O5C755+158\/er5c1o7QtU7XJR8dBMtkcBgue0hSzCSPlfmjOOJPIAcNtNm1GopnmIwPWyy+ItCgIsiLVB40DLxHRN\/cY83DVKoz7XfgcBsXK\/zb2CSibDiWRMnOiJ8BNu+NwDyCXNLJHahBXLM4m5T6384MCKPbkmCOdWLZIZ2A\/z7D1Wu0Ws5YIrABPS8IksdLgashG\/FO2LIFC902Rr0jgZgVnVGQsaQWLalx3ySMNwYO96VP3IkKIFE7Ntheh82Mm42oVCCKyKP4t8y\/PmthJBC+h7mZ6iqAs0I5YrBAWogxPudOn70Hhc\/sDVocLV4MKEApkF2ptlONZTM87VtLZ+fRJ17KLjpGsWr0EylGAPQaIjyaEDCet05Bsrh45ZrhsoXKKErMostymHe+qaIg8mdOyk8QMeZDcz+PMjBNLkg0zNCn6+xpsy5p4UNmiCxZvK7ZLDNSSwkq8N\/HJw6tya2lxoOqoQ==", 'BG_IU': "\/\/www.google.com\/js\/bg\/1KUtCLBFZQ_JFefvknMO8_wNfNZDIBfWr9x-gjgyf-k.js", {% if yt.commentsToken %} 'COMMENTS_TOKEN': "{{ yt.commentsToken }}", {% endif %} 'GET_PLAYER_EVENT_ID': "23PrWrDCHMvF-gPPu7LAAQ", 'HL_LOCALE': "en_US", 'TTS_URL': "", 'JS_DELAY_LOAD': 0, 'LIST_AUTO_PLAY_VALUE': 1, 'SHUFFLE_VALUE': 0, 'SKIP_RELATED_ADS': false, 'SKIP_TO_NEXT_VIDEO': false, 'CONVERSION_CONFIG_DICT': {"baseUrl":"https:\/\/www.youtube.com\/pagead\/viewthroughconversion\/962985656\/","vid":"dQw4w9WgXcQ","focEnabled":true,"uid":"38IQsAvIsxxjztdMZQtwHA","rmktEnabled":true}, 'RESOLUTION_TRACKING_ENABLED': false, 'WATCH_LEGAL_TEXT_ENABLE_AUTOSCROLL': false, 'PLAYBACK_ID': "AAVrUziaGLGwlrLT", 'IS_DISTILLER': true, 'SHARE_CAPTION': null, 'SHARE_REFERER': "", 'PLAYLIST_INDEX': {{ yt.playlistIndex ? yt.playlistIndex : 'null' }} }); yt.pushConfigArray('TIMING_WAIT', 'parn'); yt.setMsg({ 'EDITOR_AJAX_REQUEST_FAILED': "Something went wrong trying to get data from the server. Try again, or reload the page.", 'EDITOR_AJAX_REQUEST_503': "This functionality is not available right now. Please try again later.", 'LOADING': "{{ yt.msgs.loading }}" }); yt.setMsg('SPEEDYG_INFO', "Experiencing interruptions?"); {% if yt.page.isLive %} yt.setConfig({ 'LIVESTREAMING_NO_SHARE_TIME': true }); yt.setConfig({ 'LIVESTREAMING_CARDIO_ENABLED': true, 'LIVESTREAMING_CARDIO_POLLING_INTERVAL': 30000, 'LIVESTREAMING_CARDIO_CONCURRENTS_METRIC': "viewership" }); yt.setMsg({ 'LIVE_WATCHING_NOW': {"case1": "1 watching now", "case0": "0 watching now", "other": "# watching now"} }); {% endif %} yt.setConfig({ 'GUIDED_HELP_LOCALE': "en_US", 'GUIDED_HELP_ENVIRONMENT': "prod" }); </script> {# Hacky playlists fix This exists to eliminate a timing issue with YouTube's JS itself, if the player loads too slowly, then it won't get updated according to a watch list change. #} {% if yt.page.playlist %} <script> (function(yt){ var playerApi = yt.www.getAPI('player-api'); if (playerApi) { playerApi.addEventListener('onReady', handlePlayerReady); } function handlePlayerReady() { var fakeSchedulerTime = 0; if (yt.www.schedulerAvailable) { yt.www.logSchedulerTime(fakeSchedulerTime); yt.www.runScheduler( yt.www.bindArgument(yt.www.getSchedulerEvent, "watch-list-change") ); } else { yt.www.fireEvent("watch-list-change"); } playerApi.removeEventListener('onReady', handlePlayerReady); } })((function(){ // Create a _yt_www API: var a = _yt_www; return { www: { getAPI: a.yn, // Formerly Ci schedulerAvailable: a.fi, logSchedulerTime: a.ci, fireEvent: a.H, getSchedulerEvent: a.ri, bindArgument: a.Ua, runScheduler: a.bi } }; })()); </script> {% endif %} {% endblock %} {%- block content -%} <div id="placeholder-player"> <div class="player-api player-width player-height"></div> </div> <div id="watch7-container" class=""> <div id="player-messages"></div> <div id="watch7-main-container"> <div id="watch7-main" class="clearfix"> <div id="watch7-preview" class="player-width player-height hid"> </div> <div id="watch7-content" class="watch-main-col " itemscope itemid="" itemtype="http://schema.org/VideoObject"> {% include '/common/watch/watch_metadata.twig' %} <div id="watch7-speedyg-area"> <div class="yt-alert yt-alert-actionable yt-alert-info hid " id="speedyg-template"> <div class="yt-alert-icon"> <span class="icon master-sprite yt-sprite"></span> </div> <div class="yt-alert-content" role="alert"> <div class="yt-alert-message" tabindex="0"> </div> </div> <div class="yt-alert-buttons"><a href="https://www.google.com/get/videoqualityreport/?v={{ yt.videoId }}" class="yt-uix-button yt-uix-sessionlink yt-uix-button-alert-info yt-uix-button-size-small" data-sessionlink="ei=oEbaW5bqB5DkkgbJ1bGQAQ" id="speedyg-link" target="_blank"><span class="yt-uix-button-content">Find out why</span></a><button class="yt-uix-button yt-uix-button-size-default yt-uix-button-close close yt-uix-close" type="button" onclick=";return false;" aria-label="Close" data-close-parent-class="yt-alert"><span class="yt-uix-button-content">Close</span></button></div> </div> </div> {%- for result in yt.page.results -%} {%- if result.videoCreatorBarRenderer -%} {% set creator_bar = result.videoCreatorBarRenderer %} {% include "/common/watch/watch7/creator_bar.twig" %} {%- endif -%} {%- if result.videoPrimaryInfoRenderer -%} {% set info = result.videoPrimaryInfoRenderer %} {% set owner = info.owner %} {% include '/common/watch/watch8/primary_info_renderer.twig' %} {% endif %} <div id="promotion-shelf" class="promotion-shelf-slot yt-card yt-card-has-padding hid"></div> {%- if result.videoSecondaryInfoRenderer -%} {% set secondaryInfo = result.videoSecondaryInfoRenderer %} {% include '/common/watch/watch7/action_panel/details.twig' %} {%- endif -%} {%- if result.videoDiscussionRenderer -%} {% include '/common/watch/watch_discussion_module.twig' %} {%- endif -%} {%- if result.videoDiscussionNotice -%} {% from '/common/watch/watch_discussion_disabled.twig' import watch_discussion_disabled %} {{ watch_discussion_disabled(result.videoDiscussionNotice.message) }} {%- endif -%} {%- endfor -%} </div> {% set secondaryResults = yt.page.secondaryResults %} {%- if yt.page.results or yt.page.secondaryResults -%} {% include '/common/watch/watch7/sidebar/watch_sidebar.twig' %} {%- endif -%} </div> </div> </div> {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements a general insertion point for error pages. #} {% extends "core.twig" %} {% import "core/macros.twig" as core %} {% set enableSnapScaling = false %} {%- block head_css -%} {{ core.css("www-error") }} {%- endblock -%} {% set pageType = "oops-content" %} {%- block title -%} Oops! Something went wrong. - {{ parent() }} {%- endblock -%} {%- block content -%} <img src="/yts/img/tv_stack-vflmeOpv_.png" alt="Sorry, something went wrong! Our tubes must be clogged." title="Sorry, something went wrong! Our tubes must be clogged."> {%- endblock -%}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% extends "core.twig" %} {% import 'core/macros.twig' as core %} {% set pageType = 'feed' %} {% set pageName = 'feed' %} {% set appbarEnabled = true %} {% set defaultGuideVisibility = true %} {% set defaultAppbarVisibility = true %} {% set enableSnapScaling = true %} {% block foot_scripts %} <script> yt.setConfig('ANGULAR_JS', "\/yts\/jslib\/angular.min-vflWkvD5q.js"); yt.setConfig('TRANSLATIONEDITOR_JS', "\/yts\/jsbin\/www-translationeditor-vflugm3V9\/www-translationeditor.js"); yt.setMsg('UNSAVED_CHANGES_WARNING', "Some of the changes you have made to channel settings have not been saved and will be lost if you navigate away from this page."); yt.setConfig( 'JS_PAGE_MODULES', [ 'www/feed', 'www/ypc_bootstrap' ]); yt.setConfig('DISMISS_THROUGH_IT', true); yt.setConfig({ 'GUIDED_HELP_LOCALE': "en_US", 'GUIDED_HELP_ENVIRONMENT': "prod" }); </script> {% endblock %} {%- block head_css -%} {{ core.css('www-home-c4') }} {% endblock %} {% block content %} {% embed 'common/channels4/branded_page_v2.twig' %} {% import 'common/uix/lockup.twig' as lockup %} {% import 'core/spinner.twig' as spinner %} {% set brandedPageConfig = { 'baseBoldTitles': true, 'containerFlexWidth': true, 'hasTopRow': true, 'secondaryColumnHidden': true } %} {% block branded_page_primary_column_content %} {% from "common/browse/main.twig" import render as browse %} {{ browse(yt.page.contents.twoColumnBrowseResultsRenderer.tabs.0.tabRenderer.content) }} {% endblock %} {% endembed %} {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import 'core/macros.twig' as core %} <script> var ytspf = ytspf || {}; ytspf.enabled = {{ yt.spfEnabled ? 'true' : 'false' }}; {%- if yt.spfEnabled -%} ytspf.config = { 'reload-identifier': 'spfreload' }; ytspf.config['request-headers'] = { 'X-YouTube-Identity-Token': null }; ytspf.config['experimental-request-headers'] = ytspf.config['request-headers']; ytspf.config['cache-max'] = 50; ytspf.config['navigate-limit'] = 50; ytspf.config['navigate-lifetime'] = 64800000; {% endif %} </script> {{ core.js('spf/spf') }}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<style name="www-roboto"> @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; src: local('Roboto Medium'), local('Roboto-Medium'), url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fBBc9.ttf)format('truetype'); } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; src: local('Roboto Regular'), local('Roboto-Regular'), url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxP.ttf)format('truetype'); } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; src: local('Roboto Medium Italic'), local('Roboto-MediumItalic'), url(//fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc6CsE.ttf)format('truetype'); } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; src: local('Roboto Italic'), local('Roboto-Italic'), url(//fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xIIzc.ttf)format('truetype'); } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2) format('woff2'); unicode-range: U+0370-03FF; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xIIzI.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc3CsTKlA.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc-CsTKlA.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc2CsTKlA.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc5CsTKlA.woff2) format('woff2'); unicode-range: U+0370-03FF; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc1CsTKlA.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc0CsTKlA.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } @font-face { font-family: 'Roboto'; font-style: italic; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc6CsQ.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2'); unicode-range: U+0370-03FF; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2) format('woff2'); unicode-range: U+0370-03FF; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fBBc4.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } </style> <script name="www-roboto"> if (document.fonts && document.fonts.load) { document.fonts.load("400 10pt Roboto", "E"); document.fonts.load("500 10pt Roboto", "E"); } </script>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
var ytcsi = { gt: function(n) { n = (n || '') + 'data_'; return ytcsi[n] || (ytcsi[n] = { tick: {}, info: {} }); }, now: window.performance && window.performance.timing && window.performance.now ? function() { return window.performance.timing.navigationStart + window.performance.now(); } : function() { return (new Date()).getTime(); }, tick: function(l, t, n) { ticks = ytcsi.gt(n).tick; var v = t || ytcsi.now(); if (ticks[l]) { ticks['_' + l] = (ticks['_' + l] || [ticks[l]]); ticks['_' + l].push(v); } ticks[l] = v; }, info: function(k, v, n) { ytcsi.gt(n).info[k] = v; }, setStart: function(s, t, n) { ytcsi.info('yt_sts', s, n); ytcsi.tick('_start', t, n); } }; (function(w, d) { ytcsi.setStart('dhs', w.performance ? w.performance.timing.responseStart : null); var isPrerender = (d.visibilityState || d.webkitVisibilityState) == 'prerender'; var vName = (!d.visibilityState && d.webkitVisibilityState) ? 'webkitvisibilitychange' : 'visibilitychange'; if (isPrerender) { ytcsi.info('prerender', 1); var startTick = function() { ytcsi.setStart('dhs'); d.removeEventListener(vName, startTick); }; d.addEventListener(vName, startTick, false); } if (d.addEventListener) { d.addEventListener(vName, function() { ytcsi.tick('vc'); }, false); } var slt = function(el, t) { setTimeout(function() { var n = ytcsi.now(); el.loadTime = n; if (el.slt) { el.slt(); } }, t); }; w.__ytRIL = function(el) { if (!el.getAttribute('data-thumb')) { if (w.requestAnimationFrame) { w.requestAnimationFrame(function() { slt(el, 0); }); } else { slt(el, 16); } } }; })(window, document);
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# This template implements the primary hitchhiker layout implementation, which is alike 2014 onwards, featuring appbar and its modified structure. In other words, this implements the main YouTube page template that most other pages extend. #} {% import 'core/macros.twig' as core %} {% import "common/alert.twig" as alert %} <!DOCTYPE html> <html lang="en" data-cast-api-enabled="true"> <head> {# The Rehike debugger uses XHook as a component for debugging network requests. Since the XHook script needs to be loaded before any other scripts in order to properly hijack XHR, this is injected if the debugger is enabled. #} {% if rehikeDebugger and not rehikeDebugger.condensed and not yt.spf %} <script>{% include "rehike/debugger/js/xhook.js" %}</script> {% endif %} {% include "core/roboto.twig" %} <script>{{ include('/core/www-ytcsi.js') }}</script> <script >var ytcfg = {d: function() {return (window.yt && yt.config_) || ytcfg.data_ || (ytcfg.data_ = {});},get: function(k, o) {return (k in ytcfg.d()) ? ytcfg.d()[k] : o;},set: function() {var a = arguments;if (a.length > 1) {ytcfg.d()[a[0]] = a[1];} else {for (var k in a[0]) {ytcfg.d()[k] = a[0][k];}}}};</script> <script>ytcfg.set("ROOT_VE_TYPE", 3854);ytcfg.set("EVENT_ID", "caLrWqLbKZD2_AOA-6vIAg");</script> <script>{{ include('/core/www-pageframesizing.js.twig') }}</script> {{ core.js('scheduler/scheduler') }} {{ core.css('www-core') }} {%- block head_css -%}{%- endblock -%} <link rel="stylesheet" href="{{ yt.playerConfig.baseCssUrl }}" name="player/www-player"> {{ core.css('www-pageframe') }} {{ core.css('www-guide') }} <title>{% block title %}YouTube{% endblock %}</title> {% include 'core/meta.twig' %} {%- if rehike.config.appearance.modernLogo -%} {% include 'experiment/ringo/ringo.twig' %} {% endif %} {% include "core/rehike_custom_css.twig" %} </head> {# The body's class contains general metadata about the YouTube session, including, such as experiments or important CSS configuration. It may need to be changed by a child template at some point, so it's made a block here. #} <body dir="ltr" id="body" class="{%- block body_class -%} {% include "core/body_class.twig" %} {% endblock %}" data-spf-name="other"> <div id="early-body"></div> <div id="body-container"> <div id="a11y-announcements-container" role="alert"> <div id="a11y-announcements-message"></div> </div> <form name="logoutForm" method="POST" action="/logout"><input type="hidden" name="action_logout" value="1"></form> {% block masthead %} <div id="ticker-content"> </div> <div id="masthead-positioner"> {%- if yt.page.ticker -%} {{ alert.render(yt.page.ticker) }} {%- endif -%} <div id="yt-masthead-container" class="clearfix yt-base-gutter"> {% include 'common/pageframe/masthead.twig' %} </div> <div id="masthead-appbar-container" class="clearfix"> <div id="masthead-appbar"> <div id="appbar-content" class=""> {%- block appbarContent -%}{% endblock %} </div> </div> </div> </div> <div id="masthead-positioner-height-offset"></div> {% endblock masthead %} <div id="page-container"> <div id="page" class="{{ pageType }} {% block page_class %}{% endblock %} clearfix "> {%- block guide_container -%} {% include 'common/appbar/appbar_guide.twig' %} {% endblock %} <div class="alerts-wrapper"> <div id="alerts" class="{{ not leftAlignPage ? "content-alignment" }}"> {% block alerts %}{% endblock %} {%- for item in yt.page.alerts -%} {{ alert.render(item) }} {%- endfor -%} </div> </div> <div id="header"> {% block header %}{% endblock %} </div> {% include 'player/core.twig' %} <div id="content" class=" {{ not leftAlignPage ? "content-alignment" }}" role="main"> {% block content %}{% endblock %} </div> </div> </div> </div> <div id="footer-container" class="yt-base-gutter force-layer"> {% include 'common/pageframe/footer.twig' %} </div> {% if yt.rehikeSecurityNotice %} {% from "rehike/security/security_lightbox.twig" import render as security_lightbox %} {{ security_lightbox(yt.rehikeSecurityNotice) }} {% endif %} {# YouTube's foot contains templates and scripts. #} {% include 'common/uix/lightbox/template_feed-privacy.twig' %} {% include 'common/uix/hidden_component_template_wrapper.twig' %} {% include 'core/spf_module.twig' %} {%- if yt.useModularCore -%} {% include 'core/modular_js_v2.twig' %} {% else %} {{ core.js('www-core/www-core') }} {% endif %} <script>if (window.ytcsi) {window.ytcsi.tick("je", null, '');}</script> {%- block foot_scripts -%}{% endblock %} {% include 'core/yt_global_js_config.twig' %} {# Inject Rebug (if it is enabled) #} {%- if rehikeDebugger -%} {% include "rehike/debugger/main.twig" %} {%- endif -%} </body> </html>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Date and language are prepended to the body class for non-appbar pages. Since this is a shared template, a hack is used here. #} {{ not appbarEnabled ? "date-" ~ yt.rehikeVersion.time|date('Ymd') }} {{ not appbarEnabled ? "en_US" }} visibility-logging-enabled ltr {{ rehike.config.appearance.modernLogo ? 'exp-invert-logo' }} {{ rehike.config.appearance.movingThumbnails ? "exp-mouseover-img" }} exp-responsive {{ rehike.config.appearance.largeSearchResults ? "exp-search-big-thumbs" }} site-center-aligned site-as-giant-card {{ (appbarEnabled and defaultGuideVisibility) ? 'guide-pinning-enabled' }} {{ (appbarEnabled and not defaultAppbarVisibility) ? 'appbar-hidden' }} not-nirvana-dogfood flex-width-enabled {{ flexWidthSnapDisabled ? '' : "flex-width-enabled-snap" }} {{ yt.spf ? '' : 'delayed-frame-styles-not-in' }} {{ yt.page.ticker ? "sitewide-ticker-visible" }} {{ yt.signin.isSignedIn ? "yt-user-logged-in" }}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Rehike uses custom CSS in some areas to change some small inconsistencies with Hitchhiker's implementation or to style custom implementations. #} {% if not yt.spf %} <style id="rehike-css"> .yt-comments-custom-emoji { width: 16px; height: 16px; vertical-align: middle; cursor: text; } .yt-comments-custom-emoji.large { width: 24px; height: 24px; } .video-list-item .stat .published-time::before { content: "\002022"; margin: 0 5px; } /* Player overwrites this for some reason and it hides channel upsell video show more link */ .yt-uix-expander-ellipsis.yt-ui-ellipsis-10::before { top: 0; } .yt-uix-expander-ellipsis.yt-ui-ellipsis-10 { max-height: none; } </style> {%- if rehike.config.appearance.cssFixes -%} <style id="hh-css-fix"> #watch-description-text { padding-top: 4px; } .comment-replies-renderer-view:hover, .comment-replies-renderer-hide:hover { text-decoration: underline; } #watch7-sidebar .video-list-item:hover a:visited .title, #watch7-sidebar .video-list-item:hover a:visited .title .yt-deemphasized-text { color: #167ac6; } </style> {%- endif -%} {% endif %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements a common template for YouTube's spinner. #} {%- macro render(label) -%} <p class="yt-spinner"> <span title="Loading icon" class="yt-spinner-img yt-sprite"></span> <span class="yt-spinner-message"> {{ label }} </span> </p> {% endmacro %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# This implements the legacy base template, which YouTube continued to use for some older pages after implementing appbar. #} {% import 'core/macros.twig' as core %} {% import "common/alert.twig" as alert %} <!DOCTYPE html> <html lang="en" dir="ltr"> <head> {# The Rehike debugger uses XHook as a component for debugging network requests. Since the XHook script needs to be loaded before any other scripts in order to properly hijack XHR, this is injected if the debugger is enabled. #} {% if rehikeDebugger and not rehikeDebugger.condensed %} <script>{% include "/rehike/debugger/js/xhook.js" %}</script> {% endif %} {% include "core/roboto.twig" %} <script>{{ include('/core/www-ytcsi.js') }}</script> <script >var ytcfg = {d: function() {return (window.yt && yt.config_) || ytcfg.data_ || (ytcfg.data_ = {});},get: function(k, o) {return (k in ytcfg.d()) ? ytcfg.d()[k] : o;},set: function() {var a = arguments;if (a.length > 1) {ytcfg.d()[a[0]] = a[1];} else {for (var k in a[0]) {ytcfg.d()[k] = a[0][k];}}}};</script> <script>ytcfg.set("ROOT_VE_TYPE", 3854);ytcfg.set("EVENT_ID", "caLrWqLbKZD2_AOA-6vIAg");</script> <script>{{ include('/core/www-pageframesizing.js.twig') }}</script> {{ core.js('scheduler/scheduler') }} {{ core.css('www-core') }} {%- block head_css -%}{% endblock %} <link rel="stylesheet" href="//s.ytimg.com/yts/cssbin/player-vflk34Vc2/www-player.css" name="player/www-player"> {{ core.css('www-pageframe') }} {{ core.css('www-guide') }} <title>{% block title %}YouTube{% endblock %}</title> {% include 'core/meta.twig' %} {%- if rehike.config.appearance.modernLogo -%} {% include 'experiment/ringo/ringo.twig' %} {% endif %} {% include "core/rehike_custom_css.twig" %} </head> <body id="" class="{%- block body_class -%} {% include "core/body_class.twig" %} {% endblock %}" dir="ltr"> <div id="body-container"> <form name="logoutForm" method="POST" action="/logout"><input type="hidden" name="action_logout" value="1"></form> <!--begin page--> <div id="ticker-content"> {%- if yt.page.ticker -%} {{ alert.render(yt.page.ticker) }} {%- endif -%} </div> {% block masthead %} <div id="yt-masthead-container" class="clearfix yt-base-gutter"> {% include 'common/pageframe/masthead.twig' %} </div> {% endblock %} <div id="alerts" class="{{ not leftAlignPage ? "content-alignment" }}"> {% block alerts %}{% endblock %} {%- for item in yt.page.alerts -%} {{ alert.render(item) }} {%- endfor -%} </div> {% block header %}{% endblock %} <div id="page-container"> <div id="page" class="{{ pageType }} {% block page_class %}{% endblock %}"> {% if guideEnabled %} {%- block guide_container -%} {% include 'common/pageframe/guide.twig' %} {% endblock %} {% endif %} <div id="content" class="{{ not leftAlignPage ? "content-alignment" }}"> {% block content %}{% endblock %} </div> </div> </div> {% include 'common/uix/lightbox/template_feed-privacy.twig' %} <!--end page--> </div> <div id="footer-container" class="yt-base-gutter"> {% include 'common/pageframe/footer.twig' %} </div> {% if yt.rehikeSecurityNotice %} {% from "rehike/security/security_lightbox.twig" import render as security_lightbox %} {{ security_lightbox(yt.rehikeSecurityNotice) }} {% endif %} {# YouTube's legacy foot contains scripts. #} <script>var yterr = yterr || true;</script> {{ core.js('www-core/www-core') }} {% include 'core/spf_module.twig' %} <script>if (window.ytcsi) {window.ytcsi.tick("je", null, '');}</script> {%- block foot_scripts -%}{% endblock %} {% include 'core/yt_global_js_config.twig' %} {# Inject Rebug (if it is enabled) #} {%- if rehikeDebugger -%} {% include "rehike/debugger/main.twig" %} {%- endif -%} </body> </html>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Defines the loaders for YouTube's modular JS design (used since 2014), albeit with currently unknown exceptions. #} {% import 'core/macros.twig' as core %} {{ core.js('www/base') }} <script> spf.script.path({ 'www/': '{{ ytConstants.jsModulesPath }}' }); var ytdepmap = { "www/base": null, "www/common": "www/base", "www/angular_base": "www/common", "www/channels_accountupload": "www/common", "www/channels": "www/common", "www/dashboard": "www/common", "www/downloadreports": "www/common", "www/experiments": "www/common", "www/feed": "www/common", "www/instant": "www/common", "www/legomap": "www/common", "www/promo_join_network": "www/common", "www/results_harlemshake": "www/common", "www/results": "www/common", "www/results_starwars": "www/common", "www/subscriptionmanager": "www/common", "www/unlimited": "www/common", "www/watch": "www/common", "www/ypc_bootstrap": "www/common", "www/ypc_core": "www/common", "www/channels_edit": "www/channels", "www/live_dashboard": "www/angular_base", "www/videomanager": "www/angular_base", "www/watch_autoplayrenderer": "www/watch", "www/watch_edit": "www/watch", "www/watch_editor": "www/watch", "www/watch_live": "www/watch", "www/watch_promos": "www/watch", "www/watch_speedyg": "www/watch", "www/watch_transcript": "www/watch", "www/watch_videoshelf": "www/watch", "www/ct_advancedsearch": "www/videomanager", "www/my_videos": "www/videomanager" }; spf.script.declare(ytdepmap); </script>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
(function() { var b = { a: "content-snap-width-1", b: "content-snap-width-2", c: "content-snap-width-3" }; function f() { var a = [], c; for (c in b) a.push(b[c]); return a } function h(a) { var c = f().concat(["guide-pinned", "show-guide"]), e = c.length, g = []; a.replace(/\S+/g, function(a) { for (var d = 0; d < e; d++) if (a == c[d]) return; g.push(a) }); return g }; function k(a, c, e) { var g = document.getElementsByTagName("html")[0], d = h(g.className); a && 1251 <= (window.innerWidth || document.documentElement.clientWidth) && (d.push("guide-pinned"), c && d.push("show-guide")); e && (e = (window.innerWidth || document.documentElement.clientWidth) - 21 - 50, 1251 <= (window.innerWidth || document.documentElement.clientWidth) && a && c && (e -= 230), d.push(1262 <= e ? "content-snap-width-3" : 1056 <= e ? "content-snap-width-2" : "content-snap-width-1")); g.className = d.join(" ") } var l = ["yt", "www", "masthead", "sizing", "runBeforeBodyIsReady"], m = this; l[0] in m || "undefined" == typeof m.execScript || m.execScript("var " + l[0]); for (var n; l.length && (n = l.shift());) l.length || void 0 === k ? m[n] && m[n] !== Object.prototype[n] ? m = m[n] : m = m[n] = {} : m[n] = k; }).call(this); try { window.ytbuffer = {}; ytbuffer.handleClick = function(e) { var element = e.target || e.srcElement; while (element.parentElement) { if (/(^| )yt-can-buffer( |$)/.test(element.className)) { window.ytbuffer = { bufferedClick: e }; element.className += ' yt-is-buffered'; break; } element = element.parentElement; } }; if (document.addEventListener) { document.addEventListener('click', ytbuffer.handleClick); } else { document.attachEvent('onclick', ytbuffer.handleClick); } } catch (e) {} {# DOCUMENTATION - runBeforeBodyIsReady => k(bool a, bool c, bool e) a: toggle guide-pinned c: toggle show-guide e: toggle content-snap-width-(n) #} yt.www.masthead.sizing.runBeforeBodyIsReady( {{ defaultGuideVisibility ? 'true' : 'false' }}, {{ defaultGuideVisibility ? 'true' : 'false' }}, {{ enableSnapScaling ? 'true' : 'false' }} );
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{%- macro js(name) -%} <script src="{{ rehike.resource.jsPath(name) }}" type="text/javascript" name="{{ name }}"></script> {% endmacro %} {%- macro css(name) -%} <link rel="stylesheet" href="{{ rehike.resource.cssPath(name) }}" name="{{ name }}"> {% endmacro %} {% macro sprite(sprite, alt) %} <span {{ alt ? ('title="' ~ alt ~ '"')|raw }} class="{{ sprite }} yt-sprite"></span> {% endmacro %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<link rel="canonical" href="https://www.youtube.com{{ yt.url }}"> <link rel="alternate" media="handheld" href="https://m.youtube.com/"> <link rel="alternate" media="only screen and (max-width: 640px)" href="https://m.youtube.com/"> <meta name="description" content="Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube."> <meta name="keywords" content="video, sharing, camera phone, video phone, free, upload"> <link rel="manifest" href="/manifest.json"> <link rel="search" type="application/opensearchdescription+xml" href="https://www.youtube.com/opensearch?locale=en_US" title="YouTube Video Search"> {% if rehike.config.appearance.modernLogo %} <link rel="shortcut icon" href="https://s.ytimg.com/yts/img/favicon-vfl8qSV2F.ico" type="image/x-icon"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_32-vflOogEID.png" sizes="32x32"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_48-vflVjB_Qk.png" sizes="48x48"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_96-vflW9Ec0w.png" sizes="96x96"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_144-vfliLAfaB.png" sizes="144x144"> <meta name="theme-color" content="#ff0000"> {% else %} <link rel="shortcut icon" href="https://s.ytimg.com/yts/img/favicon-vflz7uhzw.ico" type="image/x-icon"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_32-vfl8NGn4k.png" sizes="32x32"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_48-vfl1s0rGh.png" sizes="48x48"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_96-vfldSA3ca.png" sizes="96x96"> <link rel="icon" href="//s.ytimg.com/yts/img/favicon_144-vflWmzoXw.png" sizes="144x144"> <meta name="theme-color" content="#e62117"> {% endif %} <meta property="og:image" content="//s.ytimg.com/yts/img/yt_1200-vfl4C3T0K.png"> <meta property="fb:app_id" content="87741124305"> <link rel="publisher" href="https://plus.google.com/115229808208707341778"> <link rel="alternate" href="android-app://com.google.android.youtube/http/www.youtube.com/"> <link rel="alternate" href="ios-app://544007664/vnd.youtube/www.youtube.com/">
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<script> yt.setConfig({ APIARY_HOST_FIRSTPARTY: "", INNERTUBE_CONTEXT_CLIENT_NAME: 1, INNERTUBE_CONTEXT_CLIENT_VERSION: "1.20180501", XHR_APIARY_HOST: "youtubei.youtube.com", GAPI_HINT_PARAMS: "m;\/_\/scs\/abc-static\/_\/js\/k=gapi.gapi.en.fXLlmSb25lg.O\/m=__features__\/rt=j\/d=1\/rs=AHpOoo87O_nfyKCryZ5rvwwhVwktxKhiRA", INNERTUBE_API_KEY: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", INNERTUBE_API_VERSION: "v1", APIARY_HOST: "", 'VISITOR_DATA': "{{ yt.visitor }}", 'DELEGATED_SESSION_ID': null, 'GAPI_HOST': "https:\/\/apis.google.com", 'GAPI_LOCALE': "en_US", 'INNERTUBE_CONTEXT_HL': "en", 'INNERTUBE_CONTEXT_GL': "US", {# needed for player init #} 'INNERTUBE_CONTEXT': { "client": { "hl": "en", "gl": "US", "visitorData": "{{ yt.visitor }}", "clientName": "WEB", "clientVersion": "2.20220119.01.00", "platform": "DESKTOP" }, "user": { "lockedSafetyMode": false }, "request": { "useSsl": true }, "clickTracking": { "clickTrackingParams": "IhMIi8Dl17K/9QIVAt3ECh3HtwGN" } }, 'XHR_APIARY_HOST': "youtubei.youtube.com", 'STS': {{ yt.playerConfig.signatureTimestamp ?? "0" }} }); yt.setConfig({ 'ROOT_VE_CHILDREN': [ "CAEQpmEiEwji18z73-raAhUQO38KHYD9Cikojh4", "CAIQ7VAiEwji18z73-raAhUQO38KHYD9Cikojh4", "CHoQ_h4iEwji18z73-raAhUQO38KHYD9Cikojh4", "CHsQ5isYACITCOLXzPvf6toCFRA7fwodgP0KKSiOHg", "CHwQtSwYACITCOLXzPvf6toCFRA7fwodgP0KKSiOHg", "CH0QtSwYASITCOLXzPvf6toCFRA7fwodgP0KKSiOHg", "CH4QtSwYAiITCOLXzPvf6toCFRA7fwodgP0KKSiOHg", "CH8QtSwYAyITCOLXzPvf6toCFRA7fwodgP0KKSiOHg", "CIABEOGLAhgEIhMI4tfM-9_q2gIVEDt_Ch2A_QopKI4e", "CIEBEOYrGAEiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIIBELUsGAAiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIMBELUsGAEiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIQBELUsGAIiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIUBELUsGAMiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIYBELUsGAQiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIcBELUsGAUiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIgBELUsGAYiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIkBELUsGAciEwji18z73-raAhUQO38KHYD9Cikojh4", "CIoBELUsGAgiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIsBEOYrGAIiEwji18z73-raAhUQO38KHYD9Cikojh4", "CIwBELUsGAAiEwji18z73-raAhUQO38KHYD9Cikojh4", "CI0BENguGAMiEwji18z73-raAhUQO38KHYD9Cikojh4", "CI4BEMcxIhMI4tfM-9_q2gIVEDt_Ch2A_QopKI4e", "CI8BEMMtGAAiEwji18z73-raAhUQO38KHYD9Cikojh4", "CJABEMMtGAEiEwji18z73-raAhUQO38KHYD9Cikojh4" ], }); yt.setConfig({ 'PAGE_NAME': "{{ pageName ?? pageType }}", {# page type usually works, but some pages (index) differ #} 'LOGGED_IN': {{ yt.signin.isSignedIn ? "true" : "false" }}, 'SESSION_INDEX': 0, 'VALID_SESSION_TEMPDATA_DOMAINS': ["www.youtube.com", "gaming.youtube.com"], 'PARENT_TRACKING_PARAMS': "", 'FORMATS_FILE_SIZE_JS': ["%s B", "%s KB", "%s MB", "%s GB", "%s TB"], 'ONE_PICK_URL': "", 'GOOGLEPLUS_HOST': "https:\/\/plus.google.com", 'PAGEFRAME_JS': "\//s.ytimg.com/yts\/jsbin\/www-pageframe-vfl1RI_FO\/www-pageframe.js", 'GAPI_LOADER_URL': "\//s.ytimg.com/yts\/jsbin\/www-gapi-loader-vflugy459\/www-gapi-loader.js", 'JS_COMMON_MODULE': "\//s.ytimg.com/yts\/jsbin\/www-en_US-vfl2g6bso\/common.js", 'PAGE_FRAME_DELAYLOADED_CSS': "\//s.ytimg.com/yts\/cssbin\/www-pageframedelayloaded-vflkvMhoL.css", 'EXPERIMENT_FLAGS': {% include 'core/experiment_flags.json' %}, {% if not (defaultGuideVisibility or yt.spf) %} 'GUIDE_DELAY_LOAD': true, 'GUIDE_DELAYLOADED_CSS': {{ rehike.resource.cssPath('www-guide')|json_encode|raw }}, {% endif %} 'GUIDED_HELP_PARAMS': { "logged_in": "0", "context": "yt_web_w2w" }, 'HIGH_CONTRAST_MODE_CSS': {{ rehike.resource.cssPath('www-highcontrastmode')|json_encode|raw }}, 'PREFETCH_CSS_RESOURCES': ["\//s.ytimg.com/yts\/cssbin\/player-vflk34Vc2\/www-player.css"], 'PREFETCH_JS_RESOURCES': ["\//s.ytimg.com/yts\/jsbin\/www-pagead-id-vflikUYq3\/www-pagead-id.js", "\//s.ytimg.com/yts\/jsbin\/player-vflHFWD7-\/en_US\/base.js"], 'PREFETCH_LINKS': false, 'PREFETCH_LINKS_MAX': 1, 'PREFETCH_AUTOPLAY': false, 'PREFETCH_AUTOPLAY_TIME': 0, 'PREFETCH_AUTONAV': false, 'PREBUFFER_MAX': 1, 'PREBUFFER_LINKS': false, 'PREBUFFER_AUTOPLAY': false, 'PREBUFFER_AUTONAV': false, {% from "common/uix/watch_later_button.twig" import render as watch_later_button %} 'WATCH_LATER_BUTTON': {{ watch_later_button({ isToggled: false, untoggledTooltip: yt.msgs.addToWatchLater }, "__VIDEO_ID__")|json_encode|raw }}, 'WATCH_QUEUE_BUTTON': " \u003cbutton class=\"yt-uix-button yt-uix-button-size-small yt-uix-button-default yt-uix-button-empty yt-uix-button-has-icon no-icon-markup addto-button addto-queue-button video-actions spf-nolink hide-until-delayloaded addto-tv-queue-button yt-uix-tooltip\" type=\"button\" onclick=\";return false;\" title=\"Queue\" data-style=\"tv-queue\" data-video-ids=\"__VIDEO_ID__\"\u003e\u003c\/button\u003e\n", 'WATCH_QUEUE_MENU': " \u003cspan class=\"thumb-menu dark-overflow-action-menu video-actions\"\u003e\n \u003cbutton aria-expanded=\"false\" onclick=\";return false;\" aria-haspopup=\"true\" type=\"button\" class=\"yt-uix-button-reverse flip addto-watch-queue-menu spf-nolink hide-until-delayloaded yt-uix-button yt-uix-button-dark-overflow-action-menu yt-uix-button-size-default yt-uix-button-has-icon no-icon-markup yt-uix-button-empty\" \u003e\u003cspan class=\"yt-uix-button-arrow yt-sprite\"\u003e\u003c\/span\u003e\u003cul class=\"watch-queue-thumb-menu yt-uix-button-menu yt-uix-button-menu-dark-overflow-action-menu hid\"\u003e\u003cli role=\"menuitem\" class=\"overflow-menu-choice addto-watch-queue-menu-choice addto-watch-queue-play-next yt-uix-button-menu-item\" data-action=\"play-next\" onclick=\";return false;\" data-video-ids=\"__VIDEO_ID__\"\u003e\u003cspan class=\"addto-watch-queue-menu-text\"\u003ePlay next\u003c\/span\u003e\u003c\/li\u003e\u003cli role=\"menuitem\" class=\"overflow-menu-choice addto-watch-queue-menu-choice addto-watch-queue-play-now yt-uix-button-menu-item\" data-action=\"play-now\" onclick=\";return false;\" data-video-ids=\"__VIDEO_ID__\"\u003e\u003cspan class=\"addto-watch-queue-menu-text\"\u003ePlay now\u003c\/span\u003e\u003c\/li\u003e\u003c\/ul\u003e\u003c\/button\u003e\n \u003c\/span\u003e\n", 'SAFETY_MODE_PENDING': false, 'ZWIEBACK_PING_URLS': ["https:\/\/www.google.com\/pagead\/lvz?req_ts=1525391985\u0026pg=index\u0026evtid=ALJwLvToJXD0p3_Zrbrrfp9ih4rqwwAMLeJ3ElrnHltrNYrWsTByMCWniNX3mAadBuAdCje5foaJkSKkWgMjL4H28LIW72flyA\u0026sigh=AD56X6t_M9BxOrscJtOgog0u0lWO3nkLDw"], 'LOCAL_DATE_TIME_CONFIG': { "amPms": ["AM", "PM"], "formatLongDateOnly": "MMMM d, y", "months": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "shortMonths": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], "weekendRange": [6, 5], "dateFormats": ["MMMM d, y 'at' h:mm a", "MMMM d, y", "MMM d, y", "MMM d, y"], "formatWeekdayShortTime": "EE h:mm a", "firstDayOfWeek": 0, "formatShortDate": "MMM d, y", "shortWeekdays": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], "formatShortTime": "h:mm a", "formatLongDate": "MMMM d, y 'at' h:mm a", "firstWeekCutoffDay": 3, "weekdays": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] }, 'PAGE_CL': 194950063, 'PAGE_BUILD_LABEL': "rehike.{{ yt.rehikeVersion.semanticVersion }}.{{ yt.rehikeVersion.time|date("Ymd") }}", 'VARIANTS_CHECKSUM': "428a944d5eaeed109e12cae9cbe78c47", 'CLIENT_PROTOCOL': "HTTP\/1.0", 'CLIENT_TRANSPORT': "tcp", 'MDX_ENABLE_CASTV2': true, 'MDX_ENABLE_QUEUE': true, 'SERVICE_WORKER_PROMPT_NOTIFICATIONS': true, 'FEEDBACK_BUCKET_ID': "Home", 'FEEDBACK_LOCALE_LANGUAGE': "en", 'FEEDBACK_LOCALE_EXTRAS': { "accept_language": null, "experiments": "23700266,23700732,23701247,23701297,23701882,23702459,23703975,23705057,23705778,23706844,23706846,23707086,23708904,23708906,23708910,23709090,23709328,23709532,23709788,23709896,23709898,23709902,23709985,23710313,23710367,23710476,23710536,23710560,23710729,23710863,23711857,23711859,23712229,23712544,23712746,23712838,23713594,23714427,23714579,23714865,23715674,23715837,23715854,23716256,23716688,23717597,23718221,23718617,23720115,23720358,23720566,23721075,23721136,23721182,23721223,23721466,23721698,23721770,23721898,23721928,23722151,23722284,23722367,23722905,23723166,23723437,23723555,23723588,23723618,23724337,23725678,23725949,23726541,23726564,23726767,23726949,23726973,23727119,23727268,23727366,23727487,23727705,23727834,23728036,23728293,23728416,23728468,23728625,23728908,23729146,23729373,23729484,23729690,23729887,23730614,23730642,23730661,23730676,23731189,23731222,23731700,23731801,23731868,23731877,23731938,23731977,23732016,23732160,23732469,23732639,23732692,23732895,23733081,23733270,23733291,23733473,23733524,23733644,23733751,23733823,23733978,23734153,23734497,23734662,23734670,23734676,23734961,23734991,23735000,23735137,23735154,23735395,23735400,23736028,23736169,23736323,23736402,23736484,23736572,23736955,23736982,23737024,23737217,23737392,23737416,23737474,23737653,23737659,23737795,23737840,23737949,23737975,23738006,23738007,23738208,23738258,23738262,23738266,23738416,23738477,23738485,23738628,23738747,23738860,23738917,23738944,23739191,23739211,23739231,23739239,23739241,23739306,23739358,23739416,23739509,23739533,23739700,23739764,23739967,9405975,9415398,9419979,9422596,9445139,9449243,9451814,9453167,9453409,9457169,9459792,9459797,9460098,9460554,9460829,9460959,9463460,9463594,9463936,9463963,9464203,9466835,9467471,9467508,9467510,9467512,9467700,9467806,9467820,9467822,9468195,9469934,9470249,9471103,9471235,9471955,9473373,9473387,9473401,9474241,9474396,9476077,9476619,9476652,9478787,9479456,9479750,9482972,9483190,9483245,9483583,9483924,9485000,9486390,9487037,9487182,9487330,9488772,9489266,9489336,9489831,9489833", "logged_in": false } }); yt.setConfig({ 'GUIDED_HELP_LOCALE': "en_US", 'GUIDED_HELP_ENVIRONMENT': "prod" }); yt.setConfig('SPF_SEARCH_BOX', true); yt.setMsg({ 'ADDTO_CREATE_NEW_PLAYLIST': "Create new playlist\n", 'ADDTO_CREATE_PLAYLIST_DYNAMIC_TITLE': " $dynamic_title_placeholder (create new)\n", 'ADDTO_WATCH_LATER': "{{ yt.msgs.addToWatchLater }}", 'ADDTO_WATCH_LATER_ADDED': "{{ yt.msgs.addedToWatchLater }}", 'ADDTO_WATCH_LATER_ERROR': "{{ yt.msgs.addToError }}", 'ADDTO_WATCH_QUEUE': "Watch Queue", 'ADDTO_WATCH_QUEUE_ADDED': "Added", 'ADDTO_WATCH_QUEUE_ERROR': "Error", 'ADDTO_TV_QUEUE': "Queue", 'ADS_INSTREAM_FIRST_PLAY': "A video ad is playing.", 'ADS_INSTREAM_SKIPPABLE': "Video ad can be skipped.", 'ADS_OVERLAY_IMPRESSION': "Ad displayed.", 'MASTHEAD_NOTIFICATIONS_LABEL': { "other": "{{ yt.masthead.notificationStrings.plural }}", "case1": "{{ yt.masthead.notificationStrings.singular }}", "case0": "{{ yt.masthead.notificationStrings.none }}" }, 'MASTHEAD_NOTIFICATIONS_COUNT_99PLUS': "99+", 'MDX_AUTOPLAY_OFF': 'Autoplay is off', 'MDX_AUTOPLAY_ON': 'Autoplay is on' }); yt.setConfig('FEED_PRIVACY_CSS_URL', "\//s.ytimg.com/yts\/cssbin\/www-feedprivacydialog-vflLtZObB.css"); yt.setConfig('FEED_PRIVACY_LIGHTBOX_ENABLED', true); yt.setConfig({ 'SBOX_JS_URL': "\//s.ytimg.com/yts\/jsbin\/www-searchbox-legacy-vflqS3UI_\/www-searchbox-legacy.js", 'SBOX_SETTINGS': { "REQUEST_DOMAIN": "us", "HAS_ON_SCREEN_KEYBOARD": false, "SESSION_INDEX": null, "REQUEST_LANGUAGE": "en", "SUGG_EXP_ID": "", "PSUGGEST_TOKEN": null, "PQ": "", "IS_FUSION": false }, 'SBOX_LABELS': { "SUGGESTION_DISMISSED_LABEL": "Suggestion removed", "SUGGESTION_DISMISS_LABEL": "Remove" } }); yt.setConfig({ 'YPC_LOADER_JS': "\//s.ytimg.com/yts\/jsbin\/www-ypc-vflq-EGzT\/www-ypc.js", 'YPC_LOADER_CSS': "\//s.ytimg.com/yts\/cssbin\/www-ypc-vflbH3pUh.css", 'YPC_SIGNIN_URL': "https:\/\/accounts.google.com\/ServiceLogin?service=youtube\u0026uilel=3\u0026hl=en\u0026continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Fapp%3Ddesktop%26action_handle_signin%3Dtrue%26hl%3Den%26next%3D%252F\u0026passive=true", 'DBLCLK_ADVERTISER_ID': "2542116", 'DBLCLK_YPC_ACTIVITY_GROUP': "youtu444", 'SUBSCRIPTION_URL': "\/subscription_ajax", 'YPC_SWITCH_URL': "\/signin?skip_identity_prompt=True\u0026action_handle_signin=true\u0026next=%2F\u0026feature=purchases", 'YPC_GB_LANGUAGE': "en_US", 'YPC_MB_URL': "https:\/\/payments.youtube.com\/payments\/v4\/js\/integrator.js?ss=md", 'YPC_TRANSACTION_URL': "\/transaction_handler", 'YPC_SUBSCRIPTION_URL': "\/ypc_subscription_ajax", 'YPC_POST_PURCHASE_URL': "\/ypc_post_purchase_ajax", 'YTR_FAMILY_CREATION_URL': "https:\/\/families.google.com\/webcreation?usegapi=1", 'YTO_GTM_DATA': { 'event': 'purchased', 'purchaseStatus': 'success' }, 'YTO_GTM_1_BUTTON_CLICK_DATA': { 'event': 'landingButtonClick', 'buttonPosition': '1' }, 'YTO_GTM_2_BUTTON_CLICK_DATA': { 'event': 'landingButtonClick', 'buttonPosition': '2' } }); yt.setMsg({ 'YPC_OFFER_OVERLAY': " \n", 'YPC_UNSUBSCRIBE_OVERLAY': " \n" }); yt.setConfig('GOOGLE_HELP_CONTEXT', "homepage"); ytcsi.info('st', 782); ytcfg.set({ "TIMING_INFO": { "yt_li": "0", "GetBrowse_rid": "0xe3b9b04aca2f9134", "yt_ref": "embed", "yt_lt": "cold", "cver": "1.20180501", "c": "WEB", "yt_fn": "what_to_watch" }, "CSI_SERVICE_NAME": "youtube" });; ytcfg.set({ "TIMING_ACTION": "home", "CSI_VIEWPORT": true, "TIMING_AFT_KEYS": ["ol"] });; yt.setConfig({ 'XSRF_TOKEN': "QUFFLUhqblpJSmpaekNVWmNDTG0yLWtydkljSDV4NTdwUXxBQ3Jtc0tuUlBKekxfRlozT2lXaEswVGZCUFpCd1dhTHNzWEFQN0hNNkFyOENZZWZISEpCaHJyNHAzTXZSaGJtVGt0Y3d0VExSTWtKTUg2QTFFamFydU1zYUlrcGhSNFZVcW91WlZaRW1RS1R6MDNUNUtQQ0UtNlc3aUExVWZkMnBwcFNYSzhCODZUSHdkZW43aEt1WGY3ZWFxWGlnUWNraGc=", 'XSRF_FIELD_NAME': "session_token", 'XSRF_REDIRECT_TOKEN': "5zwyZSJJ-Uiz2ANn_3WjC6YjC9B8MTUyNTQ3ODM4NkAxNTI1MzkxOTg2" }); yt.setConfig('ID_TOKEN', null); window.ytcfg.set('SERVICE_WORKER_KILLSWITCH', false); yt.setConfig('THUMB_DELAY_LOAD_BUFFER', 300); if (window.ytcsi) { window.ytcsi.tick("jl", null, ''); } </script>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# # Helper for img elements # # @author Taniko Yamamoto <[email protected]> #} {# # data: { src, ?alt = "", ?ariaHidden: "true", ?onload, ?width, ?height, ?delayLoad: true, ?ytImg } #} {%- macro img(data) -%} <img alt="{{ data.alt }}" aria-hidden="{{ data.ariaHidden ?? "true" }}" {%- if data.ytImg -%} data-ytimg="1" {%- endif -%} {%- for name, value in data.customAttributes -%} {{ name }}="{{ value }}" {%- endfor -%} {%- if data.onload -%} onload="{{ data.onload }}" {%- endif -%} {%- if data.width -%} width="{{ data.width }}" {%- endif -%} {%- if data.height -%} height="{{ data.height }}" {%- endif -%} {# If delayload is set, the image source is stored in another attribute to be swapped in by JS. #} {%- if not (data.delayLoad == false) -%} data-thumb="{{ data.src }}" src="{{ PIXEL }}" {# Global pixel variable #} {%- else -%} src="{{ data.src }}" {%- endif -%} > {%- endmacro -%}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import "core/macros.twig" as core %} <html> <head> <title>404 Not Found</title> {{ core.css("www-core") }} {{ core.css("www-error") }} {{ core.css("www-pageframe") }} <style name="www-roboto">@font-face{font-family:'Roboto';font-style:normal;font-weight:500;src:local('Roboto Medium'),local('Roboto-Medium'),url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fBBc9.ttf)format('truetype');}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;src:local('Roboto Regular'),local('Roboto-Regular'),url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxP.ttf)format('truetype');}@font-face{font-family:'Roboto';font-style:italic;font-weight:500;src:local('Roboto Medium Italic'),local('Roboto-MediumItalic'),url(//fonts.gstatic.com/s/roboto/v18/KFOjCnqEu92Fr1Mu51S7ACc6CsE.ttf)format('truetype');}@font-face{font-family:'Roboto';font-style:italic;font-weight:400;src:local('Roboto Italic'),local('Roboto-Italic'),url(//fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xIIzc.ttf)format('truetype');}</style> {% if rehike.config.appearance.modernLogo %} {% include 'experiment/ringo/ringo.twig' %} {% endif %} </head> <body class="{{ rehike.config.appearance.modernLogo ? "exp-invert-logo" }}"> <div id="error-page"> <div id="error-page-content"> <img src="/yts/img/ringo/img/image-hh-404-vflP3hqNT.png" alt="" id="error-page-hh-illustration"> <p>This page isn't available. Sorry about that.</p> <p>Try searching for something else.</p> <div id="yt-masthead"> <a href="/" class="masthead-logo-renderer spf-link " id="logo-container" title="YouTube Home"> <span title="YouTube Home" class="logo masthead-logo-renderer-logo yt-sprite"></span></a> <form id="masthead-search" class="search-form consolidated-form" action="/results" onsubmit="if (document.getElementById('masthead-search-term').value == '') return false;" data-clicktracking="CAIQ7VAiEwji18z73-raAhUQO38KHYD9Cikojh4"> <button class="yt-uix-button yt-uix-button-size-default yt-uix-button-default search-btn-component search-button" type="submit" onclick="if (document.getElementById('masthead-search-term').value == '') return false; document.getElementById('masthead-search').submit(); return false;;return true;" tabindex="2" id="search-btn" dir="ltr"><span class="yt-uix-button-content">Search</span></button> <div id="masthead-search-terms" class="masthead-search-terms-border " dir="ltr"><input id="masthead-search-term" autocomplete="off" onkeydown="if (!this.value &amp;&amp; (event.keyCode == 40 || event.keyCode == 32 || event.keyCode == 34)) {this.onkeydown = null; this.blur();}" class="search-term masthead-search-renderer-input yt-uix-form-input-bidi" name="search_query" value="" type="text" tabindex="1" placeholder="Search" title="Search" aria-label="Search" spellcheck="false" style="outline: currentcolor none medium;"></div> <div class="gsfi" style="background: transparent none repeat scroll 0% 0%; color: rgb(0, 0, 0); padding: 0px; position: absolute; white-space: pre; visibility: hidden;"></div></form> </div> </div> <span id="error-page-vertical-align"></span> </div> {{ core.js("www-notfound/www-notfound") }} <script> yt.setConfig({'SBOX_JS_URL': "{{ rehike.resource.jsPath("www-searchbox/www-searchbox") }}",'SBOX_SETTINGS': {"REQUEST_DOMAIN": "us", "REQUEST_LANGUAGE": "en", "HAS_ON_SCREEN_KEYBOARD": false},'SBOX_LABELS': {"SUGGESTION_DISMISS_LABEL": "Dismiss", "SUGGESTION_DISMISSED_LABEL": "Suggestion dismissed"}}); yt.www.notfound.init(); </script> </body> </html>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<style> .exp-invert-logo .hats-logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/logo_mini_gray-vflfanGkh.png); width: 65px; height: 15px; } .exp-invert-logo #header:before, .exp-invert-logo .ypc-join-family-header .logo, .exp-invert-logo #footer-logo .footer-logo-icon, .exp-invert-logo #yt-masthead #logo-container .logo, .exp-invert-logo #masthead #logo-container, .exp-invert-logo .admin-masthead-logo a, .exp-invert-logo #yt-sidebar-styleguide-logo #logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/logo_small-vflHpzGZm.png); width: 100px; height: 30px; } .exp-invert-logo.inverted-hdpi #header:before, .exp-invert-logo.inverted-hdpi .ypc-join-family-header .logo, .exp-invert-logo.inverted-hdpi #footer-logo .footer-logo-icon, .exp-invert-logo.inverted-hdpi #yt-masthead #logo-container .logo, .exp-invert-logo.inverted-hdpi #masthead #logo-container, .exp-invert-logo.inverted-hdpi .admin-masthead-logo a, .exp-invert-logo.inverted-hdpi #yt-sidebar-styleguide-logo #logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/logo_small_2x-vfl4_cFqn.png); background-size: 100px 30px; width: 100px; height: 30px; } .exp-invert-logo.exp-fusion-nav-redesign .masthead-logo-renderer-logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/yt_play_logo-vflLfk4yD.png); width: 40px; height: 28px; } .exp-invert-logo.inverted-hdpi.exp-fusion-nav-redesign .masthead-logo-renderer-logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/yt_play_logo_2x-vflXx5Pg3.png); width: 40px; height: 28px; } @media screen and (max-width: 656px) { .exp-invert-logo #yt-masthead #logo-container .logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/yt_play_logo-vflLfk4yD.png); width: 40px; height: 28px; } .exp-invert-logo.inverted-hdpi #yt-masthead #logo-container .logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/yt_play_logo_2x-vflXx5Pg3.png); background-size: 40px 28px; width: 40px; height: 28px; } } @media only screen and (min-width: 0px) and (max-width: 498px), only screen and (min-width: 499px) and (max-width: 704px) { .exp-invert-logo.exp-responsive #yt-masthead #logo-container { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/yt_play_logo-vflLfk4yD.png); width: 40px; height: 28px; } .exp-invert-logo.inverted-hdpi.exp-responsive #yt-masthead #logo-container { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/yt_play_logo_2x-vflXx5Pg3.png); background-size: 40px 28px; width: 40px; height: 28px; } } .exp-invert-logo #yt-masthead #logo-container .logo-red { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/logo_youtube_red-vflZxcSR1.png); width: 132px; height: 30px; } .exp-invert-logo.inverted-hdpi #yt-masthead #logo-container .logo-red { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/logo_youtube_red_2x-vflOSHA_n.png); background-size: 132px 30px; width: 132px; height: 30px; } .exp-invert-logo .guide-item .guide-video-youtube-red-icon { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/video_youtube_red-vflovGTdz.png); width: 20px; height: 20px; } .exp-invert-logo.inverted-hdpi .guide-item .guide-video-youtube-red-icon { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/video_youtube_red_2x-vflqMdgEM.png); background-size: 20px 20px; width: 20px; height: 20px; } .exp-invert-logo .guide-item:hover .guide-video-youtube-red-icon, .exp-invert-logo .guide-item.guide-item-selected .guide-video-youtube-red-icon { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/video_youtube_red_hover-vflgV4Gv0.png); width: 20px; height: 20px; } .exp-invert-logo.inverted-hdpi .guide-item:hover .guide-video-youtube-red-icon, .exp-invert-logo.inverted-hdpi .guide-item.guide-item-selected .guide-video-youtube-red-icon { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/video_youtube_red_hover_2x-vflYjZHvf.png); background-size: 20px 20px; width: 20px; height: 20px; } .exp-invert-logo li.guide-section h3, .exp-invert-logo li.guide-section h3 a { color: #f00; } .exp-invert-logo a.yt-uix-button-epic-nav-item:hover, .exp-invert-logo a.yt-uix-button-epic-nav-item.selected, .exp-invert-logo a.yt-uix-button-epic-nav-item.yt-uix-button-toggled, .exp-invert-logo button.yt-uix-button-epic-nav-item:hover, .exp-invert-logo button.yt-uix-button-epic-nav-item.selected, .exp-invert-logo button.yt-uix-button-epic-nav-item.yt-uix-button-toggled, .exp-invert-logo .epic-nav-item:hover, .exp-invert-logo .epic-nav-item.selected, .exp-invert-logo .epic-nav-item.yt-uix-button-toggled, .exp-invert-logo .epic-nav-item-heading, .exp-invert-logo .yt-gb-shelf-item-thumbtab.yt-gb-selected-shelf-tab::before { border-color: #f00; } .exp-invert-logo .resume-playback-progress-bar, .exp-invert-logo .yt-uix-button-subscribe-branded, .exp-invert-logo .yt-uix-button-subscribe-branded[disabled], .exp-invert-logo .yt-uix-button-subscribe-branded[disabled]:hover, .exp-invert-logo .yt-uix-button-subscribe-branded[disabled]:active, .exp-invert-logo .yt-uix-button-subscribe-branded[disabled]:focus, .exp-invert-logo .sb-notif-on .yt-uix-button-content, .exp-invert-logo .guide-item.guide-item-selected, .exp-invert-logo .guide-item.guide-item-selected:hover, .exp-invert-logo .guide-item.guide-item-selected .yt-deemphasized-text, .exp-invert-logo .guide-item.guide-item-selected:hover .yt-deemphasized-text { background-color: #f00; } .exp-invert-logo .yt-uix-button-subscribe-branded:hover { background-color: #d90a17; } .exp-invert-logo .yt-uix-button-subscribe-branded.yt-is-buffered, .exp-invert-logo .yt-uix-button-subscribe-branded:active, .exp-invert-logo .yt-uix-button-subscribe-branded.yt-uix-button-toggled, .exp-invert-logo .yt-uix-button-subscribe-branded.yt-uix-button-active, .exp-invert-logo .yt-uix-button-subscribed-branded.external, .exp-invert-logo .yt-uix-button-subscribed-branded.external[disabled], .exp-invert-logo .yt-uix-button-subscribed-branded.external:active, .exp-invert-logo .yt-uix-button-subscribed-branded.external.yt-uix-button-toggled, .exp-invert-logo .yt-uix-button-subscribed-branded.external.yt-uix-button-active { background-color: #a60812; } </style> <style> .exp-invert-logo #header:before, .exp-invert-logo .ypc-join-family-header .logo, .exp-invert-logo #footer-logo .footer-logo-icon, .exp-invert-logo #yt-masthead #logo-container .logo, .exp-invert-logo #masthead #logo-container, .exp-invert-logo .admin-masthead-logo a, .exp-invert-logo #yt-sidebar-styleguide-logo #logo { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/logo_small_2x-vfl4_cFqn.png); background-size: 100px 30px; } .exp-invert-logo #yt-masthead #logo-container .logo-red { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/logo_youtube_red_2x-vflOSHA_n.png); background-size: 132px 30px; } @media only screen and (min-width: 0px) and (max-width: 498px), only screen and (min-width: 499px) and (max-width: 704px) { .exp-invert-logo.exp-responsive #yt-masthead #logo-container { background: no-repeat url(//s.ytimg.com/yts/img/ringo/hitchhiker/yt_play_logo_2x-vflXx5Pg3.png); background-size: 40px 28px; } } </style> <style name="ringo-fix"> .exp-invert-logo #creator-sidebar .creator-sidebar-item.selected, .exp-invert-logo #creator-sidebar .creator-sidebar-submenu .creator-sidebar-item.selected a:hover, .exp-invert-logo #creator-sidebar .creator-sidebar-submenu a.creator-sidebar-section-link.selected, .exp-invert-logo #creator-sidebar .creator-sidebar-single-section.selected a, .exp-invert-logo #creator-sidebar .creator-sidebar-single-section.selected a:hover, .exp-invert-logo #progress { background: #f00; } .exp-invert-logo #progress dd, .exp-invert-logo #progress dt { box-shadow: #f00 1px 0 6px 1px; } </style>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<div id="player" class=" {{ playerType ? playerType : 'off-screen' }} " role="complementary"> <div id="theater-background" class="player-height"></div> <div id="player-mole-container"> <div id="player-unavailable" class="{{ yt.playerUnavailable ? " player-width player-height player-unavailable " : "hid" }}"> {% if yt.playerUnavailable %} {% include "player/player_unavailable.twig" %} {% endif %} </div> <div id="player-api" class="player-width player-height off-screen-target player-api" tabIndex="-1"></div> <script >if (window.ytcsi) {window.ytcsi.tick("cfg", null, '');}</script> {# Player definition scripts. This is somewhat different to what you'd expect. This implements a ytInitialPlayerResponse object, which is compatible with Polymer's load methods. This simply allows extensions and userscripts to intercept the player response before the player is loaded. #} <script> ytcfg.set("STS", {{ yt.playerConfig.signatureTimestamp }}); var ytInitialPlayerResponse = { "playerResponse": {{ yt.playerResponse|json_encode|raw }} }; </script> <script>{% apply spaceless %} var ytplayer = ytplayer || {}; ytplayer.config = { "args": { {%- if yt.playerResponse -%} raw_player_response: ytInitialPlayerResponse.playerResponse, {% if yt.watchNextResponse %} raw_watch_next_response: {{ yt.watchNextResponse|json_encode|raw }}, {% endif %} {% endif %} {%- if yt.page.playlist -%} "swf_player_response": "1", "videoId": "{{ yt.videoId }}", "list": "{{ yt.playlistId }}", "external_list": "1", "idpj": "-1", "no_get_video_log": "0", "is_listed": "1", "t": "1", "plid": "AAVm9hRW-h1RWxWz", "ldpj": "-31", "ptk": "youtube_multi", "pltype": "content", {%- endif -%} disable_watch_next: true, "apiary_host_firstparty": "", "fexp": "23708904,23708906,23708910,23710476,23712544,23716256,23721698,23721898,23723588,23723618,23725949,23726564,23729690,23730642,23733473,23733751,23735154,23735395,23736169,23736484,23736955,23737659,23738006,23738944,23739239,23739533,23739764,9405975,9422596,9449243,9470249,9471235,9474241,9476619,9476652,9483924,9485000,9487182", "player_error_log_fraction": "1.0", "host_language": "en", "enablejsapi": "1", "c": "WEB", "innertube_context_client_version": "2.20210623.00.00", "hl": "en_US", "fflags": "{% include "player/flags.twig" %}", "xhr_apiary_host": "youtubei.youtube.com", "gapi_hint_params": "m;\/_\/scs\/abc-static\/_\/js\/k=gapi.gapi.en.fXLlmSb25lg.O\/m=__features__\/rt=j\/d=1\/rs=AHpOoo87O_nfyKCryZ5rvwwhVwktxKhiRA", "autoplay": "1", "external_play_video": "1", "innertube_api_key": "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8", "cver": "2.20210623.00.00", "cr": "US", "is_html5_mobile_device": false, "innertube_api_version": "v1", "apiary_host": "" }, "params": { "allowfullscreen": "true", "allowscriptaccess": "always", "bgcolor": "#000000" }, "assets": { "css": {{ (yt.playerConfig.baseCssUrl)|json_encode|raw }}, "js": {{ (yt.playerConfig.baseJsUrl)|json_encode|raw }} }, "html5": true, "url": "", "sts": {{ yt.playerConfig.signatureTimestamp }}, "attrs": { "id": "movie_player", "class": "ytp-embed" } }; {% endapply %} ytplayer.load = function() { yt.player.Application.create("player-api", ytplayer.config); ytplayer.config.loaded = true; }; </script> <div id="player-playlist" class=" {{ yt.page.playlist ? 'content-alignment watch-player-playlist' : 'hid' }} "> {%- if yt.page.playlist -%} {% include '/common/watch/watch_playlist.twig' %} {%- endif -%} </div> </div> <div class="clear"></div> </div> <script> // Check if the end-user uses age restrict bypass extension // If so, the player unavailable message cannot be removed by // it by default, so we need to do it ourselves. if ("SYARB_CONFIG" in window) { var a = document.createElement("style"); a.id = "age-restrict-bypass-fix"; a.innerHTML = "#player-unavailable { display: none; }"; document.body.appendChild(a); } </script>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
<img class="icon meh" src="{{ ytConstants.img.meh7 }}" alt=""> <div class="content"> <h1 id="unavailable-message" class="message"> {{ rehike.getText(yt.playerUnavailable.reason) }} </h1> {% if yt.playerUnavailable.subreason %} <div id="unavailable-submessage" class="submessage"> {{ rehike.getText(yt.playerUnavailable.subreason) }} {%- if yt.playerUnavailable.subreason.watch7PlayerAgeGateContent -%} {% set agegate = yt.playerUnavailable.subreason.watch7PlayerAgeGateContent %} <div id="watch7-player-age-gate-content"> <p>{{ agegate.message }}</p> <p></p> {% from "common/uix/button.twig" import render as button %} {{ button(agegate.button) }} </div> {%- endif -%} </div> {% endif %} </div>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{%- from "common/browse/item_section.twig" import render as item_section -%} {%- import "common/uix/lockup.twig" as lockup -%} {%- from "common/playlist/pl_video.twig" import render as pl_video -%} { "test": {{ yt.FUCK|json_encode|raw }}, {%- if yt.page.continuation -%} {%- import "common/uix/load_more_button.twig" as load_more -%} "load_more_widget_html": {{ load_more.render(yt.page.continuation, yt.page.target)|json_encode|raw }}, {%- endif -%} "content_html": {%- apply json_encode|raw -%} {%- for item in yt.page.items -%} {%- if item.itemSectionRenderer -%} <li> {{ item_section(item.itemSectionRenderer) }} </li> {%- elseif item.gridVideoRenderer or item.gridPlaylistRenderer or item.gridRadioRenderer or item.gridChannelRenderer -%} <li class="channels-content-item yt-shelf-grid-item {{ item.gridChannelRenderer ? "channel-shelf-item" }}"> {{ lockup.grid(item) }} </li> {%- elseif item.videoRenderer or item.playlistRenderer or item.radioRenderer or item.channelRenderer -%} <li class="feed-item-container yt-section-hover-container browse-list-item-container branded-page-box vve-check "> <div class="feed-item-dismissable "> <div class="feed-item-main feed-item-no-author"> <div class="feed-item-main-content"> {{ lockup.tile(item) }} </div> </div> </div> <div class="feed-item-dismissal-notices"> <div class="feed-item-dismissal feed-item-dismissal-hide hid"> This item has been hidden </div> </div> </li> {%- elseif item.playlistVideoRenderer -%} {{ pl_video(item) }} {%- endif -%} {%- endfor -%} {%- endapply -%}, "innertube_data": {{ yt.page|json_encode|raw }} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% from "common/thumb.twig" import render as thumb %} <div id="yt-delegate-accounts"> {%- for account in yt.page -%} <a href="{{ account.switchUrl }}" class="yt-masthead-account-picker-option yt-masthead-account-picker-user-option"> {{ thumb({ type: "square", width: 36, height: 36, delayload: true, image: account.photo, class: ["yt-masthead-picker-photo-wrapper"] }) }} <div class="yt-masthead-picker-info"> <div class="yt-masthead-picker-name" dir="ltr">{{ account.name }}</div> <div class="yt-masthead-picker-account-subtitle">{{ account.byline }}</div> </div> </a> {%- endfor -%} </div>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import "common/watch/watch7/sidebar/macros.twig" as sidebar %} <div id="watch-more-related"> {%- for item in yt.page.items -%} {% if item.compactVideoRenderer %} {{ sidebar.video_item(item) }} {% endif %} {% endfor %} </div>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% from "/common/addto/addto.twig" import render as addto %} <?xml version="1.0" encoding="utf-8"?> <root> <html_content> <![CDATA[{{ addto(yt.page.addto)|raw }}]]> </html_content> <return_code><![CDATA[0]]></return_code> </root>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{%- from "common/uix/button.twig" import render as button -%} { "content_html": {%- apply json_encode|raw -%} <div class="overlay-confirmation-preferences-dialog"> <div class="overlay-confirmation-preferences-container"> <div class="overlay-confirmation-channel-info">{{ yt.page.title }}</div> <div class="overlay-confirmation-content"> {%- for option in yt.page.options -%} <div class="overlay-confirmation-preferences-option"> <label> <span class="yt-uix-form-input-radio-container {{ option.checked ? "checked" }}"> <input type="radio" class="yt-uix-form-input-radio {{ option.class }}" name="overlay-confirmation-preferences-update-frequency" {{ option.checked ? 'checked="checked"' }} data-service-endpoint="{{ option.params }}"> <span class="yt-uix-form-input-radio-element"></span> </span> {{ option.label }} </label> </div> {%- endfor -%} </div> </div> </div> <div class="yt-uix-overlay-actions"> {{ button(yt.page.cancelButton) }} {{ button(yt.page.saveButton) }} </div> {%- endapply -%} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import "common/comments/main.twig" as dv2 %} { "html_content": {{ dv2.comment(yt.page, true)|json_encode|raw }} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import "common/comments/main.twig" as dv2 %} { "html_content": {{ dv2.comment_thread(yt.page)|json_encode|raw }} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import '/common/comments/main.twig' as main %} { "content_html": {{ include("/common/comments/comments_thread_list.twig")|json_encode|raw }}{% if yt.page.commentContinuationRenderer %}, "load_more_widget_html": {{ main.loadMoreWidget(yt.page.commentContinuationRenderer.token)|json_encode|raw }}{% endif %} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{ "content_html": {{ include("/common/comments/replies_list.twig")|json_encode|raw }} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import "common/watch/watch7/action_panel/base.twig" as action_panel %} {%- from "common/uix/button.twig" import render as button -%} {%- from "core/spinner.twig" import render as spinner -%} { "url_short": "{{ yt.page.shortUrl }}", "share_html": {%- apply json_encode|raw -%} <div id="debug" class="hid"> {{ yt.page|json_encode }} </div> <div class="share-panel"> <div class="yt-uix-tabs"> <span class="yt-uix-button-group" data-button-toggle-group="share-panels"> {%- for tab in yt.page.tabs -%} {{ button(tab) }} {%- endfor -%} </span> </div> <div class="share-panel-show-loading hid"> {{ spinner(yt.msgs.loading) }} </div> <div class="share-panel-services-container"> <div id="share-services-container" class="clearfix"> <div class="share-panel-services"> <ul class="share-group ytg-box"> {%- for service in yt.page.services -%} <li> <button class="yt-uix-tooltip share-service-button share-{{ service.icon }}-icon" title="{{ service.tooltip }}" onclick="yt.window.popup('{{ service.url }}', {width:{{ service.width }},height:{{ service.height }},scrollbars:true});return false;"> <span class="share-service-icon share-service-icon-{{ service.icon }} yt-sprite"></span> <span class="share-service-checkmark yt-sprite"></span> </button> </li> {%- endfor -%} </ul> </div> </div> <div class="share-panel-url-container share-panel-reverse"> <span class="share-panel-url-input-container yt-uix-form-input-container yt-uix-form-input-text-container yt-uix-form-input-non-empty"> <input type="text" class="yt-uix-form-input-text share-panel-url" name="share_url" value="{{ yt.page.shortUrl }}" data-video-id="{{ yt.page.videoId }}"> </span> </div> <span class="share-panel-start-at-container"> <label> <span class="yt-uix-form-input-checkbox-container"> <input class="share-panel-start-at" type="checkbox"> <span class="yt-uix-form-input-checkbox-element"></span> </span> {{ yt.page.startStr }} </label> <input type="text" value="0:00" title="Video start time" class="yt-uix-form-input-text share-panel-start-at-time"> </span> </div> <div class="share-panel-embed-container hid"> {{ action_panel.loading() }} </div> <div class="share-panel-email-container hid" data-disabled="true"> <p class="display-message">This feature is not available right now. Check back later!</p> </div> </div> {%- endapply -%} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{%- from "common/uix/button.twig" import render as button -%} {%- from "core/spinner.twig" import render as spinner -%} { "iframe_code": "<iframe width=\"__width__\" height=\"__height__\" src=\"__url__\" frameborder=\"0\" gesture=\"media\" allowfullscreen></iframe>", "iframe_url": "{{ yt.page.embedUrl }}", "alternate_embed_urls": { {%- for url in yt.page.alternateUrls -%} "{{ url.key }}": "{{ url.content }}" {% if loop.last == false %},{% endif %} {%- endfor -%} }, "embed_html": {%- apply json_encode|raw -%} <div id="debug" class="hid"> {{ yt.page|json_encode }} </div> <div class="share-panel"> <div class="share-panel-show-loading hid"> {{ spinner(yt.msgs.loading) }} </div> <div class="yt-uix-expander yt-uix-expander-collapsed"> {% if yt.page.isList %} <div class="share-panel-playlist-options"> <span class="yt-uix-form-input-checkbox-container checked"> <input type="checkbox" class="yt-uix-form-input-checkbox" name="embed-with-playlist" checked="checked" id="embed-with-playlist" value="1"> <span class="yt-uix-form-input-checkbox-element"></span> </span> <label for=embed-with-playlist>{{ yt.page.strs.sharePlaylist }}</label> <button type="button" aria-expanded="false" class=" yt-uix-button yt-uix-button-default yt-uix-button-size-default" onclick=";return false;" aria-haspopup="true" data-button-menu-indicate-selected="true"> <span class="yt-uix-button-content">{{ yt.page.strs.currentVideo }}</span> <span class="yt-uix-button-arrow yt-sprite"></span> <ul class=" yt-uix-button-menu yt-uix-button-menu-default hid" role="menu" aria-haspopup="true"> <li role="menuitem"> <span id="embed-with-playlist-current" class=" yt-uix-button-menu-item" onclick=";return false;" >{{ yt.page.strs.currentVideo }}</span> </li> <li role="menuitem"> <span id="embed-with-playlist-first" class=" yt-uix-button-menu-item" onclick=";return false;" >{{ yt.page.strs.startPlaylist }}</span> </li> </ul> </button> </div> {% endif %} <span class=" yt-uix-form-input-container yt-uix-form-input-text-container "> <input class="yt-uix-form-input-text share-embed-code" title="{{ yt.page.strs.embedCode }}"> </span> <div class="yt-uix-expander-body"> <div id="share-preview" class="share-embed-options"> <span>{{ yt.page.strs.preview }}</span> <div id="video-preview"></div> </div> <div class="share-embed-options"> <label for="embed-layout-options">{{ yt.page.strs.videoSize }}</label> <span class="yt-uix-form-input-select "> <span class="yt-uix-form-input-select-content"> <span class="yt-uix-form-input-select-arrow yt-sprite"></span> <span class="yt-uix-form-input-select-value"></span> </span> <select class="yt-uix-form-input-select-element " id="embed-layout-options"> {%- for size in yt.page.sizes -%} <option value="{{ size.name }}" {% if size.text is not defined %} data-width="{{ size.width }}" data-height="{{ size.height }}"> {{ size.width }} &times; {{ size.height}} {% else %} >{{ size.text }} {% endif %} </option> {%- endfor -%} </select> </span> <span id="share-embed-customize" class="hid"> <input type="text" class="yt-uix-form-input-text share-embed-size-custom-width" maxlength="4"> &times; <input type="text" class="yt-uix-form-input-text share-embed-size-custom-height" maxlength="4"> </span> </div> <ul class="share-embed-options"> {%- for option in yt.page.options -%} <li> <label> <input type="checkbox" class="share-embed-option" name="{{ option.name }}" {% if option.active == true %} checked {% endif %}> {{ option.text }} {% if option.url is defined %} [<a href="{{ option.url }}" target="_blank">?</a>] {% endif %} </label> </li> {%- endfor -%} <li> <p class="share-panel-embed-legal">{{ yt.page.strs.legalNotice }}<a href=\"https://developers.google.com/youtube/terms\">{{ yt.page.strs.legalNoticeLink }}</a></p> </li> </ul> </div> <button class="yt-uix-button yt-uix-button-size-default yt-uix-button-expander yt-uix-expander-head yt-uix-expander-collapsed-body yt-uix-gen204" type="button" onclick=";return false;"> <span class="yt-uix-button-content">{{ yt.msgs.showMore }}</span> </button> <button class="yt-uix-button yt-uix-button-size-default yt-uix-button-expander yt-uix-expander-head yt-uix-expander-body" type="button" onclick=";return false;"> <span class="yt-uix-button-content">{{ yt.msgs.showLess }}</span> </button> </div> {%- endapply -%} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import "common/uix/load_more_button.twig" as load_more %} {% from "common/feed/macros.twig" import notification_item as notification %} <body> <div id="yt-masthead-notifications-content" class="yt-uix-scroller" data-loaded="true" data-scroller-mousewheel-listener="" data-scroller-scroll-listener=""> <ol id="item-section-{{ generateRid() }}" class="item-section"> {% for section in yt.notifSections %} {% for item in section.multiPageMenuNotificationSectionRenderer.items %} {{ notification(item) }} {% endfor %} {% endfor %} </ol> {% set lastSection = yt.notifSections|last %} {% set lastSection = lastSection.multiPageMenuNotificationSectionRenderer.items %} {% set lastItem = lastSection|last %} {% if lastItem.continuationItemRenderer %} {% set this = lastItem.continuationItemRenderer %} {{ load_more.render(this.continuationEndpoint.getNotificationMenuEndpoint.ctoken, "item-section-327280", false, "feed_ajax") }} {% endif %} </div> </body>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% import "common/feed/macros.twig" as feed %} {% import "common/uix/load_more_button.twig" as load_more %} { "content_html": {%- apply json_encode|raw -%} {%- for item in yt.notifList -%} {{ feed.notification_item(item) }} {%- endfor -%} {%- endapply -%}{%- if yt.nextContinuation -%}, "load_more_widget_html": {{ load_more.render(yt.nextContinuation, "item-section-327280", false, "feed_ajax")|json_encode|raw }} {%- endif -%} }
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% extends "core.twig" %} {%- block title -%} Rehike Version - {{ parent() }} {%- endblock -%} {%- block body_class -%} {{ parent() }} rehike rehike-version-page {%- endblock -%} {%- block content -%} {# Early stylesheet #} <style> body.rehike-version-page { min-width: 850px; } .rehike-version-page .yt-base-gutter { min-width: 790px; } #rehike-version .header { border-bottom: 1px solid #e2e2e2; padding: 12px; height: 30px; } #rehike-version .header-left { float: left; } #rehike-version .header-left .header-text { margin-top: 3px; } #rehike-version .header-right { float: right; } #rehike-version-content { padding: 12px; } #rehike-brand-header { margin-bottom: 16px; } .rehike-brand-text, .rehike-brand-nightly { color: #333; font-weight: 500; font-size: 32px; } .rehike-brand-nightly { color: #62287b; font-weight: 700; transition: ease-in color 100ms; } .rehike-brand-nightly:hover { color: #7c339b; } .rehike-version-logo-content { display: inline-block; vertical-align: middle; margin-left: 20px; font-size: 32px; } .rehike-version-text { color: #565656; font-size: 16px; } .rehike-version-notice { border-top: 1px solid #e2e2e2; text-align: center; margin-top: 12px; padding-top: 12px; } .rehike-version-notice > * { margin: 0 auto; } .rehike-version-notice:first-child { margin-top: 0; padding-top: 0; border-top: none; } .rehike-version-notice .notice-header { width: 700px; font-size: 26px; color: #000; margin-bottom: 6px; } .rehike-version-notice .notice-description { display: block; width: 600px; font-size: 16px; color: #666; } #rehike-info-nightly { margin-top: 0px; border-top: 1px solid #e2e2e2; padding-top: 6px; } #rehike-info-nightly .commit-head { margin-top: 6px; line-height: 20px; /* temporary */ margin-left: 60px; } #rehike-info-nightly .commit-name { color: #000; } #rehike-info-nightly .commit-branch { color: #111; font-weight: 500; } #rehike-info-nightly .commit-branch::after { content: "•"; margin: 0px 4px; font-weight: 500; color: #000; } #rehike-info-nightly .commit-button { margin-top: 4px; } #rehike-version .commit-hash { font-family: monospace; background: #eee; border: 1px solid #ddd; padding: 1px 2px; display: inline; } #rehike-version .commit-name { font-size: 18px; } #rehike-version .commit-time { display: block; color: #333; } .rehike-version-mini-logo { background: url(/rehike/static/version/logo_small_grey.png); width: 89px; height: 30px; } .rehike-version-logo { background: url(/rehike/static/version/logo.png); width: 156px; height: 179px; vertical-align: middle; margin-left: 16px; } .branch-icon { background: url(/rehike/static/version/branch_icon.png); width: 42px; height: 38px; position: absolute; margin-top: 8px; margin-left: 5px; } #rehike-info-extra { border-top: 1px solid #e2e2e2; margin-bottom: 4px; } #rehike-info-extra h1 { margin-top: 6px; } .extra-info { border-collapse: separate; border-spacing: 8px 4px; margin-left: -8px; } </style> {% set page = yt.page %} <div id="rehike-version" class="yt-card"> <div class="header"> <span class="header-left"> <h1 class="header-text">{{ page.headingText }}</h1> </span> <span class="header-right"> <span class="rehike-version-mini-logo yt-sprite"></span> </span> </div> <div id="rehike-version-content"> {%- if page.brandName -%} <div id="rehike-brand-header"> {% apply spaceless %} <span class="rehike-version-logo yt-sprite"></span> <span class="rehike-version-logo-content"> <span class="rehike-brand-text">{{ page.brandName }}</span> {% endapply %} {% if page.nightlyNotice %} <span class="rehike-brand-nightly yt-uix-tooltip" title="{{ page.nightlyNotice.tooltip }}"> {{ page.nightlyNotice.text }}</span> {% endif %} <div class="rehike-version-text">{{ page.version }}</div> </span> </div> {%- endif -%} {%- if page.extraInfo -%} {% set info = page.extraInfo %} <div id="rehike-info-extra"> <h1>{{ info.headingText }}</h1> <table class="extra-info"> <tbody> {% for item in info.info %} <tr> <td> <b>{{ item[0] }}</b> </td> <td> {{ item[1] }} </td> </tr> {% endfor %} </tbody> </table> </div> {%- endif -%} {%- if page.nightlyInfo -%} {% set info = page.nightlyInfo %} <div id="rehike-info-nightly"> <h1>{{ info.headingText }}</h1> <div class="branch-icon yt-sprite"></div> <div class="commit-head"> {% apply spaceless %} <h3 class="commit-name">{{ info.commitName }}</h3> <span class="commit-branch">{{ info.branch }}</span> <span class="commit-hash yt-uix-tooltip" title="{{ info.fullCommitHash }}" data-full-hash="{{ info.fullCommitHash }}" data-tooltip-show-delay="600">{{ info.commitHash }}</span> <span class="commit-time">{{ info.commitDateTime }}</span> {% if info.ghButton %} <a href="{{ info.ghButton.endpoint }}" target="_blank" class="commit-button yt-uix-button yt-uix-button-default yt-uix-button-size-small">{{ info.ghButton.label }}</a> {% endif %} {% endapply %} </div> </div> {%- endif -%} {%- if page.failedNotice -%} {{ _self.notice(page.failedNotice, "rehike-version-failed-notice") }} {%- endif -%} {%- if page.nonGitNotice -%} {{ _self.notice(page.nonGitNotice, "rehike-version-non-git-notice") }} {%- endif -%} </div> </div> {%- endblock -%} {%- macro notice(data, id) -%} <div {% if id %} id="{{ id }}" {% endif %} class="rehike-version-notice" > <div class="notice-header">{{ data.text }}</div> {%- if data.description -%} <span class="notice-description">{{ data.description }}</span> {%- endif -%} </div> {%- endmacro -%}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% extends 'core.twig' %} {% set pageType = 'page-default oops-content' %} {%- block head_css -%} <link rel="stylesheet" href="//s.ytimg.com/yts/cssbin/www-error-vflvD9R0Z.css" name="www-error"> {% endblock %} {%- block alerts -%} <div class="yt-alert yt-alert-actionable yt-alert-error "> <div class="yt-alert-icon"> <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> </div> <div class="yt-alert-content" role="alert"> <span class="yt-alert-vertical-trick"></span> <div class="yt-alert-message"> {{ yt.errInfo.messagePreview }} </div> </div> <div class="yt-alert-buttons"> <button target="_blank" class="yt-uix-button yt-uix-button-alert-error yt-uix-button-size-small" id="fatal-more"><span class="yt-uix-button-content">More information</span></button> </div> </div> {% endblock %} {%- block content -%} <img src="//s.ytimg.com/yts/img/tv_stack-vflmeOpv_.png" alt="Sorry, something went wrong! Our tubes must be clogged." title="Sorry, something went wrong! Our tubes must be clogged."> <div id="fatal-dialog-template" class="hid"> <div id="fatal-dialog" class="yt-dialog preserve-players" data-player-ready-pubsub-key="589"> <div class="yt-dialog-base"> <span class="yt-dialog-align"></span> <div role="dialog" tabindex="0" class="yt-dialog-fg yt-uix-overlay-primary yt-uix-overlay"> <div class="yt-dialog-fg-content yt-dialog-show-content"> <div class="yt-dialog-content"> <div class="yt-dialog-overlay-content-container"> <div class="yt-dialog-header"> <h2 class="yt-dialog-title">Error log</h2> <button id="fatal-log-close" class="yt-uix-button yt-uix-button-empty yt-uix-button-has-icon yt-uix-button-opacity yt-uix-button-size-default yt-uix-tooltip" data-tooltip-text="Close" onclick=";return false;" title="Close" type="button"> <span class="yt-uix-button-icon-wrapper"> <span class="yt-sprite yt-uix-button-icon yt-uix-button-icon-close"> </span> </span> <span class="yt-uix-button-content"> </span> </button> </div> <div id="fatal-stack-trace"> <pre>{{ yt.errInfo.message }}</pre> </div> </div> </div> </div> <div class="yt-dialog-focus-trap" tabindex="0"></div> </div> </div> </div> </div> <style> #fatal-dialog .yt-dialog-header h2.yt-dialog-title { font-weight: 400; font-size: 20px; } #fatal-dialog .yt-dialog-header { position: relative; } #fatal-log-close { position: absolute; top: 10px; right: -10px; } #fatal-stack-trace { box-sizing: border-box; padding: 6px; overflow: scroll; border: 1px solid #ccc; overflow-x: auto; width: calc(100vw - 96px); height: calc(100vh - 112px); } #fatal-stack-trace > pre { white-space: pre-wrap; } </style> <script> ( function() { // I speedran this at 3 am forgive me (function(){ function create() { document.body.setAttribute("class", document.body.getAttribute("class") + " hide-players yt-dialog-active" ); var bgdiv = document.createElement("DIV"); bgdiv.setAttribute("id", "yt-dialog-bg"); bgdiv.setAttribute("class", "yt-dialog-bg"); bgdiv.setAttribute("style", "height: 100%; width: 100%; position: fixed;"); document.body.insertBefore(bgdiv, document.getElementById("footer-container").nextSibling ); document.getElementById("fatal-dialog-template").setAttribute("class", ""); } function kill() { document.body.setAttribute("class", document.body.getAttribute("class").replace(" hide-players yt-dialog-active", "") ); document.getElementById("yt-dialog-bg").outerHTML = ""; // ie < 9 no remove document.getElementById("fatal-dialog-template").setAttribute("class", "hid"); } document.getElementById("fatal-more").onclick = create; document.getElementById("fatal-log-close").onclick = kill; })(); } )(); </script> {% endblock %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{% macro render(data) %} {% from "common/uix/button.twig" import render as button %} <div id="rehike-security-notice-wrapper"> <div id="rehike-security-notice-lightbox" class="yt-dialog preserve-players" data-player-ready-pubsub-key="589"> <div class="yt-dialog-base"> <span class="yt-dialog-align"></span> <div role="dialog" tabindex="0" class="yt-dialog-fg yt-uix-overlay-primary yt-uix-overlay"> <div class="yt-dialog-fg-content yt-dialog-show-content"> <div class="yt-dialog-content"> <div class="yt-dialog-overlay-content-container"> <div class="yt-dialog-header"> <h2 class="yt-dialog-title">{{ data.title }}</h2> </div> <div id="rehike-security-notice-text"> {%- for run in data.message -%} {%- if run.navigationEndpoint -%} <a href="{{ rehike.getUrl(run) }}">{{ run.text }}</a> {%- else -%} {{ run.text }} {%- endif -%} {%- endfor -%} </div> {{ button(data.moreOptionsButton) }} <div class="yt-uix-overlay-actions"> {{ button(data.doNotShowAgainButton) }} {{ button(data.learnMoreButton) }} {{ button(data.dismissButton) }} </div> </div> </div> </div> <div class="yt-dialog-focus-trap" tabindex="0"></div> </div> </div> </div> </div> <style> #rehike-security-notice-lightbox .yt-dialog-fg { max-width: 640px; } #rehike-security-notice-ignore-button { display: none; } #rehike-security-notice-lightbox.more-options #rehike-security-notice-ignore-button { display: inline-block; } #rehike-security-notice-lightbox.more-options #rehike-security-notice-more-options-button { visibility: hidden; opacity: 0; pointer-events: none; } #rehike-security-notice-more-options-button { padding: 0; } #rehike-security-notice-lightbox .yt-uix-overlay-actions { margin-top: 5px; } </style> <script> // I speedran this at 3 am forgive me (function(){ function create() { document.body.setAttribute("class", document.body.getAttribute("class") + " hide-players yt-dialog-active" ); var bgdiv = document.createElement("DIV"); bgdiv.setAttribute("id", "yt-dialog-bg"); bgdiv.setAttribute("class", "yt-dialog-bg"); bgdiv.setAttribute("style", "height: 100%; width: 100%; position: fixed;"); document.body.insertBefore(bgdiv, document.getElementById("footer-container").nextSibling ); } function kill() { document.body.setAttribute("class", document.body.getAttribute("class").replace(" hide-players yt-dialog-active", "") ); document.getElementById("yt-dialog-bg").outerHTML = ""; // ie < 9 no remove document.getElementById("rehike-security-notice-wrapper").setAttribute("class", "hid"); } function expandMoreOptions() { document.getElementById("rehike-security-notice-lightbox").setAttribute("class", "more-options"); } function disableWarning() { var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest(); xhr.open('POST', '/rehike/update_config'); xhr.onload = function() {}; xhr.setRequestHeader('Content-Type', 'application/json') xhr.send(JSON.stringify({ "hidden.securityIgnoreWindowsServerRunningAsSystem": true })); kill(); } create(); document.getElementById("rehike-security-notice-dismiss-button").onclick = kill; document.getElementById("rehike-security-notice-more-options-button").onclick = expandMoreOptions; document.getElementById("rehike-security-notice-ignore-button").onclick = disableWarning; })(); </script> {% endmacro %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the base HTML insertion for the Rehike debugger. @author Taniko Yamamoto <[email protected]> @author The Rehike Maintainers #} {% if not yt.spf %} {% set rebug = rehikeDebugger %} <div id="rebug-main" class="{{ rebug.condensed ? "rebug-condensed" }}"> <script> var _rebugcfg = _rebugcfg || {}; _rebugcfg.globalWalker = _rebugcfg.globalWalker || {}; _rebugcfg.globalWalker.data = _rebugcfg.globalWalker.data || {}; _rebugcfg.globalWalker.attr = _rebugcfg.globalWalker.attr || {}; </script> <script> _rebugcfg.CONDENSED = {{ rebug.condensed ? "true" : "false" }}; _rebugcfg.HISTORY_RAW_UPDATE_TAB_IDS = {{ rebug.getJsHistoryTabIds()|json_encode|raw }}; </script> <style> {% include "rehike/debugger/css/main.css.twig" %} </style> {%- if rebug.openButton -%} {% include "rehike/debugger/open_button.twig" %} {%- endif -%} {% import "rehike/debugger/lightbox_main.twig" as main %} <div id="rebug-lightbox-container"> <div id="rebug-lightbox"> {{ main.dialog(rebug.dialog) }} </div> </div> <script> {% include "rehike/debugger/js/main.js.twig" %} </script> {# Global walker config #} {% set globalAttr = rebug.jsAttrs %} <script async="true"> _rebugcfg.globalWalker.data["yt"] = {{ yt|json_encode|raw }}; _rebugcfg.globalWalker.attr["yt"] = {{ globalAttr|json_encode|raw }}; </script> </div> {% endif %}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the core lightbox (dialog) macros for the Rehike debugger. @author Taniko Yamamoto <[email protected]> @author The Rehike Maintainers #} {%- macro dialog(data) -%} {# PATCH (dcooper): **This cannot have the yt-dialog class**, as it causes a bug in common.js at yt.ui.Dialog.prototype.isAnyDialogDisplayed_() --> goog.dom.getElementsByClass("yt-dialog") This bug breaks standard closing behaviour as implemented by YouTube's source code. The check essentially recognises the Rebug dialog container as a parent dialog to any further open dialogs, such as the subscription preferences one, and, as such, prevents the dialog from fully closing. This leaves the background sitting behind, with all references disposed of by the UIX Overlay class upon its understanding that the bound dialog had closed properly, therefore leaving it to the user to manually remove the dialog background scrim using Inspect Element or refreshing the page. Since there are no stylistic drawbacks to this change, I've opted to simply update Rebug to remove this class and completely fix the behaviour, which has been a thorn in the side of Rehike developers and users alike for months now. #} <div class="rebug-base-dialog"> <div class="yt-dialog-base"> <span class="yt-dialog-align"></span> <div role="dialog" tabindex="0" class="yt-dialog-fg yt-uix-overlay-primary yt-uix-overlay"> <div class="yt-dialog-fg-content yt-dialog-show-content"> <div class="yt-dialog-content"> {{ _self.content(data) }} </div> </div> <div class="yt-dialog-focus-trap" tabindex="0"></div> </div> </div> </div> {%- endmacro -%} {%- macro content(data) -%} {{ _self.dialog_header(data.header) }} <div class="rebug-main-content"> {{ not rehikeDebugger.condensed ? _self.dialog_tabs_switcher(data.tabs) }} {{ _self.dialog_tabs_container(data.tabs) }} </div> {%- endmacro -%} {%- macro dialog_header(data) -%} <div class="yt-dialog-header"> {%- if data.title -%} <h2 class="yt-dialog-title"> {{ data.title }} {%- if data.helpLink -%} <a id="rebug-help-link" href="{{ data.helpLink.href }}" target="_blank">{{ data.helpLink.text }}</a> {%- endif -%} </h2> {%- endif -%} {%- if data.historyButton -%} {% from "/common/uix/button.twig" import render as button %} {{ button(data.historyButton) }} {%- endif -%} {%- if data.closeButton -%} {% from "/common/uix/button.twig" import render as button %} <div class="rebug-close-button-wrapper"> {{ button(data.closeButton) }} </div> {%- endif -%} </div> {%- endmacro -%} {%- macro dialog_tabs_switcher(tabs) -%} <div id="rebug-tabs-switcher"> {%- for tab in tabs -%} <div class="rebug-tab {{ tab.selected ? "rebug-tab-selected" }}" data-tab-target="{{ tab.id }}"> {{ tab.title }} </div> {%- endfor -%} </div> {%- endmacro -%} {%- macro dialog_tabs_container(tabs) -%} <div id="rebug-tabbed-content-wrapper"> {%- for tab in tabs -%} {{ _self.dialog_tab_content(tab) }} {%- endfor -%} </div> {%- endmacro -%} {%- macro dialog_tab_content(data) -%} <div id="rebug-tab-content-{{ data.id }}" class="rebug-tab-content {{ data.selected ? "rebug-tab-selected" }}" data-tab-id="{{ data.id }}"> {{ _self.rich_content_renderer(data.content.richDebuggerRenderer) }} </div> {%- endmacro -%} {%- macro error_renderer(data) -%} <div class="rebug-error-renderer error-{{ data.type }} rebug-expander rebug-expander-collapsed"> <span class="icon error-icon-{{ data.type }} yt-sprite"></span> <span class="rebug-error-renderer-content"> <b>{{ data.errorTypeText }}</b><span class="colon">:</span> <span class="collapsed-display"> {# File has to come first for the CSS to display properly. #} <span class="file"> {{ data.shortFile }}:{{ data.line }} </span> <span class="message"> {{ data.message }} </span> </span> <span class="expanded-display"> <div class="message"> {{ data.message }} </div> <div class="file"> {{ data.file }}:{{ data.line }} </div> </span> </span> </div> {%- endmacro -%} {%- macro nothing_to_see_renderer(data) -%} <div class="nothing-to-see-renderer"> <div class="text">{{ data.text }}</div> </div> {%- endmacro -%} {%- macro loading_renderer() -%} {% from "core/spinner.twig" import render as spinner %} <div class="loading"> {{ spinner("Loading...") }} </div> {%- endmacro -%} {%- macro rich_content_renderer(data) -%} {%- for item in data -%} {%- if item.heading -%} <h1>{{ item.heading.text }}</h1> {%- elseif item.subheading -%} <h2>{{ item.subheading.text }}</h2> {%- elseif item.simpleText -%} {{ item.simpleText.text }} {%- elseif item.code -%} <code style="white-space:pre">{{ item.code.text }}</code> {%- elseif item.errorRenderer -%} {{ _self.error_renderer(item.errorRenderer) }} {%- elseif item.nothingToSeeRenderer -%} {{ _self.nothing_to_see_renderer(item.nothingToSeeRenderer) }} {%- elseif item.globalWalkerContainer -%} {% import "rehike/debugger/global_walker.twig" as global_walker %} {{ global_walker.container(item.globalWalkerContainer) }} {%- elseif item.loadingRenderer -%} {{ _self.loading_renderer() }} {%- endif -%} {%- endfor -%} {%- endmacro -%} {{ _self.dialog(rehikeDebugger.dialog) }} </div>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{# Implements the Rehike debugger popup. @author Taniko Yamamoto <[email protected]> @author The Rehike Maintainers #} {% from "common/uix/button.twig" import render as button %} <div id="rebug-open-button-container"> {{ button(rehikeDebugger.openButton, null, "rebug-open-button") }} </div>
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }
{%- macro container(data) -%} {% from "rehike/debugger/lightbox_main.twig" import loading_renderer %} <div class="global-walker-container"> {{ loading_renderer() }} <div class="items"></div> </div> {%- endmacro -%}
{ "repo_name": "Rehike/Rehike", "stars": "81", "repo_language": "PHP", "file_name": "config.php", "mime_type": "text/x-php" }