diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 000000000..861ea1e7f --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,9 @@ +{ + "permissions": { + "allow": [ + "Bash(mkdir:*)", + "Bash(cp:*)" + ], + "deny": [] + } +} \ No newline at end of file diff --git a/omni-tools/CHANGELOG.md b/omni-tools/CHANGELOG.md new file mode 100644 index 000000000..5e23559a5 --- /dev/null +++ b/omni-tools/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +## 1.0.0 + +- Initial release +- Based on omni-tools docker image iib0011/omni-tools:latest +- Self-hosted web application with various online utilities +- Client-side processing for privacy and security +- Features image, video, PDF, text, date/time, math, and data tools \ No newline at end of file diff --git a/omni-tools/Dockerfile b/omni-tools/Dockerfile new file mode 100644 index 000000000..87ec284d3 --- /dev/null +++ b/omni-tools/Dockerfile @@ -0,0 +1,107 @@ +#============================# +# ALEXBELGIUM'S DOCKERFILE # +#============================# +# _.------. +# _.-` ('>.-`"""-. +# '.--'` _'` _ .--.) +# -' '-.-';` ` +# ' - _.' ``'--. +# '---` .-'""` +# /` +#=== Home Assistant Addon ===# + +################# +# 1 Build Image # +################# + +ARG BUILD_FROM +ARG BUILD_VERSION +FROM ${BUILD_FROM} + +################## +# 2 Modify Image # +################## + +# Set S6 wait time +ENV S6_CMD_WAIT_FOR_SERVICES=1 \ + S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ + S6_SERVICES_GRACETIME=0 + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Uses /bin for compatibility purposes +# hadolint ignore=DL4005 +RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; fi && \ + if [ ! -f /bin/bash ] && [ -f /usr/bin/bash ]; then ln -s /usr/bin/bash /bin/bash; fi + +# Modules +ARG MODULES="00-local_mounts.sh 00-smb_mounts.sh" + +# Automatic modules download +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automodules.sh" "/ha_automodules.sh" +RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh + +# Manual apps +ENV PACKAGES="nginx" + +# Automatic apps & bashio +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_autoapps.sh" "/ha_autoapps.sh" +RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.sh + +################ +# 4 Entrypoint # +################ + +# Add entrypoint +ENV S6_STAGE2_HOOK=/ha_entrypoint.sh +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint.sh" "/ha_entrypoint.sh" + +# Entrypoint modifications +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh" +RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh + +VOLUME [ "/data" ] +WORKDIR / + +ENTRYPOINT [ "/usr/bin/env" ] +CMD [ "/ha_entrypoint.sh" ] + +############ +# 5 Labels # +############ + +ARG BUILD_ARCH +ARG BUILD_DATE +ARG BUILD_DESCRIPTION +ARG BUILD_NAME +ARG BUILD_REF +ARG BUILD_REPOSITORY +ARG BUILD_VERSION +ENV BUILD_VERSION="${BUILD_VERSION}" +LABEL \ + io.hass.name="${BUILD_NAME}" \ + io.hass.description="${BUILD_DESCRIPTION}" \ + io.hass.arch="${BUILD_ARCH}" \ + io.hass.type="addon" \ + io.hass.version=${BUILD_VERSION} \ + maintainer="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.title="${BUILD_NAME}" \ + org.opencontainers.image.description="${BUILD_DESCRIPTION}" \ + org.opencontainers.image.vendor="Home Assistant Add-ons" \ + org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.url="https://github.com/alexbelgium" \ + org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \ + org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \ + org.opencontainers.image.created=${BUILD_DATE} \ + org.opencontainers.image.revision=${BUILD_REF} \ + org.opencontainers.image.version=${BUILD_VERSION} + +################# +# 6 Healthcheck # +################# \ No newline at end of file diff --git a/omni-tools/README.md b/omni-tools/README.md new file mode 100644 index 000000000..5be3ba51b --- /dev/null +++ b/omni-tools/README.md @@ -0,0 +1,96 @@ +# Home Assistant Add-on: Omni Tools + +## About + +Omni Tools is a self-hosted web application offering a variety of online utilities for everyday tasks. All file processing is done entirely client-side, ensuring privacy and security. + +![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] + +## Features + +- **Image Tools**: Image resizer, converter +- **Video Tools**: Video trimmer +- **PDF Tools**: PDF splitter, merger +- **Text/List Tools**: Various text manipulation utilities +- **Date and Time Tools**: Date/time calculators and converters +- **Math Tools**: Mathematical calculators and converters +- **Data Tools**: JSON, CSV, XML processors + +## Installation + +1. Add this repository to your Home Assistant Supervisor add-on store +2. Install the "Omni Tools" add-on +3. Start the add-on +4. Open the web UI + +## Configuration + +### Option: `PUID` + +User ID to run the application with. Default is `0`. + +### Option: `PGID` + +Group ID to run the application with. Default is `0`. + +### Option: `TZ` + +Timezone setting for the application. + +## Usage + +1. Access the web interface through the Home Assistant sidebar or by navigating to the add-on's web UI +2. Choose from various tool categories: + - Image/Video/Audio processing + - PDF manipulation + - Text and list processing + - Date and time utilities + - Mathematical tools + - Data format conversions + +All processing is done locally in your browser for maximum privacy and security. + +## Support + +Got questions? + +You have several options to get them answered: + +- The [Home Assistant Discord Chat Server][discord] +- The Home Assistant [Community Forum][forum] +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] + +## Authors & contributors + +The original setup of this repository is by [Alex Belgium][alexbelgium]. + +## License + +MIT License + +Copyright (c) 2017-2024 Alex Belgium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg +[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg +[alexbelgium]: https://github.com/alexbelgium +[discord]: https://discord.gg/c5DvZ4e +[forum]: https://community.home-assistant.io +[reddit]: https://reddit.com/r/homeassistant \ No newline at end of file diff --git a/omni-tools/apparmor.txt b/omni-tools/apparmor.txt new file mode 100644 index 000000000..98a6c893f --- /dev/null +++ b/omni-tools/apparmor.txt @@ -0,0 +1,87 @@ +#include + +profile omni-tools flags=(attach_disconnected,mediate_deleted) { + #include + + # Capabilities + capability, + file, + signal (send) set=(kill,term,int,hup,cont), + + # S6-Overlay + /init ix, + /bin/** ix, + /usr/bin/** ix, + /run/{s6,s6-rc*,service}/** ix, + /package/** ix, + /command/** ix, + /etc/services.d/** rwix, + /etc/cont-init.d/** rwix, + /etc/cont-finish.d/** rwix, + /run/{,**} rwk, + /dev/tty rw, + + # Bashio + /usr/lib/bashio/** ix, + /tmp/** rwk, + + # Access to options.json and other files within your addon + /data/** rw, + + # Start new profile for service + /usr/bin/omni-tools cx -> omni-tools, + + profile omni-tools flags=(attach_disconnected,mediate_deleted) { + #include + + # Receive signals from S6-Overlay + signal (receive) set=(kill,term,int,hup,cont), + + # Access to options.json and other files within your addon + /data/** rw, + /usr/bin/omni-tools r, + + # Access to mapped volumes + /share/** rw, + /config/** rw, + + # Network access + network inet dgram, + network inet stream, + network inet6 dgram, + network inet6 stream, + network netlink raw, + + # System directories + /etc/passwd r, + /etc/group r, + /etc/nsswitch.conf r, + /etc/hosts r, + /etc/resolv.conf r, + /etc/ssl/openssl.cnf r, + /etc/ssl/certs/ r, + /etc/ssl/certs/** r, + /usr/share/ca-certificates/ r, + /usr/share/ca-certificates/** r, + + # Library access + /lib/** rm, + /usr/lib/** rm, + /usr/local/lib/** rm, + + # Proc and sys access + /proc/ r, + /proc/** r, + /sys/fs/cgroup/** r, + + # Tmp access + /tmp/** rwk, + /var/tmp/** rwk, + + # Device access + /dev/null rw, + /dev/zero rw, + /dev/random r, + /dev/urandom r, + } +} \ No newline at end of file diff --git a/omni-tools/build.json b/omni-tools/build.json new file mode 100644 index 000000000..2f3b2e230 --- /dev/null +++ b/omni-tools/build.json @@ -0,0 +1,8 @@ +{ + "build_from": { + "aarch64": "ghcr.io/alexbelgium/base-alpine:3.19.1-5", + "amd64": "ghcr.io/alexbelgium/base-alpine:3.19.1-5" + }, + "squash": false, + "args": {} +} \ No newline at end of file diff --git a/omni-tools/config.json b/omni-tools/config.json new file mode 100644 index 000000000..a5fd9b4be --- /dev/null +++ b/omni-tools/config.json @@ -0,0 +1,52 @@ +{ + "arch": [ + "aarch64", + "amd64" + ], + "codenotary": "alexandrep.github@gmail.com", + "description": "Self-hosted web application offering various online utilities for everyday tasks", + "environment": { + "PGID": "0", + "PUID": "0" + }, + "hassio_api": true, + "homeassistant_api": true, + "image": "ghcr.io/alexbelgium/omni-tools-{arch}", + "ingress": true, + "ingress_stream": true, + "map": [ + "addon_config:rw", + "share:rw" + ], + "name": "Omni Tools", + "options": { + "PGID": "0", + "PUID": "0" + }, + "panel_admin": false, + "panel_icon": "mdi:toolbox", + "ports": { + "8080/tcp": 8080 + }, + "ports_description": { + "8080/tcp": "Web UI port" + }, + "privileged": [ + "SYS_ADMIN", + "DAC_READ_SEARCH" + ], + "schema": { + "PGID": "int?", + "PUID": "int?", + "TZ": "str?", + "cifsdomain": "str?", + "cifspassword": "str?", + "cifsusername": "str?", + "localdisks": "str?", + "networkdisks": "str?" + }, + "slug": "omni-tools", + "udev": true, + "url": "https://github.com/alexbelgium/hassio-addons", + "version": "1.0.0" +} \ No newline at end of file diff --git a/omni-tools/icon.png b/omni-tools/icon.png new file mode 100644 index 000000000..735fa3606 Binary files /dev/null and b/omni-tools/icon.png differ diff --git a/omni-tools/logo.png b/omni-tools/logo.png new file mode 100644 index 000000000..735fa3606 Binary files /dev/null and b/omni-tools/logo.png differ diff --git a/omni-tools/rootfs/etc/cont-init.d/99-run.sh b/omni-tools/rootfs/etc/cont-init.d/99-run.sh new file mode 100644 index 000000000..842cea273 --- /dev/null +++ b/omni-tools/rootfs/etc/cont-init.d/99-run.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash +# ============================================================================== +# Home Assistant Add-on: Omni Tools +# Starts omni-tools +# ============================================================================== + +bashio::log.info "Starting omni-tools..." + +# Create nginx configuration +mkdir -p /etc/nginx/http.d + +cat > /etc/nginx/http.d/default.conf << 'EOF' +server { + listen 8080; + server_name _; + + location / { + proxy_pass http://localhost:80; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} +EOF + +# Start nginx +nginx + +# Start omni-tools container content +exec docker run -d --name omni-tools-app --restart unless-stopped -p 80:80 iib0011/omni-tools:latest \ No newline at end of file