ownfoil 2.4.0.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. ownfoil-2.4.0.dev0/.devcontainer/devcontainer.json +29 -0
  2. ownfoil-2.4.0.dev0/.devcontainer/post-create.sh +58 -0
  3. ownfoil-2.4.0.dev0/.github/dependabot.yml +31 -0
  4. ownfoil-2.4.0.dev0/.github/release.yml +21 -0
  5. ownfoil-2.4.0.dev0/.github/workflows/docker.yml +68 -0
  6. ownfoil-2.4.0.dev0/.github/workflows/docker_pr.yml +32 -0
  7. ownfoil-2.4.0.dev0/.github/workflows/pypi.yml +27 -0
  8. ownfoil-2.4.0.dev0/.github/workflows/region_titles.yml +73 -0
  9. ownfoil-2.4.0.dev0/.github/workflows/stale.yml +21 -0
  10. ownfoil-2.4.0.dev0/.gitignore +24 -0
  11. ownfoil-2.4.0.dev0/Dockerfile +25 -0
  12. ownfoil-2.4.0.dev0/LICENSE.md +661 -0
  13. ownfoil-2.4.0.dev0/PKG-INFO +221 -0
  14. ownfoil-2.4.0.dev0/README.md +189 -0
  15. ownfoil-2.4.0.dev0/app/app.py +653 -0
  16. ownfoil-2.4.0.dev0/app/auth.py +370 -0
  17. ownfoil-2.4.0.dev0/app/clients/__init__.py +9 -0
  18. ownfoil-2.4.0.dev0/app/clients/client.py +171 -0
  19. ownfoil-2.4.0.dev0/app/clients/cyberfoil.py +137 -0
  20. ownfoil-2.4.0.dev0/app/clients/sphaira.py +197 -0
  21. ownfoil-2.4.0.dev0/app/clients/tinfoil.py +189 -0
  22. ownfoil-2.4.0.dev0/app/constants.py +149 -0
  23. ownfoil-2.4.0.dev0/app/db.py +583 -0
  24. ownfoil-2.4.0.dev0/app/file_compression.py +191 -0
  25. ownfoil-2.4.0.dev0/app/file_watcher.py +308 -0
  26. ownfoil-2.4.0.dev0/app/library.py +555 -0
  27. ownfoil-2.4.0.dev0/app/local.py +42 -0
  28. ownfoil-2.4.0.dev0/app/migrations/README +1 -0
  29. ownfoil-2.4.0.dev0/app/migrations/alembic.ini +51 -0
  30. ownfoil-2.4.0.dev0/app/migrations/env.py +111 -0
  31. ownfoil-2.4.0.dev0/app/migrations/script.py.mako +23 -0
  32. ownfoil-2.4.0.dev0/app/migrations/versions/78c33e9bffce_drop_old_files_table_and_create_new_.py +109 -0
  33. ownfoil-2.4.0.dev0/app/migrations/versions/a1b2c3d4e5f6_add_tasks_and_ignored_events.py +63 -0
  34. ownfoil-2.4.0.dev0/app/migrations/versions/b2c3d4e5f6a7_add_organized_column_to_files.py +22 -0
  35. ownfoil-2.4.0.dev0/app/migrations/versions/c3d4e5f6a7b8_add_worker_id_to_tasks.py +22 -0
  36. ownfoil-2.4.0.dev0/app/migrations/versions/d4e5f6a7b8c9_add_temp_files.py +28 -0
  37. ownfoil-2.4.0.dev0/app/run.py +97 -0
  38. ownfoil-2.4.0.dev0/app/settings.py +327 -0
  39. ownfoil-2.4.0.dev0/app/shop.py +52 -0
  40. ownfoil-2.4.0.dev0/app/static/favicon/apple-touch-icon.png +0 -0
  41. ownfoil-2.4.0.dev0/app/static/favicon/favicon-96x96.png +0 -0
  42. ownfoil-2.4.0.dev0/app/static/favicon/favicon.ico +0 -0
  43. ownfoil-2.4.0.dev0/app/static/favicon/favicon.svg +5 -0
  44. ownfoil-2.4.0.dev0/app/static/favicon/site.webmanifest +21 -0
  45. ownfoil-2.4.0.dev0/app/static/favicon/web-app-manifest-192x192.png +0 -0
  46. ownfoil-2.4.0.dev0/app/static/favicon/web-app-manifest-512x512.png +0 -0
  47. ownfoil-2.4.0.dev0/app/static/logo/logo-1024.png +0 -0
  48. ownfoil-2.4.0.dev0/app/static/logo/logo-128.png +0 -0
  49. ownfoil-2.4.0.dev0/app/static/logo/logo-256.png +0 -0
  50. ownfoil-2.4.0.dev0/app/static/logo/logo-512.png +0 -0
  51. ownfoil-2.4.0.dev0/app/static/logo/logo-64.png +0 -0
  52. ownfoil-2.4.0.dev0/app/static/logo/logo.svg +3 -0
  53. ownfoil-2.4.0.dev0/app/static/style.css +125 -0
  54. ownfoil-2.4.0.dev0/app/tasks.py +967 -0
  55. ownfoil-2.4.0.dev0/app/templates/base.html +36 -0
  56. ownfoil-2.4.0.dev0/app/templates/index.html +656 -0
  57. ownfoil-2.4.0.dev0/app/templates/login.html +34 -0
  58. ownfoil-2.4.0.dev0/app/templates/nav.html +43 -0
  59. ownfoil-2.4.0.dev0/app/templates/profile.html +7 -0
  60. ownfoil-2.4.0.dev0/app/templates/settings.html +1411 -0
  61. ownfoil-2.4.0.dev0/app/templates/setup.html +546 -0
  62. ownfoil-2.4.0.dev0/app/titledb.py +100 -0
  63. ownfoil-2.4.0.dev0/app/titledb_store.py +533 -0
  64. ownfoil-2.4.0.dev0/app/titles.py +239 -0
  65. ownfoil-2.4.0.dev0/app/utils.py +352 -0
  66. ownfoil-2.4.0.dev0/app/worker.py +149 -0
  67. ownfoil-2.4.0.dev0/app/worker_pool.py +89 -0
  68. ownfoil-2.4.0.dev0/chart/Chart.yaml +8 -0
  69. ownfoil-2.4.0.dev0/chart/readme.md +2 -0
  70. ownfoil-2.4.0.dev0/chart/templates/deploy.yaml +51 -0
  71. ownfoil-2.4.0.dev0/chart/templates/ingress.yaml +34 -0
  72. ownfoil-2.4.0.dev0/chart/templates/pvc.yaml +24 -0
  73. ownfoil-2.4.0.dev0/chart/templates/services.yaml +19 -0
  74. ownfoil-2.4.0.dev0/chart/values.yaml +46 -0
  75. ownfoil-2.4.0.dev0/docker/run.sh +16 -0
  76. ownfoil-2.4.0.dev0/docker-compose.yml +22 -0
  77. ownfoil-2.4.0.dev0/ownfoil/__init__.py +1 -0
  78. ownfoil-2.4.0.dev0/ownfoil/cli.py +64 -0
  79. ownfoil-2.4.0.dev0/pyproject.toml +55 -0
  80. ownfoil-2.4.0.dev0/requirements.txt +13 -0
  81. ownfoil-2.4.0.dev0/tests/conftest.py +11 -0
  82. ownfoil-2.4.0.dev0/tests/test_compression.py +673 -0
  83. ownfoil-2.4.0.dev0/tests/test_file_watcher.py +328 -0
  84. ownfoil-2.4.0.dev0/tests/test_organizer_paths.py +177 -0
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "Ownfoil",
3
+ "image": "mcr.microsoft.com/devcontainers/base:bookworm",
4
+
5
+ // Install uv, Python and the virtualenv once, when the container is created.
6
+ "postCreateCommand": "bash .devcontainer/post-create.sh",
7
+
8
+ // Make the virtualenv the default interpreter for every process in the container.
9
+ "remoteEnv": {
10
+ "PATH": "${containerWorkspaceFolder}/.venv/bin:${containerEnv:PATH}"
11
+ },
12
+
13
+ // Ownfoil web UI
14
+ "forwardPorts": [8465],
15
+ "portsAttributes": {
16
+ "8465": {
17
+ "label": "Ownfoil",
18
+ "onAutoForward": "notify"
19
+ }
20
+ },
21
+
22
+ "customizations": {
23
+ "vscode": {
24
+ "extensions": [
25
+ "eamodio.gitlens"
26
+ ]
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+ # Prepare the development environment: uv, Python, virtualenv and dependencies.
3
+ # Runs once when the dev container / Codespace is created.
4
+ set -euo pipefail
5
+
6
+ PYTHON_VERSION="3.14"
7
+ REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
8
+ VENV_DIR="${REPO_DIR}/.venv"
9
+
10
+ # uv installs itself in ~/.local/bin
11
+ export PATH="${HOME}/.local/bin:${PATH}"
12
+
13
+ # 1. Install uv (the base image may already provide it)
14
+ if ! command -v uv >/dev/null 2>&1; then
15
+ echo "Installing uv..."
16
+ curl -LsSf https://astral.sh/uv/install.sh | sh
17
+ fi
18
+ uv --version
19
+
20
+ # 2. Install the Python version used by the Ownfoil image (see Dockerfile)
21
+ echo "Installing Python ${PYTHON_VERSION}..."
22
+ uv python install "${PYTHON_VERSION}"
23
+
24
+ # 3. Create the virtualenv
25
+ echo "Creating virtualenv in ${VENV_DIR}..."
26
+ uv venv --python "${PYTHON_VERSION}" --allow-existing "${VENV_DIR}"
27
+
28
+ # 4. Install the application requirements, plus pytest to run the test suite
29
+ echo "Installing requirements..."
30
+ uv pip install --python "${VENV_DIR}/bin/python" --requirement "${REPO_DIR}/requirements.txt" pytest
31
+
32
+ # 5. Activate the virtualenv in interactive shells
33
+ for rc in "${HOME}/.bashrc" "${HOME}/.zshrc"; do
34
+ [ -f "${rc}" ] || continue
35
+ grep -qxF "source ${VENV_DIR}/bin/activate" "${rc}" || {
36
+ printf '\n# Activate the Ownfoil virtualenv\nsource %s/bin/activate\n' "${VENV_DIR}" >> "${rc}"
37
+ }
38
+ done
39
+
40
+ echo "Environment ready: $(${VENV_DIR}/bin/python --version)"
41
+
42
+ # 6. Install the Claude Code CLI.
43
+ if ! command -v claude >/dev/null 2>&1; then
44
+ echo "Installing Claude Code CLI..."
45
+ curl -fsSL https://claude.ai/install.sh | bash
46
+ fi
47
+ # Skip onboarding
48
+ cat > ~/.claude.json << EOF
49
+ {
50
+ "hasCompletedOnboarding": true,
51
+ "theme": "dark",
52
+ "projects": {
53
+ "${REPO_DIR}": {
54
+ "hasTrustDialogAccepted": true
55
+ }
56
+ }
57
+ }
58
+ EOF
@@ -0,0 +1,31 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ # Maintain dependencies for GitHub Actions
9
+ - package-ecosystem: "github-actions"
10
+ directory: "/"
11
+ target-branch: "develop"
12
+ schedule:
13
+ interval: "weekly"
14
+ labels:
15
+ - "type/build"
16
+
17
+ - package-ecosystem: "docker"
18
+ directory: "/"
19
+ target-branch: "develop"
20
+ schedule:
21
+ interval: "weekly"
22
+ labels:
23
+ - "type/build"
24
+
25
+ - package-ecosystem: "pip"
26
+ directory: "/"
27
+ target-branch: "develop"
28
+ schedule:
29
+ interval: "weekly"
30
+ labels:
31
+ - "type/build"
@@ -0,0 +1,21 @@
1
+ changelog:
2
+ categories:
3
+ - title: New Features
4
+ labels:
5
+ - 'type/feat'
6
+ - title: Fixes and Improvements
7
+ labels:
8
+ - 'type/fix'
9
+ - 'type/improv'
10
+ - title: Other Changes
11
+ labels:
12
+ - '*'
13
+ exclude:
14
+ labels:
15
+ - 'type/feat'
16
+ - 'type/fix'
17
+ - 'type/improv'
18
+ - 'type/build'
19
+ - title: Dependencies
20
+ labels:
21
+ - 'type/build'
@@ -0,0 +1,68 @@
1
+ name: Publish multi arch Docker image
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches:
7
+ - '**'
8
+ tags:
9
+ - '*.*.*'
10
+
11
+ jobs:
12
+ push_to_registry:
13
+ name: Push Docker image to Docker Hub
14
+ if: startsWith(github.ref, 'refs/tags/') || (!startsWith(github.ref, 'refs/heads/master') && !startsWith(github.ref, 'refs/heads/dependabot') && !startsWith(github.event.head_commit.message, 'ci') && !startsWith(github.event.head_commit.message, 'doc'))
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ # Get the repository's code
18
+ - name: Checkout
19
+ uses: actions/checkout@v7
20
+ # with:
21
+ # submodules: recursive
22
+
23
+ # https://github.com/docker/setup-qemu-action
24
+ - name: Set up QEMU
25
+ uses: docker/setup-qemu-action@v4
26
+
27
+ # https://github.com/docker/setup-buildx-action
28
+ - name: Set up Docker Buildx
29
+ id: buildx
30
+ uses: docker/setup-buildx-action@v4
31
+
32
+ - name: Log in to Docker Hub
33
+ uses: docker/login-action@v4
34
+ with:
35
+ username: ${{ secrets.DOCKER_USERNAME }}
36
+ password: ${{ secrets.DOCKER_PASSWORD }}
37
+
38
+ - name: Extract metadata (tags, labels) for Docker
39
+ id: meta
40
+ uses: docker/metadata-action@v6
41
+ with:
42
+ images: a1ex4/ownfoil
43
+ flavor: |
44
+ latest=auto
45
+ tags: |
46
+ type=ref,event=tag
47
+ type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
48
+ type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master' }}
49
+ type=semver,pattern={{version}}
50
+ type=semver,pattern={{major}}.{{minor}}
51
+ type=semver,pattern={{major}}
52
+
53
+ - name: Set platforms based on branch or tag
54
+ run: |
55
+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
56
+ echo "PLATFORMS=linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6" >> $GITHUB_ENV
57
+ else
58
+ echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
59
+ fi
60
+
61
+ - name: Build and push Docker image
62
+ uses: docker/build-push-action@v7
63
+ with:
64
+ context: .
65
+ platforms: ${{ env.PLATFORMS }}
66
+ push: true
67
+ tags: ${{ steps.meta.outputs.tags }}
68
+ labels: ${{ steps.meta.outputs.labels }}
@@ -0,0 +1,32 @@
1
+ name: Build multi arch Docker image on PR
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ jobs:
7
+ push_to_registry:
8
+ name: Build multi arch Docker image on PR
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ # Get the repository's code
12
+ - name: Checkout
13
+ uses: actions/checkout@v7
14
+ # with:
15
+ # submodules: recursive
16
+
17
+ # https://github.com/docker/setup-qemu-action
18
+ - name: Set up QEMU
19
+ uses: docker/setup-qemu-action@v4
20
+
21
+ # https://github.com/docker/setup-buildx-action
22
+ - name: Set up Docker Buildx
23
+ id: buildx
24
+ uses: docker/setup-buildx-action@v4
25
+
26
+ - name: Build Docker images
27
+ uses: docker/build-push-action@v7
28
+ with:
29
+ context: .
30
+ # platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
31
+ platforms: linux/amd64,linux/arm64
32
+ push: false
@@ -0,0 +1,27 @@
1
+ name: Publish Python package to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - '*.*.*'
8
+
9
+ jobs:
10
+ build_and_publish:
11
+ name: Build and publish to PyPI
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+ permissions:
15
+ id-token: write
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v7
19
+
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v7
22
+
23
+ - name: Build package
24
+ run: uv build
25
+
26
+ - name: Publish to PyPI
27
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,73 @@
1
+ # This is a basic workflow to help you get started with Actions
2
+
3
+ name: Build titledb
4
+
5
+ # Controls when the workflow will run
6
+ on:
7
+ schedule:
8
+ - cron: '0 */4 * * *'
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
13
+ jobs:
14
+ # This workflow contains a single job called "build"
15
+ build:
16
+ # The type of runner that the job will run on
17
+ runs-on: ubuntu-latest
18
+
19
+ # Steps represent a sequence of tasks that will be executed as part of the job
20
+ steps:
21
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
22
+ - uses: actions/checkout@v7
23
+ - uses: actions/setup-python@v7
24
+ with:
25
+ python-version: '3.10'
26
+
27
+ # Runs a set of commands using the runners shell
28
+ - name: Setup folders
29
+ run: |
30
+ sudo apt update && sudo apt install -y libcurl4-openssl-dev libssl-dev
31
+ git clone https://github.com/blawar/nut
32
+ cd nut
33
+ pip install -r requirements.txt
34
+ mkdir build_artefacts
35
+ git clone --depth=1 https://github.com/blawar/titledb
36
+ titledb_commit=$(git -C titledb rev-parse --short HEAD)
37
+ echo "formatted_date=$(date +"%Y-%m-%d_%H%M%S")" >> $GITHUB_ENV
38
+ touch "build_artefacts/latest_${titledb_commit}"
39
+
40
+ - uses: jannekem/run-python-script-action@v1
41
+ name: Generate region titles
42
+ with:
43
+ script: |
44
+ import os, sys
45
+ import json
46
+
47
+ os.chdir('nut')
48
+ sys.path.append(os.getcwd())
49
+ import nut
50
+
51
+ with open('titledb/languages.json') as f:
52
+ languages = json.load(f)
53
+ languages = dict(sorted(languages.items()))
54
+ for region in languages.keys():
55
+ for language in languages[region]:
56
+ print(region, language)
57
+ nut.importRegion(region, language)
58
+ os.rename('titledb/titles.json', f'build_artefacts/titles.{region}.{language}.json')
59
+
60
+ for f in [
61
+ 'cnmts.json',
62
+ 'languages.json',
63
+ 'versions.json',
64
+ 'versions.txt',
65
+ ]:
66
+ os.rename(f'titledb/{f}', f'build_artefacts/{f}')
67
+
68
+
69
+ - uses: actions/upload-artifact@v7
70
+ with:
71
+ name: titledb
72
+ path: nut/build_artefacts/*
73
+ compression-level: 9
@@ -0,0 +1,21 @@
1
+ name: 'Close stale issues'
2
+ on:
3
+ workflow_dispatch:
4
+ schedule:
5
+ - cron: '30 1 * * *'
6
+
7
+ jobs:
8
+ stale:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Close stale issues
12
+ uses: actions/stale@v10
13
+ with:
14
+ days-before-stale: 30
15
+ days-before-close: 7
16
+ stale-issue-label: 'status/stale'
17
+ stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.'
18
+ close-issue-message: 'Closing this issue due to inactivity. Feel free to reopen if necessary.'
19
+ any-of-labels: 'status/waiting-for-info'
20
+ operations-per-run: 200
21
+ debug-only: false
@@ -0,0 +1,24 @@
1
+ __pycache__
2
+ config
3
+ data
4
+
5
+ # venv
6
+ /bin
7
+ /venv
8
+ /include
9
+ /lib
10
+ /lib64
11
+ /pyvenv.cfg
12
+ /share
13
+ /Scripts
14
+
15
+ # pyenv
16
+ .python-version
17
+
18
+ # uv build/tool artifacts
19
+ /dist
20
+ ownfoil.bat
21
+ uv.lock
22
+
23
+ .claude
24
+ CLAUDE.local.md
@@ -0,0 +1,25 @@
1
+ FROM python:3.14-alpine
2
+
3
+ # Install platform-specific build dependencies
4
+ ARG TARGETPLATFORM
5
+ RUN apk update && apk add --no-cache bash sudo git \
6
+ && if [ "$TARGETPLATFORM" = "linux/arm/v6" ] || [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
7
+ apk add --no-cache build-base gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev; \
8
+ fi
9
+
10
+ COPY requirements.txt /tmp/
11
+ RUN pip install --no-cache-dir --requirement /tmp/requirements.txt && rm /tmp/requirements.txt
12
+ RUN if [ "$TARGETPLATFORM" = "linux/arm/v6" ] || [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
13
+ apk del build-base gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev; \
14
+ fi
15
+
16
+ RUN mkdir /app
17
+ COPY ./app /app
18
+ COPY ./docker/run.sh /app/run.sh
19
+
20
+ RUN mkdir -p /app/data
21
+
22
+ WORKDIR /app
23
+
24
+ ENTRYPOINT [ "/app/run.sh" ]
25
+