diff --git a/bak/uwsgi.ini.back b/bak/uwsgi.ini.back deleted file mode 100644 index 37f6d8c..0000000 --- a/bak/uwsgi.ini.back +++ /dev/null @@ -1,25 +0,0 @@ -[uwsgi] -# User and group www-data on debian -uid = 33 -gid = 33 -master = true -# No. of processes can be increased -processes = 9 -chown-socket =www-data:www-data -virtualenv = /opt/venv -pythonpath = /srv/flask-fet-fotos/ -#pidfile = /srv/simple_sample_flat_index/uwsgi.pid -#socket = /srv/simple_sample_flat_index/uwsgi.sock -pidfile=/var/run/fet_fotos.pid -socket = /var/run/fet_fotos.sock -chmod-socket = 666 -module = foto_gallery -callable= app -wsgi-file = run.py -logdate = true - -loglevel = debug -gevent = 100 -vacuum=true -plugins=python3,logfile -py-autoreload=2 \ No newline at end of file diff --git a/blueimp/.github/workflows/nodejs.yml b/blueimp/.github/workflows/nodejs.yml new file mode 100644 index 0000000..89973ab --- /dev/null +++ b/blueimp/.github/workflows/nodejs.yml @@ -0,0 +1,25 @@ +name: Node CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [8.x, 10.x, 12.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm test + env: + CI: true diff --git a/blueimp/.gitignore b/blueimp/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/blueimp/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/config.cfg.sample b/config.cfg.sample deleted file mode 100644 index 3e081e3..0000000 --- a/config.cfg.sample +++ /dev/null @@ -1,6 +0,0 @@ -pages_root: 'data_sample' -static_root: 'static' -default_template: 'page.html' -url_prefix: "/stuff" -FLATPAGES_EXTENSION: ".md" -FLATPAGES_AUTO_RELOAD: True diff --git a/data/ghg/group-young-people-posing-photo_52683-18823.jpg b/data/ghg/group-young-people-posing-photo_52683-18823.jpg new file mode 100644 index 0000000..07a310a Binary files /dev/null and b/data/ghg/group-young-people-posing-photo_52683-18823.jpg differ diff --git a/data/ghg/index.md b/data/ghg/index.md index e69de29..da5a4a9 100644 --- a/data/ghg/index.md +++ b/data/ghg/index.md @@ -0,0 +1,4 @@ +title: ghg Title +author: andis + +Asdf Asdf \ No newline at end of file diff --git a/data/ghg/test.jpg b/data/ghg/test.jpg deleted file mode 100644 index e69de29..0000000 diff --git a/data/ghg/worried-concept-illustration_114360-3481.jpg b/data/ghg/worried-concept-illustration_114360-3481.jpg new file mode 100644 index 0000000..f4dd86f Binary files /dev/null and b/data/ghg/worried-concept-illustration_114360-3481.jpg differ diff --git a/foto_gallery/__init__.py b/foto_gallery/__init__.py index 4543a69..af1c902 100644 --- a/foto_gallery/__init__.py +++ b/foto_gallery/__init__.py @@ -15,8 +15,8 @@ import re from PIL import Image, ExifTags, ImageOps from functools import partial from flask_csp.csp import csp_header, csp_default +import slugify -#cfg = Config("./config.cfg") import environ env = environ.Env( # set casting, default value @@ -45,11 +45,16 @@ app.logger.setLevel(logging.DEBUG) # Initialize FlatPages Index flatpages = FlatPagesIndex(app) -flatpages_index.Links.endpoint="intern.post" -flatpages_index.Links.image_url=lambda s,x: url_for(s.endpoint,name=x) + + + flatpages_index.Links.thumb_url=lambda s,x: url_for("intern.thumb",size=128,name=x) flatpages_index.Links.image_url=lambda s,x: url_for("intern.post",name=x) flatpages_index.Page.page_defaults={"type":"gallery", "template":"gallery.html"} + +flatpages.cfg("url", lambda s,x: url_for("intern.post",name=x)) +flatpages.cfg("thumb_url", lambda s,x: url_for("intern.thumb",size=512,name=x)) + flatpages.get('index') app.logger.info('Initialize FET Foto Gallery App') @@ -57,17 +62,25 @@ app.logger.info('flatpages loaded %d pages' % len(flatpages._pages)) app.logger.info("Data directory is: %s" % flatpages.root) -#csp_d=csp_default() -#csp_d.update({'default-src':"'self' 'unsafe-inline'", 'script-src': "'unsafe-inline' 'self'"}) - - - freezer = Freezer(app) page_blueprint = Blueprint('intern', __name__) api_blueprint = Blueprint('api', __name__) + + +@app.template_filter() +def thumbimage(post): + if post.thumb_url: + return post.thumb_url + elif len(post.images)>0: + return post.images[0] + +@app.template_filter() +def slug(string): + return slugify.slugify(string) + @page_blueprint.route('/thumb/') def thumb(size=64,name=''): if not size in [32,64,128,256,512]: @@ -150,6 +163,8 @@ def postjson(name='index'): + app.register_blueprint(page_blueprint, url_prefix=app.config["url_prefix"],static_folder='static') app.register_blueprint(api_blueprint, url_prefix="/api/"+app.config["url_prefix"],static_folder='static') app.add_url_rule('%s/' % app.config["url_prefix"],'page', post) + diff --git a/foto_gallery/templates/gallery.html b/foto_gallery/templates/gallery.html index e014262..b900e5d 100644 --- a/foto_gallery/templates/gallery.html +++ b/foto_gallery/templates/gallery.html @@ -8,7 +8,7 @@ {% block content %}

{{post.title}}

- von {{post.author}} + von {{post.author}} {{post.html | safe}} {% if post.links.images |length > 0 %} diff --git a/foto_gallery/templates/layout.html b/foto_gallery/templates/layout.html index 6ce0d1d..90acc12 100644 --- a/foto_gallery/templates/layout.html +++ b/foto_gallery/templates/layout.html @@ -24,13 +24,13 @@