the browser-facing portion of osu!
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add youtube embed support for changelog builds

nanaya 9474dcb7 c1b30099

+64 -35
+2 -2
app/Libraries/BBCodeFromDB.php
··· 341 341 342 342 public function parseYoutube($text) 343 343 { 344 - $text = str_replace("[youtube:{$this->uid}]", "<div class='bbcode__video-box'><div class='bbcode__video'><iframe src='https://www.youtube.com/embed/", $text); 345 - $text = str_replace("[/youtube:{$this->uid}]", "?rel=0' frameborder='0' allowfullscreen></iframe></div></div>", $text); 344 + $text = str_replace("[youtube:{$this->uid}]", "<div class='bbcode__video-box'><div class='u-embed-wide'><iframe src='https://www.youtube.com/embed/", $text); 345 + $text = str_replace("[/youtube:{$this->uid}]", "?rel=0' allowfullscreen></iframe></div></div>", $text); 346 346 347 347 return $text; 348 348 }
+4 -3
app/Transformers/BuildTransformer.php
··· 23 23 public function transform(Build $build) 24 24 { 25 25 return [ 26 + 'created_at' => json_time($build->date), 27 + 'display_version' => $build->displayVersion(), 26 28 'id' => $build->getKey(), 29 + 'users' => $build->users ?? 0, 27 30 'version' => $build->version, 28 - 'display_version' => $build->displayVersion(), 29 - 'users' => $build->users ?? 0, 30 - 'created_at' => json_time($build->date), 31 + 'youtube_id' => $build->youtube_id, 31 32 ]; 32 33 } 33 34
+33
database/migrations/2023_06_15_090320_add_youtube_id_to_builds.php
··· 1 + <?php 2 + 3 + // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4 + // See the LICENCE file in the repository root for full licence text. 5 + 6 + declare(strict_types=1); 7 + 8 + use Illuminate\Database\Migrations\Migration; 9 + use Illuminate\Database\Schema\Blueprint; 10 + use Illuminate\Support\Facades\Schema; 11 + 12 + return new class extends Migration 13 + { 14 + /** 15 + * Run the migrations. 16 + */ 17 + public function up(): void 18 + { 19 + Schema::table('osu_builds', function (Blueprint $table) { 20 + $table->string('youtube_id')->nullable(); 21 + }); 22 + } 23 + 24 + /** 25 + * Reverse the migrations. 26 + */ 27 + public function down(): void 28 + { 29 + Schema::table('osu_builds', function (Blueprint $table) { 30 + $table->dropColumn('youtube_id'); 31 + }); 32 + } 33 + };
-13
resources/css/bbcode.less
··· 127 127 &__video-box { 128 128 max-width: 425px; 129 129 } 130 - 131 - &__video { 132 - position: relative; 133 - padding-bottom: 75%; 134 - 135 - & iframe { 136 - position: absolute; 137 - left: 0; 138 - right: 0; 139 - width: 100%; 140 - height: 100%; 141 - } 142 - } 143 130 }
-1
resources/css/bem-index.less
··· 136 136 @import "bem/discrete-bar"; 137 137 @import "bem/download-page"; 138 138 @import "bem/download-page-header"; 139 - @import "bem/download-page-video"; 140 139 @import "bem/estimate-min-lines"; 141 140 @import "bem/fake-bold"; 142 141 @import "bem/fancy-graph";
+5
resources/css/bem/build.less
··· 47 47 opacity: 0.5; 48 48 } 49 49 } 50 + 51 + &__video { 52 + margin-top: 20px; 53 + max-width: 100%; 54 + } 50 55 }
-13
resources/css/bem/download-page-video.less
··· 1 - // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 2 - // See the LICENCE file in the repository root for full licence text. 3 - 4 - .download-page-video { 5 - // this trick maintains the video's aspect ratio while resizing 6 - // see: http://alistapart.com/article/creating-intrinsic-ratios-for-video 7 - padding-bottom: 56.25%; /* 16:9 */ 8 - position: relative; 9 - 10 - iframe { 11 - .full-size(); 12 - } 13 - }
+11
resources/css/utilities.less
··· 46 46 overflow: hidden !important; 47 47 } 48 48 49 + .u-embed-wide { 50 + // this trick maintains the video's aspect ratio while resizing 51 + // see: http://alistapart.com/article/creating-intrinsic-ratios-for-video 52 + padding-bottom: 56.25%; /* 16:9 */ 53 + position: relative; 54 + 55 + > iframe { 56 + .full-size(); 57 + } 58 + } 59 + 49 60 .u-fancy-scrollbar { 50 61 .fancy-scrollbar(); 51 62 }
+1 -1
resources/js/changelog-build/main.coffee
··· 36 36 className: 'builds__group', 37 37 div 38 38 className: 'builds__item' 39 - el Build, build: @props.build, showDate: true, modifiers: ['build'] 39 + el Build, build: @props.build, showDate: true, showVideo: true, modifiers: ['build'] 40 40 41 41 div className: 'page-nav', 42 42 div className: 'page-nav__item page-nav__item--left',
+6 -1
resources/js/components/build.coffee
··· 2 2 # See the LICENCE file in the repository root for full licence text. 3 3 4 4 import * as React from 'react' 5 - import { a, div, i, span } from 'react-dom-factories' 5 + import { a, div, i, iframe, span } from 'react-dom-factories' 6 6 import { classWithModifiers } from 'utils/css' 7 7 import { changelogBuild } from 'utils/url' 8 8 import { ChangelogEntry } from './changelog-entry' ··· 31 31 if @props.showDate ? false 32 32 div className: 'build__date', moment(@props.build.created_at).format('LL') 33 33 34 + if @props.build.youtube_id? && (@props.showVideo ? false) 35 + div className: 'build__video u-embed-wide', 36 + iframe 37 + allowFullScreen: true 38 + src: "https://www.youtube.com/embed/#{@props.build.youtube_id}?rel=0" 34 39 for category in categories 35 40 div 36 41 key: category
+1
resources/js/interfaces/changelog-build.ts
··· 6 6 name: string; 7 7 }; 8 8 version: string; 9 + youtube_id: string; 9 10 }
+1 -1
resources/views/home/download.blade.php
··· 145 145 <h2 class="title title--page-extra"> 146 146 {{ osu_trans('home.download.video-guide') }} 147 147 </h2> 148 - <div class="download-page-video"> 148 + <div class="u-embed-wide"> 149 149 <iframe 150 150 src="https://youtube.com/embed/videoseries?list={{ config('osu.urls.youtube-tutorial-playlist') }}" 151 151 ></iframe>