This commit is contained in:
Rik Berkelder 2025-02-12 22:11:50 +01:00
commit 698993349c
26 changed files with 430 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config

9
README.md Normal file
View File

@ -0,0 +1,9 @@
Example repo relating to a blog post.
requires a working docker setup to run.
run using `docker compose run`. listens on port 8080 by default.
login credentials:
- username: riksolo
- password: password

14
docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
services:
nextcloud:
image: linuxserver/nextcloud:30.0.0-ls343
restart: unless-stopped
ports:
- 8080:80
volumes:
- ./config:/config
- ./nextcloud-data:/data
- ./s6-rc-inotify:/etc/s6-overlay/s6-rc.d/svc-inotify
- ./svc-inotify:/etc/s6-overlay/s6-rc.d/user/contents.d/svc-inotify
environment:
- PUID=1000
- PGID=100

26
nextcloud-data/.htaccess Normal file
View File

@ -0,0 +1,26 @@
# Generated by Nextcloud on 2025-02-12 16:50:38
# Section for Apache 2.4 to 2.6
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule mod_access_compat.c>
Order Allow,Deny
Deny from all
Satisfy All
</IfModule>
# Section for Apache 2.2
<IfModule !mod_authz_core.c>
<IfModule !mod_access_compat.c>
<IfModule mod_authz_host.c>
Order Allow,Deny
Deny from all
</IfModule>
Satisfy All
</IfModule>
</IfModule>
# Section for Apache 2.2 to 2.6
<IfModule mod_autoindex.c>
IndexIgnore *
</IfModule>

2
nextcloud-data/.ncdata Normal file
View File

