let na = Math.abs(angle)
if (na > 90) na = 90 - (na - 90)
let an = Math.PI * na / 180
let nwl = width * Math.cos(an)
let nhl = width * Math.sin(an)
let nhu = height * Math.cos(an)
let nwr = height * Math.sin(an)
return [nwl + nwr, nhu + nhl]
class DriverLoginServiceProvider extends ServiceProvider
{
// protected $defer = true;
public function register()
{
$this->app->singleton(DriverLogin::class, function ($app) {
return DriverLogin::where('phone', Request::input('phone', 'none'))->first();
});
}
public function provides()
{
return [DriverLogin::class];
}
}
public function loginCheckPhone(CheckDriver $request, DriverLogin $driver)
{
// Проверяем можно ли делать повторную отправку.
if ( ($checkSend = Sms::checkSend($driver->verify_code)) !== true ) {
return response()->json( $checkSend, 403);
}
$driver->verify_code = Sms::send($driver->phone, 'Ваш код авторизации в личном кабинете: %code');
$driver->save();
}
public function passes($attribute, $value)
{
return (app()->get(DriverLogin::class)) ? true : false;
}
<?php
namespace App\Models;
class DriverLogin extends \Backend\Driver\Models\Driver
{
}
?>
<?php
namespace App\Services;
use Backend\Driver\Models\Driver;
use Request;
class DriverLogin
{
private static $model = null;
public static function get()
{
if (DriverLogin::$model === null ) {
$phone = Request::input('phone', '');
DriverLogin::$model = (iconv_strlen($phone) != 12)
? false
: Driver::where('phone', $phone)->first();
}
return DriverLogin::$model;
}
}
?>
user nginx;
events {
worker_connections 1024;
}
http {
upstream docker-registry {
server registry:5000;
}
## Set a variable to help us decide if we need to add the
## 'Docker-Distribution-Api-Version' header.
## The registry always sets this header.
## In the case of nginx performing auth, the header is unset
## since nginx is auth-ing before proxying.
map $upstream_http_docker_distribution_api_version $docker_distribution_api_version {
'' 'registry/2.0';
}
#------------------------READ ONLY ACCESS-------------------------
server {
listen 5000;
client_max_body_size 0;
chunked_transfer_encoding on;
location /v2/ {
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}
#Доступ только на чтение
if ($request_method !~* ^(GET|HEAD)$ ) {
return 403;
}
add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
proxy_pass http://registry:5000;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}
}
#---------------------------WRITE ACCESS-----------------------------
server {
listen 5001;
client_max_body_size 0;
chunked_transfer_encoding on;
location /v2/ {
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}
auth_basic "Registry realm";
auth_basic_user_file /run/secrets/passwd;
allow 172.18.0.1;
deny all;
add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
proxy_pass http://registry:5000;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}
}
}
version: '3.4'
services:
nginx:
image: nginx
ports:
- target: 5000
published: 5000
mode: host
- target: 5001
published: 5001
mode: host
configs:
- source: nginx
target: /etc/nginx/nginx.conf
secrets:
- passwd
networks:
registry_network:
deploy:
replicas: 1
resources:
limits:
cpus: '0.25'
memory: 256M
placement:
constraints: [node.labels.registry == true]
logging:
driver: syslog
options:
tag: registry-nginx
syslog-address: "udp://10.92.60.151:514"
registry:
image: registry:2
networks:
registry_network:
aliases:
- registry
volumes:
- /srv/registry:/var/lib/registry
deploy:
replicas: 1
resources:
limits:
cpus: '0.25'
memory: 256M
placement:
constraints: [node.labels.registry == true]
logging:
driver: syslog
options:
tag: registry
syslog-address: "udp://10.92.60.151:514"
secrets:
passwd:
file: ./nginx/passwd
configs:
nginx:
file: ./nginx/nginx.conf
networks:
registry_network:
driver: overlay
docker login 10.92.60.151:5001
preserve_hostname: false
if ( Request::ajax() ) return $this->dataReturn;
return view($templite, [ 'data' => $this->dataReturn ]);
axios.get(url, {
params: {
_ajax: true
}
})