README.md (5660B)
1 # ktistec tweaks
2
3 Small tweaks and hacks for [ktistec](https://github.com/toddsundsted/ktistec).
4
5 Please send patches or remarks to
6 [jayvii+ktistec-tweaks[AT]posteo[DOT]de](mailto:jayvii+ktistec-tweaks[AT]posteo[DOT]de).
7
8 ---
9
10 ## Docker
11
12 You can run ktistec via the provided
13 [`docker-compose`](https://docs.docker.com/compose/)
14
15 ```bash
16 cd docker/
17 docker-compose -f docker-compose.yaml up -d
18 ```
19
20 ---
21
22 ## CSS
23
24 Currently, the `./css/` directory contains three theming tweaks:
25
26 - [purple-ish](#purple-ish-theme): a modern theme with automatic dark/bright
27 mode and purple highlights
28 - [mobile](#mobile): small adjustments of the layout to make the UI more
29 appealing for mobile users
30 - [visibility](#visibility): small adjustments to improve visibility of content
31 in the sense of accessibility
32
33 ### Purple-Ish Theme:
34
35 ![Purpleish Theme in Dark and Bright Mode](https://paste.jayvii.de/7e381ec8f9dd995c8c6b3c597fb6b8ec650626b177e70ae6742472eec1880ce0)
36
37 ### Mobile:
38
39 ![Mobile Navigation header with feather-icons on small screens (large screens have the original text labels)](https://paste.jayvii.de/d26291ae6b5caf7491825906b236d6524f21cd59c14e0d4c4eb30f0211d315b4)
40
41 ![Secondary Menu collapsed into the "Timelines" menu on small screen](https://paste.jayvii.de/2d6ce406136a95cce4df900345fdf1b6e7420d1971f59c1665cfd2900150934f)
42
43 ![Secondary Menu opened on hover or click on small screen](https://paste.jayvii.de/109083c0e43dc186be2c635396d6a0974d58095248e601e562d8750aa23f7424)
44
45 ![Pagination Buttons stretched across full width](https://paste.jayvii.de/0b36cc52046111ca8542b48a5c6bcfebce116dda23482f402efbb8ffc39c9ebd)
46
47 ### Visibility:
48
49 ![Preview-Images without clipping and grey borders around the image previews](https://paste.jayvii.de/1677fd0325dc9ca18fb527df68af50ea98d4f851268f09d4299fef85532e2f63)
50
51 ![A post thread with several layers. The grey borders on the left side indicate layer depth.](https://paste.jayvii.de/37bfe0f3cdad3497f4b315b38962281008be756c72a7a89fd44b2e0da7404fff)
52
53 **Minify CSS:**
54
55 ```bash
56 make minify-css
57 ```
58
59 Place the minified `purpleish.min.css`, `layout.min.css` and/or
60 `visibility.min.css`in the `public/3rd/` directory and at **AT THE START OF**
61 `public/3rd/semantic-2.4.1.min.css`:
62
63 ```css
64 @import url('purpleish.min.css');
65 @import url('visibility.min.css');
66 @import url('mobile.min.css');
67
68 /* ... rest of the file's content */
69 ```
70
71 **Manual installation:**
72
73 ```bash
74 KTISTEC_PATH="/var/www/ktistec"
75 KTISTEC_CSS="${KTISTEC_PATH}/public/3rd"
76 cp ./css/*.min.css ${KTISTEC_CSS}/
77 cp -r ./css/icons ${KTISTEC_CSS}/icons
78 echo "@import url('purpleish.min.css');" > ${KTISTEC_CSS}/tmp
79 echo "@import url('visibility.min.css');" >> ${KTISTEC_CSS}/tmp
80 echo "@import url('mobile.min.css');" >> ${KTISTEC_CSS}/tmp
81 cat ${KTISTEC_CSS}/semantic-*.min.css >> ${KTISTEC_CSS}/tmp
82 mv ${KTISTEC_CSS}/tmp ${KTISTEC_CSS}/semantic-*.min.css
83 ```
84
85 **Docker (via [this repo's docker-compose](#docker) file):**
86
87 ```bash
88 docker cp ./css/purpleish.min.css ktistec:/app/public/3rd/purpleish.min.css
89 docker cp ./css/visibility.min.css ktistec:/app/public/3rd/visibility.min.css
90 docker cp ./css/mobile.min.css ktistec:/app/public/3rd/mobile.min.css
91 docker cp ./css/icons ktistec:/app/public/3rd/icons
92 docker exec -ti ktistec \
93 sh -c "
94 echo \"@import url('purpleish.min.css');\" > /app/public/3rd/tmp && \
95 echo \"@import url('visibility.min.css');\" >> /app/public/3rd/tmp && \
96 echo \"@import url('mobile.min.css');\" >> /app/public/3rd/tmp && \
97 cat /app/public/3rd/semantic*.css >> /app/public/3rd/tmp && \
98 mv /app/public/3rd/tmp /app/public/3rd/semantic-*.min.css
99 "
100 ```
101
102 ## Backups
103
104 ### Database
105
106 Database backups should be done either by file-copying **when the database is
107 not in use**, i.e. as long as ktistec is not running, or better yet with the
108 [`.backup`](https://sqlite.org/cli.html#special_commands_to_sqlite3_dot_commands_)
109 command, which handles file-locking and changes to the database during the
110 backup procedure. However, either way, because `.backup` also honours file
111 locking by the ktistec process itself and because changes to the database
112 are constantly accounted for (which, depending on your instances volume, can
113 prolonge the backup process indefinitely), ktistec should not be running during
114 backup process.
115
116 **Manual installation:**
117
118 ```bash
119 KTISTEC_PATH="/var/www/ktistec"
120 kill server && \
121 sqlite3 ${KTISTEC_PATH}/db/ktistec.db \
122 ".backup \"${KTISTEC_PATH}/db/ktistec_backup_$(date +%Y-%m-%d).sq3\""; \
123 ${KTISTEC_PATH}/server &
124 ```
125
126 **Docker (via [this repo's docker-compose](#docker) file):**
127
128 ```bash
129 docker stop ktistec && \
130 docker run -ti --rm \
131 -v /var/www/ktistec/db:/db \
132 -v /var/www/ktistec/backups:/backups \
133 alpine:latest \
134 sh -c '
135 apk update && \
136 apk add sqlite && \
137 sqlite3 /db/ktistec.db \
138 ".backup \"/backups/ktistec_backup_$(date +%Y-%m-%d).sq3\""
139 '; \
140 docker restart ktistec
141 ```
142
143 ### Uploads
144
145 The uploads-folder contains images and other media files that you uploaded or
146 included in one of your posts. It makes sense to back them up as well in order
147 to prevent data loss.
148
149 Since these are typically just image files, the easiest way to back them up is
150 by archiving them with `tar`.
151
152 **Manual installation:**
153
154 ```bash
155 KTISTEC_PATH="/var/www/ktistec"
156 tar -cf ${KTISTEC_PATH}/uploads_backup_$(date +%Y-%m-%d).tar \
157 ${KTISTEC_PATH}/public/uploads/
158 ```
159
160 **Docker (via [this repo's docker-compose](#docker) file):**
161
162 ```bash
163 docker run -ti --rm \
164 -v /var/www/ktistec/uploads:/uploads \
165 -v /var/www/ktistec/backups:/backups \
166 alpine:latest \
167 sh -c '
168 apk update && \
169 apk add tar && \
170 tar -vcf /backups/uploads_backup_$(date +%Y-%m-%d).tar /uploads/
171 '
172 ```