@ -0,0 +1,2 @@
# Nextcloud data directory
# Do not change this file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,315 @@
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2015 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
/**
* Namespace to hold functions related to convert mimetype to icons
*
* @namespace
*/
OC.MimeType = {
/**
* Cache that maps mimeTypes to icon urls
*/
_mimeTypeIcons: {},
/**
* Return the file icon we want to use for the given mimeType.
* The file needs to be present in the supplied file list
*
* @param {string} mimeType The mimeType we want an icon for
* @param {array} files The available icons in this theme
* @return {string} The icon to use or null if there is no match
*/
_getFile: function(mimeType, files) {
var icon = mimeType.replace(new RegExp('/', 'g'), '-');
// Generate path
if (mimeType === 'dir' && files.includes('folder')) {
return 'folder';
} else if (mimeType === 'dir-encrypted' && files.includes('folder-encrypted')) {
return 'folder-encrypted';
} else if (mimeType === 'dir-shared' && files.includes('folder-shared')) {
return 'folder-shared';
} else if (mimeType === 'dir-public' && files.includes('folder-public')) {
return 'folder-public';
} else if ((mimeType === 'dir-external' || mimeType === 'dir-external-root') && files.includes('folder-external')) {
return 'folder-external';
} else if (files.includes(icon)) {
return icon;
} else if (files.includes(icon.split('-')[0])) {
return icon.split('-')[0];
} else if (files.includes('file')) {
return 'file';
}
return null;
},
/**
* Return the url to icon of the given mimeType
*
* @param {string} mimeType The mimeType to get the icon for
* @return {string} Url to the icon for mimeType
*/
getIconUrl: function(mimeType) {
if (typeof mimeType === 'undefined') {
return undefined;
}
while (mimeType in OC.MimeTypeList.aliases) {
mimeType = OC.MimeTypeList.aliases[mimeType];
}
if (mimeType in OC.MimeType._mimeTypeIcons) {
return OC.MimeType._mimeTypeIcons[mimeType];
}
// First try to get the correct icon from the current theme
var gotIcon = null;
var path = '';
if (OC.theme.folder !== '' && Array.isArray(OC.MimeTypeList.themes[OC.theme.folder])) {
path = OC.getRootPath() + '/themes/' + OC.theme.folder + '/core/img/filetypes/';
var icon = OC.MimeType._getFile(mimeType, OC.MimeTypeList.themes[OC.theme.folder]);
if (icon !== null) {
gotIcon = true;
path += icon;
}
}
if(OCA.Theming && gotIcon === null) {
path = OC.generateUrl('/apps/theming/img/core/filetypes/');
path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files);
gotIcon = true;
}
// If we do not yet have an icon fall back to the default
if (gotIcon === null) {
path = OC.getRootPath() + '/core/img/filetypes/';
path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files);
}
path += '.svg';
if(OCA.Theming) {
path += "?v=" + OCA.Theming.cacheBuster;
}
// Cache the result
OC.MimeType._mimeTypeIcons[mimeType] = path;
return path;
}
};
/**
* This file is automatically generated
* DO NOT EDIT MANUALLY!
*
* You can update the list of MimeType Aliases in config/mimetypealiases.json
* The list of files is fetched from core/img/filetypes
* To regenerate this file run ./occ maintenance:mimetype:update-js
*/
OC.MimeTypeList={
aliases: {
"application/coreldraw": "image",
"application/epub+zip": "text",
"application/font-sfnt": "font",
"application/font-woff": "font",
"application/gpx+xml": "location",
"application/gzip": "package/x-generic",
"application/illustrator": "image",
"application/javascript": "text/code",
"application/json": "text/code",
"application/msaccess": "file",
"application/msexcel": "x-office/spreadsheet",
"application/msonenote": "x-office/document",
"application/mspowerpoint": "x-office/presentation",
"application/msword": "x-office/document",
"application/octet-stream": "file",
"application/postscript": "image",
"application/rss+xml": "application/xml",
"application/vnd.android.package-archive": "package/x-generic",
"application/vnd.excalidraw+json": "whiteboard",
"application/vnd.lotus-wordpro": "x-office/document",
"application/vnd.garmin.tcx+xml": "location",
"application/vnd.google-earth.kml+xml": "location",
"application/vnd.google-earth.kmz": "location",
"application/vnd.ms-excel": "x-office/spreadsheet",
"application/vnd.ms-excel.addin.macroEnabled.12": "x-office/spreadsheet",
"application/vnd.ms-excel.sheet.binary.macroEnabled.12": "x-office/spreadsheet",
"application/vnd.ms-excel.sheet.macroEnabled.12": "x-office/spreadsheet",
"application/vnd.ms-excel.template.macroEnabled.12": "x-office/spreadsheet",
"application/vnd.ms-fontobject": "font",
"application/vnd.ms-powerpoint": "x-office/presentation",
"application/vnd.ms-powerpoint.addin.macroEnabled.12": "x-office/presentation",
"application/vnd.ms-powerpoint.presentation.macroEnabled.12": "x-office/presentation",
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12": "x-office/presentation",
"application/vnd.ms-powerpoint.template.macroEnabled.12": "x-office/presentation",
"application/vnd.ms-visio.drawing.macroEnabled.12": "application/vnd.visio",
"application/vnd.ms-visio.drawing": "application/vnd.visio",
"application/vnd.ms-visio.stencil.macroEnabled.12": "application/vnd.visio",
"application/vnd.ms-visio.stencil": "application/vnd.visio",
"application/vnd.ms-visio.template.macroEnabled.12": "application/vnd.visio",
"application/vnd.ms-visio.template": "application/vnd.visio",
"application/vnd.ms-word.document.macroEnabled.12": "x-office/document",
"application/vnd.ms-word.template.macroEnabled.12": "x-office/document",
"application/vnd.oasis.opendocument.presentation": "x-office/presentation",
"application/vnd.oasis.opendocument.presentation-template": "x-office/presentation",
"application/vnd.oasis.opendocument.spreadsheet": "x-office/spreadsheet",
"application/vnd.oasis.opendocument.spreadsheet-template": "x-office/spreadsheet",
"application/vnd.oasis.opendocument.text": "x-office/document",
"application/vnd.oasis.opendocument.text-master": "x-office/document",
"application/vnd.oasis.opendocument.text-template": "x-office/document",
"application/vnd.oasis.opendocument.graphics": "x-office/drawing",
"application/vnd.oasis.opendocument.graphics-template": "x-office/drawing",
"application/vnd.oasis.opendocument.text-web": "x-office/document",
"application/vnd.oasis.opendocument.text-flat-xml": "x-office/document",
"application/vnd.oasis.opendocument.spreadsheet-flat-xml": "x-office/spreadsheet",
"application/vnd.oasis.opendocument.graphics-flat-xml": "x-office/drawing",
"application/vnd.oasis.opendocument.presentation-flat-xml": "x-office/presentation",
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "x-office/presentation",
"application/vnd.openxmlformats-officedocument.presentationml.slideshow": "x-office/presentation",
"application/vnd.openxmlformats-officedocument.presentationml.template": "x-office/presentation",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "x-office/spreadsheet",
"application/vnd.openxmlformats-officedocument.spreadsheetml.template": "x-office/spreadsheet",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "x-office/document",
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": "x-office/document",
"application/vnd.visio": "x-office/document",
"application/vnd.wordperfect": "x-office/document",
"application/x-7z-compressed": "package/x-generic",
"application/x-bzip2": "package/x-generic",
"application/x-cbr": "text",
"application/x-compressed": "package/x-generic",
"application/x-dcraw": "image",
"application/x-deb": "package/x-generic",
"application/x-fictionbook+xml": "text",
"application/x-font": "font",
"application/x-gimp": "image",
"application/x-gzip": "application/gzip",
"application/x-iwork-keynote-sffkey": "x-office/presentation",
"application/x-iwork-numbers-sffnumbers": "x-office/spreadsheet",
"application/x-iwork-pages-sffpages": "x-office/document",
"application/x-mobipocket-ebook": "text",
"application/x-perl": "text/code",
"application/x-photoshop": "image",
"application/x-php": "text/code",
"application/x-rar-compressed": "package/x-generic",
"application/x-tar": "package/x-generic",
"application/x-tex": "text",
"application/xml": "text/html",
"application/yaml": "text/code",
"application/zip": "package/x-generic",
"database": "file",
"httpd/unix-directory": "dir",
"text/css": "text/code",
"text/csv": "x-office/spreadsheet",
"text/html": "text/code",
"text/x-c": "text/code",
"text/x-c++src": "text/code",
"text/x-h": "text/code",
"text/x-java-source": "text/code",
"text/x-ldif": "text/code",
"text/x-python": "text/code",
"text/x-rst": "text",
"text/x-shellscript": "text/code",
"web": "text/code",
"application/internet-shortcut": "link",
"application/km": "mindmap",
"application/x-freemind": "mindmap",
"application/vnd.xmind.workbook": "mindmap",
"image/targa": "image/tga",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform": "x-office/form",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf": "x-office/form-template",
"image/x-emf": "image/emf"
},
files: [
"application",
"application-pdf",
"audio",
"file",
"folder",
"folder-drag-accept",
"folder-encrypted",
"folder-external",
"folder-public",
"folder-shared",
"folder-starred",
"font",
"image",
"link",
"location",
"mindmap",
"package-x-generic",
"text",
"text-calendar",
"text-code",
"text-vcard",
"video",
"whiteboard",
"x-office-document",
"x-office-drawing",
"x-office-form",
"x-office-form-template",
"x-office-presentation",
"x-office-spreadsheet"
],
themes: []
};
/**
* SPDX-FileCopyrightText: 2016 ownCloud Inc.
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/* global Select2 */
/**
* Select2 extension for toggling values in a multi-select dropdown
*/
(function(Select2) {
var Select2FindHighlightableChoices = Select2.class.multi.prototype.findHighlightableChoices;
Select2.class.multi.prototype.findHighlightableChoices = function () {
if (this.opts.toggleSelect) {
return this.results.find('.select2-result-selectable:not(.select2-disabled)');
}
return Select2FindHighlightableChoices.apply(this, arguments);
};
var Select2TriggerSelect = Select2.class.multi.prototype.triggerSelect;
Select2.class.multi.prototype.triggerSelect = function (data) {
if (this.opts.toggleSelect && this.val().indexOf(this.id(data)) !== -1) {
var self = this;
var val = this.id(data);
var selectionEls = this.container.find('.select2-search-choice').filter(function() {
return (self.id($(this).data('select2-data')) === val);
});
if (this.unselect(selectionEls)) {
// also unselect in dropdown
this.results.find('.select2-result.select2-selected').each(function () {
var $this = $(this);
if (self.id($this.data('select2-data')) === val) {
$this.removeClass('select2-selected');
}
});
this.clearSearch();
}
return false;
} else {
return Select2TriggerSelect.apply(this, arguments);
}
};
})(Select2);

