forked from ppy/osu-web
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into post-preview-ts
- Loading branch information
Showing
540 changed files
with
6,097 additions
and
2,338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,6 +166,7 @@ CLIENT_CHECK_VERSION=false | |
# SEARCH_MINIMUM_LENGTH=2 | ||
|
||
# BEATMAPS_DIFFICULTY_CACHE_SERVER_URL=http://localhost:5001 | ||
# BEATMAPS_OWNERS_MAX=10 | ||
# BEATMAPSET_DISCUSSION_KUDOSU_PER_USER=10 | ||
# BEATMAPSET_GUEST_ADVANCED_SEARCH=0 | ||
# BEATMAPSET_MAXIMUM_DISQUALIFIED_RANK_PENALTY_DAYS=7 | ||
|
@@ -189,21 +190,6 @@ CLIENT_CHECK_VERSION=false | |
# ES_CLIENT_CONNECT_TIMEOUT=0.5 | ||
# ES_SEARCH_TIMEOUT=5s | ||
|
||
# TOURNAMENT_BANNER_CURRENT_ID= | ||
# Image path/url for tournament supporter banner. | ||
# Will be appended with country abbreviation and `.jpg`. `@2x` version is also required (prepended before `.jpg`). | ||
# Example: | ||
# prefix: https://assets.ppy.sh/tournament-banners/official/twc2018_ | ||
# image path: https://assets.ppy.sh/tournament-banners/official/twc2018_JP.jpg | ||
# image path @2x: https://assets.ppy.sh/tournament-banners/official/[email protected] | ||
# TOURNAMENT_BANNER_CURRENT_PREFIX= | ||
|
||
# TOURNAMENT_BANNER_PREVIOUS_ID= | ||
# Same as `_CURRENT_PREFIX`. | ||
# TOURNAMENT_BANNER_PREVIOUS_PREFIX= | ||
# Winning country code | ||
# TOURNAMENT_BANNER_PREVIOUS_WINNER_ID= | ||
|
||
# {prefix}{filename}.png with {filename} the achievement slug as stored in database. | ||
# USER_ACHIEVEMENT_ICON_PREFIX=https://assets.ppy.sh/user-achievements/ | ||
|
||
|
@@ -244,6 +230,7 @@ CLIENT_CHECK_VERSION=false | |
# USER_PROFILE_SCORES_NOTICE= | ||
|
||
# MULTIPLAYER_MAX_ATTEMPTS_LIMIT=128 | ||
# MULTIPLAYER_ROOM_CLOSE_GRACE_PERIOD_MINUTES=5 | ||
|
||
# NOTIFICATION_QUEUE=notification | ||
# NOTIFICATION_REDIS_HOST=127.0.0.1 | ||
|
@@ -303,6 +290,7 @@ CLIENT_CHECK_VERSION=false | |
# SCORES_EXPERIMENTAL_RANK_AS_EXTRA=false | ||
# SCORES_PROCESSING_QUEUE=osu-queue:score-statistics | ||
# SCORES_SUBMISSION_ENABLED=1 | ||
# SCORE_INDEX_MAX_ID_DISTANCE=10_000_000 | ||
|
||
# BANCHO_BOT_USER_ID= | ||
|
||
|
@@ -332,3 +320,6 @@ CLIENT_CHECK_VERSION=false | |
|
||
# COUNTRY_PERFORMANCE_USER_COUNT=1000 | ||
# COUNTRY_PERFORMANCE_WEIGHTING_FACTOR=0.99 | ||
|
||
# TAGS_CACHE_DURATION=60 | ||
# BEATMAP_TAGS_CACHE_DURATION=60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\Beatmap; | ||
use Illuminate\Console\Command; | ||
|
||
class BeatmapsMigrateOwners extends Command | ||
{ | ||
protected $signature = 'beatmaps:migrate-owners'; | ||
|
||
protected $description = 'Migrates beatmap owners to new table.'; | ||
|
||
public function handle() | ||
{ | ||
$progress = $this->output->createProgressBar(); | ||
|
||
Beatmap::chunkById(1000, function ($beatmaps) use ($progress) { | ||
foreach ($beatmaps as $beatmap) { | ||
$beatmap->beatmapOwners()->firstOrCreate(['user_id' => $beatmap->user_id]); | ||
$progress->advance(); | ||
} | ||
}); | ||
|
||
$progress->finish(); | ||
$this->line(''); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Beatmap; | ||
use App\Models\BeatmapTag; | ||
use App\Models\Tag; | ||
|
||
class BeatmapTagsController extends Controller | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->middleware('auth', [ | ||
'only' => [ | ||
'store', | ||
'destroy', | ||
], | ||
]); | ||
|
||
$this->middleware('require-scopes:public', ['only' => 'index']); | ||
} | ||
|
||
public function index($beatmapId) | ||
{ | ||
$topBeatmapTags = cache_remember_mutexed( | ||
"beatmap_tags:{$beatmapId}", | ||
$GLOBALS['cfg']['osu']['tags']['beatmap_tags_cache_duration'], | ||
[], | ||
fn () => Tag::topTags($beatmapId), | ||
); | ||
|
||
return [ | ||
'beatmap_tags' => $topBeatmapTags, | ||
]; | ||
} | ||
|
||
public function destroy($beatmapId, $tagId) | ||
{ | ||
BeatmapTag::where('tag_id', $tagId) | ||
->where('beatmap_id', $beatmapId) | ||
->where('user_id', \Auth::user()->getKey()) | ||
->delete(); | ||
|
||
return response()->noContent(); | ||
} | ||
|
||
public function store($beatmapId) | ||
{ | ||
$tagId = get_int(request('tag_id')); | ||
|
||
$beatmap = Beatmap::findOrFail($beatmapId); | ||
priv_check('BeatmapTagStore', $beatmap)->ensureCan(); | ||
|
||
$tag = Tag::findOrFail($tagId); | ||
|
||
$user = \Auth::user(); | ||
|
||
$tag | ||
->beatmapTags() | ||
->firstOrCreate(['beatmap_id' => $beatmapId, 'user_id' => $user->getKey()]); | ||
|
||
return response()->noContent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.