mirror of
https://github.com/tcsenpai/pensieve.git
synced 2025-06-10 13:07:15 +00:00
fix: use relative path for web assets
This commit is contained in:
parent
a218b9362b
commit
fff57e607a
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import httpx
|
import httpx
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI, HTTPException, Depends, status, Query, Request
|
from fastapi import FastAPI, HTTPException, Depends, status, Query, Request
|
||||||
@ -11,7 +12,6 @@ from typing import List, Annotated
|
|||||||
from fastapi.responses import FileResponse
|
from fastapi.responses import FileResponse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
|
||||||
|
|
||||||
import typesense
|
import typesense
|
||||||
from memos.config import settings
|
from memos.config import settings
|
||||||
@ -67,22 +67,27 @@ app.add_middleware(
|
|||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
)
|
)
|
||||||
|
|
||||||
app.mount("/_app", StaticFiles(directory="static/_app", html=True))
|
|
||||||
|
current_dir = os.path.dirname(__file__)
|
||||||
|
|
||||||
|
app.mount(
|
||||||
|
"/_app", StaticFiles(directory=os.path.join(current_dir, "static/_app"), html=True)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/favicon.png", response_class=FileResponse)
|
@app.get("/favicon.png", response_class=FileResponse)
|
||||||
async def favicon_png():
|
async def favicon_png():
|
||||||
return FileResponse("static/favicon.png")
|
return FileResponse(os.path.join(current_dir, "static/favicon.png"))
|
||||||
|
|
||||||
|
|
||||||
@app.get("/favicon.ico", response_class=FileResponse)
|
@app.get("/favicon.ico", response_class=FileResponse)
|
||||||
async def favicon_ico():
|
async def favicon_ico():
|
||||||
return FileResponse("static/favicon.png")
|
return FileResponse(os.path.join(current_dir, "static/favicon.png"))
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
async def serve_spa():
|
async def serve_spa():
|
||||||
return FileResponse("static/app.html")
|
return FileResponse(os.path.join(current_dir, "static/app.html"))
|
||||||
|
|
||||||
|
|
||||||
def get_db():
|
def get_db():
|
||||||
|
@ -4,8 +4,8 @@ import adapter from '@sveltejs/adapter-static';
|
|||||||
const config = {
|
const config = {
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter({
|
adapter: adapter({
|
||||||
pages: '../build',
|
pages: '../memos/static',
|
||||||
assets: '../build',
|
assets: '../memos/static',
|
||||||
precompress: false,
|
precompress: false,
|
||||||
strict: true,
|
strict: true,
|
||||||
fallback: 'app.html' // may differ from host to host
|
fallback: 'app.html' // may differ from host to host
|
||||||
|
Loading…
x
Reference in New Issue
Block a user