Версия 0.8.0 #4
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
Захотелось написать свой независимый сервис защиты от роботов. Сервис каптча написан на фреймворке Laravel. Вдохновлялся, а так же брал картинки с проекта <a href="https://github.com/wenlng/go-captcha" target="_blank">Go Captcha</a>.
|
Захотелось написать свой независимый сервис защиты от роботов. Сервис каптча написан на фреймворке Laravel. Вдохновлялся, а так же брал картинки с проекта <a href="https://github.com/wenlng/go-captcha" target="_blank">Go Captcha</a>.
|
||||||
|
|
||||||
|
[Сайт проекта](https://service-captcha.projects.kor-elf.net/)
|
||||||
|
|
||||||
## Зависимости
|
## Зависимости
|
||||||
|
|
||||||
php 8.2 (модули: redis, gd)
|
php 8.3 (модули: redis, gd)
|
||||||
|
|
||||||
redis
|
redis
|
||||||
|
|
||||||
@ -26,7 +28,7 @@ https://captcha-admin-demo.tut-site.net/api-docs/
|
|||||||
https://git.kor-elf.net/kor-elf/service-captcha-gui
|
https://git.kor-elf.net/kor-elf/service-captcha-gui
|
||||||
|
|
||||||
## Как проверять со стороны бэкенда
|
## Как проверять со стороны бэкенда
|
||||||
Для Laravel 10 есть готовый пакет: https://git.kor-elf.net/kor-elf/captcha-rule-for-laravel
|
Для Laravel 10, 11 есть готовый пакет: https://git.kor-elf.net/kor-elf/captcha-rule-for-laravel
|
||||||
|
|
||||||
Можно установить этот пакет так: composer require kor-elf/captcha-rule-for-laravel
|
Можно установить этот пакет так: composer require kor-elf/captcha-rule-for-laravel
|
||||||
|
|
||||||
|
@ -29,13 +29,16 @@ final class CaptchaLog extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast.
|
* Get the attributes that should be cast.
|
||||||
*
|
*
|
||||||
* @var array
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
'type' => CaptchaLogType::class,
|
'type' => CaptchaLogType::class,
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeLatest(Builder $query): Builder
|
public function scopeLatest(Builder $query): Builder
|
||||||
{
|
{
|
||||||
|
@ -51,15 +51,18 @@ final class User extends Authenticatable
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast.
|
* Get the attributes that should be cast.
|
||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
'is_active' => 'boolean',
|
'is_active' => 'boolean',
|
||||||
'lang' => Lang::class,
|
'lang' => Lang::class,
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the user's roles
|
* Return the user's roles
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
"keywords": ["framework", "laravel"],
|
"keywords": ["framework", "laravel"],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.2",
|
"php": "^8.3",
|
||||||
"guzzlehttp/guzzle": "^7.2",
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
"laravel/framework": "^10.0",
|
"laravel/framework": "^11.0",
|
||||||
"laravel/sanctum": "^3.2",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/tinker": "^2.8"
|
"laravel/tinker": "^2.8"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
@ -17,8 +17,8 @@
|
|||||||
"laravel/pint": "^1.0",
|
"laravel/pint": "^1.0",
|
||||||
"laravel/sail": "^1.18",
|
"laravel/sail": "^1.18",
|
||||||
"mockery/mockery": "^1.4.4",
|
"mockery/mockery": "^1.4.4",
|
||||||
"nunomaduro/collision": "^7.0",
|
"nunomaduro/collision": "^8.1",
|
||||||
"phpunit/phpunit": "^10.0",
|
"phpunit/phpunit": "^10.5",
|
||||||
"spatie/laravel-ignition": "^2.0"
|
"spatie/laravel-ignition": "^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
2578
app/application/composer.lock
generated
2578
app/application/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -63,5 +63,4 @@
|
|||||||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM docker.io/php:8.2-zts-alpine3.18 AS UNIT_BUILDER
|
FROM docker.io/php:8.3-zts-alpine3.18 AS UNIT_BUILDER
|
||||||
|
|
||||||
ARG UNIT_VERSION=1.31.1
|
ARG UNIT_VERSION=1.31.1
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ RUN apk --no-cache add pcre2-dev gcc git musl-dev make && \
|
|||||||
make && \
|
make && \
|
||||||
make install
|
make install
|
||||||
|
|
||||||
FROM docker.io/php:8.2-zts-alpine3.18 as BUILD
|
FROM docker.io/php:8.3-zts-alpine3.18 as BUILD
|
||||||
|
|
||||||
COPY --from=UNIT_BUILDER /var/sbin/unitd /usr/sbin/unitd
|
COPY --from=UNIT_BUILDER /var/sbin/unitd /usr/sbin/unitd
|
||||||
COPY --from=UNIT_BUILDER /var/lib/unit/ /var/lib/unit/
|
COPY --from=UNIT_BUILDER /var/lib/unit/ /var/lib/unit/
|
||||||
@ -48,32 +48,32 @@ RUN apk --no-cache add pcre2 libbz2 libpng libwebp libjpeg-turbo icu-libs freety
|
|||||||
&& ln -sf /dev/stdout /var/log/unit.log \
|
&& ln -sf /dev/stdout /var/log/unit.log \
|
||||||
&& addgroup -S unit && adduser -S unit -G unit
|
&& addgroup -S unit && adduser -S unit -G unit
|
||||||
|
|
||||||
FROM BUILD as APP_BUILD_FOR_PRODUCTION
|
#FROM BUILD as APP_BUILD_FOR_PRODUCTION
|
||||||
WORKDIR /home/app
|
#WORKDIR /home/app
|
||||||
|
#
|
||||||
COPY application /home/app
|
#COPY application /home/app
|
||||||
|
#
|
||||||
RUN apk --no-cache add git nodejs npm \
|
#RUN apk --no-cache add git nodejs npm \
|
||||||
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
# && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
||||||
&& composer install --optimize-autoloader --no-dev \
|
# && composer install --optimize-autoloader --no-dev \
|
||||||
&& npm install && npm run build \
|
# && npm install && npm run build \
|
||||||
&& rm -rf /home/app/node_modules /home/app/.env
|
# && rm -rf /home/app/node_modules /home/app/.env
|
||||||
|
#
|
||||||
|
#
|
||||||
FROM BUILD AS PRODUCTION
|
#FROM BUILD AS PRODUCTION
|
||||||
|
#
|
||||||
COPY --from=APP_BUILD_FOR_PRODUCTION /home/app /var/www/html
|
#COPY --from=APP_BUILD_FOR_PRODUCTION /home/app /var/www/html
|
||||||
COPY docker/docker-entrypoint_prod.sh /home/unit/docker-entrypoint.sh
|
#COPY docker/docker-entrypoint_prod.sh /home/unit/docker-entrypoint.sh
|
||||||
|
#
|
||||||
WORKDIR /var/www/html
|
#WORKDIR /var/www/html
|
||||||
|
#
|
||||||
RUN chmod 755 /home/unit/docker-entrypoint.sh
|
#RUN chmod 755 /home/unit/docker-entrypoint.sh
|
||||||
|
#
|
||||||
STOPSIGNAL SIGTERM
|
#STOPSIGNAL SIGTERM
|
||||||
|
#
|
||||||
ENTRYPOINT ["/home/unit/docker-entrypoint.sh"]
|
#ENTRYPOINT ["/home/unit/docker-entrypoint.sh"]
|
||||||
EXPOSE 9000
|
#EXPOSE 9000
|
||||||
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock", "--user", "unit", "--group", "unit"]
|
#CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock", "--user", "unit", "--group", "unit"]
|
||||||
|
|
||||||
|
|
||||||
FROM BUILD AS DEVELOP
|
FROM BUILD AS DEVELOP
|
||||||
|
Loading…
Reference in New Issue
Block a user