pub / ktistec-tweaks

Tweaks for the ActivityPub server ktistec
git clone https://src.jayvii.de/pub/ktistec-tweaks.git
Home | Log | Files | Exports | Refs | Submodules | README | RSS

README.md (6017B)


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