Skip to content

Commit

Permalink
Merge pull request #71 from waschinski/dev
Browse files Browse the repository at this point in the history
Update from dev branch

Former-commit-id: 4a9d7ba
  • Loading branch information
waschinski committed Mar 16, 2023
2 parents 61c80a7 + f59d36f commit 61f0b86
Show file tree
Hide file tree
Showing 32 changed files with 220 additions and 119 deletions.
6 changes: 4 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ [email protected]
AUTHOR_WEBSITE=https://maxvoltar.com
DESCRIPTION=@maxvoltar's minimalistic, self-hosted photo stream.
BASEURL=
# URL must end with / or links will be broken
URL=https://maxvoltar.photo/
# URL must NOT end with / or links will be messed up
URL=https://maxvoltar.photo
SHOW_RSS_FEED=1
SHOW_OFFICIAL_GITHUB=1
HEADER_ENABLED=0
HEADER_BACKGROUND_COLOR="#161e2e"
ALLOW_ORDER_SORT_CHANGE=1
ALLOW_ORIGINAL_DOWNLOAD=0
ALLOW_INDEXING=1
Expand Down
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% include head.html %}
<body>
<div class="four-oh-four">
<img src="{{ site.env.URL }}favicon.svg" alt="">
<img src="{{ site.env.URL }}/favicon.svg" alt="">
<h1>404</h1>
<p>Photo not found.</p>
<a href="{{ site.env.URL }}">Back to overview</a>
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
ARG BASE_IMAGE=ruby:3.1.2-alpine3.15
ARG BASE_IMAGE=ruby:3.1.3-alpine3.17
FROM ${BASE_IMAGE}

