releases/iib_app_cli

pull/723/head
zanllp 2024-08-24 04:53:58 +08:00
parent 8ac2676f3b
commit 3ed98ea156
5 changed files with 38 additions and 5 deletions

View File

@ -43,7 +43,22 @@ jobs:
script-name: app.py
output-file: iib_api_server
output-dir: out
include-data-dir: |
vue/dist=vue/dist
- run: cp out/iib_api_server out/iib_app_cli_${{ env.VERSION }}_${{ runner.os }}
if: matrix.os == 'ubuntu-20.04'
- run: cp out/iib_api_server.exe out/iib_app_cli-${{ env.VERSION }}-${{ runner.os }}.exe
if: matrix.os == 'windows-latest'
- name: Upload Server Artifacts
uses: actions/upload-artifact@v3
with:
name: iib_app_cli
path: |
out/iib_app_cli-${{ env.VERSION }}_${{ runner.os }}
out/iib_app_cli-${{ env.VERSION }}-${{ runner.os }}.exe
- name: Upload Server Artifacts
uses: actions/upload-artifact@v3
with:
@ -195,6 +210,11 @@ jobs:
with:
name: bundle-${{ env.VERSION }}-Linux
path: artifacts
- uses: actions/download-artifact@v3
with:
name: iib_app_cli
path: artifacts
- name: Release
uses: softprops/action-gh-release@v1

View File

@ -36,7 +36,7 @@ from scripts.iib.tool import (
get_current_commit_hash,
get_current_tag,
get_file_info_by_path,
get_frame_at_second
get_data_file_path
)
from fastapi import FastAPI, HTTPException, Header, Response
from fastapi.staticfiles import StaticFiles
@ -73,7 +73,8 @@ try:
except Exception as e:
logger.error(e)
index_html_path = os.path.join(cwd, "vue/dist/index.html") # 在app.py也被使用
index_html_path = get_data_file_path("vue/dist/index.html") if is_exe_ver else os.path.join(cwd, "vue/dist/index.html") # 在app.py也被使用
send_img_path = {"value": ""}
@ -746,7 +747,7 @@ def infinite_image_browsing_api(app: FastAPI, **kwargs):
return Response(content=content, media_type="text/html")
return FileResponse(index_html_path)
static_dir = f"{cwd}/vue/dist"
static_dir = get_data_file_path("vue/dist") if is_exe_ver else f"{cwd}/vue/dist"
@app.get(api_base + "/fe-static/{file_path:path}")
async def serve_static_file(file_path: str):
file_full_path = f"{static_dir}/{file_path}"

View File

@ -4,6 +4,8 @@ import sys
from scripts.iib.tool import cwd
def load_plugins(plugin_dir):
if not os.path.exists(plugin_dir):
return []
plugins = []
for filename in os.listdir(plugin_dir):
main_module_path = os.path.join(plugin_dir, filename, 'main.py')

View File

@ -723,4 +723,14 @@ def get_frame_at_second(video_path, second):
container.seek(frame_container_pts, backward=True, stream=container.streams.video[0])
frame = next(container.decode(video=0))
return frame
return frame
def get_data_file_path(filename):
if hasattr(sys, '_MEIPASS'):
# Running in a PyInstaller bundle
base_path = os.path.join(sys._MEIPASS)
else:
# Running in a normal Python environment
base_path = os.path.join(os.path.dirname(__file__))
return os.path.normpath(os.path.join(base_path, "../../", filename))

View File

@ -8,7 +8,7 @@
},
"package": {
"productName": "Infinite Image Browsing",
"version": "1.0.0"
"version": "1.1.0"
},
"tauri": {
"allowlist": {