View File

@ -0,0 +1 @@
{"\/app\/www\/public\/core\/js\/merged-template-prepend.json":1739378991,"\/app\/www\/public\/core\/js\/mimetype.js":1739378991,"\/app\/www\/public\/core\/js\/mimetypelist.js":1739378991,"\/app\/www\/public\/core\/js\/select2-toggleselect.js":1739378991}

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM9.5 11.5C9.5 12.3 8.8 13 8 13H7V15H5.5V9H8C8.8 9 9.5 9.7 9.5 10.5V11.5ZM14.5 13.5C14.5 14.3 13.8 15 13 15H10.5V9H13C13.8 9 14.5 9.7 14.5 10.5V13.5ZM18.5 10.5H17V11.5H18.5V13H17V15H15.5V9H18.5V10.5ZM12 10.5H13V13.5H12V10.5ZM7 10.5H8V11.5H7V10.5Z" fill="#DC5047"/>
</svg>

After

Width:  |  Height:  |  Size: 468 B

View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" height="24" width="24" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M5 21c-.55 0-1.021-.196-1.412-.587A1.927 1.927 0 0 1 3 19V5c0-.55.196-1.021.588-1.413A1.926 1.926 0 0 1 5 3h14c.55 0 1.021.196 1.413.587.391.392.587.863.587 1.413v14a1.93 1.93 0 0 1-.587 1.413A1.93 1.93 0 0 1 19 21H5Zm1-4h12l-3.75-5-3 4L9 13l-3 4Zm2.5-7a1.45 1.45 0 0 0 1.063-.437A1.45 1.45 0 0 0 10 8.5c0-.417-.146-.771-.437-1.062A1.447 1.447 0 0 0 8.5 7c-.417 0-.771.146-1.062.438A1.443 1.443 0 0 0 7 8.5c0 .417.146.771.438 1.063.291.291.645.437 1.062.437Z" style="fill:#969696;fill-rule:nonzero"/></svg>