ENV VIPSVER 8.12.2
RUN apk update && apk upgrade &&\
apk add --update --no-cache build-base glib-dev libexif-dev expat-dev tiff-dev jpeg-dev libgsf-dev git rsync lftp openssh &&\
apk add --update --no-cache build-base glib-dev exiftool libexif-dev expat-dev tiff-dev jpeg-dev libpng libgsf-dev vips git rsync lftp openssh perl &&\
rm -rf /var/cache/apk/*

RUN wget -O ./vips-$VIPSVER.tar.gz https://github.com/libvips/libvips/releases/download/v$VIPSVER/vips-$VIPSVER.tar.gz && tar -xvzf ./vips-$VIPSVER.tar.gz && cd vips-$VIPSVER && ./configure && make && make install && cd .. && rm -r vips-$VIPSVER.tar.gz vips-$VIPSVER

COPY ./ /photo-stream
COPY ./ /photo-stream

WORKDIR /photo-stream

Expand Down
8 changes: 3 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ruby "~> 3.1.2"
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 4.2.0"
gem "jekyll", "~> 4.3.0"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
Expand All @@ -17,22 +17,20 @@ gem "minima", "~> 2.5"
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "webrick", "~> 1.7"
gem "exifr"
gem "exiftool_vendored", "12.50"
gem "ruby-vips", "~> 2.1.4"
gem "jekyll_image_processing", git: "https://github.com/benubois/jekyll_image_processing"
gem "jekyll-tidy"
gem "jekyll-exif-data", "~> 0.0"
gem 'jekyll-dotenv'
gem "htmlbeautifier", "<1.4.0"
end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
gem "tzinfo", "~> 1.2"
gem "tzinfo", "~> 2.0"
gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?

80 changes: 42 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/benubois/jekyll_image_processing
revision: e4a262620db88b5c5672d3398b120abc5fb74a61
revision: af9886cec78a8a66c14d323e0e293360740bd382
specs:
jekyll_image_processing (0.1.0)
image_processing (>= 1.10.3)
Expand All @@ -9,50 +9,53 @@ GIT
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.1.10)
dotenv (2.7.6)
concurrent-ruby (1.2.2)
dotenv (2.8.1)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
exifr (1.3.9)
exiftool (1.2.4)
json
exiftool_vendored (12.50.0)
exiftool (>= 0.7.0)
ffi (1.15.5)
forwardable-extended (2.6.0)
google-protobuf (3.22.2)
htmlbeautifier (1.3.1)
htmlcompressor (0.4.0)
http_parser.rb (0.8.0)
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
jekyll (4.2.2)
jekyll (4.3.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
mercenary (>= 0.3.6, < 0.5)
pathutil (~> 0.9)
rouge (~> 3.0)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (~> 2.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-dotenv (0.2.0)
dotenv (~> 2.7)
jekyll (~> 4)
jekyll-exif-data (0.0.3)
exifr (~> 1.3)
jekyll-feed (0.16.0)
jekyll-feed (0.17.0)
jekyll (>= 3.7, < 5.0)
jekyll-sass-converter (2.2.0)
sassc (> 2.0.1, < 3.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-tidy (0.2.2)
Expand All @@ -61,58 +64,59 @@ GEM
jekyll
jekyll-watch (2.2.1)
listen (~> 3.0)
json (2.6.3)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.7.1)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_magick (4.11.0)
mini_magick (4.12.0)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.7)
rb-fsevent (0.11.1)
public_suffix (5.0.1)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.28.0)
rouge (4.1.0)
ruby-vips (2.1.4)
ffi (~> 1.12)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
tzinfo (1.2.10)
thread_safe (~> 0.1)
tzinfo-data (1.2022.1)
sass-embedded (1.59.3)
google-protobuf (~> 3.21)
rake (>= 10.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2022.7)
tzinfo (>= 1.0.0)
unicode-display_width (1.8.0)
unicode-display_width (2.4.2)
wdm (0.1.1)
webrick (1.7.0)
webrick (1.8.1)

PLATFORMS
ruby

DEPENDENCIES
exifr
exiftool_vendored (= 12.50)
htmlbeautifier (< 1.4.0)
jekyll (~> 4.2.0)
jekyll (~> 4.3.0)
jekyll-dotenv
jekyll-exif-data (~> 0.0)
jekyll-tidy
jekyll_image_processing!
minima (~> 2.5)
ruby-vips (~> 2.1.4)
tzinfo (~> 1.2)
tzinfo (~> 2.0)
tzinfo-data
wdm (~> 0.1.1)
webrick (~> 1.7)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ There is a [demo](https://photo-stream-muh3.onrender.com/) of this repository ho

- Lazy loading
- Only load larger resolutions when needed (to save on bandwidth)
- Supports [PNG, JPG, JPEG, GIF and WebP](https://github.com/benubois/jekyll_image_processing/blob/master/lib/jekyll_image_processing/processed_image.rb#L38) files
- Photo tints
- Keyboard shortcuts
- Unique URL's for photos
Expand Down Expand Up @@ -151,7 +152,7 @@ First thing you want to do is edit a couple of things in `/.env`:
- `AUTHOR_WEBSITE`: Your website (could be the address of this photo stream).
- `DESCRIPTION`: Description of your photo stream.
- `BASEURL`: Should be left empty or removed **⚠️ Do not change unless you know what you're doing**
- `URL`: Where will this photo stream live (example: `https://maxvoltar.photo/`), must end with / or links will be broken.
- `URL`: Where will this photo stream live (example: `https://maxvoltar.photo`), must NOT end with / or links will be messed up.
- `SHOW_RSS_FEED`: Set to either `1` or `0` to enable or disable showing the RSS feed button.
- `SHOW_OFFICIAL_GITHUB`: Set to either `1` or `0` to enable or disable showing the link to the official github repository.
- `DEFAULT_REVERSE_SORT`: Set this to `1` to reverse the photo sort order and show oldest photos first. Defaults to `0`.
Expand Down
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# Build settings
plugins:
- jekyll-dotenv
- jekyll-exif-data

image_processing:
large:
Expand Down
14 changes: 9 additions & 5 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="robots" content="noindex" />
{% endif %}
<title data-title="{{ site.env.TITLE }}">{{ page.title | default: site.env.TITLE }}</title>
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="{{ site.env.URL }}feed.xml">
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="{{ site.env.URL }}/feed.xml">
<meta property="og:title" content="{{ page.title | default: site.env.TITLE }}">
<meta property="og:type" content="website">
<meta property="og:url" content="{{ site.env.URL }}">
Expand All @@ -25,8 +25,12 @@
{% if site.env.ALLOW_IMAGE_SHARING == "1" %}
<link rel="stylesheet" type="text/css" href="{{ '/css/toastify.min.css' | relative_url }}">
{% endif %}
<link rel="shortcut icon" type="image/svg+xml" href="{{ '/favicon.svg' | relative_url }}" />
<link rel="shortcut icon" type="image/png" href="{{ '/favicon.png' | relative_url }}" />
<link rel="apple-touch-icon" href="touch-icon-iphone.png" />
<link rel="mask-icon" href="favicon.svg" />
<link rel="apple-touch-icon" sizes="180x180" href="{{ '/apple-touch-icon.png?v=1' | relative_url }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/favicon-32x32.png?v=1' | relative_url }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ '/favicon-16x16.png?v=1' | relative_url }}">
<link rel="manifest" href="{{ '/site.webmanifest?v=1' | relative_url }}">
<link rel="mask-icon" href="{{ '/favicon.svg?v=1' | relative_url }}">
<link rel="shortcut icon" href="{{ '/favicon.ico?v=1' | relative_url }}">
<meta name="msapplication-TileColor" content="#603cba">
<meta name="theme-color" content="#ffffff">
</head>
7 changes: 5 additions & 2 deletions _includes/javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@

const openPhoto = (id, href) => {
const photo = document.getElementById(id);
const title = photo.getAttribute('title');
const phototitle = photo.getAttribute('title');
removeTargetClass();
photo.classList.add(TARGET_CLASS);
document.title = title;
document.title = phototitle;
{% if site.env.HEADER_ENABLED == "1" %}const title = document.querySelector('head title').getAttribute('data-title');
document.getElementById('page-title').innerHTML = title + '<span id="breadcrumb">//</span>' + phototitle;{% endif %}
if (href) {
window.history.pushState({id: id}, '', href);
}
Expand All @@ -91,6 +93,7 @@
const title = document.querySelector('head title').getAttribute('data-title');
removeTargetClass();
document.title = title;
{% if site.env.HEADER_ENABLED == "1" %}document.getElementById('page-title').innerHTML = title;{% endif %}
if (href) {
window.history.pushState({}, '', href);
}
Expand Down
4 changes: 2 additions & 2 deletions _includes/photo.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<ul class="meta">
<!--
<li>{{ image_path | exif: 'model'}}</li>
<li>{{ image_path | exif: 'exposure_time.to_s'}}</li>
<li><span class="aperture"><em>f</em>/</span>{{ image_path | exif: 'f_number.to_f'}}</li>
<li>{{ image_path | exif: 'exposure_time'}}</li>
<li><span class="aperture"><em>f</em>/</span>{{ image_path | exif: 'aperture_value'}}</li>
-->
{% if site.env.ALLOW_IMAGE_SHARING == "1" %}
<li><a onClick="shareImage('{{ image.basename }}', '{{ slug | relative_url }}')" class="gridview-button share" title="Share this image">Share</a></li>
Expand Down
35 changes: 35 additions & 0 deletions _plugins/exif-data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Plugin found at https://github.com/nataliastanko/jekyll-lightgallery-exif - thanks Natalia!

#frozen_string_literal: true

require 'exiftool'

module Jekyll
module ExifData
module ExifDataFilter

# Read exif/xmp using exiftool
#
# file - relative path to the file
# exiftag - title, decription, file_size, create_date, megapixels, ...
def exif(file, exiftag)
exiftag = exiftag.to_sym
filepath = File.expand_path(File.dirname(File.dirname(__FILE__))) + '/' + file

begin
if File.exist?(filepath)
e = Exiftool.new(filepath)
e.to_hash.key?(exiftag)
e[exiftag]
end

rescue StandardError => e
puts e.message
file
end
end
end
end
end

Liquid::Template.register_filter(Jekyll::ExifData::ExifDataFilter)
12 changes: 4 additions & 8 deletions _plugins/photo_filter.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
require "exifr"
require "exiftool"

module Jekyll
module PhotoFilter
def photo_filter(files)
photos = files.select {|photo| photo.relative_path.include?("original") }
sorted = photos.sort_by { |photo|
(EXIFR::JPEG.new(photo.path).exif? && EXIFR::JPEG.new(photo.path).date_time_original ?
EXIFR::JPEG.new(photo.path).date_time_original.to_s :
(Exiftool.new(photo.path)[:date_time_original] ?
Exiftool.new(photo.path)[:date_time_original] :
photo.modified_time.to_s)
}
sorted.each do |photo|
(EXIFR::JPEG.new(photo.path).exif? && EXIFR::JPEG.new(photo.path).date_time_original ?
EXIFR::JPEG.new(photo.path).date_time_original.to_s :
photo.modified_time.to_s)
end.reverse
sorted.reverse
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion _plugins/rename_photos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.jekyll_config

def self.rename
directory = jekyll_config["image_processing"]["large"]["source"]
Dir.glob("#{directory}/*.[jJ][pP]*[gG]").each do |filename|
Dir.glob("#{directory}/*").each do |filename|
file = File.new(filename)
dir = File.dirname(file.path)
name = File.basename(file.path, ".*")
Expand Down
Binary file added android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apple-touch-icon-precomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
9 changes: 9 additions & 0 deletions browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png?v=1"/>
<TileColor>#603cba</TileColor>
</tile>
</msapplication>
</browserconfig>
Loading

0 comments on commit 61f0b86

Please sign in to comment.