Compare commits

..

No commits in common. "dev" and "master" have entirely different histories.
dev ... master

154 changed files with 18840 additions and 18147 deletions

View File

@ -1,45 +0,0 @@
APP_DEBUG=true
APP_ENV=development
APP_FALLBACK_LOCALE=en
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blessingskin
DB_USERNAME=username
DB_PASSWORD=secret
DB_PREFIX=
# Hash Algorithm for Passwords
#
# Available values:
# - BCRYPT, ARGON2I, PHP_PASSWORD_HASH
# - MD5, SALTED2MD5
# - SHA256, SALTED2SHA256
# - SHA512, SALTED2SHA512
#
# New sites are *highly* recommended to use BCRYPT.
#
PWD_METHOD=BCRYPT
APP_KEY=base64:JaytOHG/JlLgulTVAhiS0tRqnAfCkQydbdP6VRmoAMY=
MAIL_MAILER=smtp
MAIL_HOST=
MAIL_PORT=465
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_CONNECTION=sync
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
PLUGINS_DIR=null
PLUGINS_URL=null

View File

@ -14,9 +14,6 @@ RUN docker-php-ext-install mysqli pdo pdo_mysql gd zip
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# Enable Apache rewrite module
RUN a2enmod rewrite
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

View File

@ -1,13 +0,0 @@
Listen 8080
<Directory /workspace/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:8080>
DocumentRoot /workspace/public
ErrorLog /workspace/storage/logs/apache-error.log
CustomLog /workspace/storage/logs/apache-access.log combined
</VirtualHost>

View File

@ -2,33 +2,30 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/php-mariadb
// Update the VARIANT arg in docker-compose.yml to pick a PHP version
{
"name": "PHP & MariaDB (Community)",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"name": "PHP & MariaDB (Community)",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
// Set *default* container specific settings.json values on container create.
"settings": {},
// Set *default* container specific settings.json values on container create.
"settings": { },
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"xdebug.php-debug",
"bmewburn.vscode-intelephense-client",
"mrmlnc.vscode-apache"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"xdebug.php-debug",
"bmewburn.vscode-intelephense-client",
"mrmlnc.vscode-apache"
],
// For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start)
"forwardPorts": [8080, 3306],
// For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start)
"forwardPorts": [8080, 3306],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo truncate -s 0 /etc/apache2/ports.conf && sudo rm -f /etc/apache2/sites-enabled/000-default.conf && sudo ln -sf /workspace/.devcontainer/blessing-skin.apache.conf /etc/apache2/sites-enabled/ && ln -sf .devcontainer/.env.devcontainer .env && composer install && yarn install",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "cp .env.example .env && sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)/public\" /var/www/html && composer install && yarn install",
// Start apache2 after the container is started
"postStartCommand": "apache2ctl start && echo '\\n👉 \\e[0;32mPlease run '\\'yarn build\\'' to build the frontend. Application is available on port 8080.\\e[0m 👈\\n'",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"powershell": "latest"
}
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"powershell": "latest"
}
}

View File

@ -7,6 +7,8 @@
coverage/
node_modules/
plugins/**
public/sw.js
public/meta.js
public/app/*
public/lang/*
public/plugins/**

View File

@ -35,71 +35,3 @@ PLUGINS_URL=
TEXTURES_DIR=
JWT_SECRET=1tdM3gXarxYI4KlAHMBo238iC2tEb4I3EtBlZTQQXvInXIt7V2ix7hJ1KTvxCKZW
PASSPORT_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC6q6SCprX3yfOE
DFBnfFk3R+33qvoe26nYQkavKfv7zA9KQxCBNHEsFKOQ6ui+ViebVHAIHBPm2518
REVMLN2JONvXbPETV6gJO/b6FFwo2Aow/GbTnesLhWEAPW11ei0/hBbjWF9hQZ/n
x3YsFk0xtml2iPDijfUohwp50iFyCQylw4S5Sy3vuVdM063dkxvECsU6wmHDev9C
PxFZGl3W2iLSwttYl7xmlwll8xuqxDQUJpJbOxrPeDKdDI1ikarSqA1c8bV1YLT+
CHxB7T5b1EPeaYRmeLl+wyd/ZxeBWWgDLBusi5wPFpSEIVxu1RzTYarOXEpD+XNV
Ohpb7LxpbJx8YRJru1B6CBouVO2pqoCEM21GtG7zSDNtaY+yVcj9Kf2SIbfz0e6a
SLAcyOT0q3aId4+z9q8TAfPVV7y0D7B3PaOz/3pMC+jHDjCRwQkN/DR7ODUKEjCd
UjsveGHtseBa3qBoKWcg39ZvwYeDF0P/cFa/yOqw5JxyWhbjk95YdPaSixdUyyMG
XkFTOrnBREVtBAfdTOG6WTFcIlyJK+ST0cJXVcrjFonbmJCCwTJqxz9t+935CfTt
CzLLPdONU16jZJ7j1cVoWb4L8o0OA+FBSawBxFOKyhFlh3+HKRnSCZSDqaSDsYUf
M3IupiGUcByhpZ9mNqhnLeivIXwapwIDAQABAoICAFu27F+S2DH0A9S7lh+aPV1H
VniKhVR2+aZ6va7fUmJ++n4yoB/TK82MIGcZu5uUyeXr4RVi8jZJbcF565BHNNtw
V7cq2/F0bmeHEkwBh9w7dRpnUIAlhS/GawfKpoaDLksYM4SkzUwECbQ/0GRN2sST
ipKGKtAtDihI3RFIeE1Ge/PPsdy2Ps4bAnUJRdHpLsmtvwSlL5JzUonyYawlI7jl
uRlTSqDnAFZpW+E+xjerKalC4EK5se0AceGuoqKszkCs98/UJCMVDigH9EER9sL4
chYLQtVz+DN7X+MdPDO9wThZygkHGPhi0DpxB7CevYhv4pN8TbLDE3Lq1ruWf2T3
7ts21ymjVIiOayBA9l86P0FSS/lP9KF53LyeNkOJKUy5On6xHoW5IKlrMJdmGwFH
B4yaR7bw5vxErhpMTzcYJVWqjCbo+PBJhdy7x+2XrrBLs9X0hfS/jeeAIuRlzju1
9xe3zO6U41sDjkCkrUavOn57DL6jh9LMgxT8cZkSdrP6rpawEyjPUi5kMbbQkv0j
eWiqz0vozJN5HcVpj36F5kqZyCnIojmeo4FCKdn7n/wvyGYQPSAekVpV80KzoJ2j
GQ440Q7Sgozj/Lw4cCPgG3/MA1Dwu+TUuaddFjBH2oqZ2X0bCqVCEVWhfmaD4z2R
I9C9nLvpxoMtcCHkG1VFAoIBAQDfawcBHMPxZQOy/qTqXZd7YR3bzGgd/SkLEWwg
PtDGKe36tDf3E/RGRij4HGl9v/fA7N/CufW0tJY7Ii/cn7yYdZg/dzaCoYIZbICl
CytWtsM0iH3XPuY3UpgsOwML0xK8hdD1U7qBKk5rnjF9Q9vKrB8ATR9hM0bPaGtr
Bqfx8A+kj6wqRpA8jbN0kZxJVv0/LgZSCrH3qUjHfXoYYtLhMBZd8UydyvyETo/1
Z44WS9oNqX8mBUvHjsuOQx3+eFPOr69QPIo06QMxytSEzMilgz40QUBWF68gKwGi
NYdUfR3IXVTmvJhYH2mQWqMKVk+KJFd2UanjKbBCOKrDSG4TAoIBAQDV5LMp/ztd
YQvMCWJzUrpazGqkoEGli/qxWb/pDpemgQT++lt6PBRQmmLKXZfNp9VJdZdP6+lF
ypGcA8tACY93m7Fk4wtewXG+0oTxmBkWqSiiO3ExoBQTxXLoZ9GwKt/exaM25QJ1
O2livxrYFFJbUe1YRqQENIURYk13RgeIaWS0gd9vp/yp0EhZAvGUPHFjKRsLjw7Y
gZDJ+lXj2pXg9THUzkhVDm+fM6blIsLcvf7qc8yKQI3nwZr00e/ba7xSNF8AhpdP
rxw59vm1RzsngZpZOK0Z1143gFRtGhhVWtvmhCvJo1EOssFu01ixE0bNq5nRIIJo
O/mY7NC9bCOdAoIBAEBfcyYz5pUwGM/DJTtN+i6XfeXt0HYLkn7Y50GnN7pRLHuW
36U2P6Tb5EQQ06hi3nzdA1/0+sG1Yq/pGsdD0zBOea6Xp8IdzQGMTMjBHhyfDkGd
rjyNqAF6r9PWsPsANx7Qo7N8C3nZ+bxyWSoRmkucKlaI4ii8gIOUP5cX1N4V4Dv3
FZEcwcRgw7srlU9gXBmPJk0PPdXxFcI8+if6mW4+z8MDmqLAcN+iT0JTMxJjipFz
K+qFjh8Smr4Dwqmme+dKoYXJ27yBAuWe3nrhElL2LL8bqfDkZBYtrgvRxotmfWVU
1vigkHibnGv2YZHB6qsP649w2jVUtq9t6m3X+bcCggEAEKDqCN7N17GewCsOm1aY
JEz2EXxf/iXGxJjsoYq/4XLwV35RNEyNa8LE4WSrU5KzszVQISd/CCz6av2khIL5
w1u4S9aW4LP7StGFAl9HvApEnXAvmaMPTIYyK70+gQqkQuZsjOz65vBKfiHLTXcu
++h/ojhDsgv/OF3DFf28wi8nZB0gqMaPjwghR8JB07trOUFN1/U0O0K/ZeRvXvp0
YnvNdvTejLZFmUPjuracHZsrwUBla24fWiAkEtprYkya5G0r4ZeVFd3QPPVlbmFu
SOD7heoxEuw6Z+gzKBQ6RhB9PguSd+eZeqINBbeqkoGkJIMtvyNe4AmhmvD2PXO1
xQKCAQAx12vD3q2+DHrpJ4fKGp1RbCxFIOYgXcBJ6zCozVZXpLUa54IBTLyQyDNF
D8+Wq5b1IbCnxBn55tsgq/CSLkVHigVfUDGnAt3lD+ggLdZmu7ayQY0BNe1quF5M
EgkOE0uYtq+2p+u4gxRB+gnQd1YIlPs0U0mrawbzV5ZX2vR5Ry1XpBno75JpnUbN
3D9DuIDVLuqsKJcx6KClWef2PzJB2uN7jDf4UnCtp5QCFB1GNt+5AzCNh9Bozas8
OflASrSn64AeyCZycCplmRY/F4BnH++7YI0Q/mjawByW7qYoHkFzmKuUcgakh200
y/ieeWy8Vunl0e4T4Bz/0zInBifn
-----END PRIVATE KEY-----"
PASSPORT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAuqukgqa198nzhAxQZ3xZ
N0ft96r6Htup2EJGryn7+8wPSkMQgTRxLBSjkOrovlYnm1RwCBwT5tudfERFTCzd
iTjb12zxE1eoCTv2+hRcKNgKMPxm053rC4VhAD1tdXotP4QW41hfYUGf58d2LBZN
MbZpdojw4o31KIcKedIhcgkMpcOEuUst77lXTNOt3ZMbxArFOsJhw3r/Qj8RWRpd
1toi0sLbWJe8ZpcJZfMbqsQ0FCaSWzsaz3gynQyNYpGq0qgNXPG1dWC0/gh8Qe0+
W9RD3mmEZni5fsMnf2cXgVloAywbrIucDxaUhCFcbtUc02GqzlxKQ/lzVToaW+y8
aWycfGESa7tQeggaLlTtqaqAhDNtRrRu80gzbWmPslXI/Sn9kiG389HumkiwHMjk
9Kt2iHePs/avEwHz1Ve8tA+wdz2js/96TAvoxw4wkcEJDfw0ezg1ChIwnVI7L3hh
7bHgWt6gaClnIN/Wb8GHgxdD/3BWv8jqsOSccloW45PeWHT2kosXVMsjBl5BUzq5
wURFbQQH3UzhulkxXCJciSvkk9HCV1XK4xaJ25iQgsEyasc/bfvd+Qn07Qsyyz3T
jVNeo2Se49XFaFm+C/KNDgPhQUmsAcRTisoRZYd/hykZ0gmUg6mkg7GFHzNyLqYh
lHAcoaWfZjaoZy3oryF8GqcCAwEAAQ==
-----END PUBLIC KEY-----"

11
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,11 @@
daysUntilStale: 7
daysUntilClose: 7
exemptLabels:
- bug
- enhancement
staleLabel: stale
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.
该 issue 在近期内缺少更新或答复如果仍然缺少更新或响应issue 将被关闭。

View File

@ -20,19 +20,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: 8.0
coverage: none
extensions: mbstring, dom, fileinfo, gd, imagick
extensions: mbstring, dom, fileinfo, gd
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
- name: Prepare
run: |
cp .env.example .env
php artisan key:generate
mkdir -p resources/views/overrides
- name: Validate Twig templates
run: php artisan twig:lint -v
@ -44,24 +45,24 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3']
php: ['8.0', '8.1']
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Setup PHP only
uses: shivammathur/setup-php@v2
if: matrix.php != '8.3'
if: matrix.php != '8.0'
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: mbstring, dom, fileinfo, sqlite, gd, zip, imagick
extensions: mbstring, dom, fileinfo, sqlite, gd, zip
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
if: matrix.php == '8.3'
if: matrix.php == '8.0'
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: mbstring, dom, fileinfo, sqlite, gd, zip, imagick
extensions: mbstring, dom, fileinfo, sqlite, gd, zip
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
@ -71,14 +72,14 @@ jobs:
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run tests only
if: matrix.php != '8.3'
if: matrix.php != '8.0'
run: ./vendor/bin/phpunit
- name: Run tests with coverage report
if: matrix.php == '8.3'
if: matrix.php == '8.0'
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload coverage report
uses: codecov/codecov-action@v1
if: matrix.php == '8.3' && success()
if: matrix.php == '8.0' && success()
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: github-actions
@ -87,7 +88,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run checks
@ -100,7 +101,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Install dependencies
run: yarn
- name: Run tests
@ -114,14 +115,8 @@ jobs:
name: Snapshot Build
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
extensions: mbstring, dom, fileinfo, sqlite, gd, zip, imagick
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Cache Node dependencies
uses: actions/cache@v3
with:
@ -143,13 +138,11 @@ jobs:
yarn build
cp resources/assets/src/images/bg.webp public/app/
cp resources/assets/src/images/favicon.ico public/app/
- uses: benjlevesque/short-sha@v3.0
- uses: benjlevesque/short-sha@v1.2
id: short-sha
- name: Archive release
run: zip -9 -r blessing-skin-server-${{ steps.short-sha.outputs.sha }}.zip app bootstrap config database plugins public resources/lang resources/views resources/misc/textures routes storage vendor .env.example artisan LICENSE README.md README-zh.md index.html
- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: blessing-skin-server-${{ steps.short-sha.outputs.sha }}.zip
path: blessing-skin-server-${{ steps.short-sha.outputs.sha }}.zip

View File

@ -9,32 +9,32 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build and create archive
run: ./tools/release.ps1
shell: pwsh
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
- name: Get version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Upload release asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./blessing-skin-server-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: blessing-skin-server-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
- name: Checkout code
uses: actions/checkout@v2
- name: Build and create archive
run: ./tools/release.ps1
shell: pwsh
env:
AZURE_TOKEN: ${{ secrets.AZURE_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Upload release asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./blessing-skin-server-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: blessing-skin-server-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip

4
.gitignore vendored
View File

@ -25,5 +25,5 @@ storage/options.php
.phpunit.result.cache
.php-cs-fixer.cache
resources/views/overrides
.DS_Store
*/.DS_Store
public/sw.js
public/meta.js

