commit 04e6cd458c489fb3962c2d6d214efa5ca851b3e7 Author: Zinny Date: Fri Aug 15 10:31:00 2025 +0200 experimental release on github diff --git a/.github/workflows/build-flatpak.yml b/.github/workflows/build-flatpak.yml new file mode 100644 index 0000000..48cca5c --- /dev/null +++ b/.github/workflows/build-flatpak.yml @@ -0,0 +1,36 @@ +name: Build Flatpak + +on: + workflow_dispatch: + push: + branches: [ main, master ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Flatpak tooling + run: | + sudo apt-get update + sudo apt-get install -y flatpak flatpak-builder imagemagick curl + + - name: Configure Flathub and required runtimes + run: | + flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + flatpak --user install -y flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08 + + - name: Build Flatpak and create bundle + run: | + chmod +x ./build-flatpak.sh + ./build-flatpak.sh + + - name: Upload .flatpak bundle artifact + uses: actions/upload-artifact@v4 + with: + name: publii-flatpak + path: publii.flatpak + if-no-files-found: error diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +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 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. + +For more information, please refer to diff --git a/README.md b/README.md new file mode 100644 index 0000000..299ba53 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Unofficial Publii Flatpak +Unofficial, work in progress, rudimentary, experimental & probably unstable Flatpak build for Publii - in other words, use it if you know you can handle errors. + + + +## Prerequisites +Before building, you need to install Flatpak, flatpak-builder, and ImageMagick: +```bash +sudo apt update +sudo apt install flatpak flatpak-builder imagemagick +``` +Add the Flathub repository if not already added: +```bash +flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +``` + +## Dynamic Version Handling +The `build-flatpak.sh` script dynamically fetches the latest Publii AppImage from the official website. It does not automatically update the `io.publii.Publii.metainfo.xml` (yet). + +## Permissions +The Flatpak has the following permissions: +- Network access (for publishing sites) +- Documents directory access (for storing sites and projects) +- Desktop integration (notifications, file chooser) +- Hardware acceleration (OpenGL/Vulkan, can't hurt because of Electron probably?) +- Session bus access (for... things?) + +### Known Issues +- `Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket` - found in console, not sure if this is normal in sandboxed environments +- `Failed to load module "canberra-gtk-module"` - *not researched yet* diff --git a/build-flatpak.sh b/build-flatpak.sh new file mode 100755 index 0000000..febd7d8 --- /dev/null +++ b/build-flatpak.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# Exit on error +set -e + +echo "Checking prerequisites..." +# Check if required tools are available +if ! flatpak list | grep -q "org.freedesktop.Platform.*23.08"; then + echo "Required Freedesktop runtime is not installed. Please install it manually with the following command:" + echo "flatpak install --user flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08 -y" + exit 1 +fi +for cmd in flatpak-builder convert curl; do + if ! command -v $cmd &> /dev/null; then + echo "$cmd is not installed. Please install it first." + exit 1 + fi +done + +# Get the latest Publii release URL and version #TODO: wacky web scraping, maybe use github api to get release number +echo "Fetching the latest Publii release..." +LATEST_RELEASE_URL=$(curl -s https://getpublii.com/download/ | grep -oE 'https://cdn.getpublii.com/Publii-[0-9]+\.[0-9]+\.[0-9]+\.AppImage' | head -n 1) +LATEST_VERSION=$(echo "$LATEST_RELEASE_URL" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') +if [ -z "$LATEST_RELEASE_URL" ]; then + echo "Error: Unable to fetch the latest Publii release URL. Please verify the website availability." + exit 1 +fi +if [ -z "$LATEST_VERSION" ]; then + echo "Error: Unable to extract the Publii version from the URL." + exit 1 +fi + +# Download the latest Publii AppImage +echo "Latest Publii version: $LATEST_VERSION" +echo "Downloading Publii AppImage..." +curl -L "$LATEST_RELEASE_URL" -o "Publii-$LATEST_VERSION.AppImage" + +# Ensure the AppImage is executable +chmod +x "Publii-$LATEST_VERSION.AppImage" +# Extract the AppImage +echo "Extracting Publii AppImage..." +./"Publii-$LATEST_VERSION.AppImage" --appimage-extract + +# Resize the icon to comply with Flatpak requirements (max 512x512) +ICON_PATH="squashfs-root/Publii.png" +if [ -f "$ICON_PATH" ]; then + convert "$ICON_PATH" -resize 512x512 "$ICON_PATH" + echo "Icon resized successfully." +else + echo "Warning: Icon file not found at $ICON_PATH" +fi + +# Build the Flatpak +echo "Begin build..." +flatpak-builder --user --install --force-clean build-dir io.publii.Publii.yml +echo "Build finished: flatpak run io.publii.Publii" + +# Create bundle +echo "Creating .flatpak bundle file... (this may take a minute or two)" +flatpak build-bundle ~/.local/share/flatpak/repo ./publii.flatpak io.publii.Publii +echo "Bundle created: publii.flatpak" + +# Optional, clean up files +rm -rf "Publii-$LATEST_VERSION.AppImage" squashfs-root build-dir .flatpak-builder +#echo "Temporary files cleaned up." diff --git a/io.publii.Publii.desktop b/io.publii.Publii.desktop new file mode 100644 index 0000000..fb63dde --- /dev/null +++ b/io.publii.Publii.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Publii +Exec=publii --no-sandbox %U +Terminal=false +Type=Application +Icon=io.publii.Publii +StartupWMClass=Publii +Comment=The most intuitive Static Site CMS designed for SEO-optimized and privacy-focused websites. +Categories=Development;WebDevelopment; +Keywords=CMS;static;site;generator;blog;website; +MimeType=application/x-publii-project; diff --git a/io.publii.Publii.metainfo.xml b/io.publii.Publii.metainfo.xml new file mode 100644 index 0000000..7170862 --- /dev/null +++ b/io.publii.Publii.metainfo.xml @@ -0,0 +1,33 @@ + + + io.publii.Publii + CC0-1.0 + GPL-3.0 + Publii + The most intuitive Static Site CMS designed for SEO-optimized and privacy-focused websites. + +

+ Creating a website doesn't have to be complicated or expensive. With the Publii app, the most intuitive CMS for static sites, you can create a beautiful, safe, and privacy-friendly website quickly and easily; perfect for anyone who wants a fast, secure website in a flash. +

+

+ Unofficial, work in progress, rudimentary, experimental and probably unstable Flatpak build for Publii - in other words, use it if you know you can handle errors. +

+
+ io.publii.Publii.desktop + + + https://getpublii.com/assets/images/publii-cms.webp + + + https://getpublii.com/assets/images/bg-themes.webp + + + https://getpublii.com + https://github.com/GetPublii/Publii/issues + https://getpublii.com/docs + Publii Contributors + + + + +
diff --git a/io.publii.Publii.yml b/io.publii.Publii.yml new file mode 100644 index 0000000..8c83241 --- /dev/null +++ b/io.publii.Publii.yml @@ -0,0 +1,71 @@ +app-id: io.publii.Publii +runtime: org.freedesktop.Platform +runtime-version: '23.08' +sdk: org.freedesktop.Sdk +command: publii +finish-args: + - --share=ipc + - --socket=x11 + - --socket=wayland + - --device=dri + - --share=network + - --filesystem=xdg-documents + - --socket=session-bus + - --talk-name=org.freedesktop.Notifications + - --talk-name=org.freedesktop.FileManager1 + - --talk-name=org.freedesktop.portal.Desktop + - --talk-name=org.freedesktop.portal.FileChooser + - --talk-name=org.freedesktop.secrets + - --env=ELECTRON_TRASH=gio + - --env=GTK_A11Y=none + - --env=NO_AT_BRIDGE=1 + +modules: + - name: libsecret + buildsystem: meson + config-opts: + - -Dmanpage=false + - -Dvapi=false + - -Dgtk_doc=false + cleanup: + - /bin + - /include + - /lib/pkgconfig + - /share/gir-1.0 + - /share/man + sources: + - type: archive + url: https://download.gnome.org/sources/libsecret/0.21/libsecret-0.21.4.tar.xz + sha256: 163d08d783be6d4ab9a979ceb5a4fecbc1d9660d3c34168c581301cd53912b20 + + - name: publii + buildsystem: simple + build-commands: + - install -Dm755 publii-wrapper.sh /app/bin/publii + - install -Dm644 Publii.png /app/share/icons/hicolor/256x256/apps/io.publii.Publii.png + - install -Dm644 io.publii.Publii.desktop /app/share/applications/io.publii.Publii.desktop + - install -Dm644 io.publii.Publii.metainfo.xml /app/share/metainfo/io.publii.Publii.metainfo.xml + - mkdir -p /app/share/publii + - cp Publii /app/share/publii/ + - cp -r resources /app/share/publii/ + - cp -r locales /app/share/publii/ + - cp *.pak /app/share/publii/ + - cp *.bin /app/share/publii/ + - cp *.dat /app/share/publii/ + - cp *.so* /app/share/publii/ + - cp chrome_* /app/share/publii/ + - cp vk_* /app/share/publii/ + - cp LICENSE* /app/share/publii/ + - mkdir -p /app/share/publii/usr/lib + - cp -r usr/lib/* /app/share/publii/usr/lib/ + - mkdir -p /app/share/publii/usr/share + - cp -r usr/share/* /app/share/publii/usr/share/ + sources: + - type: dir + path: squashfs-root + - type: file + path: io.publii.Publii.desktop + - type: file + path: io.publii.Publii.metainfo.xml + - type: file + path: publii-wrapper.sh diff --git a/publii-wrapper.sh b/publii-wrapper.sh new file mode 100755 index 0000000..42e6980 --- /dev/null +++ b/publii-wrapper.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Publii Flatpak wrapper script +export PUBLII_RESOURCES_PATH="/app/share/publii" +export LD_LIBRARY_PATH="/app/share/publii/usr/lib:/app/share/publii:$LD_LIBRARY_PATH" + +# Suppress GTK accessibility warnings +export GTK_A11Y=none +export NO_AT_BRIDGE=1 + +# Set up the environment +cd /app/share/publii + +# Run Publii with the proper library path and disable Electron sandbox +# (Flatpak provides its own sandboxing) +exec ./Publii --no-sandbox "$@"