No description
Find a file
2024-09-18 10:52:58 +02:00
.docker Add Docker 2023-07-13 14:56:36 +02:00
app Update theme 2024-09-18 10:02:32 +02:00
bin Add Docker 2023-07-13 14:56:36 +02:00
cache New version from scratch 2023-06-21 11:42:36 +02:00
datas Add select img format type (jpeg, png) 2023-06-28 12:29:20 +02:00
public Update theme 2024-09-18 10:02:32 +02:00
src/images Fix missing favicon 2024-03-20 10:33:35 +01:00
tpl Update theme 2024-09-18 10:02:32 +02:00
.gitignore New version from scratch 2023-06-21 11:42:36 +02:00
composer.json New version from scratch 2023-06-21 11:42:36 +02:00
Dockerfile Update Docker file 2024-07-02 17:29:44 +02:00
DockerRun Update Docker version 2024-03-22 13:51:08 +01:00
LICENSE New version from scratch 2023-06-21 11:42:36 +02:00
README.md Update doc 2024-09-18 10:52:58 +02:00

!!!! Be careful !!!!

Use at your own risk

Soshot make webshot of internet page with headless machine (Google Chrome).

Ideas

  • If webshot exist in desired size, serve them, if not, verif if complete exist, if exist, crop and resize, save and serve
  • If webshot not exist get information of page and add in the queue
  • Cron job take a webshot of complete page and save them (1920 x complete lenth)
  • Crop image and resize desired format (1920x1080, 1280x720, 160x90 ...), save and serve

SoShot always make complete webshot (1920x page lenght) + first demande size.

Size use 16/9 ratio :

  • fav = define by config (default 48px)
  • og = define by the website himself (no resize or crop)
  • thumb = 160x90
  • nhd = 640x360
  • hd = 1280x720
  • full = 1920x1080
  • complete = 1920xpage height

Installation

For the moment I don't provide any image in any hub.

Build image

wget https://forge.leslibres.org/Knah-Tsaeb/Soshot/raw/branch/main/Dockerfile
docker buildx build --no-cache -t soshot:0.3.0 .

Start container

You can use native docker volume.

docker run -v soshot_datas:/var/www/datas -v soshot_cache:/var/www/cache -e TZ=UTC -p 8187:80 --name soshot soshot:0.3.0

Or use absolute path

docker run -v /opt/soshot/datas:/var/www/datas -v /opt/soshot/cache:/var/www/public/cache -e TZ=UTC -p 8187:80 --name soshot soshot:0.3.0

Classic way

Requirements

  • PHP 8.*
  • Sqlite3
  • PDO
  • Composer
  • Imagick
  • PHP-GD
  • CRON
  • Chrome / Chromium

Make directory on your web server and go in

mkdir /var/www/soshot && cd /var/www/soshot

Clone git repo

git clone https://forge.leslibres.org/Knah-Tsaeb/Soshot.git .

Install dependencies

composer install --no-dev

Add cron task

sudo crontab -u www-data -e
php /var/www/soshot/bin/thumbShoter.php

Configure your web server to serve in "public" directory.

Go to web page https://shoshot.your-domain.tld

Configuration

You can use a web interface (if option "use web gui" is set to true), https://shoshot.your-domain.tld/backend?page=settings

Or you can modify config file /datas/config.json.

{
    "onlyLocalServer": true,
    "webPage": false,
    "log": true,
    "alwaysMakePdf": false,
    "icoSize": 48,
    "expireCache": 12,
    "maxGenPerBatch": 5,
    "permitType": [],
    "password": null,
    "key": null,
    "chromePath": null,
    "fileFormat": "jpeg"
}
Option Type Default Description
onlyLocalServer bool true ShoShot only work for local machine, return 404 if use with remote machine
webPage bool false Soshot only work with endpoint /api. Return 404 if not
log bool true Not implemented yet
alwaysMakePdf bool false If true, SoShot make a complete webshot and PDF of page
icoSize int 48 Define size of favicon
expireCache int 12 Not implemented yet
permitType array null Select authorized size or type of webshot
maxGenPerBatch int 5 Foreach cron task as launch, SoShot make 5 webshot
key string 12 !!! DANGER !!! If you change key, all previous generation will be invalid. Soshot re make all previous generationt
password string null Password for admin interface. No min or max character
chromePath string null If path of Chrome/Chromium is not in PATH, you can define here

Usage

For generating webshot the entry point is https://shoshot.your-domain.tld/api?

You need to define 3 parameters :

  • type (fav, og, pdf, thumb, hd, full, complete)
  • hmac (hash_hmac('sha1', url of page, your Api key);)
  • url (url of page encode with url_encode)

Example : https://shoshot.your-domain.tld/api?type=fav&hmac=44a2b3f1bc43895c23779f4e71558e9976a4daf2&url=https%3A%2F%2Ffr.wikipedia.org%2Fwiki%2FLogiciel_libre

License

GNU General Public License v3.0

See LICENSE file for more detail.

Thanks