Skip to content

Commit

Permalink
Merge pull request #31 from geekdinazor/main
Browse files Browse the repository at this point in the history
search fix and flatpak support
  • Loading branch information
geekdinazor authored Feb 4, 2025
2 parents 4ea1fac + fa099ed commit 5426a90
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 16 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,35 @@ jobs:
name: linux-artifact
path: dist/linux/finch-${{ env.VERSION }}-linux-all.deb

build-flatpak:
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Flatpak environment
run: |
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08
- name: Build Flatpak bundle
run: |
flatpak-builder --repo=repo --force-clean build-dir flatpak/com.furkankalkan.FinchS3.yml
flatpak build-bundle repo finch-${{ env.VERSION }}-linux-x86_64.flatpak com.furkankalkan.FinchS3
- name: Upload Flatpak Artifact
uses: actions/upload-artifact@v4
with:
name: flatpak-artifact
path: finch-${{ env.VERSION }}-linux-x86_64.flatpak

release:
needs: [build-macos-arm, build-macos-intel, build-windows, build-linux]
needs: [build-macos-arm, build-macos-intel, build-windows, build-linux, build-flatpak]
runs-on: ubuntu-latest
steps:
- name: Download MacOS Apple Silicon Artifact
Expand All @@ -237,6 +262,11 @@ jobs:
with:
name: linux-artifact

- name: Download Flatpak Artifact
uses: actions/download-artifact@v4
with:
name: flatpak-artifact

- name: Create Release
uses: ncipollo/release-action@v1
with:
Expand All @@ -249,3 +279,4 @@ jobs:
finch-${{ env.VERSION }}-macos-x86_64.dmg
finch-${{ env.VERSION }}-windows-x86_64.msi
finch-${{ env.VERSION }}-linux-all.deb
finch-${{ env.VERSION }}-linux-x86_64.flatpak
2 changes: 1 addition & 1 deletion finch/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self):
subtitle_font = QFont('sans', 12)
subtitle_font.setItalic(True)
subtitle_label.setFont(subtitle_font)
version_label = QLabel('v1.0 ALPHA')
version_label = QLabel('v1.0 BETA')
version_label.setFont(subtitle_font)
contributors_label = QLabel("<strong>Contributors:</strong>")
contributors_label.setContentsMargins(0, 10, 0, 0)
Expand Down
39 changes: 25 additions & 14 deletions finch/widgets/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,37 @@ def _build_tree_structure(self, objects):
tree = {}
for path, size, date in objects:
current = tree
*folders, filename = path.split('/')
for folder in folders:
current = current.setdefault(folder, {})
current[filename] = {"_info": (size, date)}
parts = path.split('/')

# Handle the case where path ends with '/' (folder)
if path.endswith('/'):
folders = parts[:-1] # Last element is empty for folders ending in '/'
for folder in folders:
current = current.setdefault(folder, {})
else:
*folders, filename = parts
# Add all intermediate folders
for folder in folders:
current = current.setdefault(folder, {})
# Add file with its metadata
current[filename] = {"_info": (size, date)}
return tree

def _add_items_to_tree(self, parent_item, tree_dict):
"""Recursively add items to the tree widget."""
for key, value in tree_dict.items():
if key == "_info":
continue

item = self._create_tree_item(name=key, object_type=ObjectType.FOLDER)
parent_item.addChild(item)

if "_info" in value:
# First add all folders
for key, value in sorted(tree_dict.items()):
if key != "_info" and not "_info" in value:
item = self._create_tree_item(name=key, object_type=ObjectType.FOLDER)
parent_item.addChild(item)
self._add_items_to_tree(item, value)

# Then add all files
for key, value in sorted(tree_dict.items()):
if key != "_info" and "_info" in value:
size, date = value["_info"]
item = self._create_tree_item(name=key, object_type=ObjectType.FILE, size=size, date=date)

self._add_items_to_tree(item, value)
parent_item.addChild(item)

def _expand_and_select(self, item, search_term):
"""Recursively expand and select matching items."""
Expand Down
66 changes: 66 additions & 0 deletions flatpak/com.furkankalkan.FinchS3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
app-id: com.furkankalkan.FinchS3
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: finch
finish-args:
- --share=network
- --share=ipc
- --socket=x11
- --socket=wayland
- --filesystem=home
# For keyring access
- --talk-name=org.freedesktop.secrets
- --filesystem=xdg-config/finch:create

build-options:
build-args:
- --share=network

modules:
- name: python3-pip
buildsystem: simple
build-commands:
- python3 -m ensurepip
- pip3 install --upgrade pip
cleanup:
- /lib/python*/site-packages/pip
- /lib/python*/site-packages/setuptools

- name: python3-boto3-slim
buildsystem: simple
build-commands:
# Install boto3 and dependencies
- pip3 install --prefix=/app boto3==1.35.5
# Find botocore version and trim it
- |
BOTOCORE_PATH=$(python3 -c "import botocore; print(botocore.__path__[0])")
cd $BOTOCORE_PATH/data
for dir in *; do
if [[ ! "$dir" =~ ^s3.* ]]; then
rm -rf "$dir"
fi
done
- name: python3-requirements
buildsystem: simple
build-commands:
- pip3 install --prefix=/app --no-cache-dir PyQt5==5.15.11 keyring==25.3.0 python-slugify==8.0.4

- name: finch
buildsystem: simple
build-commands:
# Copy project files to a known location
- cp -r /run/build/finch/project /app/
# Install the package
- pip3 install --prefix=/app --no-deps /app/project
# Install application files
- install -Dm644 /app/project/icon.png /app/share/icons/hicolor/256x256/apps/com.furkankalkan.FinchS3.png
- install -Dm644 /app/project/flatpak/files/com.furkankalkan.FinchS3.desktop /app/share/applications/com.furkankalkan.FinchS3.desktop
- install -Dm644 /app/project/flatpak/files/com.furkankalkan.FinchS3.metainfo.xml /app/share/metainfo/com.furkankalkan.FinchS3.metainfo.xml
# Cleanup
- rm -rf /app/project
sources:
- type: dir
path: ..
dest: project
9 changes: 9 additions & 0 deletions flatpak/files/com.furkankalkan.FinchS3.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Finch S3 Client
Comment=Open source and cross-platform GUI client for Amazon S3
Exec=finch
Icon=com.furkankalkan.FinchS3
Terminal=false
Type=Application
Categories=Network;FileTransfer;
Keywords=s3;aws;storage;cloud;
33 changes: 33 additions & 0 deletions flatpak/files/com.furkankalkan.FinchS3.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>com.furkankalkan.FinchS3</id>
<metadata_license>MIT</metadata_license>
<project_license>MIT</project_license>
<name>Finch S3 Client</name>
<summary>GUI client for Amazon S3 and compatible storage platforms</summary>
<description>
<p>
Open source and cross-platform GUI client for Amazon S3 and compatible storage platforms.
</p>
<p>Features:</p>
<ul>
<li>Support for multiple credential through access &amp; secret keys</li>
<li>Use cross-platform secure secret key storage</li>
<li>Browse and manage your S3 buckets and objects in file tree</li>
<li>Delete folders and buckets recursively</li>
<li>Upload and download files</li>
<li>Searching buckets &amp; objects</li>
</ul>
</description>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/mantis-software-company/finch/main/img.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://github.com/mantis-software-company/finch</url>
<developer_name>Furkan Kalkan</developer_name>
<releases>
<release version="1.0.0a1" date="2024-01-01"/>
</releases>
<content_rating type="oars-1.1"/>
</component>

0 comments on commit 5426a90

Please sign in to comment.