Skip to main content

Privacy aware webdeveloper in the FOSS universe, part of, founder of (Nextcloud SaaS) and father of a daughter.

Learn more about me. Email me at




How to include JS/CSS files from the Create React App into your Nextcloud app

2 min read

React and Nextcloud

I have recently started developing a React app for Nextcloud. After creating the React boilerplate inside my Nextcloud app (in the /src directory) and developing some basic features outside of Nextcloud (just "npm start"), I wanted to get the React part called and included into the Nextcloud app.

As Webpack uses chunk splitting which generates more than one JavaScript file and also adds a hash to the file name for cache resetting, I had problems including it as it is described in the Nextcloud docs. For now my app is not that big so I used this hack to disable chunk splitting in CRA without ejecting.

In the template/index.php i used this PHP code to get the hashed file into app:

 * Uses the manifest file to get the filenames with hash
 * @param  string  $filename
 * @return string
function asset_path($filename) {
	$manifest_path = './apps/portknox_admin/build/asset-manifest.json';
	$ext = pathinfo($filename, PATHINFO_EXTENSION);
	$strip = ($ext == "css") ? -4 : -3;
	if (file_exists($manifest_path)) {
		$manifest = json_decode(file_get_contents($manifest_path), TRUE);
	} else {
		$manifest = [];

	if (array_key_exists($filename, $manifest)) {
		return '../build'. substr($manifest[$filename], 0, $strip);
	return '../build' . substr($filename, 0, $strip);

style('portknox_admin', asset_path('main.css'));
script('portknox_admin', asset_path('main.js')); 

Maybe this helps someone, leave a comment if you have improvements or a better way.



Portknox Update August

1 min read

I just posted an update on the Portknox blog. If you are a Portknox customer or intressted in Portknox read it over there.


Python Script zum Download der wöchentlichen Epub Ausgabe

2 min read

Seit ich ein 7,8 Zoll PocketBook Inkpad 3 besitze, lese ich auch die Zeit auf diesem Ebook-Reader. Um das wöchentlich erscheinde Epub auf den Reader zu bekommen, habe ich mir ein Download Python Script geschrieben.

Es versucht die Downlaod URL zu generieren und die Datei runterzuladen, im Fehlerfall schickt es mir eine E-Mail. Damit (und mit Hilfe meines alten Bash Scripts) bekomme ich die Zeit per Send-to-PocketBook auf meinen Reader.

Meine jetzige Lösung nutzt leider noch Server von dritten (Email über Sent-to-Pocket). Vielleicht bau ich es noch aus, um die Syncronisation über meine Nextcloud laufen zu lassen. Möglich scheint es zu sein.


# -*- coding: utf-8 -*-
import datetime

from email.mime.text import MIMEText
import requests
import smtplib
import sys
import os.path

email = sys.argv[1]
password = sys.argv[2]

def send_mail_to_me():
        msg = MIMEText('nt')
        msg['Subject'] = ' epub url does not exist'
        msg['From'] = email
        msg['To'] = email
        s = smtplib.SMTP('localhost')
        s.sendmail(msg['From'], [msg['To']], msg.as_string())

def download_file(url):
    local_filename = url.split('/')[-1]
    # NOTE the stream=True parameter
    r = requests.get(url, auth=(email, password), stream=True)
    with open(local_filename, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024):
            if chunk: # filter out keep-alive new chunks
    return local_filename

if __name__ == '__main__':
    now =
    wk = now.isocalendar()[1]
    url = '{}-{}/epub/die_zeit_2018_{}.epub'.format(now.year, wk, wk+1)
    local_filename = url.split('/')[-1]
    full_script_path = os.path.dirname(os.path.abspath(__file__))
    full_zeit_path = full_script_path + '/' + local_filename
    if not os.path.isfile(full_zeit_path):
        url_exits = requests.get(url, auth=(email, password))
        if url_exits.status_code not in [200, 201]:
            name = download_file(url)
            print name


Github Gist Link


Portknox Update March

1 min read

Just published a monthly update on
My Nextcloud Hosting company.