1# Lens
2A read only file explorer with media capabilities.
3
4# Dev
5
6To run the project you simply need to run:
7
8```bash
9make run
10```
11
12It should run using sqlite with a randon AES key. But if you don't set a
13`AES_KEY` a new one will generated every time the project is realead and you
14will be logged out.
15
16You can also create a `.env` file which will be read by make to populate the
17environment variables, e.g.:
18
19```ini
20# .env
21DB_TYPE=psql
22DB_CON=host=localhost user=admin password=admin dbname=lens port=5432
23LOG_LEVEL=error
24SCHEDULER_COUNT=10
25CACHE_PATH=/home/myhome/.thumb
26AES_KEY=X4Eu3OT/WqUtUJhGLUtQ4xRahwhWYaSs+k2a03Kz1A8=
27```
28
29To generate a new `AES_KEY` run:
30```
31openssl rand -rand /dev/urandom 32 | base64
32```
33
34Obs.: don't quote the value, that will be done automatically.
35
36Throughout the development you can also run `make watch` for a hot reload
37experience. It will feedback loop a bit faster.
38
39## Build and install
40
41To build you simply run:
42
43```
44make
45```
46
47And a `./bin/lens` will be created.
48
49To install run:
50
51```
52make install
53```
54
55Or you can pass a custom target folder.
56
57```
58PREFIX=~/.local/ make install
59```
60
61# Requirements
62
63## qtc
64
65It is used as template engine for html. To install it:
66
67```
68go install github.com/valyala/quicktemplate/qtc@latest
69```
70
71## libvips
72
73Libvips[^1] is required by bimp [^2] used for image manipulation.
74
75## ffmpeg
76
77Used to generate video thumbnail.
78
79## sassc
80
81Sassc[^4] is used to generate the css file from sass.
82
83## Bulma
84
85Bulma is the css framework of choice for this project. It is added as
86sub-module, so don't forget to pull it.
87
88# TODO
89
90* Demo site
91* Single image viewer and show exif info (not sure how yet)
92* Better UI error handling (or error handling at all).
93* Log out option
94* Better pagination
95* Better Testing. Since I still on initial iteration phases I'm not adding as
96 many testing as I'd like to. Once I set on most of the design I'll add more
97 test (is this ever done :thinking:).
98
99[^1]: https://github.com/libvips/libvips
100[^2]: https://github.com/h2non/bimg
101[^3]: https://github.com/alicebob/miniredis
102[^4]: https://github.com/sass/sassc
103[^5]: https://github.com/photoview/photoview
104[^6]: https://github.com/photoview/photoview#why-yet-another-self-hosted-photo-gallery
105[^7]: https://git.sr.ht/~gabrielgio/apkbuilds
106[^8]: https://artifacts.gabrielgio.me/repo/v3.18/x86_64/