Skip to content

Commit

Permalink
Issue #41: Add support for a custom favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
daledavies committed Jul 19, 2022
1 parent cdaeff7 commit 1d1d0e0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Jump is yet another self-hosted startpage for your server designed to be simple,

Get the container image from Docker Hub (https://hub.docker.com/r/daledavies/jump).

The following will start Jump and serve the page at http://localhost:8123 with a custom site name, Open Weather Map support, and volumes to map Jump's "backgrounds" and "sites" directories to local directories on your machine (`OWMAPIKEY` and `LATLONG` values below are just for example)...
The following will start Jump and serve the page at http://localhost:8123 with a custom site name, Open Weather Map support, and volumes to map Jump's "backgrounds", "favicon", "search" and "sites" directories to local directories on your machine (`OWMAPIKEY` and `LATLONG` values below are just for example)...

```yaml
version: '3'
Expand All @@ -37,6 +37,7 @@ services:
- 8123:8080
volumes:
- ./backgrounds:/backgrounds
- ./favicon:/favicon
- ./search:/search
- ./sites:/sites
environment:
Expand Down Expand Up @@ -70,7 +71,7 @@ You can use the following optional environment variables to configure/customise

#### Volume Mapping

You can map the "backgrounds", "search" and "sites" directories to local directories as shown in the Docker Compose example above. Your local directories will be populated with Jump's default files when the container is next started unless the local directories already contain files, in which case the local files will be used by Jump instead.
You can map the "backgrounds", "favicon", "search" and "sites" directories to local directories as shown in the Docker Compose example above. Your local directories will be populated with Jump's default files when the container is next started unless the local directories already contain files, in which case the local files will be used by Jump instead.

#### Docker

Expand All @@ -79,6 +80,7 @@ The same can be achieved just using Docker CLI...
```bash
docker run -d -p 8123:8080 \
--volume <path/to/backgrounds>:/backgrounds \
--volume <path/to/favicon>:/favicon \
--volume <path/to/sites>:/sites \
--volume <path/to/search>:/search \
--env SITENAME='Custom site name' \
Expand Down Expand Up @@ -221,6 +223,10 @@ To use your own background images just copy them to the `/backgrounds/` director

If instead you want to use Unsplash for random background images add an Unsplash API key to `config.php` or pass the `UNSPLASHAPIKEY ` environment variable to the Docker container. You can provide a comma separated list of collection ID's using the `unsplashcollections` option in `config.php` or by passing them to the Docker container via the `UNSPLASHCOLLECTIONS` environment variable.

### Favicon

After mapping the `favicon` directory as shown in the Docker Compose or Docker examples above, replace the default `icon.png` file with whatever PNG icon image you want (ensuring that the filename is always `icon.png`).

## Development

Patches, improvements and feature requests are welcomed although I want to avoid anything that requires an admin interface or user accounts.
Expand Down
12 changes: 11 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ -z "${DEVELOPMENT-}" ]; then
echo >&2 "-------------------------------------------------------------"
echo >&2 "";

echo >&2 "- Checking if backgrounds, search or sites volumes have been mounted."
echo >&2 "- Checking if backgrounds, favicon, search or sites volumes have been mounted."
if [ -e "/backgrounds" ]; then
echo >&2 " - Backgrounds directory is mapped... symlinking."
rm /var/www/html/assets/backgrounds -r
Expand All @@ -39,6 +39,16 @@ if [ -z "${DEVELOPMENT-}" ]; then
fi
fi

if [ -e "/favicon" ]; then
echo >&2 " - Favicon directory is mapped... symlinking."
rm /var/www/html/assets/images/favicon -r
ln -s /favicon /var/www/html/assets/images/
if [ ! "$(ls -A /favicon)" ]; then
echo >&2 " -- Empty so populating with default favicon image."
cp /usr/src/jumpapp/assets/images/favicon/* /favicon -r
fi
fi

if [ -e "/sites" ]; then
echo >&2 " - Sites directory is mapped... symlinking."
rm /var/www/html/sites -r
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion jumpapp/templates/header.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{> partials/cssbundle}}
<link rel="stylesheet" href="{{{wwwurl}}}/background-css.php">
<link rel="stylesheet" href="{{{wwwurl}}}/assets/css/weather-icons.min.css">
<link rel="icon" type="image/png" href="{{{wwwurl}}}/favicon.png">
<link rel="icon" type="image/png" href="{{{wwwurl}}}/assets/images/favicon/icon.png">
<title>{{title}}</title>
<script>
const JUMP = {
Expand Down

0 comments on commit 1d1d0e0

Please sign in to comment.