generated from mirzaev/pot-php
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ef75a5814 | |||
| 4d2e419018 | |||
| 91d5883885 | |||
| 4203b1e9f8 | |||
| 658a95877c | |||
| 3ce62f13e2 | |||
| 1361f8cd5e | |||
| 323beeb886 | |||
| 9378f022b4 |
53
README.md
53
README.md
@@ -1,2 +1,51 @@
|
||||
# pechatalka
|
||||
Chat-robot constructor for the Svoboda typography
|
||||
# Pechatalka
|
||||
Site and chat-robot constructor for the Svoboda typography
|
||||
|
||||
# Installation
|
||||
Before process any command think about **what it does** and whether the **paths** are specified correctly<br>
|
||||
|
||||
## NGINX
|
||||
### Create the NGINX server
|
||||
You can copy an example of the server file from here: `/examples/nginx/pechatalka.conf`<br>
|
||||
<small><i>I prefer to rename nginx config files to domain names. For example: `pechatalka.kodorvan.tech`</i></small><br>
|
||||
|
||||
<i>The file will be half commented out specifically to start the server for generating the TLS/SSL certificate</i><br>
|
||||
|
||||
1. `cd /examples/nginx`<br>
|
||||
2. `sudo cp pechatalka.conf /etc/nginx/sites-avaiable/pechatalka.conf`<br>
|
||||
3. `sudo nvim /etc/nginx/sites-avaiable/pechatalka.conf`<br>
|
||||
<small>3.1. <i>Customize the file according to your requirements</i></small><br>
|
||||
4. `sudo ln -s /etc/nginx/sites-avaiable/pechatalka.conf /etc/nginx/sites-enabled/pechatalka.conf`<br>
|
||||
5. `sudo nginx -t`<br>
|
||||
<small>5.1. <i>Make sure that <b>NGINX does not throw errors</b>, otherwise proceed to the instructions for generate a TLS/SSL certificate</i></small><br>
|
||||
6. `sudo service nginx restart`<br>
|
||||
|
||||
### Add mime-type recognition for javascript modules
|
||||
<small>Edit the file: `/etc/nginx/mime.types`</small><br>
|
||||
**From:** `application/javascript js;`<br>
|
||||
**To:** `application/javascript js mjs;`
|
||||
|
||||
### Generate a TLS/SSL sertificate (via [certbot](http://certbot.eff.org/) for [ubuntu](https://ubuntu.com/))
|
||||
1. `sudo apt install certbot python3-certbot-nginx`<br>
|
||||
2. `sudo certbot certonly --nginx`<br>
|
||||
<small><i>The **domain** must already be **bound** to the **IP-address** of the server by `CNAME`, `A` or `AAAA` record</i></small><br>
|
||||
3. Uncomment and reconfigure the nginx server file
|
||||
4. `sudo nginx -t`<br>
|
||||
<small>4.1. <i>Make sure that <b>NGINX does not throw errors</b></i></small><br>
|
||||
5. `sudo service nginx restart`
|
||||
|
||||
### Set up firewall rules for HTTP and HTTPS requests (for [ubuntu](https://ubuntu.com/))
|
||||
1. `sudo ufw allow "NGINX Full"`<br>
|
||||
<small>1.1. <i>Make sure that the <b>port for SSH connection</b> is open</i></small><br>
|
||||
2. `sudo ufw allow 22`<br>
|
||||
<small>2.1. <i>Use your SSH port instead of 22</i></small><br>
|
||||
3. `sudo ufw enable`
|
||||
|
||||
## SystemD (or any alternative you like)
|
||||
You can copy an example of the systemd file from here: `/examples/systemd/arming.service`<br>
|
||||
1. `cd examples/systemd`<br>
|
||||
2. `sudo cp pechatalka.service /etc/systemd/system/pechatalka.service && sudo chmod +x /etc/systemd/system/pechatalka.service`<br>
|
||||
3. `sudo nvim /etc/systemd/system/pechatalka.service`<br>
|
||||
<small>3.1. <i>Customize the file according to your requirements</i></small><br>
|
||||
4. `sudo systemctl daemon-reload`<br>
|
||||
3. `sudo systemctl enable pechatalka`<br>
|
||||
@@ -156,7 +156,13 @@ final class paper extends core
|
||||
|
||||
// Resizing the layer image
|
||||
$image->adaptiveResizeImage((int) round($blank['width'] * $layer['scale']), 0);
|
||||
$image->roundCornersImage($layer['corners'], $layer['corners']);
|
||||
|
||||
if (!empty($layer['corners'])) {
|
||||
// Received the layer image corners
|
||||
|
||||
// Masking the layer image with corners
|
||||
$image->roundCornersImage($layer['corners'], $layer['corners']);
|
||||
}
|
||||
|
||||
// Calculating the layer image coordinates by the layer image mask
|
||||
$vertical = $blank['height'] - $before;
|
||||
@@ -175,15 +181,15 @@ final class paper extends core
|
||||
// Drawing the cutting line
|
||||
$draw = new imagick_draw();
|
||||
$draw->setfillcolor($canvas['background'] ?? '#fff');
|
||||
$stroke = 1;
|
||||
$draw->setStrokeOpacity($stroke);
|
||||
$stroke = 2;
|
||||
$draw->setStrokeOpacity(1);
|
||||
$draw->setStrokeColor('#000');
|
||||
$draw->setStrokeWidth(2);
|
||||
$draw->setStrokeWidth($stroke);
|
||||
$draw->circle(
|
||||
$place['x'] + $blank['width'] / 2,
|
||||
$place['y'] + $blank['height'] / 2,
|
||||
round($place['x'] + $blank['width'] / 2 - $stroke),
|
||||
round($place['y'] + $blank['height'])
|
||||
round($place['x'] + $blank['width'] / 2 + $stroke),
|
||||
round($place['y'] + $blank['height'] + $stroke)
|
||||
);
|
||||
$paper->drawimage($draw);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% block js %}
|
||||
<script src="https://telegram.org/js/telegram-web-app.js"></script>
|
||||
<!-- <script src="https://telegram.org/js/telegram-web-app.js"></script> -->
|
||||
<script src="/js/modules/damper.mjs" type="module"></script>
|
||||
<script src="/js/core.js"></script>
|
||||
<script src="/js/modules/telegram.mjs" type="module"></script>
|
||||
|
||||
Reference in New Issue
Block a user