After

Width:  |  Height:  |  Size: 705 B

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#000000">
<path d="M0 0h24v24H0z" fill="none" />
<path fill="#969696"
d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z" />
</svg>

After

Width:  |  Height:  |  Size: 299 B

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#000000">
<path d="M0 0h24v24H0z" fill="none" />
<path fill="#49abea"
d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z" />
</svg>

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

BIN
nextcloud-data/owncloud.db Normal file

Binary file not shown.

46
s6-rc-inotify/run Normal file
View File

@ -0,0 +1,46 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if ! command -v inotifywait 2>&1 >/dev/null; then
echo "No inotifywait found. install inotify tools"
apk add inotify-tools
fi
echo "running inotify"
BASEEXCLUDE='.*\.swp|.*\.swx'
detect(){
WATCH=$1
EXCLUDE=$2
REPLACEIN=$3
REPLACEWITH=$4
echo "watching $WATCH and excluding $EXCLUDE"
inotifywait -mre close_write,delete --format '%e|%w|%f' --exclude "$EXCLUDE" "$WATCH" | while read RAWEVENT
do
echo $RAWEVENT
IFS='|'
read -a SPLITEVENT <<< "$RAWEVENT"
EVENT=${SPLITEVENT[0]}
DIR=${SPLITEVENT[1]}
FILE=${SPLITEVENT[2]}
REPLACEDFILE=$DIR
if [[ $EVENT != 'DELETE' ]]; then
REPLACEDFILE+=$FILE
fi
if [ -n "$REPLACEIN" ] && [ -n "$REPLACEWITH" ]; then
REPLACEDFILE=${REPLACEDFILE/$REPLACEIN/$REPLACEWITH}
fi
occ files:scan --path=\"$REPLACEDFILE\" --shallow
done
}
detect /data/riksolo/files $BASEEXCLUDE /data/riksolo /riksolo

1
s6-rc-inotify/type Normal file
View File

@ -0,0 +1 @@
longrun

0
svc-inotify Normal file
View File