Skip to content

Commit 5b10b16

Browse files
Bug: Fix build issues (#503)
* Add sync microservice to the resources folder. * Debug CI issue 1.0 * Remove custom logging implementation and related configuration files * Remove redundant file listing steps from build workflow * update logging * Fix resource path in main.rs and update CSP in tauri.conf.json for improved security and functionality * Add devtools feature to Tauri configuration and update dependencies * Add user preferences management and integrate into settings page * feat: add process plugin and health check functionality - Added `tauri-plugin-process` to Cargo.toml and initialized it in main.rs. - Updated migrated.json to include process permissions. - Introduced health check endpoints for main backend and sync microservice. - Created ServerCheck component to verify the health of services during onboarding. - Enhanced InfoDialog to conditionally show close button based on state. - Updated settings page to streamline user preferences query. - Added CORS middleware to sync microservice for cross-origin requests. - Refactored API functions to include health check logic. * chore: update version numbers to 1.0.0 in package.json, Cargo.toml, and tauri.conf.json * refactor: improve code formatting and consistency in microservice and configuration files
1 parent e985b25 commit 5b10b16

File tree

39 files changed

+764
-281
lines changed

39 files changed

+764
-281
lines changed

.github/workflows/build-and-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ jobs:
319319
unzip -o *.zip
320320
rm *.zip
321321
ls -l
322-
323322
- name: Setup Node
324323
uses: actions/setup-node@v4
325324
with:

backend/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,6 @@ cython_debug/
136136

137137
images/
138138

139-
dist/
139+
dist/*
140+
!dist/README.md
140141
tests/inputs/PictoPy.thumbnails/

backend/app/custom_logging.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

backend/app/logging_config.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

backend/app/utils/microservice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ def _start_frozen_sync_service() -> bool:
5252
# Get the directory where the current executable is located
5353
if getattr(sys, "frozen", False):
5454
# When frozen, sys.executable points to the main executable
55-
app_dir = Path(sys.executable).parent
55+
app_dir = Path(sys.executable).parent.parent
5656
else:
5757
# Fallback (shouldn't happen in this function)
5858
app_dir = Path(__file__).parent.parent.parent.parent
5959

60-
# Look for the PictoPy_Sync directory and executable
61-
sync_dir = app_dir / "PictoPy_Sync"
60+
# Look for the sync-microservice directory and executable
61+
sync_dir = app_dir / "sync-microservice"
6262

6363
# Determine executable name based on platform
6464
system = platform.system().lower()

backend/dist/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## Do not delete this file.
1+
## Do not delete the "dist" folder.
22

3-
This file is essential for the development environment to start.
3+
This folder is essential for the development environment to start.

backend/main.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from app.routes.face_clusters import router as face_clusters_router
2828
from app.routes.user_preferences import router as user_preferences_router
2929
from fastapi.openapi.utils import get_openapi
30-
from app.custom_logging import CustomizeLogger
3130

3231

3332
@asynccontextmanager
@@ -66,8 +65,6 @@ async def lifespan(app: FastAPI):
6665
],
6766
)
6867

69-
app.logger = CustomizeLogger.make_logger("app/logging_config.json")
70-
7168

7269
def generate_openapi_json():
7370
try:
@@ -90,9 +87,9 @@ def generate_openapi_json():
9087

9188
with open(openapi_path, "w") as f:
9289
json.dump(openapi_schema, f, indent=2)
93-
app.logger.info(f"OpenAPI JSON generated at {openapi_path}")
90+
print(f"OpenAPI JSON generated at {openapi_path}")
9491
except Exception as e:
95-
app.logger.error(f"Failed to generate openapi.json: {e}")
92+
print(f"Failed to generate openapi.json: {e}")
9693

9794

9895
# Add CORS middleware
@@ -106,7 +103,7 @@ def generate_openapi_json():
106103

107104

108105
# Basic health check endpoint
109-
@app.get("/", tags=["Health"])
106+
@app.get("/health", tags=["Health"])
110107
async def root():
111108
return {"message": "PictoPy Server is up and running!"}
112109

@@ -125,6 +122,11 @@ async def root():
125122
# Entry point for running with: python3 main.py
126123
if __name__ == "__main__":
127124
multiprocessing.freeze_support() # Required for Windows
128-
config = Config(app=app, host="0.0.0.0", port=8000, log_config=None)
125+
config = Config(
126+
app=app,
127+
host="0.0.0.0",
128+
port=8000,
129+
log_level="info",
130+
)
129131
server = Server(config)
130132
server.run()

backend/requirements.txt

40 Bytes
Binary file not shown.

docs/backend/backend_python/openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
}
1717
],
1818
"paths": {
19-
"/": {
19+
"/health": {
2020
"get": {
2121
"tags": [
2222
"Health"
2323
],
2424
"summary": "Root",
25-
"operationId": "root__get",
25+
"operationId": "root_health_get",
2626
"responses": {
2727
"200": {
2828
"description": "Successful Response",

frontend/api/api-functions/face_clusters.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)