+ Submit Your Appeal +
++ Please fill-in all fields with appropriate detail. Appeals with false or insufficient detail will likely be denied. +
+diff --git a/.github/actions/tasks/install-composer-deps/action.yml b/.github/actions/install-composer-deps/action.yml similarity index 100% rename from .github/actions/tasks/install-composer-deps/action.yml rename to .github/actions/install-composer-deps/action.yml diff --git a/.github/actions/tasks/install-npm-deps/action.yml b/.github/actions/install-npm-deps/action.yml similarity index 100% rename from .github/actions/tasks/install-npm-deps/action.yml rename to .github/actions/install-npm-deps/action.yml diff --git a/.github/actions/tasks/install-php/action.yml b/.github/actions/install-php/action.yml similarity index 100% rename from .github/actions/tasks/install-php/action.yml rename to .github/actions/install-php/action.yml diff --git a/.github/actions/recipes/deploy/action.yml b/.github/actions/recipes/deploy/action.yml deleted file mode 100644 index 4b3703bbf..000000000 --- a/.github/actions/recipes/deploy/action.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Deploy -description: Deploys the current branch to the web server - -inputs: - keep-releases: - description: "Max number of releases stored (for rollback purposes)" - required: true - branch: - description: "Name of git branch to deploy" - required: true - -runs: - using: composite - steps: - - name: Install PHP - uses: ./.github/actions/tasks/install-php - - - name: Install Composer dependencies - shell: bash - run: composer install - - - name: Deploy - uses: deployphp/action@6242095e7207facf115ac4439760356bc52760ac - env: - DEPLOY_BRANCH: ${{ inputs.branch }} - DEPLOY_HOST: ${{ env.DEPLOY_HOST }} - DEPLOY_USER: ${{ env.DEPLOY_USER }} - DEPLOY_PATH: ${{ env.DEPLOY_PATH }} - DEPLOY_DISCORD_CHANNEL_ID: ${{ env.DEPLOY_DISCORD_CHANNEL_ID }} - DEPLOY_DISCORD_CHANNEL_TOKEN: ${{ env.DEPLOY_DISCORD_CHANNEL_TOKEN }} - with: - private-key: ${{ env.DEPLOY_PRIVATE_KEY }} - dep: "deploy -o keep_releases=${{ inputs.keep-releases }}" diff --git a/.github/workflows/__deploy.yml b/.github/workflows/__deploy.yml new file mode 100644 index 000000000..463a7fc0f --- /dev/null +++ b/.github/workflows/__deploy.yml @@ -0,0 +1,41 @@ +name: Deploy + +on: + workflow_call: + inputs: + branch: + required: true + type: string + keep-releases: + required: true + type: number + environment: + required: true + type: string + +jobs: + deploy: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + + - name: Install PHP + uses: ./.github/actions/install-php + + - name: Install Composer dependencies + run: composer install + + - name: Deploy ${{ inputs.branch }} branch + uses: deployphp/action@6242095e7207facf115ac4439760356bc52760ac + env: + DEPLOY_BRANCH: ${{ inputs.branch }} + DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} + DEPLOY_USER: ${{ secrets.DEPLOY_USER }} + DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} + DEPLOY_DISCORD_CHANNEL_ID: ${{ secrets.DEPLOY_DISCORD_CHANNEL_ID }} + DEPLOY_DISCORD_CHANNEL_TOKEN: ${{ secrets.DEPLOY_DISCORD_CHANNEL_TOKEN }} + with: + private-key: ${{ secrets.DEPLOY_PRIVATE_KEY }} + dep: "deploy -o keep_releases=${{ inputs.keep-releases }}" + diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index a30a766bc..23ea48daf 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -12,21 +12,10 @@ concurrency: jobs: deploy: - runs-on: ubuntu-latest - environment: dev - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - - name: Deploy dev branch - uses: ./.github/actions/recipes/deploy - env: - DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} - DEPLOY_USER: ${{ secrets.DEPLOY_USER }} - DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} - DEPLOY_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }} - DEPLOY_DISCORD_CHANNEL_ID: ${{ secrets.DEPLOY_DISCORD_CHANNEL_ID }} - DEPLOY_DISCORD_CHANNEL_TOKEN: ${{ secrets.DEPLOY_DISCORD_CHANNEL_TOKEN }} - with: - branch: main - keep-releases: 3 + uses: ./.github/workflows/__deploy.yml + secrets: inherit + with: + environment: dev + branch: main + keep-releases: 3 diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index f06a6fdf6..914d74252 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -25,23 +25,12 @@ concurrency: jobs: deploy: - runs-on: ubuntu-latest - environment: production - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - - name: Deploy release branch - uses: ./.github/actions/recipes/deploy - env: - DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} - DEPLOY_USER: ${{ secrets.DEPLOY_USER }} - DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} - DEPLOY_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }} - DEPLOY_DISCORD_CHANNEL_ID: ${{ secrets.DEPLOY_DISCORD_CHANNEL_ID }} - DEPLOY_DISCORD_CHANNEL_TOKEN: ${{ secrets.DEPLOY_DISCORD_CHANNEL_TOKEN }} - with: - branch: release - keep-releases: 5 + uses: ./.github/workflows/__deploy.yml + secrets: inherit + with: + environment: production + branch: release + keep-releases: 5 tag: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d41942a97..82c67b095 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,6 @@ concurrency: jobs: unit-test: runs-on: ubuntu-latest - services: mariadb: image: mariadb:11.0.5 @@ -26,21 +25,20 @@ jobs: --health-interval=10s --health-timeout=5s --health-retries=3 - steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Install PHP - uses: ./.github/actions/tasks/install-php + uses: ./.github/actions/install-php - name: Install Composer dependencies - uses: ./.github/actions/tasks/install-composer-deps + uses: ./.github/actions/install-composer-deps - name: Prepare .env file run: cp .env.ci .env - name: Install npm dependencies - uses: ./.github/actions/tasks/install-npm-deps + uses: ./.github/actions/install-npm-deps - name: Calculate front-end asset hash id: get-assets-cache diff --git a/README.md b/README.md index 462e90edf..f0ed8b58d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@
--- diff --git a/app/Core/Domains/Environment/Environment.php b/app/Core/Domains/Environment/Environment.php index 2ae64d7cf..7376aca79 100644 --- a/app/Core/Domains/Environment/Environment.php +++ b/app/Core/Domains/Environment/Environment.php @@ -4,9 +4,7 @@ final class Environment { - private function __construct() - { - } + private function __construct() {} public static function getLevel(): EnvironmentLevel { diff --git a/app/Core/Domains/Mojang/Api/MojangPlayerApi.php b/app/Core/Domains/Mojang/Api/MojangPlayerApi.php deleted file mode 100644 index eaa0c5a5d..000000000 --- a/app/Core/Domains/Mojang/Api/MojangPlayerApi.php +++ /dev/null @@ -1,183 +0,0 @@ -client->request('GET', 'https://api.mojang.com/users/profiles/minecraft/'.$name, [ - 'query' => [ - 'at' => $time, - ], - ]); - } catch (ClientException $e) { - if ($e->getCode() === 429) { - throw new TooManyRequestsException('rate_limited', 'Too many requests sent to the Mojang API'); - } - throw $e; - } - - // if no player exists, return null - if ($response->getStatusCode() === 204) { - return null; - } - - $body = json_decode($response->getBody()); - - return new MojangPlayer( - $body->id, - $body->name, - isset($body->legacy), - isset($body->demo) - ); - } - - /** - * Retrieves the UUID for the person who first registered - * the given name, regardless of who currently owns it now. - * - * @param $name - * @return MojangPlayer - * @throws TooManyRequestsException - */ - public function getOriginalOwnerUuidOf(string $name): ?MojangPlayer - { - return $this->getUuidOf($name, 0); - } - - /** - * Retrieves UUIDs for every name in the given array, in a - * single lookup. - * - * The API only allows a max of 10 names per lookup. - * - * @return MinecraftPlayer[] - * @throws TooManyRequestsException - */ - public function getUuidBatchOf(array $names): ?array - { - if (count($names) === 0 || count($names) > 10) { - throw new \Exception('Batch must contain between 1 and 10 names to search'); - } - - // Just in case a dictionary was given to us, use only the values - $names = array_values($names); - - // Strip empty names from the batch or else the API will return an error - $names = array_filter($names, fn ($name) => ! empty($name)); - - $response = null; - try { - $response = $this->client->request('POST', 'https://api.mojang.com/profiles/minecraft', [ - 'json' => $names, - ]); - } catch (ClientException $e) { - if ($e->getCode() === 429) { - throw new TooManyRequestsException('rate_limited', 'Too many requests sent to the Mojang API'); - } - throw $e; - } - - $data = json_decode($response->getBody()); - if (count($data) === 0) { - return []; - } - - return collect($data) - ->keyBy(function ($player) { - return $player->name; - }) - ->map(function ($player) { - return new MojangPlayer( - str_replace('-', '', $player->id), - $player->name, - isset($body->legacy), - isset($body->demo) - ); - }) - ->toArray(); - } - - /** - * Returns all the usernames this user has used in the past and - * the one they are using currently. - * - * The UUID must be given without hyphens. - * - * @param $uuid - * @return array|null - * @throws TooManyRequestsException - */ - public function getNameHistoryOf($uuid): ?MojangPlayerNameHistory - { - $response = null; - try { - $response = $this->client->request('GET', 'https://api.mojang.com/user/profiles/'.$uuid.'/names'); - } catch (ClientException $e) { - if ($e->getCode() === 429) { - throw new TooManyRequestsException('rate_limited', 'Too many requests sent to the Mojang API'); - } - throw $e; - } - - // if no player exists, return null - if ($response->getStatusCode() === 204) { - return null; - } - - return new MojangPlayerNameHistory( - json_decode($response->getBody()) - ); - } - - /** - * Returns all the usernames this user has used in the past and - * the one they are using currently. - * - * Performs two lookups as the original API can only be queried using an UUID. - * - * @param $name - * @return array|null - * @throws TooManyRequestsException - */ - public function getNameHistoryByNameOf($name): ?MojangPlayerNameHistory - { - $player = $this->getUuidOf($name); - if ($player !== null) { - return $this->getNameHistoryOf($player->getUuid()); - } - - return null; - } -} diff --git a/app/Core/Domains/Mojang/Data/MojangPlayer.php b/app/Core/Domains/Mojang/Data/MojangPlayer.php deleted file mode 100644 index eb2e31192..000000000 --- a/app/Core/Domains/Mojang/Data/MojangPlayer.php +++ /dev/null @@ -1,46 +0,0 @@ -uuid; - } - - /** - * Player's in-game name. - */ - public function getAlias(): string - { - return $this->alias; - } - - /** - * Whether the account has not migrated to a Mojang account. - */ - public function isLegacyAccount(): bool - { - return $this->isLegacyAccount; - } - - /** - * Whether the account is a free account (ie. unpaid). - */ - public function isDemoAccount(): bool - { - return $this->isDemoAccount; - } -} diff --git a/app/Core/Domains/Mojang/Data/MojangPlayerNameChange.php b/app/Core/Domains/Mojang/Data/MojangPlayerNameChange.php deleted file mode 100644 index 126549de8..000000000 --- a/app/Core/Domains/Mojang/Data/MojangPlayerNameChange.php +++ /dev/null @@ -1,61 +0,0 @@ -alias = $alias; - $this->changedToAt = $changedToAt; - $this->isCurrent = $isCurrent; - } - - public function getAlias(): string - { - return $this->alias; - } - - public function getChangeDate(): ?int - { - if ($this->changedToAt !== null) { - return $this->changedToAt / 1000; - } - - return null; - } - - public function isCurrentAlias(): bool - { - return $this->isCurrent; - } - - public function isOriginalAlias(): bool - { - return $this->changedToAt === null; - } -} diff --git a/app/Core/Domains/Mojang/Data/MojangPlayerNameHistory.php b/app/Core/Domains/Mojang/Data/MojangPlayerNameHistory.php deleted file mode 100644 index 2b191c0ad..000000000 --- a/app/Core/Domains/Mojang/Data/MojangPlayerNameHistory.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ - private $nameChanges = []; - - public function __construct(array $nameChanges) - { - for ($i = 0; $i < count($nameChanges); $i++) { - $nameChange = $nameChanges[$i]; - $this->nameChanges[] = new MojangPlayerNameChange( - $nameChange->name, - property_exists($nameChange, 'changedToAt') ? $nameChange->changedToAt : null, - $i + 1 === count($nameChanges) - ); - } - } - - /** - * @return array| Status | -Reason | -Banned By | -Banned At | -Expires | -
|---|---|---|---|---|
| {{ $ban->isActive() ? 'Active' : 'Removed' }} | -{{ $ban->reason ?? 'No Reason Given' }} | -
- @if($ban->banner_player_id != null && !empty($ban->bannerPlayer->alias))
- |
- - {{ $ban->created_at->format('j M Y H:i') }} - | -- {{ $ban->expires_at?->format('j M Y H:i') ?? 'Never' }} - | -
- If you have been wrongfully banned, please post your request, and we will investigate the matter. Alternatively, if you are simply seeking a second chance, you may plead your case for consideration. -
-- Please fill out all fields honestly. -
---@endsection - - diff --git a/resources/views/front/pages/ban-appeal/_username-lookup.blade.php b/resources/views/front/pages/ban-appeal/_username-lookup.blade.php deleted file mode 100644 index dff949e0e..000000000 --- a/resources/views/front/pages/ban-appeal/_username-lookup.blade.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/resources/views/front/pages/ban-appeal/create.blade.php b/resources/views/front/pages/ban-appeal/create.blade.php deleted file mode 100644 index f13ed325e..000000000 --- a/resources/views/front/pages/ban-appeal/create.blade.php +++ /dev/null @@ -1,60 +0,0 @@ -@extends('front.pages.ban-appeal._layout-form') - -@section('col-2') -WARNING
- Abuse of the ban appeal system will result in your access being revoked. -
Below is a list of your current ban and any previous bans.
- @include('front.pages.ban-appeal._ban-history') -+ Please fill-in all fields with appropriate detail. Appeals with false or insufficient detail will likely be denied. +
++ If you have been wrongfully banned, please let us know so we can investigate the matter. + Alternatively, if you are seeking a second chance, you may plead your case for consideration. +
+If the ban doesn't appear above, try searching manually. Enter your current Minecraft - username.
- - @include('front.pages.ban-appeal._username-lookup') -To appeal a ban, sign in to your PCB account. Alternatively, you may appeal as a guest.
- Sign In -To start your appeal, enter the current username of your Minecraft account
- - @include('front.pages.ban-appeal._username-lookup') -+ Find and select the ban you wish to appeal. If you have trouble locating it, you can still fill out the form manually. +
+| Player Name | +Reason | +Ban Date | ++ |
|---|---|---|---|
|
+ |
+ + {{ $ban->reason ?? "-" }} + | ++ {{ $ban->created_at->format('j M Y H:i') }} + | +
+ |
+
- View the status of your ban appeal. You will be emailed with any updates. -
-- Please note that you cannot submit another appeal until this appeal has been resolved. -
-@endsection +@section('body') +Your appeal has been considered, and your ban has been reduced to a temporary ban.
-You will be unbanned on {{ $banAppeal->gamePlayerBan->expires_at }}.
+ + - @break - @case(\App\Domains\BanAppeals\Data\BanAppealStatus::DENIED) -