View File

@ -8,16 +8,11 @@ $finder = PhpCsFixer\Finder::create()
$config = new PhpCsFixer\Config();
return $config->setRules([
'@Symfony' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
'global_namespace_import' => [
'import_constants' => true,
'import_functions' => true,
'import_classes' => null,
],
])
'@Symfony' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
])
->setFinder($finder);

68
.vscode/launch.json vendored
View File

@ -1,34 +1,38 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Jest Tests",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${file}"],
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**"]
},
{
"type": "php",
"request": "launch",
"name": "Launch with XDebug",
"ignore": ["**/vendor/**/*.php"]
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch with Firefox Debugger",
"url": "http://localhost/",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack:///",
"path": "${workspaceFolder}/"
}
]
}
]
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Jest Tests",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${file}"],
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": [
"<node_internals>/**"
]
},
{
"type": "php",
"request": "launch",
"name": "Launch with XDebug",
"ignore": [
"**/vendor/**/*.php"
]
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch with Firefox Debugger",
"url": "http://localhost/",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack:///",
"path": "${workspaceFolder}/"
}
]
}
]
}

View File

@ -40,9 +40,9 @@ Blessing Skin 是一个开源的 PHP 项目,这意味着您可以自由地在
Blessing Skin 对您的服务器有一定的要求。在大多数情况下,下列所需的 PHP 扩展已经开启。
- 一台支持 URL 重写的主机Nginx 或 Apache
- PHP >= 8.1.0
- PHP >= 8.0.2
- 安装并启用如下 PHP 扩展:
- OpenSSL >= 1.1.1 (TLS 1.3)
- OpenSSL
- PDO
- Mbstring
- Tokenizer
@ -52,7 +52,6 @@ Blessing Skin 对您的服务器有一定的要求。在大多数情况下,下
- JSON
- fileinfo
- zip
- Imagick
## 快速使用
@ -62,9 +61,105 @@ Blessing Skin 对您的服务器有一定的要求。在大多数情况下,下
Blessing Skin 提供了强大的插件系统,您可以通过添加多种多样的插件来为您的皮肤站添加功能。
## 支持并赞助 Blessing Skin
如果您觉得这个软件对您很有帮助,欢迎通过赞助来支持开发!
目前可在 [爱发电](https://afdian.net/@blessing-skin) 上赞助。
### Sponsors
<table>
<tbody>
<tr>
<td align=center>
<a href="https://afdian.net/@gao_cai_sheng">
<img src="https://pic1.afdiancdn.com/user/2aac23481b1b11ea9f6e52540025c377/avatar/96a8b23d98cbac5aa36601db15a27e5e_w512_h512_s234.jpg" width="120" height="120">
<br>
gao_cai_sheng
</a>
</td>
<td align=center>
<a href="https://afdian.net/@LD_fantasy">
<img src="https://pic1.afdiancdn.com/user/9bed7bb454f011eb821652540025c377/avatar/cb679e3eac693e0eea2eac527c7954e0_w700_h1307_s137.jpg" width="120" height="120">
<br>
K_LazyCat
</a>
</td>
<td align=center>
<a href="https://afdian.net/@nmzy2018">
<img src="https://pic1.afdiancdn.com/user/a66f79d2f5a311e9af4e52540025c377/avatar/98682fb3c5914a39c8986bb1e97b5501_w512_h512_s248.jpg" width="120" height="120">
<br>
伊南
</a>
</td>
<td align=center>
<a href="">
<img src="https://pic1.afdiancdn.com/default/avatar/avatar-blue.png" width="120" height="120">
<br>
家乐
</a>
</td>
<td align=center>
<a href="https://afdian.net/@oar-01">
<img src="https://pic1.afdiancdn.com/user/e391f6ccdfa911ebb0e352540025c377/avatar/74da4afa92fa2666c306d43ab7a8804b_w1920_h1080_s338.jpg" width="120" height="120">
<br>
黄金鞘翅的郡主
</a>
</td>
</tr>
<tr>
<td align=center>
<a href="https://www.bilibili.plus/caucmc1.orz">
<img src="https://pic1.afdiancdn.com/user/edde2efc879611e889f552540025c377/avatar/d6a712efd6560b28989ac33f99c8915d_w473_h454_s24.jpg" width="120" height="120">
<br>
睡觉塞牙
</a>
</td>
</tr>
</tbody>
</table>
### Backers
<table>
<tbody>
<tr>
<td align=center>
<a href="https://afdian.net/@ValiantShishu976400">
<img src="https://pic1.afdiancdn.com/user/178a08963a5e11e9addd52540025c377/avatar/ece9f089aaf2c2f83204a8de11697caf_w350_h350_s16.jpg" width="75" height="75">
<br>
飒爽师叔
</a>
</td>
<td align=center>
<a href="https://afdian.net/@PAKingdom">
<img src="https://pic1.afdiancdn.com/user/18ad3338e58a11e9b29352540025c377/avatar/1e8b6476b589ddac545ac1ce13166e59_w584_h797_s59.jpg" width="75" height="75">
<br>
皮皮帕
</a>
</td>
<td align=center>
<a href="https://afdian.net/@oar-01">
<img src="https://pic1.afdiancdn.com/user/e391f6ccdfa911ebb0e352540025c377/avatar/74da4afa92fa2666c306d43ab7a8804b_w1920_h1080_s338.jpg" width="75" height="75">
<br>
黄金鞘翅的郡主
</a>
</td>
<td align=center>
<a href="">
<img src="https://pic1.afdiancdn.com/user/fc143860efa111ebb3e552540025c377/avatar/6e1d0f3f6ffb80b89b44269f59aa775f_w1080_h1080_s107.jpg" width="75" height="75">
<br>
♂sudo rm -rf /*[幼稚鬼]
</a>
</td>
</tr>
</tbody>
</table>
## 自行构建
详情可阅读 [这里](https://blessing.netlify.app/build.html)。
详情可阅读 [这里](https://blessing.netlify.com/build.html)。
> 您可以订阅我们的 Telegram 频道 [Blessing Skin News](https://t.me/blessing_skin_news) 来获取最新开发动态。当有新的 Commit 被推送时,我们的机器人将会在频道内发送一条消息来提示您能否拉取最新代码,以及拉取后应该做什么。
@ -76,7 +171,7 @@ Blessing Skin 可支持多种语言,当前支持英语、简体中文和西班
## 问题报告
请参阅 [报告问题的正确姿势](https://blessing.netlify.app/report.html)。
请参阅 [报告问题的正确姿势](https://blessing.netlify.com/report.html)。
## 相关链接

103
README.md
View File

@ -4,7 +4,7 @@
<p align="center"><img src="https://media.githubusercontent.com/media/bs-community/logo/main/logo.png"></p>
<p align="center">
<a href="https://github.com/bs-community/blessing-skin-server/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/bs-community/blessing-skin-server/CI.yml?branch=dev&style=flat-square"></a>
<a href="https://github.com/bs-community/blessing-skin-server/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/bs-community/blessing-skin-server/CI?style=flat-square"></a>
<a href="https://codecov.io/gh/bs-community/blessing-skin-server"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/bs-community/blessing-skin-server?style=flat-square"></a>
<a href="https://github.com/bs-community/blessing-skin-server/releases"><img alt="GitHub release (latest SemVer including pre-releases)" src="https://img.shields.io/github/v/release/bs-community/blessing-skin-server?include_prereleases&style=flat-square"></a>
<a href="https://github.com/bs-community/blessing-skin-server/blob/master/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/bs-community/blessing-skin-server?style=flat-square"></a>
@ -40,9 +40,9 @@ Blessing Skin is an open-source project written in PHP, which means you can depl
Blessing Skin has only a few system requirements. In most cases, these PHP extensions are already enabled.
- Web server with URL rewriting enabled (Nginx or Apache)
- PHP >= 8.1.0
- PHP >= 8.0.2
- PHP Extensions
- OpenSSL >= 1.1.1 (TLS 1.3)
- OpenSSL
- PDO
- Mbstring
- Tokenizer
@ -52,7 +52,6 @@ Blessing Skin has only a few system requirements. In most cases, these PHP exten
- JSON
- fileinfo
- zip
- Imagick
## Quick Install
@ -62,6 +61,102 @@ Please read [Installation Guide](https://blessing.netlify.app/en/setup.html).
Blessing Skin provides an elegant and powerful plugin system, and you can attach plenty of functions and customization to your site via installing plugins.
## Supporting Blessing Skin
Welcome to sponsoring Blessing Skin if this software is useful for you!
Currently you can sponsor us via [爱发电](https://afdian.net/@blessing-skin).
### Sponsors
<table>
<tbody>
<tr>
<td align=center>
<a href="https://afdian.net/@gao_cai_sheng">
<img src="https://pic1.afdiancdn.com/user/2aac23481b1b11ea9f6e52540025c377/avatar/96a8b23d98cbac5aa36601db15a27e5e_w512_h512_s234.jpg" width="120" height="120">
<br>
gao_cai_sheng
</a>
</td>
<td align=center>
<a href="https://afdian.net/@LD_fantasy">
<img src="https://pic1.afdiancdn.com/user/9bed7bb454f011eb821652540025c377/avatar/cb679e3eac693e0eea2eac527c7954e0_w700_h1307_s137.jpg" width="120" height="120">
<br>
K_LazyCat
</a>
</td>
<td align=center>
<a href="https://afdian.net/@nmzy2018">
<img src="https://pic1.afdiancdn.com/user/a66f79d2f5a311e9af4e52540025c377/avatar/98682fb3c5914a39c8986bb1e97b5501_w512_h512_s248.jpg" width="120" height="120">
<br>
伊南
</a>
</td>
<td align=center>
<a href="">
<img src="https://pic1.afdiancdn.com/default/avatar/avatar-blue.png" width="120" height="120">
<br>
家乐
</a>
</td>
<td align=center>
<a href="https://afdian.net/@oar-01">
<img src="https://pic1.afdiancdn.com/user/e391f6ccdfa911ebb0e352540025c377/avatar/74da4afa92fa2666c306d43ab7a8804b_w1920_h1080_s338.jpg" width="120" height="120">
<br>
黄金鞘翅的郡主
</a>
</td>
</tr>
<tr>
<td align=center>
<a href="https://www.bilibili.plus/caucmc1.orz">
<img src="https://pic1.afdiancdn.com/user/edde2efc879611e889f552540025c377/avatar/d6a712efd6560b28989ac33f99c8915d_w473_h454_s24.jpg" width="120" height="120">
<br>
睡觉塞牙
</a>
</td>
</tr>
</tbody>
</table>
### Backers
<table>
<tbody>
<tr>
<td align=center>
<a href="https://afdian.net/@ValiantShishu976400">
<img src="https://pic1.afdiancdn.com/user/178a08963a5e11e9addd52540025c377/avatar/ece9f089aaf2c2f83204a8de11697caf_w350_h350_s16.jpg" width="75" height="75">
<br>
飒爽师叔
</a>
</td>
<td align=center>
<a href="https://afdian.net/@PAKingdom">
<img src="https://pic1.afdiancdn.com/user/18ad3338e58a11e9b29352540025c377/avatar/1e8b6476b589ddac545ac1ce13166e59_w584_h797_s59.jpg" width="75" height="75">
<br>
皮皮帕
</a>
</td>
<td align=center>
<a href="https://afdian.net/@oar-01">
<img src="https://pic1.afdiancdn.com/user/e391f6ccdfa911ebb0e352540025c377/avatar/74da4afa92fa2666c306d43ab7a8804b_w1920_h1080_s338.jpg" width="75" height="75">
<br>
黄金鞘翅的郡主
</a>
</td>
<td align=center>
<a href="">
<img src="https://pic1.afdiancdn.com/user/fc143860efa111ebb3e552540025c377/avatar/6e1d0f3f6ffb80b89b44269f59aa775f_w1080_h1080_s107.jpg" width="75" height="75">
<br>
♂sudo rm -rf /*[幼稚鬼]
</a>
</td>
</tr>
</tbody>
</table>
## Build From Source
Please refer to [Manual Build](https://blessing.netlify.app/build.html).

View File

@ -53,9 +53,8 @@ class Handler extends ExceptionHandler
})
->filter(function ($trace) {
// @codeCoverageIgnoreStart
$isFromPlugins = !app()->runningUnitTests()
&& Str::contains($trace['file'], resolve('plugins')->getPluginsDirs()->all());
$isFromPlugins = !app()->runningUnitTests() &&
Str::contains($trace['file'], resolve('plugins')->getPluginsDirs()->all());
// @codeCoverageIgnoreEnd
return Str::startsWith($trace['file'], 'app') || $isFromPlugins;
})

View File

@ -53,7 +53,7 @@ class AdminController extends Controller
$grouping = fn ($field) => fn ($item) => Carbon::parse($item->$field)->isoFormat('l');
$mapping = fn ($item) => count($item);
$aligning = fn ($data) => fn ($day) => $data->get($day) ?? 0;
$aligning = fn ($data) => fn ($day) => ($data->get($day) ?? 0);
/** @var Collection */
$userRegistration = User::where('register_at', '>=', $oneMonthAgo)
@ -86,7 +86,7 @@ class AdminController extends Controller
Request $request,
PluginManager $plugins,
Filesystem $filesystem,
Filter $filter,
Filter $filter
) {
$db = config('database.connections.'.config('database.default'));
$dbType = Arr::get([

View File

@ -8,16 +8,16 @@ use App\Mail\ForgotPassword;
use App\Models\Player;
use App\Models\User;
use App\Rules;
use Auth;
use Blessing\Filter;
use Blessing\Rejection;
use Cache;
use Carbon\Carbon;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\URL;
use Mail;
use Session;
use URL;
use Vectorface\Whip\Whip;
class AuthController extends Controller
@ -50,7 +50,7 @@ class AuthController extends Controller
Request $request,
Rules\Captcha $captcha,
Dispatcher $dispatcher,
Filter $filter,
Filter $filter
) {
$data = $request->validate([
'identification' => 'required',
@ -151,7 +151,7 @@ class AuthController extends Controller
Request $request,
Rules\Captcha $captcha,
Dispatcher $dispatcher,
Filter $filter,
Filter $filter
) {
$can = $filter->apply('can_register', null);
if ($can instanceof Rejection) {
@ -176,8 +176,8 @@ class AuthController extends Controller
$dispatcher->dispatch('auth.registration.attempt', [$data]);
if (
option('register_with_player_name')
&& Player::where('name', $playerName)->count() > 0
option('register_with_player_name') &&
Player::where('name', $playerName)->count() > 0
) {
return json(trans('user.player.add.repeated'), 1);
}
@ -248,7 +248,7 @@ class AuthController extends Controller
Request $request,
Rules\Captcha $captcha,
Dispatcher $dispatcher,
Filter $filter,
Filter $filter
) {
$data = $request->validate([
'email' => 'required|email',

View File

@ -4,12 +4,12 @@ namespace App\Http\Controllers;
use App\Models\Texture;
use App\Models\User;
use Auth;
use Blessing\Filter;
use Blessing\Rejection;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class ClosetController extends Controller
{
@ -75,7 +75,7 @@ class ClosetController extends Controller
public function add(
Request $request,
Dispatcher $dispatcher,
Filter $filter,
Filter $filter
) {
['tid' => $tid, 'name' => $name] = $request->validate([
'tid' => 'required|integer',
@ -132,7 +132,7 @@ class ClosetController extends Controller
Request $request,
Dispatcher $dispatcher,
Filter $filter,
$tid,
$tid
) {
['name' => $name] = $request->validate(['name' => 'required']);
/** @var User */

View File

@ -17,15 +17,8 @@ class ClosetManagementController extends Controller
public function add(Request $request, Dispatcher $dispatcher, User $user)
{
$tid = $request->input('tid');
$texture = Texture::find($tid);
if (!$texture) {
return json(trans('user.closet.add.not-found'), 1);
}
if ($user->closet()->where('tid', $request->tid)->count() > 0) {
return json(trans('user.closet.add.repeated'), 1);
}
/** @var Texture */
$texture = Texture::findOrFail($tid);
$name = $texture->name;
$dispatcher->dispatch('closet.adding', [$tid, $name, $user]);
@ -42,14 +35,10 @@ class ClosetManagementController extends Controller
$tid = $request->input('tid');
$dispatcher->dispatch('closet.removing', [$tid, $user]);
$item = $user->closet()->find($tid);
if (empty($item)) {
return json(trans('user.closet.remove.non-existent'), 1);
}
/** @var Texture */
$texture = Texture::findOrFail($tid);
$user->closet()->detach($tid);
$texture = Texture::find($tid);
$user->closet()->detach($texture->tid);
$dispatcher->dispatch('closet.removed', [$texture, $user]);

View File

@ -163,10 +163,6 @@ class OptionsController extends Controller
->text('max_upload_file_size')->addon('KB')
->hint(trans('options.general.max_upload_file_size.hint', ['size' => ini_get('upload_max_filesize')]));
$form->group('max_texture_width')
->text('max_texture_width')->addon('px')
->hint(trans('options.general.max_texture_width.hint'));
$form->select('player_name_rule')
->option('official', trans('options.general.player_name_rule.official'))
->option('cjk', trans('options.general.player_name_rule.cjk'))

View File

@ -10,11 +10,11 @@ use App\Models\Player;
use App\Models\Texture;
use App\Models\User;
use App\Rules;
use Auth;
use Blessing\Filter;
use Blessing\Rejection;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
class PlayerController extends Controller
@ -124,7 +124,7 @@ class PlayerController extends Controller
public function delete(
Dispatcher $dispatcher,
Filter $filter,
Player $player,
Player $player
) {
/** @var User */
$user = auth()->user();
@ -157,7 +157,7 @@ class PlayerController extends Controller
Request $request,
Dispatcher $dispatcher,
Filter $filter,
Player $player,
Player $player
) {
$name = $request->validate([
'name' => [
@ -194,7 +194,7 @@ class PlayerController extends Controller
Request $request,
Dispatcher $dispatcher,
Filter $filter,
Player $player,
Player $player
) {
/** @var User */
$user = auth()->user();
@ -234,7 +234,7 @@ class PlayerController extends Controller
Request $request,
Dispatcher $dispatcher,
Filter $filter,
Player $player,
Player $player
) {
$types = $request->input('type', []);

View File

@ -23,8 +23,8 @@ class PlayersManagementController extends Controller
$currentUser = $request->user();
if (
$owner->uid !== $currentUser->uid
&& $owner->permission >= $currentUser->permission
$owner->uid !== $currentUser->uid &&
$owner->permission >= $currentUser->permission
) {
return json(trans('admin.players.no-permission'), 1)
->setStatusCode(403);
@ -44,7 +44,7 @@ class PlayersManagementController extends Controller
public function name(
Player $player,
Request $request,
Dispatcher $dispatcher,
Dispatcher $dispatcher
) {
$name = $request->validate([
'player_name' => [
@ -70,7 +70,7 @@ class PlayersManagementController extends Controller
public function owner(
Player $player,
Request $request,
Dispatcher $dispatcher,
Dispatcher $dispatcher
) {
$uid = $request->validate(['uid' => 'required|integer'])['uid'];
@ -96,7 +96,7 @@ class PlayersManagementController extends Controller
public function texture(
Player $player,
Request $request,
Dispatcher $dispatcher,
Dispatcher $dispatcher
) {
$data = $request->validate([
'tid' => 'required|integer',
@ -123,7 +123,7 @@ class PlayersManagementController extends Controller
public function delete(
Player $player,
Dispatcher $dispatcher,
Dispatcher $dispatcher
) {
$dispatcher->dispatch('player.deleting', [$player]);

View File

@ -77,7 +77,7 @@ class ReportController extends Controller
public function review(
Report $report,
Request $request,
Dispatcher $dispatcher,
Dispatcher $dispatcher
) {
$data = $request->validate([
'action' => ['required', Rule::in(['delete', 'ban', 'reject'])],
@ -88,9 +88,9 @@ class ReportController extends Controller
if ($action == 'reject') {
if (
$report->informer
&& ($score = option('reporter_score_modification', 0)) > 0
&& $report->status == Report::PENDING
$report->informer &&
($score = option('reporter_score_modification', 0)) > 0 &&
$report->status == Report::PENDING
) {
$report->informer->score -= $score;
$report->informer->save();
@ -151,9 +151,9 @@ class ReportController extends Controller
public static function returnScore($report)
{
if (
$report->status == Report::PENDING
&& ($score = option('reporter_score_modification', 0)) < 0
&& $report->informer
$report->status == Report::PENDING &&
($score = option('reporter_score_modification', 0)) < 0 &&
$report->informer
) {
$report->informer->score -= $score;
$report->informer->save();

View File

@ -20,7 +20,7 @@ class SetupController extends Controller
Request $request,
Filesystem $filesystem,
Connection $connection,
DatabaseManager $manager,
DatabaseManager $manager
) {
if ($request->isMethod('get')) {
try {
@ -121,7 +121,7 @@ class SetupController extends Controller
'database/migrations',
'vendor/laravel/passport/database/migrations',
],
]);
]);
$siteUrl = url('/');
if (Str::endsWith($siteUrl, '/index.php')) {

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Texture;
use App\Models\User;
use Auth;
use Blessing\Filter;
use Blessing\Rejection;
use Illuminate\Contracts\Events\Dispatcher;
@ -11,12 +12,10 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Validation\Rule;
use Intervention\Image\Facades\Image;
use League\CommonMark\GithubFlavoredMarkdownConverter;
use Storage;
class SkinlibController extends Controller
{
@ -135,7 +134,7 @@ class SkinlibController extends Controller
->with('texture', $texture)
->with('grid', $grid)
->with('extra', [
'download' => (bool) option('allow_downloading_texture'),
'download' => option('allow_downloading_texture'),
'currentUid' => $user ? $user->uid : 0,
'admin' => $user && $user->isAdmin(),
'inCloset' => $user && $user->closet()->where('tid', $texture->tid)->count() > 0,
@ -190,7 +189,7 @@ class SkinlibController extends Controller
public function handleUpload(
Request $request,
Filter $filter,
Dispatcher $dispatcher,
Dispatcher $dispatcher
) {
$file = $request->file('file');
if ($file && !$file->isValid()) {
@ -221,16 +220,6 @@ class SkinlibController extends Controller
$type = $data['type'];
$size = getimagesize($file);
$maxWidth = option('max_texture_width', 8192);
if ($size[0] > $maxWidth) {
$message = trans('skinlib.upload.too-wide', [
'width' => $size[0],
'maxWidth' => $maxWidth,
]);
return json($message, 1);
}
if ($size[0] % 64 != 0 || $size[1] % 32 != 0) {
$message = trans('skinlib.upload.invalid-size', [
'type' => $type === 'cape' ? trans('general.cape') : trans('general.skin'),
@ -264,17 +253,8 @@ class SkinlibController extends Controller
}
}
$image = Image::make($file);
$imagick = $image->getCore();
$imagick->setOption('png:compression-filter', '0');
$imagick->setOption('png:compression-level', '9');
$imagick->setOption('png:compression-strategy', '0');
$imagick->setOption('png:exclude-chunk', 'all');
$imagick->stripImage();
$sanitized = $image->encode('png')->getEncoded();
$hash = hash('sha256', $image->encoded);
$hash = $filter->apply('uploaded_texture_hash', $hash, [$image]);
$hash = hash_file('sha256', $file);
$hash = $filter->apply('uploaded_texture_hash', $hash, [$file]);
/** @var User */
$user = Auth::user();
@ -290,11 +270,11 @@ class SkinlibController extends Controller
return json(trans('skinlib.upload.repeated'), 2, ['tid' => $duplicated->tid]);
}
$fileSize = ceil(strlen($sanitized) / 1024);
$size = ceil($file->getSize() / 1024);
$isPublic = is_string($data['public'])
? $data['public'] === '1'
: $data['public'];
$cost = $fileSize * (
$cost = $size * (
$isPublic
? option('score_per_storage')
: option('private_score_per_storage')
@ -305,13 +285,13 @@ class SkinlibController extends Controller
return json(trans('skinlib.upload.lack-score'), 1);
}
$dispatcher->dispatch('texture.uploading', [$image, $name, $hash]);
$dispatcher->dispatch('texture.uploading', [$file, $name, $hash]);
$texture = new Texture();
$texture->name = $name;
$texture->type = $type;
$texture->hash = $hash;
$texture->size = $fileSize;
$texture->size = $size;
$texture->public = $isPublic;
$texture->uploader = $user->uid;
$texture->likes = 1;
@ -320,14 +300,14 @@ class SkinlibController extends Controller
/** @var FilesystemAdapter */
$disk = Storage::disk('textures');
if ($disk->missing($hash)) {
$disk->put($hash, $sanitized);
$file->storePubliclyAs('', $hash, ['disk' => 'textures']);
}
$user->score -= $cost;
$user->closet()->attach($texture->tid, ['item_name' => $name]);
$user->save();
$dispatcher->dispatch('texture.uploaded', [$texture, $image]);
$dispatcher->dispatch('texture.uploaded', [$texture, $file]);
return json(trans('skinlib.upload.success', ['name' => $name]), 0, [
'tid' => $texture->tid,
@ -406,7 +386,7 @@ class SkinlibController extends Controller
Request $request,
Dispatcher $dispatcher,
Filter $filter,
Texture $texture,
Texture $texture
) {
$data = $request->validate(['name' => [
'required',
@ -436,7 +416,7 @@ class SkinlibController extends Controller
Request $request,
Dispatcher $dispatcher,
Filter $filter,
Texture $texture,
Texture $texture
) {
$data = $request->validate([
'type' => ['required', Rule::in(['steve', 'alex', 'cape'])],

View File

@ -6,11 +6,11 @@ use App\Models\Player;
use App\Models\Texture;
use App\Models\User;
use Blessing\Minecraft;
use Cache;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Facades\Image;
use Image;
use Storage;
class TextureController extends Controller
{
@ -71,8 +71,7 @@ class TextureController extends Controller
$lastModified = $disk->lastModified($hash);
// TODO: refactor
return \Intervention\Image\ImageManagerStatic::configure(['driver' => 'gd'])->make($image)
return Image::make($image)
->response($usePNG ? 'png' : 'webp', 100)
->setLastModified(Carbon::createFromTimestamp($lastModified));
}
@ -146,8 +145,7 @@ class TextureController extends Controller
$disk = Storage::disk('textures');
if (is_null($texture) || $disk->missing($texture->hash)) {
// TODO: refactor
return \Intervention\Image\ImageManagerStatic::configure(['driver' => 'gd'])->make(resource_path("misc/textures/avatar$mode.png"))
return Image::make(resource_path("misc/textures/avatar$mode.png"))
->resize($size, $size)
->response($usePNG ? 'png' : 'webp', 100);
}
@ -167,8 +165,7 @@ class TextureController extends Controller
$lastModified = Carbon::createFromTimestamp($disk->lastModified($hash));
// TODO: refactor
return \Intervention\Image\ImageManagerStatic::configure(['driver' => 'gd'])->make($image)
return Image::make($image)
->resize($size, $size)
->response($usePNG ? 'png' : 'webp', 100)
->setLastModified($lastModified);

View File

@ -40,7 +40,7 @@ class TranslationsController extends Controller
Request $request,
Application $app,
JavaScript $js,
LanguageLine $line,
LanguageLine $line
) {
$data = $request->validate(['text' => 'required|string']);
@ -57,7 +57,7 @@ class TranslationsController extends Controller
public function delete(
Application $app,
JavaScript $js,
LanguageLine $line,
LanguageLine $line
) {
$line->delete();

View File

@ -6,16 +6,16 @@ use App\Events\UserProfileUpdated;
use App\Mail\EmailVerification;
use App\Models\Texture;
use App\Models\User;
use Auth;
use Blessing\Filter;
use Blessing\Rejection;
use Carbon\Carbon;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\URL;
use League\CommonMark\GithubFlavoredMarkdownConverter;
use Mail;
use Session;
use URL;
class UserController extends Controller
{
@ -330,9 +330,9 @@ class UserController extends Controller
}
if (
!$texture->public
&& $user->uid !== $texture->uploader
&& !$user->isAdmin()
!$texture->public &&
$user->uid !== $texture->uploader &&
!$user->isAdmin()
) {
return json(trans('skinlib.show.private'), 1);
}

View File

@ -18,8 +18,8 @@ class UsersManagementController extends Controller
$authUser = $request->user();
if (
$targetUser->isNot($authUser)
&& $targetUser->permission >= $authUser->permission
$targetUser->isNot($authUser) &&
$targetUser->permission >= $authUser->permission
) {
return json(trans('admin.users.operations.no-permission'), 1)
->setStatusCode(403);
@ -134,8 +134,8 @@ class UsersManagementController extends Controller
$permission = (int) $data['permission'];
if (
$permission === User::ADMIN
&& $request->user()->permission < User::SUPER_ADMIN
$permission === User::ADMIN &&
$request->user()->permission < User::SUPER_ADMIN
) {
return json(trans('admin.users.operations.no-permission'), 1)
->setStatusCode(403);

View File

@ -11,20 +11,19 @@ class Kernel extends HttpKernel
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\TrimStrings::class,
Middleware\ConvertEmptyStringsToNull::class,
Middleware\DetectLanguagePrefer::class,
\App\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\DetectLanguagePrefer::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
* @var array
*/
protected $middlewareGroups = [
'web' => [
@ -33,38 +32,39 @@ class Kernel extends HttpKernel
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class,
Middleware\EnforceEverGreen::class,
Middleware\RedirectToSetup::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\EnforceEverGreen::class,
\App\Http\Middleware\RedirectToSetup::class,
'bindings',
],
'api' => [
\Illuminate\Routing\Middleware\SubstituteBindings::class,
'bindings',
],
'authorize' => [
'auth:web',
Middleware\RejectBannedUser::class,
Middleware\EnsureEmailFilled::class,
Middleware\FireUserAuthenticated::class,
\App\Http\Middleware\RejectBannedUser::class,
\App\Http\Middleware\EnsureEmailFilled::class,
\App\Http\Middleware\FireUserAuthenticated::class,
],
];
/**
* The application's middleware aliases.
* The application's route middleware.
*
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
* @var array
*/
protected $middlewareAliases = [
'auth' => Middleware\Authenticate::class,
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'guest' => Middleware\RedirectIfAuthenticated::class,
'role' => Middleware\CheckRole::class,
'setup' => Middleware\CheckInstallation::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'role' => \App\Http\Middleware\CheckRole::class,
'setup' => \App\Http\Middleware\CheckInstallation::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => Middleware\CheckUserVerified::class,
'verified' => \App\Http\Middleware\CheckUserVerified::class,
'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class,
'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class,
];

View File

@ -14,7 +14,7 @@ class Authenticate extends Middleware
'msg' => trans('auth.check.anonymous'),
]);
return route('auth.login');
return '/auth/login';
}
}
}

View File

@ -2,17 +2,16 @@
namespace App\Http\Middleware;
use App\Models\User;
use Closure;
use Illuminate\Http\Request;
class CheckRole
{
protected $roles = [
'banned' => User::BANNED,
'normal' => User::NORMAL,
'admin' => User::ADMIN,
'super-admin' => User::SUPER_ADMIN,
'banned' => -1,
'normal' => 0,
'admin' => 1,
'super-admin' => 2,
];
public function handle(Request $request, Closure $next, $role)

View File

@ -14,8 +14,8 @@ class DetectLanguagePrefer
?? $request->cookie('locale')
?? $request->getPreferredLanguage();
if (
($info = Arr::get(config('locales'), $locale))
&& ($alias = Arr::get($info, 'alias'))
($info = Arr::get(config('locales'), $locale)) &&
($alias = Arr::get($info, 'alias'))
) {
$locale = $alias;
}
@ -28,9 +28,7 @@ class DetectLanguagePrefer
/** @var Response */
$response = $next($request);
if (!in_array('api', optional($request->route())->middleware() ?? [])) {
$response->cookie('locale', $locale, 120);
}
$response->cookie('locale', $locale, 120);
return $response;
}

View File

@ -3,16 +3,12 @@
namespace App\Http\Middleware;
use App\Models\User;
use Illuminate\Http\Request;
use Closure;
class RejectBannedUser
{
public function handle(Request $request, \Closure $next)
public function handle($request, Closure $next)
{
if ($request->route()->getName() === 'auth.logout') {
return $next($request);
}
if ($request->user()->permission == User::BANNED) {
if ($request->expectsJson()) {
$response = json(trans('auth.check.banned'), -1);

View File

@ -22,7 +22,7 @@ class FootComposer
Request $request,
JavaScript $javascript,
Dispatcher $dispatcher,
Filter $filter,
Filter $filter
) {
$this->request = $request;
$this->javascript = $javascript;

View File

@ -20,7 +20,7 @@ class HeadComposer
public function __construct(
Dispatcher $dispatcher,
Request $request,
Filter $filter,
Filter $filter
) {
$this->dispatcher = $dispatcher;
$this->request = $request;

View File

@ -29,28 +29,13 @@ class UserMenuComposer
false
);
$avatarPNG = $this->filter->apply('user_avatar', $avatarPNG, [$user]);
$menuItems = [
['label' => trans('general.user-center'), 'link' => route('user.home')],
['label' => trans('general.profile'), 'link' => route('user.profile.view')],
];
if ($user->isAdmin()) {
array_push(
$menuItems,
['label' => '', 'link' => '#divider'],
['label' => trans('general.admin-panel'), 'link' => route('admin.view')],
['label' => trans('general.user-manage'), 'link' => route('admin.users.view')],
['label' => trans('general.report-manage'), 'link' => route('admin.reports.view')],
['label' => 'Web CLI', 'link' => '#launch-cli'],
);
}
$menuItems = $this->filter->apply('user_menu', $menuItems, [$user]);
$cli = $this->request->is('admin', 'admin/*');
$view->with([
'user' => $user,
'avatar' => $avatar,
'avatar_png' => $avatarPNG,
'menu' => $menuItems,
'cli' => $cli,
]);
}
}

View File

@ -3,7 +3,7 @@
namespace App\Listeners;
use App\Models\User;
use Illuminate\Support\Facades\Event;
use Event;
class NotifyFailedPlugin
{

View File

@ -4,7 +4,6 @@ namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Headers;
use Illuminate\Queue\SerializesModels;
class EmailVerification extends Mailable
@ -27,13 +26,4 @@ class EmailVerification extends Mailable
->subject(trans('user.verification.mail.title', ['sitename' => $site_name]))
->view('mails.email-verification');
}
public function headers(): Headers
{
return new Headers(
text: [
'Auto-Submitted' => 'auto-generated',
]
);
}
}

View File

@ -4,7 +4,6 @@ namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Headers;
use Illuminate\Queue\SerializesModels;
class ForgotPassword extends Mailable
@ -27,13 +26,4 @@ class ForgotPassword extends Mailable
->subject(trans('auth.forgot.mail.title', ['sitename' => $site_name]))
->view('mails.password-reset');
}
public function headers(): Headers
{
return new Headers(
text: [
'Auto-Submitted' => 'auto-generated',
]
);
}
}

View File

@ -3,6 +3,7 @@
namespace App\Models;
use App\Events\PlayerProfileUpdated;
use App\Models;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -56,17 +57,17 @@ class Player extends Model
public function user()
{
return $this->belongsTo(User::class, 'uid');
return $this->belongsTo(Models\User::class, 'uid');
}
public function skin()
{
return $this->belongsTo(Texture::class, 'tid_skin');
return $this->belongsTo(Models\Texture::class, 'tid_skin');
}
public function cape()
{
return $this->belongsTo(Texture::class, 'tid_cape');
return $this->belongsTo(Models\Texture::class, 'tid_cape');
}
public function getModelAttribute()

View File

@ -25,6 +25,8 @@ class SiteMessage extends Notification implements ShouldQueue
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
@ -35,6 +37,8 @@ class SiteMessage extends Notification implements ShouldQueue
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)

View File

@ -9,21 +9,25 @@ class ScopeObserver
{
/**
* Handle the Scope "saved" event.
*
* @return void
*/
public function saved(): void
public function saved()
{
$this->refreshCachedScopes();
}
/**
* Handle the Scope "deleted" event.
*
* @return void
*/
public function deleted(): void
public function deleted()
{
$this->refreshCachedScopes();
}
protected function refreshCachedScopes(): void
protected function refreshCachedScopes()
{
Cache::forget('scopes');
Cache::rememberForever('scopes', function () {

View File

@ -10,14 +10,14 @@ use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
public function register()
{
$this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher'));
$this->app->singleton(Services\Option::class);
$this->app->alias(Services\Option::class, 'options');
}
public function boot(Request $request): void
public function boot(Request $request)
{
Paginator::useBootstrap();

View File

@ -2,27 +2,31 @@
namespace App\Providers;
use App\Models\Scope;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
use Laravel\Passport\Passport;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
* The policy mappings for the application.
*
* @var array<class-string, class-string>
* @var array
*/
protected $policies = [
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot(): void
public function boot()
{
$this->registerPolicies();
Passport::routes();
$defaultScopes = [
'User.Read' => 'auth.oauth.scope.user.read',
'Notification.Read' => 'auth.oauth.scope.notification.read',
@ -41,19 +45,7 @@ class AuthServiceProvider extends ServiceProvider
'ReportsManagement.ReadWrite' => 'auth.oauth.scope.reports-management.readwrite',
];
/*
* Return empty scopes if running unit tests or before installation.
* In these cases, migrations arent run yet, so DB queries will fail.
* OAuth isnt tested in unit tests, so returning empty scopes should be fine...?
* Maybe the best approach is to run migrations before bootstrap in tests,
* but this seems impossible for DB_DATABASE=:memory:;
* Or change how scopes are registered so they don't depend on the database,
* but that may introduce BREAKING CHANGES and plugin incompatibility.
* PRs welcome for better solutions!
*/
$scopes = (app()->runningUnitTests() || !Storage::disk('root')->exists('storage/install.lock')) ? [] : Cache::rememberForever('scopes', function () {
return Scope::pluck('description', 'name')->toArray();
});
$scopes = Cache::get('scopes', []);
Passport::tokensCan(array_merge($defaultScopes, $scopes));

View File

@ -9,11 +9,7 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
// The event listener mappings for the application.
protected $listen = [
'App\Events\PluginWasEnabled' => [
Listeners\CopyPluginAssets::class,
@ -48,8 +44,10 @@ class EventServiceProvider extends ServiceProvider
/**
* Register any events for your application.
*
* @return void
*/
public function boot(): void
public function boot()
{
Scope::observe(ScopeObserver::class);
}

View File

@ -7,13 +7,13 @@ use Illuminate\Support\ServiceProvider;
class PluginServiceProvider extends ServiceProvider
{
public function register(): void
public function register()
{
$this->app->singleton(PluginManager::class);
$this->app->alias(PluginManager::class, 'plugins');
}
public function boot(PluginManager $plugins): void
public function boot(PluginManager $plugins)
{
$plugins->boot();
}

View File

@ -5,8 +5,9 @@ namespace App\Providers;
use App\Events\ConfigureRoutes;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Laravel\Passport\Passport;
use Route;
class RouteServiceProvider extends ServiceProvider
{
@ -19,7 +20,7 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define the routes for the application.
*/
public function map(Router $router): void
public function map(Router $router)
{
$this->mapStaticRoutes($router);
@ -27,9 +28,10 @@ class RouteServiceProvider extends ServiceProvider
$this->mapApiRoutes();
Passport::routes();
foreach ($router->getRoutes()->getRoutesByName() as $name => $route) {
if (Str::startsWith($name, ['passport.authorizations', 'passport.tokens', 'passport.clients'])) {
$route->middleware(['auth', 'verified']);
$route->middleware('verified');
}
}
@ -40,7 +42,7 @@ class RouteServiceProvider extends ServiceProvider
* Define the "web" routes for the application.
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(Router $router): void
protected function mapWebRoutes(Router $router)
{
Route::middleware(['web'])
->namespace($this->namespace)
@ -51,7 +53,7 @@ class RouteServiceProvider extends ServiceProvider
* Define the "static" routes for the application.
* These routes will not load session, etc.
*/
protected function mapStaticRoutes(Router $router): void
protected function mapStaticRoutes(Router $router)
{
Route::namespace($this->namespace)
->group(base_path('routes/static.php'));
@ -61,7 +63,7 @@ class RouteServiceProvider extends ServiceProvider
* Define the "api" routes for the application.
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware(

View File

@ -3,12 +3,12 @@
namespace App\Providers;
use App\Http\View\Composers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use View;
class ViewServiceProvider extends ServiceProvider
{
public function boot(): void
public function boot()
{
View::composer([
'home',

View File

@ -8,10 +8,10 @@ use App\Events;
use App\Notifications;
use Blessing\Filter;
use Closure;
use Event;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Str;
use Notification;
class Hook
{

View File

@ -2,10 +2,10 @@
namespace App\Services;
use DB;
use Illuminate\Database\QueryException;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
class Option
{
@ -20,14 +20,13 @@ class Option
return;
}
if (!file_exists(storage_path('install.lock')) || app()->runningUnitTests()) {
try {
$this->items = DB::table('options')
->get()
->mapWithKeys(fn ($item) => [$item->option_name => $item->option_value]);
} catch (QueryException $e) {
$this->items = collect();
return;
}
$this->items = DB::table('options')
->get()
->mapWithKeys(fn ($item) => [$item->option_name => $item->option_value]);
}
public function get($key, $default = null, $raw = false)

View File

@ -2,10 +2,10 @@
namespace App\Services;
use App\Services\Facades\Option;
use BadMethodCallException;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Option;
use ReflectionClass;
/**
@ -38,7 +38,7 @@ class OptionForm
protected $hookBefore;
protected $hookAfter;
protected $alwaysCallback;
protected $alwaysCallback = null;
protected $renderWithoutTable = false;
protected $renderInputTagsOnly = false;
@ -59,7 +59,7 @@ class OptionForm
}
/**
* @throws BadMethodCallException
* @throws \BadMethodCallException
*/
public function __call(string $method, array $params): OptionFormItem
{
@ -105,6 +105,7 @@ class OptionForm
* Add a piece of data to the option form.
*
* @param string|array $key
* @param mixed $value
*/
public function with($key, $value = null): self
{
@ -203,7 +204,7 @@ class OptionForm
/**
* Handle the HTTP post request and update modified options.
*/
public function handle(?callable $callback = null): self
public function handle(callable $callback = null): self
{
$request = request();
$allPostData = $request->all();
@ -351,7 +352,7 @@ class OptionFormItem
public $format;
public $value;
public $value = null;
public $disabled;

View File

@ -36,7 +36,7 @@ class PluginManager
Application $app,
Option $option,
Dispatcher $dispatcher,
Filesystem $filesystem,
Filesystem $filesystem
) {
$this->app = $app;
$this->option = $option;
@ -366,7 +366,7 @@ class PluginManager
*/
public function formatUnresolved(
Collection $unsatisfied,
Collection $conflicts,
Collection $conflicts
): array {
$unsatisfied = $unsatisfied->map(function ($detail, $name) {
if ($name === 'blessing-skin-server') {

View File

@ -20,7 +20,7 @@ class JavaScript
public function __construct(
Filesystem $filesystem,
Repository $cache,
PluginManager $plugins,
PluginManager $plugins
) {
$this->filesystem = $filesystem;
$this->cache = $cache;

View File

@ -6,15 +6,14 @@ use Spatie\TranslationLoader\TranslationLoaderManager;
class Loader extends TranslationLoaderManager
{
protected function loadPaths(array $paths, $locale, $group)
protected function loadPath($path, $locale, $group)
{
return collect($paths)
->reduce(function ($output, $path) use ($locale, $group) {
if ($this->files->exists($full = "{$path}/{$locale}/{$group}.yml")) {
$output = resolve(Yaml::class)->parse($full);
}
$translations = parent::loadPath($path, $locale, $group);
return $output;
}, []);
$full = "{$path}/{$locale}/{$group}.yml";
return count($translations) === 0 && $this->files->exists($full)
? resolve(Yaml::class)->parse($full)
: [];
}
}

View File

@ -52,11 +52,21 @@ if (!function_exists('option')) {
* Get / set the specified option value.
*
* If an array is passed as the key, we will assume you want to set an array of values.
*
* @param array|string $key
* @param mixed $default
* @param bool $raw return raw value without convertion
*
* @return mixed
*/
function option(string|array $key, mixed $default = null, bool $raw = false)
function option($key = null, $default = null, $raw = false)
{
$options = app('options');
if (is_null($key)) {
return $options;
}
if (is_array($key)) {
$options->set($key);

View File

@ -29,7 +29,27 @@ ini_set('display_errors', true);
file_put_contents($envPath, preg_replace('/APP_KEY\s*=\s*/', 'APP_KEY='.$key."\n\n", $envFile));
}
$requiredVersion = '8.1.0';
$requiredFunctions = ['symlink', 'readlink', 'putenv', 'realpath'];
$disabledFunctions = preg_split('/,\s*/', ini_get('disable_functions'));
foreach ($requiredFunctions as $fn) {
if (in_array($fn, $disabledFunctions)) {
die_with_utf8_encoding(
'[Error] Please don\'t disable built-in function "'.$fn.'", which is specified in "php.ini" file.<br>'.
"[错误] 请不要在 php.ini 中禁用 $fn 函数。".
'<strong>我们不建议使用您使用宝塔等面板软件,因为容易引起兼容性问题。</strong>'
);
}
}
if (!empty(ini_get('open_basedir'))) {
die_with_utf8_encoding(
'[Error] Please disable "open_basedir" option by editing "php.ini" file.<br>'.
'[错误] 请修改 php.ini 以关闭 "open_basedir" 选项。'.
'<strong>我们不建议使用您使用宝塔等面板软件,因为容易引起兼容性问题。</strong>'
);
}
$requiredVersion = '8.0.2';
preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches);
$version = $matches[1];
if (version_compare($version, $requiredVersion, '<')) {
@ -51,7 +71,6 @@ ini_set('display_errors', true);
'json',
'fileinfo',
'zip',
'imagick',
],
'write_permission' => [
'bootstrap/cache',

View File

@ -3,10 +3,9 @@
"description": "A web application brings your custom skins back in offline Minecraft servers.",
"license": "MIT",
"require": {
"php": "^8.1",
"php": ">=8.0.2",
"ext-ctype": "*",
"ext-gd": "*",
"ext-imagick": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
@ -19,35 +18,35 @@
"blessing/texture-renderer": "^0.2",
"composer/ca-bundle": "^1.2",
"composer/semver": "^3.2",
"doctrine/dbal": "^3.0",
"doctrine/inflector": "^2.0",
"spatie/laravel-ignition": "^2.0",
"doctrine/dbal": "^2.10",
"doctrine/inflector": "^1.3",
"facade/ignition": "^2.0",
"gregwar/captcha": "1.*",
"guzzlehttp/guzzle": "^7.0",
"intervention/image": "^2.7",
"laravel/framework": "^10.0",
"laravel/passport": "^11.0",
"laravel/framework": "^8.0",
"laravel/passport": "^10.0",
"lorisleiva/laravel-search-string": "^1.0",
"nesbot/carbon": "^2.0",
"nunomaduro/collision": "^7.0",
"rcrowe/twigbridge": "^0.14",
"spatie/laravel-translation-loader": "^2.7",
"symfony/process": "^6.0",
"nunomaduro/collision": "^5.0",
"rcrowe/twigbridge": "^0.12",
"spatie/laravel-translation-loader": "^2.6",
"symfony/process": "^5.0",
"symfony/yaml": "^5.0",
"twig/twig": "^3.0",
"vectorface/whip": "^0.4.0"
"twig/twig": "^2.11",
"vectorface/whip": "^0.3.2"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.5",
"barryvdh/laravel-ide-helper": "^2.10",
"fakerphp/faker": "^1.13",
"friendsofphp/php-cs-fixer": "^3.13",
"laravel/browser-kit-testing": "^7.0",
"friendsofphp/php-cs-fixer": "^3.0",
"laravel/browser-kit-testing": "^6.1",
"laravel/tinker": "^2.4",
"mockery/mockery": "^1.4",
"phpunit/phpunit": "^10.0",
"symfony/css-selector": "^6.2",
"symfony/dom-crawler": "^6.2"
"phpunit/phpunit": "^9.4",
"symfony/css-selector": "^5.0",
"symfony/dom-crawler": "^5.0"
},
"autoload": {
"psr-4": {
@ -71,7 +70,6 @@
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},

24279
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,5 @@
<?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
return [
/*
|--------------------------------------------------------------------------
@ -12,7 +9,6 @@ return [
| Version of Blessing Skin Server.
|
*/
'version' => '6.0.2',
/*
@ -23,24 +19,12 @@ return [
| Where to get information of new versions.
|
*/
'update_source' => env(
'UPDATE_SOURCE',
'https://dev.azure.com/blessing-skin/51010f6d-9f99-40f1-a262-0a67f788df32/_apis/git/'.
'repositories/a9ff8df7-6dc3-4ff8-bb22-4871d3a43936/Items?path=%2Fupdate.json'
),
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'blessing_skin'),
/*
@ -149,24 +133,6 @@ return [
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
@ -178,10 +144,29 @@ return [
|
*/
'providers' => ServiceProvider::defaultProviders()->merge([
'providers' => [
/*
* Package Service Providers...
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Application Service Providers...
@ -192,7 +177,7 @@ return [
App\Providers\PluginServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\ViewServiceProvider::class,
])->toArray(),
],
/*
|--------------------------------------------------------------------------
@ -205,7 +190,44 @@ return [
|
*/
'aliases' => Facade::defaultAliases()->merge([
'Option' => App\Services\Facades\Option::class,
])->toArray(),
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
/*
* Blessing Skin
*/
'Option' => App\Services\Facades\Option::class,
],
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
@ -102,4 +103,5 @@ return [
'expire' => 60,
],
],
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
@ -10,7 +11,7 @@ return [
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
| Supported: "pusher", "redis", "log", "null"
|
*/
@ -28,6 +29,7 @@ return [
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
@ -35,20 +37,8 @@ return [
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
'useTLS' => true,
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
@ -63,5 +53,7 @@ return [
'null' => [
'driver' => 'null',
],
],
];

View File

@ -3,6 +3,7 @@
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
@ -12,6 +13,9 @@ return [
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
@ -25,12 +29,10 @@ return [
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
@ -44,13 +46,11 @@ return [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
@ -75,7 +75,6 @@ return [
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
@ -87,9 +86,6 @@ return [
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
@ -97,11 +93,12 @@ return [
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'blessing_skin'), '_').'_cache_'),
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'blessing_skin'), '_').'_cache'),
];

View File

@ -3,6 +3,7 @@
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
@ -33,6 +34,7 @@ return [
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
@ -54,7 +56,7 @@ return [
'collation' => 'utf8mb4_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'strict' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
@ -72,7 +74,7 @@ return [
'charset' => 'utf8',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'search_path' => 'public',
'schema' => 'public',
'sslmode' => 'prefer',
],
@ -87,9 +89,8 @@ return [
'charset' => 'utf8',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
@ -117,6 +118,7 @@ return [
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
@ -127,8 +129,7 @@ return [
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
@ -136,10 +137,11 @@ return [
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Debugbar Settings
@ -15,8 +16,7 @@ return [
'enabled' => env('DEBUGBAR_ENABLED', null),
'except' => [
'telescope*',
'horizon*',
//
],
/*
@ -32,57 +32,13 @@ return [
|
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, socket, custom
'path' => storage_path('debugbar'), // For file driver
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '', // Instance of StorageInterface for custom driver
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
'port' => 2304, // Port to use with the "socket" driver
'provider' => '', // Instance of StorageInterface for custom driver
],
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking file name.
|
| Supported: "phpstorm", "vscode", "vscode-insiders", "vscode-remote",
| "vscode-insiders-remote", "vscodium", "textmate", "emacs",
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
| "xdebug", "espresso"
|
*/
'editor' => env('DEBUGBAR_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Debugbar will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH', ''),
'local_sites_path' => env('DEBUGBAR_LOCAL_SITES_PATH', ''),
/*
|--------------------------------------------------------------------------
| Vendors
@ -91,7 +47,7 @@ return [
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and highlight.js
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
@ -108,9 +64,6 @@ return [
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
|
| Note for your request to be identified as ajax requests they must either send the header
| X-Requested-With with the value XMLHttpRequest (most JS libraries send this), or have application/json as a Accept header.
*/
'capture_ajax' => true,
@ -148,29 +101,27 @@ return [
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => false, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'mail' => false, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => true, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
'models' => true, // Display models
'livewire' => true, // Display Livewire (when available)
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
],
/*
@ -187,26 +138,20 @@ return [
'show_name' => true, // Also show the users name/email in the debugbar
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'timeline' => false, // Add the queries to the timeline
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // Deprecated setting, is always only SELECT
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => false, // Show hints for common mistakes
'show_copy' => false, // Show copy button next to the query,
'slow_threshold' => false, // Only track queries that last longer than this time in ms
'hints' => true, // Show hints for common mistakes
],
'mail' => [
'full_log' => false,
],
'views' => [
'timeline' => false, // Add the views to the timeline (Experimental)
'data' => false, // Note: Can slow down the application, because the data can be quite large..
'exclude_paths' => [], // Add the paths which you don't want to appear in the views
'data' => false, //Note: Can slow down the application, because the data can be quite large..
],
'route' => [
'label' => true, // show complete route on bar
@ -253,24 +198,4 @@ return [
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
/*
|--------------------------------------------------------------------------
| DebugBar theme
|--------------------------------------------------------------------------
|
| Switches between light and dark theme. If set to auto it will respect system preferences
| Possible values: auto, light, dark
*/
'theme' => env('DEBUGBAR_THEME', 'auto'),
/*
|--------------------------------------------------------------------------
| Backtrace stack limit
|--------------------------------------------------------------------------
|
| By default, the DebugBar limits the number of frames returned by the 'debug_backtrace()' function.
| If you need larger stacktraces, you can increase this number. Setting it to 0 will result in no limit.
*/
'debug_backtrace_limit' => 50,
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
@ -41,6 +42,7 @@ return [
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
@ -59,5 +61,7 @@ return [
'testing' => [
'driver' => 'memory',
],
],
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
@ -43,8 +44,9 @@ return [
*/
'argon' => [
'memory' => 65536,
'threads' => 1,
'time' => 4,
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];

View File

@ -1,20 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "GD Library" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => 'imagick'
];

View File

@ -10,6 +10,7 @@
*/
return [
/*
|--------------------------------------------------------------------------
| JWT Authentication Secret
@ -44,6 +45,7 @@ return [
*/
'keys' => [
/*
|--------------------------------------------------------------------------
| Public Key
@ -80,6 +82,7 @@ return [
*/
'passphrase' => env('JWT_PASSPHRASE'),
],
/*
@ -262,6 +265,7 @@ return [
*/
'providers' => [
/*
|--------------------------------------------------------------------------
| JWT Provider
@ -294,5 +298,7 @@ return [
*/
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
],
];

View File

@ -29,7 +29,7 @@ return [
],
'es_ES' => [
'name' => 'Español',
'short_name' => 'es',
'short_name' => 'es'
],
'ru' => [
'alias' => 'ru_RU',

View File

@ -3,9 +3,9 @@
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
@ -19,22 +19,6 @@ return [
'default' => env('LOG_CHANNEL', 'daily'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
@ -60,16 +44,14 @@ return [
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'level' => 'debug',
'days' => 14,
'replace_placeholders' => true,
],
'slack' => [
@ -77,44 +59,36 @@ return [
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => LOG_USER,
'replace_placeholders' => true,
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
'level' => 'debug',
],
'null' => [
@ -126,4 +100,5 @@ return [
'path' => storage_path('logs/laravel.log'),
],
],
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
@ -27,22 +28,19 @@ return [
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover"
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
@ -51,21 +49,15 @@ return [
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'postmark' => [
'transport' => 'postmark',
// 'client' => [
// 'timeout' => 5,
// ],
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
@ -76,14 +68,6 @@ return [
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
@ -120,4 +104,5 @@ return [
resource_path('views/vendor/mail'),
],
],
];

View File

@ -36,7 +36,7 @@ $menu['admin'] = [
['title' => 'general.status', 'link' => 'admin/status', 'icon' => 'fa-battery-three-quarters'],
['title' => 'general.plugin-manage', 'link' => 'admin/plugins/manage', 'icon' => 'fa-plug'],
['title' => 'general.plugin-market', 'link' => 'admin/plugins/market', 'icon' => 'fa-shopping-bag'],
['title' => 'general.plugin-configs', 'id' => 'plugin-configs', 'icon' => 'fa-cogs', 'children' => []],
['title' => 'general.plugin-configs', 'id' => 'plugin-configs', 'icon' => 'fa-cogs', 'children' => []],
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'],
];

View File

@ -1,56 +1,56 @@
<?php
return [
'site_url' => '',
'site_name' => 'Blessing Skin',
'site_description' => 'Open-source PHP Minecraft Skin Hosting Service',
'site_url' => '',
'site_name' => 'Blessing Skin',
'site_description' => 'Open-source PHP Minecraft Skin Hosting Service',
'register_with_player_name' => 'true',
'require_verification' => 'false',
'regs_per_ip' => '3',
'announcement' => 'Welcome to Blessing Skin {version}!',
'home_pic_url' => './app/bg.webp',
'custom_css' => '',
'custom_js' => '',
'player_name_rule' => 'official',
'require_verification' => 'false',
'regs_per_ip' => '3',
'announcement' => 'Welcome to Blessing Skin {version}!',
'home_pic_url' => './app/bg.webp',
'custom_css' => '',
'custom_js' => '',
'player_name_rule' => 'official',
'custom_player_name_regexp' => '',
'player_name_length_min' => '3',
'player_name_length_max' => '16',
'user_initial_score' => '1000',
'sign_gap_time' => '24',
'sign_score' => '10,100',
'score_per_storage' => 'true',
'player_name_length_min' => '3',
'player_name_length_max' => '16',
'user_initial_score' => '1000',
'sign_gap_time' => '24',
'sign_score' => '10,100',
'score_per_storage' => 'true',
'private_score_per_storage' => '10',
'return_score' => 'true',
'score_per_player' => '100',
'sign_after_zero' => 'false',
'version' => '',
'copyright_text' => '<b>Copyright &copy; {year} <a href="{site_url}">{site_name}</a>.</b> All rights reserved.',
'auto_del_invalid_texture' => 'false',
'return_score' => 'true',
'score_per_player' => '100',
'sign_after_zero' => 'false',
'version' => '',
'copyright_text' => '<b>Copyright &copy; {year} <a href="{site_url}">{site_name}</a>.</b> All rights reserved.',
'auto_del_invalid_texture' => 'false',
'allow_downloading_texture' => 'true',
'texture_name_regexp' => '',
'cache_expire_time' => '31536000',
'max_upload_file_size' => '1024',
'force_ssl' => 'false',
'auto_detect_asset_url' => 'true',
'plugins_enabled' => '',
'copyright_prefer' => '0',
'score_per_closet_item' => '0',
'favicon_url' => 'app/favicon.ico',
'score_award_per_texture' => '0',
'texture_name_regexp' => '',
'cache_expire_time' => '31536000',
'max_upload_file_size' => '1024',
'force_ssl' => 'false',
'auto_detect_asset_url' => 'true',
'plugins_enabled' => '',
'copyright_prefer' => '0',
'score_per_closet_item' => '0',
'favicon_url' => 'app/favicon.ico',
'score_award_per_texture' => '0',
'take_back_scores_after_deletion' => 'true',
'score_award_per_like' => '0',
'meta_keywords' => '',
'meta_description' => '',
'meta_extras' => '',
'cdn_address' => '',
'recaptcha_sitekey' => '',
'recaptcha_secretkey' => '',
'recaptcha_invisible' => 'false',
'score_award_per_like' => '0',
'meta_keywords' => '',
'meta_description' => '',
'meta_extras' => '',
'cdn_address' => '',
'recaptcha_sitekey' => '',
'recaptcha_secretkey' => '',
'recaptcha_invisible' => 'false',
'reporter_score_modification' => '0',
'reporter_reward_score' => '0',
'content_policy' => '',
'transparent_navbar' => 'false',
'status_code_for_private' => '403',
'navbar_color' => 'cyan',
'sidebar_color' => 'dark-maroon',
'reporter_reward_score' => '0',
'content_policy' => '',
'transparent_navbar' => 'false',
'status_code_for_private' => '403',
'navbar_color' => 'cyan',
'sidebar_color' => 'dark-maroon',
];

View File

@ -1,62 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Passport Guard
|--------------------------------------------------------------------------
|
| Here you may specify which authentication guard Passport will use when
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'web',
/*
|--------------------------------------------------------------------------
| Encryption Keys
|--------------------------------------------------------------------------
|
| Passport uses encryption keys while generating secure access tokens for
| your application. By default, the keys are stored as local files but
| can be set via environment variables when that is more convenient.
|
*/
'private_key' => env('PASSPORT_PRIVATE_KEY'),
'public_key' => env('PASSPORT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Client UUIDs
|--------------------------------------------------------------------------
|
| By default, Passport uses auto-incrementing primary keys when assigning
| IDs to clients. However, if Passport is installed using the provided
| --uuids switch, this will be set to "true" and UUIDs will be used.
|
*/
'client_uuids' => false,
/*
|--------------------------------------------------------------------------
| Personal Access Client
|--------------------------------------------------------------------------
|
| If you enable client hashing, you should set the personal access client
| ID and unhashed secret within your environment file. The values will
| get used while issuing fresh personal access tokens to your users.
|
*/
'personal_access_client' => [
'id' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_ID'),
'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET'),
],
];

View File

@ -33,7 +33,7 @@ return [
*/
'registry' => env(
'PLUGINS_REGISTRY',
'https://bs-plugins.littleservice.cn/registry_{lang}.json'
'https://gplane.coding.net/p/blessing-skin-plugins-dist/d/blessing-skin-plugins-dist/git/raw/master/registry_{lang}.json'
),
/*

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
@ -28,6 +29,7 @@ return [
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
@ -37,7 +39,6 @@ return [
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
@ -46,7 +47,6 @@ return [
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
@ -54,10 +54,9 @@ return [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
@ -66,24 +65,8 @@ return [
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'job_batches',
],
/*
@ -98,8 +81,9 @@ return [
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

View File

@ -10,5 +10,5 @@ return [
|
*/
'cipher' => env('PWD_METHOD', 'BCRYPT'),
'salt' => env('SALT', ''),
'salt' => env('SALT', ''),
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
@ -17,7 +18,6 @@ return [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
@ -29,4 +29,5 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
@ -69,7 +70,7 @@ return [
|
*/
'connection' => env('SESSION_CONNECTION'),
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
@ -89,15 +90,13 @@ return [
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| When using the "apc", "memcached", or "dynamodb" session drivers you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
@ -149,7 +148,7 @@ return [
|
*/
'domain' => env('SESSION_DOMAIN'),
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
@ -158,7 +157,7 @@ return [
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
| the cookie from being sent to you if it can not be done securely.
|
*/
@ -184,11 +183,12 @@ return [
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict", "none", null
| Supported: "lax", "strict", "none"
|
*/
'same_site' => 'lax',
];

View File

@ -1,6 +1,7 @@
<?php
return [
/*
* Language lines will be fetched by these loaders. You can put any class here that implements
* the Spatie\TranslationLoader\TranslationLoaders\TranslationLoader-interface.
@ -19,4 +20,5 @@ return [
* This is the translation manager which overrides the default Laravel `translation.loader`
*/
'translation_manager' => App\Services\Translations\Loader::class,
];

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
/*
/**
* Configuration options for Twig.
*/
return [
'twig' => [
/*
|--------------------------------------------------------------------------
@ -33,6 +34,7 @@ return [
|
*/
'environment' => [
// When set to true, the generated templates have a __toString() method
// that you can use to display the generated nodes.
// default: false
@ -42,6 +44,10 @@ return [
// default: utf-8
'charset' => 'utf-8',
// The base template class to use for generated templates.
// default: TwigBridge\Twig\Template
'base_template_class' => 'TwigBridge\Twig\Template',
// An absolute path where to store the compiled templates, or false to disable caching. If null
// then the cache file path is used.
// default: cache file storage path
@ -67,19 +73,6 @@ return [
'optimizations' => -1,
],
/*
|--------------------------------------------------------------------------
| Safe Classes
|--------------------------------------------------------------------------
|
| When set, the output of the `__string` method of the following classes will not be escaped.
| default: Laravel's Htmlable, which the HtmlString class implements.
|
*/
'safe_classes' => [
\Illuminate\Contracts\Support\Htmlable::class => ['html'],
],
/*
|--------------------------------------------------------------------------
| Global variables
@ -93,6 +86,7 @@ return [
],
'extensions' => [
/*
|--------------------------------------------------------------------------
| Extensions
@ -104,21 +98,21 @@ return [
|
*/
'enabled' => [
'TwigBridge\Extension\Laravel\Event',
'Twig\Extension\StringLoaderExtension',
'TwigBridge\Extension\Loader\Facades',
'TwigBridge\Extension\Loader\Filters',
'TwigBridge\Extension\Loader\Functions',
'TwigBridge\Extension\Loader\Globals',
'TwigBridge\Extension\Laravel\Auth',
'TwigBridge\Extension\Laravel\Config',
'TwigBridge\Extension\Laravel\Dump',
'TwigBridge\Extension\Laravel\Input',
// 'TwigBridge\Extension\Laravel\Input',
'TwigBridge\Extension\Laravel\Session',
'TwigBridge\Extension\Laravel\Str',
// 'TwigBridge\Extension\Laravel\Str',
'TwigBridge\Extension\Laravel\Translator',
'TwigBridge\Extension\Laravel\Url',
'TwigBridge\Extension\Laravel\Model',
// 'TwigBridge\Extension\Laravel\Model',
// 'TwigBridge\Extension\Laravel\Gate',
// 'TwigBridge\Extension\Laravel\Form',
@ -183,12 +177,7 @@ return [
| </code>
|
*/
'functions' => [
'elixir',
'head',
'last',
'mix',
],
'functions' => [],
/*
|--------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
@ -32,4 +33,5 @@ return [
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

View File

@ -2,7 +2,6 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAllTables extends Migration
{

View File

@ -1,8 +1,6 @@
<?php
use App\Services\Facades\Option;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class ImportOptions extends Migration
{

View File

@ -2,7 +2,6 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddVerificationToUsersTable extends Migration
{

View File

@ -1,21 +0,0 @@
<?php
use App\Services\Facades\Option;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Option::set('max_texture_width', 8192);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
};

View File

@ -23,13 +23,12 @@
"dependencies": {
"@emotion/react": "^11.0.0",
"@emotion/styled": "^11.0.0",
"@fortawesome/fontawesome-free": "^6.3.0",
"@hot-loader/react-dom": "^17.0.0",
"@tweenjs/tween.js": "^18.5.0",
"admin-lte": "^3.2.0",
"blessing-skin-shell": "^0.3.4",
"bootstrap": "^4.6.1",
"cac": "6.6.1",
"cac": "^6.6.1",
"cli-spinners": "^2.5.0",
"clsx": "^1.1.1",
"echarts": "^5.1.2",
@ -45,13 +44,15 @@
"react-draggable": "^4.4.2",
"react-hot-loader": "^4.12.21",
"react-loading-skeleton": "^2.1.1",
"react-use": "^17.4.0",
"reaptcha": "^1.7.2",
"rxjs": "^6.5.5",
"skinview-utils": "^0.5.5",
"skinview3d": "^3.0.0-alpha.1",
"skinview3d": "^2.2.1",
"spectre.css": "^0.5.8",
"use-immer": "^0.4.2",
"workbox-expiration": "^5.1.3",
"workbox-routing": "^5.1.3",
"workbox-strategies": "^5.1.3",
"xterm": "^4.6.0",
"xterm-addon-fit": "^0.4.0"
},
@ -151,13 +152,12 @@
"/node_modules/",
"<rootDir>/resources/assets/tests/(views|components)/.*\\.ts$"
],
"maxWorkers": "50%",
"maxWorkers": 1,
"globals": {
"ts-jest": {
"tsconfig": "<rootDir>/resources/assets/tests/tsconfig.json",
"isolatedModules": true
}
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
}

View File

@ -1,23 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<source>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" backupStaticAttributes="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
<exclude>
<directory suffix=".php">./app/Services/Cipher</directory>
</exclude>
</source>
</coverage>
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing" />
<env name="APP_ENV" value="testing"/>
</php>
<listeners>
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Printer"/>
</listeners>
</phpunit>

View File

@ -1,6 +1,5 @@
/** @jsxImportSource @emotion/react */
import React, { useState, useEffect, useRef } from 'react'
import { useMeasure } from 'react-use'
import { css } from '@emotion/react'
import styled from '@emotion/styled'
import * as skinview3d from 'skinview3d'
@ -27,12 +26,17 @@ interface Props {
initPositionZ?: number
}
const animationFactories = [
() => new skinview3d.WalkingAnimation(),
() => new skinview3d.RunningAnimation(),
() => new skinview3d.FlyingAnimation(),
() => new skinview3d.IdleAnimation(),
]
type AnimationHandles = {
walk: skinview3d.SubAnimationHandle | null
run: skinview3d.SubAnimationHandle | null
rotate: skinview3d.SubAnimationHandle | null
}
const animationHandles: AnimationHandles = {
walk: null,
run: null,
rotate: null,
}
const ActionButton = styled.i`
display: inline;
@ -44,17 +48,13 @@ const ActionButton = styled.i`
`
const cssViewer = css`
flex: 1 1 auto;
${breakpoints.greaterThan(breakpoints.Breakpoint.lg)} {
min-height: 500px;
}
min-height: 300px;
width: 100%;
height: 100%;
canvas {
display: flex;
justify-content: center;
cursor: move;
}
`
@ -63,9 +63,10 @@ const Viewer: React.FC<Props> = (props) => {
const viewRef: React.MutableRefObject<skinview3d.SkinViewer> = useRef(null!)
const containerRef = useRef<HTMLCanvasElement>(null)
const animationHandlesRef = useRef(animationHandles)
const [paused, setPaused] = useState(false)
const [animation, setAnimation] = useState(0)
const [running, setRunning] = useState(false)
const [bgPicture, setBgPicture] = useState(-1)
const indicator = (() => {
@ -82,39 +83,36 @@ const Viewer: React.FC<Props> = (props) => {
useEffect(() => {
const container = containerRef.current!
const viewer = new skinview3d.SkinViewer({
const viewer = new skinview3d.FXAASkinViewer({
canvas: container,
width: container.clientWidth,
height: container.clientHeight,
skin: props.skin || SkinSteve,
cape: props.cape || undefined,
cape: props.cape || '',
model: props.isAlex ? 'slim' : 'default',
zoom: initPositionZ / 100,
})
viewer.autoRotate = true
if (document.body.classList.contains('dark-mode')) {
viewer.background = '#6c757d'
}
const rotate = viewer.animations.add(skinview3d.RotatingAnimation)
animationHandlesRef.current.rotate = rotate
const control = skinview3d.createOrbitControls(viewer)
viewRef.current = viewer
return () => {
control.dispose()
viewer.dispose()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
const [containerWrapperRef, containerMeasure] = useMeasure<HTMLDivElement>()
useEffect(() => {
viewRef.current.setSize(containerMeasure.width, containerMeasure.height)
})
useEffect(() => {
const viewer = viewRef.current
viewer.loadSkin(props.skin || SkinSteve, {
model: props.isAlex ? 'slim' : 'default',
})
viewer.loadSkin(props.skin || SkinSteve, props.isAlex ? 'slim' : 'default')
}, [props.skin, props.isAlex])
useEffect(() => {
@ -127,63 +125,52 @@ const Viewer: React.FC<Props> = (props) => {
}, [props.cape])
useEffect(() => {
const viewer = viewRef.current
const factory = animationFactories[animation]
if (factory === undefined) {
viewer.animation = null
const handles = animationHandlesRef.current
if (running) {
handles.walk?.resetAndRemove()
handles.walk = null
const run = viewRef.current.animations.add(skinview3d.RunningAnimation)
run.speed = 0.6
handles.run = run
} else {
const newAnimation = factory()
newAnimation.paused = paused // Perseve `paused` state
viewer.animation = newAnimation
handles.run?.resetAndRemove()
handles.run = null
const walk = viewRef.current.animations.add(skinview3d.WalkingAnimation)
handles.walk = walk
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [animation])
}, [running])
useEffect(() => {
const currentAnimation = viewRef.current.animation
if (currentAnimation !== null) {
currentAnimation.paused = paused
}
viewRef.current.animations.paused = paused
}, [paused])
useEffect(() => {
const viewer = viewRef.current
const backgroundUrl = backgrounds[bgPicture]
if (backgroundUrl === undefined) {
viewer.background = null
} else {
viewer.loadBackground(backgroundUrl)
}
viewRef.current.loadBackground(backgrounds[bgPicture]!)
}, [bgPicture])
const togglePause = () => {
setPaused((paused) => {
if (paused) {
return false
} else {
viewRef.current.autoRotate = false
return true
}
})
setPaused((paused) => !paused)
}
const toggleAnimation = () => {
setAnimation((index) => (index + 1) % animationFactories.length)
setPaused(false)
const toggleRun = () => {
setRunning((running) => !running)
}
const toggleRotate = () => {
const viewer = viewRef.current
viewer.autoRotate = !viewer.autoRotate
const handles = animationHandlesRef.current
if (handles.rotate) {
handles.rotate.paused = !handles.rotate.paused
}
}
const toggleBackEquippment = () => {
const player = viewRef.current.playerObject
if (player.backEquipment === 'cape') {
player.backEquipment = 'elytra'
} else {
player.backEquipment = 'cape'
}
const handleReset = () => {
const handles = animationHandlesRef.current
handles.walk?.resetAndRemove()
handles.run?.resetAndRemove()
handles.rotate?.resetAndRemove()
viewRef.current.animations.paused = true
}
const setWhite = () => {
@ -226,42 +213,38 @@ const Viewer: React.FC<Props> = (props) => {
</h3>
<div>
<ActionButton
className={`fas fa-tablet ${props.cape ? '' : 'd-none'}`}
className={`fas fa-${running ? 'walking' : 'running'}`}
data-toggle="tooltip"
data-placement="bottom"
title={t('general.switchCapeElytra')}
onClick={toggleBackEquippment}
title={`${t('general.walk')} / ${t('general.run')}`}
onClick={toggleRun}
></ActionButton>
<ActionButton
className={`fas fa-person-running`}
data-toggle="tooltip"
data-placement="bottom"
title={t('general.switchAnimation')}
onClick={toggleAnimation}
></ActionButton>
<ActionButton
className={`fas fa-${paused ? 'play' : 'pause'}`}
data-toggle="tooltip"
data-placement="bottom"
title={
paused
? t('general.playAnimation')
: t('general.pauseAnimation')
}
onClick={togglePause}
></ActionButton>
<ActionButton
className="fas fa-rotate-right"
className="fas fa-redo-alt"
data-toggle="tooltip"
data-placement="bottom"
title={t('general.rotation')}
onClick={toggleRotate}
></ActionButton>
<ActionButton
className={`fas fa-${paused ? 'play' : 'pause'}`}
data-toggle="tooltip"
data-placement="bottom"
title={t('general.pause')}
onClick={togglePause}
></ActionButton>
<ActionButton
className="fas fa-stop"
data-toggle="tooltip"
data-placement="bottom"
title={t('general.reset')}
onClick={handleReset}
></ActionButton>
</div>
</div>
</div>
<div ref={containerWrapperRef} css={cssViewer} className="p-0">
<canvas ref={containerRef}></canvas>
<div className="card-body p-0">
<canvas ref={containerRef} css={cssViewer}></canvas>
</div>
<div className="card-footer">
<div className="mt-2 mb-3 d-flex">

View File

@ -6,11 +6,13 @@ import routes from './scripts/route'
Object.assign(window, { React, ReactDOM, $ })
const entry = document.querySelector('[href="#launch-cli"]')
entry?.addEventListener('click', async () => {
const { launch } = await import('./scripts/cli')
launch()
})
if (blessing.route.startsWith('admin')) {
const entry = document.querySelector<HTMLAnchorElement>('#launch-cli')
entry?.addEventListener('click', async () => {
const { launch } = await import('./scripts/cli')
launch()
})
}
const route = routes.find((route) =>
new RegExp(`^${route.path}$`, 'i').test(blessing.route),

View File

@ -0,0 +1,9 @@
const blessingElement = document.querySelector('#blessing-globals')!
// @ts-ignore
window.blessing = JSON.parse(blessingElement.textContent!)
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js?v6')
})
export {}

View File

@ -0,0 +1,123 @@
import { registerRoute } from 'workbox-routing'
import {
CacheFirst,
StaleWhileRevalidate,
NetworkOnly,
} from 'workbox-strategies'
import { ExpirationPlugin } from 'workbox-expiration'
const oneWeek = 7 * 24 * 3600
if (process.env.NODE_ENV === 'development') {
registerRoute(/\.js/, new NetworkOnly())
registerRoute(/\.css/, new NetworkOnly())
}
//#region Pictures
registerRoute(
/\/preview\/\d+/,
new CacheFirst({
cacheName: 'texture-preview-v2',
fetchOptions: {
credentials: 'omit',
},
plugins: [
new ExpirationPlugin({ maxAgeSeconds: oneWeek, purgeOnQuotaError: true }),
],
}),
)
registerRoute(
/\/app\/.*\.webp/,
new StaleWhileRevalidate({
cacheName: 'webp-resource-v1',
fetchOptions: {
credentials: 'omit',
},
}),
)
registerRoute(
/\/avatar\/\d+/,
new CacheFirst({
cacheName: 'avatar-v2',
fetchOptions: {
credentials: 'omit',
},
plugins: [new ExpirationPlugin({ maxAgeSeconds: oneWeek })],
}),
)
//#endregion
//#region JavaScript files
registerRoute(
/.+\/app\/\w{2,3}\.\w{7}\.js$/,
new CacheFirst({
cacheName: 'javascript-v1',
fetchOptions: {
credentials: 'omit',
mode: 'cors',
},
plugins: [
new ExpirationPlugin({ maxAgeSeconds: oneWeek, purgeOnQuotaError: true }),
],
}),
)
registerRoute(
/.+\/plugins\/.+\.js$/,
new StaleWhileRevalidate({
cacheName: 'javascript-v1',
fetchOptions: {
credentials: 'omit',
mode: 'cors',
},
plugins: [
new ExpirationPlugin({ maxAgeSeconds: oneWeek, purgeOnQuotaError: true }),
],
}),
)
//#endregion
//#region CSS files
registerRoute(
/.+\/app\/.*\.css$/,
new CacheFirst({
cacheName: 'stylesheet-v1',
fetchOptions: {
credentials: 'omit',
mode: 'cors',
},
plugins: [
new ExpirationPlugin({ maxAgeSeconds: oneWeek, purgeOnQuotaError: true }),
],
}),
)
registerRoute(
/.+\/plugins\/.+\.css$/,
new StaleWhileRevalidate({
cacheName: 'stylesheet-v1',
fetchOptions: {
credentials: 'omit',
mode: 'cors',
},
plugins: [
new ExpirationPlugin({ maxAgeSeconds: oneWeek, purgeOnQuotaError: true }),
],
}),
)
//#endregion
//#region Fonts
registerRoute(
({ request }) => request.destination === 'font',
new StaleWhileRevalidate({
cacheName: 'font-v1',
fetchOptions: {
credentials: 'omit',
mode: 'cors',
},
plugins: [new ExpirationPlugin({ maxEntries: 12 })],
}),
)
//#endregion

View File

@ -75,7 +75,7 @@ body {
.main-button {
color: #fff;
padding: 0.8em 2em;
padding: 0.8em 2.5em;
border-radius: 5px;
background: transparent;
border: 1px solid #fff;

View File

@ -72,9 +72,6 @@ function createLineChart(
chart.setOption({
title: {
text: data.label,
textStyle: {
color: textColor,
},
},
textStyle: {
color: textColor,

View File

@ -257,9 +257,7 @@ const Show: React.FC = () => {
})()
const canEdit = currentUid === texture.uploader || isAdmin
const textureUrl = texture.hash
? `${blessing.base_url}/textures/${texture.hash}`
: ''
const textureUrl = `${blessing.base_url}/textures/${texture.hash}`
return (
<>

View File

@ -32,7 +32,7 @@ const EmailVerification: React.FC = () => {
{t('user.verification.sending')}
</>
) : (
<a className="link-info" href="#" onClick={send}>
<a href="#" onClick={send}>
{t('user.verification.resend')}
</a>
)}

View File

@ -1,55 +1,71 @@
/* eslint-disable max-params */
/* eslint-disable max-classes-per-file */
import type {
PlayerObject,
SkinObject,
CapeObject,
EarsObject,
} from 'skinview3d'
import type { PlayerObject, SkinObject, CapeObject } from 'skinview3d'
export class SkinViewer {
export class FXAASkinViewer {
disposed = false
background = null
animation = null
autoRotate = false
autoRotateSpeed = 1.0
background = ''
animations = new RootAnimation()
animationPaused = false
playerObject: PlayerObject
constructor() {
this.animationPaused = false
this.playerObject = {
skin: {} as SkinObject,
cape: {} as CapeObject,
ears: {} as EarsObject,
backEquipment: 'cape',
} as PlayerObject
}
loadSkin() {}
resetSkin() {}
loadCape() {}
resetCape() {}
loadBackground() {}
setSize() {}
dispose() {
this.disposed = true
}
}
export class PlayerAnimation {
speed = 1.0
export class RootAnimation {
paused = false
progress = 0
add(animation: unknown) {
return animation
}
}
export class IdleAnimation extends PlayerAnimation {}
export function createOrbitControls() {
return {
dispose() {},
}
}
export class WalkingAnimation extends PlayerAnimation {}
export class RunningAnimation extends PlayerAnimation {}
export class FlyingAnimation extends PlayerAnimation {}
export const WalkingAnimation = new Proxy(
{},
{
get() {
return jest.fn()
},
},
)
export const RunningAnimation = new Proxy(
{},
{
get() {
return jest.fn()
},
},
)
export const RotatingAnimation = new Proxy(
{},
{
get() {
return jest.fn()
},
},
)
export function isSlimSkin() {
return false

View File

@ -49,27 +49,33 @@ describe('indicator', () => {
})
describe('actions', () => {
it('toggle animation', () => {
const component = <Viewer isAlex={false} />
const { getByTitle } = render(component)
fireEvent.click(getByTitle(`${t('general.switchAnimation')}`)) // should start running
fireEvent.click(getByTitle(`${t('general.switchAnimation')}`)) // should start flying
fireEvent.click(getByTitle(`${t('general.switchAnimation')}`)) // should be idle
fireEvent.click(getByTitle(`${t('general.switchAnimation')}`)) // should start walking
it('toggle run', () => {
const { getByTitle } = render(<Viewer isAlex={false} />)
fireEvent.click(getByTitle(`${t('general.walk')} / ${t('general.run')}`))
})
it('toggle rotation', () => {
const { getByTitle } = render(<Viewer isAlex={false} />)
fireEvent.click(getByTitle(t('general.rotation'))) // should stop rotation
fireEvent.click(getByTitle(t('general.rotation'))) // should start rotation
fireEvent.click(getByTitle(t('general.rotation')))
})
it('toggle pause', () => {
const { getByTitle } = render(<Viewer isAlex={false} />)
const icon = getByTitle(t('general.pauseAnimation'))
const icon = getByTitle(t('general.pause'))
fireEvent.click(icon)
expect(icon).toHaveClass('fa-play')
})
it('reset', () => {
const { getByTitle } = render(<Viewer isAlex={false} />)
fireEvent.click(getByTitle(t('general.reset')))
})
it('reset when running', () => {
const { getByTitle } = render(<Viewer isAlex={false} />)
fireEvent.click(getByTitle(`${t('general.walk')} / ${t('general.run')}`))
fireEvent.click(getByTitle(t('general.reset')))
})
})
describe('background', () => {

View File

@ -26,7 +26,7 @@ score-intro:
rates:
storage: ':score scores = 1 KB storage'
player: ':score scores = 1 player'
closet: ':score scores = 1 closet item'
closet: ':score socres = 1 closet item'
closet:
add:
success: Added :name to closet successfully.

Some files were not shown because too many files have changed in this diff Show More