Skip to content

Commit

Permalink
Release version 0.17.0, adding a pyinstaller-compiled sidecar to redu…
Browse files Browse the repository at this point in the history
…ce the likelihood of false positives from antivirus software.
  • Loading branch information
zanllp committed Jul 10, 2024
1 parent 9bef303 commit 5070097
Show file tree
Hide file tree
Showing 33 changed files with 176 additions and 93 deletions.
77 changes: 76 additions & 1 deletion .github/workflows/tauri_app_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,83 @@ jobs:
vue/src-tauri/target/release/bundle/nsis/Infinite Image Browsing_${{ env.VERSION }}_x64-setup.exe
vue/src-tauri/target/release/bundle/deb/infinite-image-browsing_${{ env.VERSION }}_amd64.deb
build-by-pyinstaller:
strategy:
matrix:
os: [windows-latest]

runs-on: ${{ matrix.os }}

permissions:
contents: write
steps:
- name: Check-out repository
uses: actions/checkout@v3

- run: echo "VERSION=$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)" >> $env:GITHUB_ENV

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Install Dependencies
run: |
pip install -r requirements.txt
- uses: sayyid5416/pyinstaller@v1
with:
spec: 'app.py'
upload_exe_with_name: 'My executable'
options: --onefile

- run: mv dist/app.exe vue/src-tauri/iib_api_server-x86_64-pc-windows-msvc.exe

- name: Install frontend dependencies
run: yarn install
working-directory: vue

- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './vue/src-tauri -> target'

- name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Build the app
run: |
yarn tauri-build
working-directory: vue

- run: |
cd vue/src-tauri/target/release/bundle/nsis
mv "Infinite Image Browsing_${{ env.VERSION }}_x64-setup.exe" "Infinite Image Browsing_${{ env.VERSION }}_x64-setup-pyinstaller.exe"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: bundle-${{ env.VERSION }}-${{ runner.os }}
path: |
vue/src-tauri/target/release/bundle/nsis/Infinite Image Browsing_${{ env.VERSION }}_x64-setup-pyinstaller.exe
release:
needs: build
needs: [build-by-pyinstaller, build]
runs-on: ubuntu-latest

permissions:
Expand Down
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def setup_parser() -> argparse.ArgumentParser:
parser.add_argument(
"--generate_image_cache",
action="store_true",
help="Pre-generate image cache to speed up browsing.",
help="Pre-generate image cache to speed up browsing. By default, only the extra paths added by the user are processed, not the paths in sd_webui_config. If you need to process paths in sd_webui_config, you must use the --sd_webui_config and --sd_webui_path_relative_to_config parameters.",
)
parser.add_argument(
"--generate_image_cache_size",
Expand Down Expand Up @@ -296,4 +296,4 @@ async def async_launch_app(
)
exit(0)

launch_app(**vars(args))
launch_app(**vars(args))
2 changes: 1 addition & 1 deletion javascript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Promise.resolve().then(async () => {
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Infinite Image Browsing</title>
<script type="module" crossorigin src="/infinite_image_browsing/fe-static/assets/index-a51ae076.js"></script>
<script type="module" crossorigin src="/infinite_image_browsing/fe-static/assets/index-5a16621a.js"></script>
<link rel="stylesheet" href="/infinite_image_browsing/fe-static/assets/index-f652cc2f.css">
</head>
Expand Down
4 changes: 2 additions & 2 deletions scripts/iib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
to_abs_path,
is_secret_key_required,
open_file_with_default_app,
is_nuitka,
is_exe_ver,
backup_db_file,
get_current_commit_hash,
get_current_tag
Expand Down Expand Up @@ -118,7 +118,7 @@ def infinite_image_browsing_api(app: FastAPI, **kwargs):
cache_base_dir = get_cache_dir()

# print(f"IIB api_base:{api_base} fe_public_path:{fe_public_path}")
if IIB_DEBUG or is_nuitka:
if IIB_DEBUG or is_exe_ver:
@app.exception_handler(Exception)
async def exception_handler(request: Request, exc: Exception):
error_msg = f"An exception occurred while processing {request.method} {request.url}: {exc}"
Expand Down
3 changes: 2 additions & 1 deletion scripts/iib/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import importlib.util
import sys
from scripts.iib.tool import cwd

def load_plugins(plugin_dir):
plugins = []
Expand All @@ -18,7 +19,7 @@ def load_plugins(plugin_dir):
plugin_inst_map = {}
# 使用插件
try:
plugin_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '../../', 'plugins'))
plugin_dir = os.path.normpath(os.path.join(cwd, 'plugins'))
plugins = load_plugins(plugin_dir)
sys.path.append(plugin_dir)
for plugin in plugins:
Expand Down
6 changes: 4 additions & 2 deletions scripts/iib/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import platform
import re
import tempfile
import imghdr
import subprocess
from typing import Dict, List
import sys
Expand All @@ -29,7 +28,10 @@

is_dev = os.getenv("APP_ENV") == "dev"
is_nuitka = "__compiled__" in globals()
cwd = os.getcwd() if is_nuitka else os.path.normpath(os.path.join(__file__, "../../../"))
is_pyinstaller_bundle = bool(getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'))
is_exe_ver = is_nuitka or is_pyinstaller_bundle

cwd = os.getcwd() if is_exe_ver else os.path.normpath(os.path.join(__file__, "../../../"))
is_win = platform.system().lower().find("windows") != -1


Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Loading

0 comments on commit 5070097

Please sign in to comment.